openpond 0.2.69 → 0.2.71

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 (397) hide show
  1. package/dist/api/client-context.d.ts +4 -0
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/{account-context-V3KLSNKS.js → account-context-LEZDNYMR.js} +1 -1
  4. package/dist/chunks/{acp-ER6CUXG2.js → acp-VWPJ2EL4.js} +1 -1
  5. package/dist/chunks/{acp-agent-AYJ5RPVF.js → acp-agent-OZHZMQ6R.js} +1 -1
  6. package/dist/chunks/{actions-command-BBUS3HDK.js → actions-command-AXGXBU75.js} +1 -1
  7. package/dist/chunks/{app-layer-JCEWGUDH.js → app-layer-OHPIYEOJ.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-ILXBFD3S.js → app-server-connected-apps-NH4667QJ.js} +1 -1
  9. package/dist/chunks/{app-server-evaluations-RRLYWLPK.js → app-server-evaluations-Y5UEF2Y7.js} +1 -1
  10. package/dist/chunks/{app-server-harness-services-XXM336NU.js → app-server-harness-services-GUHAIIPS.js} +1 -1
  11. package/dist/chunks/app-server-runtime-CH5STRJP.js +2 -0
  12. package/dist/chunks/apps-DNLT6P4J.js +2 -0
  13. package/dist/chunks/{chunk-MOXIGLN2.js → chunk-23YW5PAQ.js} +1 -1
  14. package/dist/chunks/{chunk-ZDEIVUUI.js → chunk-27OJ2OLP.js} +1 -1
  15. package/dist/chunks/{chunk-RY46UPBO.js → chunk-2ACX7IW5.js} +1 -1
  16. package/dist/chunks/{chunk-NSSZ2ZIU.js → chunk-2EAZB2MW.js} +1 -1
  17. package/dist/chunks/{chunk-DRLP7GIU.js → chunk-2GEZ3ZY7.js} +1 -1
  18. package/dist/chunks/{chunk-PAYFJHPO.js → chunk-2PVW2XFF.js} +1 -1
  19. package/dist/chunks/{chunk-Y2WNZWT2.js → chunk-2Q6FTL4C.js} +1 -1
  20. package/dist/chunks/{chunk-KP2MYTP5.js → chunk-2QHB5P2K.js} +1 -1
  21. package/dist/chunks/{chunk-FNGZ4UDZ.js → chunk-33UVQ7DU.js} +1 -1
  22. package/dist/chunks/{chunk-M4ZHFDRJ.js → chunk-3JVZ7OCQ.js} +1 -1
  23. package/dist/chunks/{chunk-4BUM6JEC.js → chunk-3JYPUOK4.js} +1 -1
  24. package/dist/chunks/{chunk-DXJC3QW7.js → chunk-3VT2PPKW.js} +1 -1
  25. package/dist/chunks/{chunk-Z33RVGP6.js → chunk-5LKEVB2P.js} +1 -1
  26. package/dist/chunks/{chunk-P4QM63L3.js → chunk-5ZBDHIIE.js} +1 -1
  27. package/dist/chunks/{chunk-WD4KAKEX.js → chunk-64EDQ7UV.js} +1 -1
  28. package/dist/chunks/{chunk-UMAVVMXL.js → chunk-6BTX66SV.js} +1 -1
  29. package/dist/chunks/{chunk-KU4TPDPH.js → chunk-6LAGMWJE.js} +1 -1
  30. package/dist/chunks/{chunk-65FJWWXG.js → chunk-6YR5IYHH.js} +1 -1
  31. package/dist/chunks/{chunk-AUO5DCEU.js → chunk-73COPJ32.js} +1 -1
  32. package/dist/chunks/{chunk-KDER7R45.js → chunk-7PDF2UX2.js} +1 -1
  33. package/dist/chunks/{chunk-SO4GMSNP.js → chunk-7SOHV5BH.js} +1 -1
  34. package/dist/chunks/{chunk-XOPHFUUY.js → chunk-ASMQTMQB.js} +1 -1
  35. package/dist/chunks/{chunk-ESYPMD7Q.js → chunk-AT3ZYNX4.js} +1 -1
  36. package/dist/chunks/{chunk-NMMHXYDJ.js → chunk-AVEHWUML.js} +1 -1
  37. package/dist/chunks/{chunk-M4A7G4S5.js → chunk-B7SCVTE6.js} +1 -1
  38. package/dist/chunks/{chunk-7EQLW2KM.js → chunk-BLNEHU62.js} +1 -1
  39. package/dist/chunks/{chunk-DKOVZ6R2.js → chunk-BQNU4HZW.js} +1 -1
  40. package/dist/chunks/{chunk-UANH7U3Y.js → chunk-BTEBZYK3.js} +1 -1
  41. package/dist/chunks/{chunk-BU6MW65V.js → chunk-BYVE4TMU.js} +1 -1
  42. package/dist/chunks/{chunk-PNPV2LDE.js → chunk-BZS2PA4O.js} +1 -1
  43. package/dist/chunks/{chunk-AFYYIJ6K.js → chunk-C7NQPICU.js} +1 -1
  44. package/dist/chunks/{chunk-K7KBFM2T.js → chunk-CBD554GZ.js} +1 -1
  45. package/dist/chunks/{chunk-GYYJ47GX.js → chunk-CWE2N3JI.js} +1 -1
  46. package/dist/chunks/{chunk-ZYLLPRPU.js → chunk-CX4T7I47.js} +1 -1
  47. package/dist/chunks/{chunk-AQUZCWM3.js → chunk-D2V2Y3FB.js} +1 -1
  48. package/dist/chunks/chunk-DFZTRMTL.js +2 -0
  49. package/dist/chunks/{chunk-2PXKSAG6.js → chunk-DLOJG7LP.js} +1 -1
  50. package/dist/chunks/{chunk-5G7BQAUA.js → chunk-DNNWMOMG.js} +1 -1
  51. package/dist/chunks/{chunk-M5X7XKXY.js → chunk-DNRC6TPJ.js} +7 -7
  52. package/dist/chunks/{chunk-HKVFU3B3.js → chunk-DUR32LJG.js} +1 -1
  53. package/dist/chunks/{chunk-XT4CSKHM.js → chunk-E57PUTV2.js} +1 -1
  54. package/dist/chunks/{chunk-4N4EH3RJ.js → chunk-EJOV6Z6F.js} +1 -1
  55. package/dist/chunks/{chunk-OUJ63LMU.js → chunk-ER2VONWQ.js} +1 -1
  56. package/dist/chunks/{chunk-PSY6IRJE.js → chunk-ESOIZG2G.js} +4 -4
  57. package/dist/chunks/{chunk-WNXUSELC.js → chunk-EXAJ2B4I.js} +1 -1
  58. package/dist/chunks/{chunk-CCZ276IA.js → chunk-F2EUZG2W.js} +1 -1
  59. package/dist/chunks/{chunk-VJR2GNRY.js → chunk-FVMTQSVW.js} +1 -1
  60. package/dist/chunks/{chunk-YI6ME6PU.js → chunk-GG6PM7TB.js} +1 -1
  61. package/dist/chunks/{chunk-DDOIPTOM.js → chunk-GMA365GI.js} +1 -1
  62. package/dist/chunks/{chunk-JVMSN7LH.js → chunk-GR4MJJCE.js} +1 -1
  63. package/dist/chunks/{chunk-TB5P3FWM.js → chunk-GUWNSMGH.js} +1 -1
  64. package/dist/chunks/{chunk-AYOMVI7J.js → chunk-HIMG7S5E.js} +1 -1
  65. package/dist/chunks/{chunk-2LJCJOJ7.js → chunk-HLJJAOI2.js} +1 -1
  66. package/dist/chunks/{chunk-AFH462DO.js → chunk-HT6ILPD6.js} +1 -1
  67. package/dist/chunks/{chunk-3Z4VM2LF.js → chunk-HUMNLSCV.js} +1 -1
  68. package/dist/chunks/{chunk-NZDLL6JN.js → chunk-HYUTDZ3N.js} +1 -1
  69. package/dist/chunks/{chunk-XYZV3FKD.js → chunk-I6KTJ3GH.js} +1 -1
  70. package/dist/chunks/{chunk-WZ35ICTE.js → chunk-IFMWAOBR.js} +1 -1
  71. package/dist/chunks/{chunk-R2FYCJL6.js → chunk-IJJ7FYZE.js} +1 -1
  72. package/dist/chunks/{chunk-XHACK2KR.js → chunk-IUYGQO2K.js} +1 -1
  73. package/dist/chunks/{chunk-55YD4UTW.js → chunk-IV2HEX3I.js} +1 -1
  74. package/dist/chunks/chunk-J7X72QUY.js +2 -0
  75. package/dist/chunks/{chunk-U7X5ZLAL.js → chunk-JCHLDNCX.js} +1 -1
  76. package/dist/chunks/chunk-JF7WWLNW.js +2 -0
  77. package/dist/chunks/{chunk-7PKDJHT6.js → chunk-JH4RACOB.js} +1 -1
  78. package/dist/chunks/{chunk-65WRWLUD.js → chunk-JVEIK4RH.js} +1 -1
  79. package/dist/chunks/{chunk-Z5CQXPIS.js → chunk-K3WM4NEC.js} +1 -1
  80. package/dist/chunks/{chunk-EGP6DF34.js → chunk-KASHK2U5.js} +2 -2
  81. package/dist/chunks/{chunk-JEMECEQH.js → chunk-KHDCMVEJ.js} +1 -1
  82. package/dist/chunks/{chunk-BDZDWHBJ.js → chunk-KURL76NW.js} +1 -1
  83. package/dist/chunks/{chunk-7OFD6TFD.js → chunk-LMLGEOKV.js} +1 -1
  84. package/dist/chunks/{chunk-QUNQM2E3.js → chunk-MPEK4ZNY.js} +1 -1
  85. package/dist/chunks/chunk-MZKCW6CB.js +2 -0
  86. package/dist/chunks/{chunk-SDHG6CKU.js → chunk-NDNSLCPE.js} +1 -1
  87. package/dist/chunks/chunk-NK2L5HA2.js +2 -0
  88. package/dist/chunks/{chunk-WCNPGKST.js → chunk-O4YHISU2.js} +1 -1
  89. package/dist/chunks/{chunk-RCQYEHHD.js → chunk-O5ZOW474.js} +1 -1
  90. package/dist/chunks/{chunk-IIT66347.js → chunk-OEAKX5TS.js} +1 -1
  91. package/dist/chunks/{chunk-LSKMALD6.js → chunk-OFV26C2U.js} +2 -2
  92. package/dist/chunks/{chunk-IO5DZUKL.js → chunk-OI4DAZ4U.js} +1 -1
  93. package/dist/chunks/{chunk-Q73RKX7I.js → chunk-OIIE5GUK.js} +1 -1
  94. package/dist/chunks/{chunk-R6I623SZ.js → chunk-OKPV6MBX.js} +6 -6
  95. package/dist/chunks/{chunk-N5EAVX4G.js → chunk-OOKHHOIU.js} +1 -1
  96. package/dist/chunks/{chunk-MIFVX5PK.js → chunk-OQ4RWCYI.js} +1 -1
  97. package/dist/chunks/{chunk-RCRZXHAI.js → chunk-OTG77H7U.js} +1 -1
  98. package/dist/chunks/{chunk-7OKZCJHS.js → chunk-OXRN2257.js} +1 -1
  99. package/dist/chunks/{chunk-4KNPCJR4.js → chunk-PJJSQ4ZI.js} +1 -1
  100. package/dist/chunks/{chunk-7RSQOC5M.js → chunk-PXQZOVSV.js} +2 -2
  101. package/dist/chunks/chunk-QKGNAYSC.js +2 -0
  102. package/dist/chunks/{chunk-R4EEGWXB.js → chunk-QN4CFJQC.js} +1 -1
  103. package/dist/chunks/{chunk-V24VHT76.js → chunk-REGKOCDO.js} +1 -1
  104. package/dist/chunks/chunk-RJY4EI46.js +2 -0
  105. package/dist/chunks/{chunk-E2JB5OCO.js → chunk-RP4DPUN2.js} +1 -1
  106. package/dist/chunks/{chunk-QLGP2OAQ.js → chunk-SNBFWBJI.js} +1 -1
  107. package/dist/chunks/{chunk-G4FRBT7G.js → chunk-SRJTQS2D.js} +3 -3
  108. package/dist/chunks/{chunk-XY7HFXLH.js → chunk-SVLVIYH2.js} +1 -1
  109. package/dist/chunks/{chunk-NW6WGGSL.js → chunk-TCTBCAI6.js} +1 -1
  110. package/dist/chunks/{chunk-7NCM6GBN.js → chunk-TOWY6Y23.js} +1 -1
  111. package/dist/chunks/{chunk-VWWKWYSQ.js → chunk-TWLPZHH7.js} +1 -1
  112. package/dist/chunks/{chunk-Y4I6CFZJ.js → chunk-UGDBMRCT.js} +1 -1
  113. package/dist/chunks/{chunk-JQOVC35K.js → chunk-UKTPX2EE.js} +1 -1
  114. package/dist/chunks/{chunk-CO23RRN7.js → chunk-UMRQKE3W.js} +1 -1
  115. package/dist/chunks/{chunk-B66QCXH2.js → chunk-USKCFST5.js} +1 -1
  116. package/dist/chunks/{chunk-3A2Y7UK3.js → chunk-USTDWGR4.js} +1 -1
  117. package/dist/chunks/{chunk-EWDDDHJN.js → chunk-UZNRH6I3.js} +1 -1
  118. package/dist/chunks/{chunk-CIZI6Z7D.js → chunk-VMW23TIZ.js} +1 -1
  119. package/dist/chunks/{chunk-22RLEU3Q.js → chunk-VND53FAU.js} +1 -1
  120. package/dist/chunks/{chunk-4G3GTEVS.js → chunk-VSQPWLAG.js} +1 -1
  121. package/dist/chunks/{chunk-KCLMA2IH.js → chunk-VV4K5YPD.js} +1 -1
  122. package/dist/chunks/{chunk-7RJOCGQ6.js → chunk-WAUFXZ5B.js} +1 -1
  123. package/dist/chunks/{chunk-HG2YFMVU.js → chunk-WXG3G2O6.js} +1 -1
  124. package/dist/chunks/{chunk-PACLKDTN.js → chunk-XBAB3HMA.js} +1 -1
  125. package/dist/chunks/chunk-XJU47QS2.js +2 -0
  126. package/dist/chunks/{chunk-WGQ3FMRF.js → chunk-XKDOPNQ5.js} +1 -1
  127. package/dist/chunks/{chunk-EYTTZ5H4.js → chunk-XLZMSD5K.js} +1 -1
  128. package/dist/chunks/{chunk-Q7FBVLLB.js → chunk-XNPTLJ5Z.js} +1 -1
  129. package/dist/chunks/{chunk-ZIQJDTQB.js → chunk-XTT3K3TR.js} +1 -1
  130. package/dist/chunks/{chunk-Q7P34B2O.js → chunk-YFHQRDNQ.js} +1 -1
  131. package/dist/chunks/{chunk-UGFSAG4U.js → chunk-YG3HITOU.js} +1 -1
  132. package/dist/chunks/{chunk-DWF3FCY4.js → chunk-Z5R4OSGC.js} +1 -1
  133. package/dist/chunks/{chunk-JT5YQ52I.js → chunk-Z6HWSTEP.js} +1 -1
  134. package/dist/chunks/{chunk-4PUOWSDE.js → chunk-ZEOYNUHL.js} +1 -1
  135. package/dist/chunks/{chunk-2TGHZXJE.js → chunk-ZG3DBXQG.js} +1 -1
  136. package/dist/chunks/{chunk-4KTGYHCE.js → chunk-ZMRP2A7K.js} +1 -1
  137. package/dist/chunks/cli-5JARGJOD.js +2 -0
  138. package/dist/chunks/{command-LNOVZQSK.js → command-AI3SMEAH.js} +11 -11
  139. package/dist/chunks/{configuration-command-C3QBDFND.js → configuration-command-NPA46ZOT.js} +1 -1
  140. package/dist/chunks/connected-app-executor-DLC23O43.js +2 -0
  141. package/dist/chunks/connected-evidence-TVORI55Q.js +2 -0
  142. package/dist/chunks/{connected-starting-assets-5LAJ7CZY.js → connected-starting-assets-WGGBWH4K.js} +1 -1
  143. package/dist/chunks/{continual-FVOLGGOE.js → continual-UHQI2EQD.js} +1 -1
  144. package/dist/chunks/core-commands-QNZUBKOC.js +2 -0
  145. package/dist/chunks/{dataset-preparation-authoring-UUYFWWCT.js → dataset-preparation-authoring-OBMJLGA4.js} +1 -1
  146. package/dist/chunks/datasets-USJLJOEQ.js +2 -0
  147. package/dist/chunks/desktop-test-IYHAOR47.js +3 -0
  148. package/dist/chunks/{dist-2MKJC6HN.js → dist-C5XFRP53.js} +1 -1
  149. package/dist/chunks/evaluation-coordination-UJENK4WQ.js +2 -0
  150. package/dist/chunks/experiment-improvements-6GJMKIER.js +2 -0
  151. package/dist/chunks/experiments-FZHILSC6.js +2 -0
  152. package/dist/chunks/experiments-signal-E32CWBS4.js +2 -0
  153. package/dist/chunks/{help-PLQJOP4P.js → help-32DLAPJR.js} +1 -1
  154. package/dist/chunks/host-profile-evaluation-tools-QAV2UGSB.js +2 -0
  155. package/dist/chunks/{host-profile-external-dataset-KSEPXY2S.js → host-profile-external-dataset-C6ZPMTX6.js} +1 -1
  156. package/dist/chunks/{hosted-app-server-composition-GZES7QXJ.js → hosted-app-server-composition-5DVBKNV3.js} +1 -1
  157. package/dist/chunks/{hosted-experiment-improvement-VG2WE7XZ.js → hosted-experiment-improvement-YQ24C54D.js} +1 -1
  158. package/dist/chunks/hosted-harness-runtime-KLIORGWV.js +2 -0
  159. package/dist/chunks/{hosted-profile-candidate-PTGQLPZO.js → hosted-profile-candidate-RCWFLOVJ.js} +1 -1
  160. package/dist/chunks/{hosted-profile-compiler-FS5R6CHJ.js → hosted-profile-compiler-UDG4BCEW.js} +1 -1
  161. package/dist/chunks/{hosted-profile-evaluation-control-UUEZEMXU.js → hosted-profile-evaluation-control-4R3L4FTK.js} +1 -1
  162. package/dist/chunks/{hosted-profile-evaluation-inspection-4F7OEF4T.js → hosted-profile-evaluation-inspection-NA4SSY7N.js} +1 -1
  163. package/dist/chunks/{hosted-profile-evaluation-preparation-LIJJZDHQ.js → hosted-profile-evaluation-preparation-B4BW6JTB.js} +1 -1
  164. package/dist/chunks/{hosted-tasksets-V24IBVJX.js → hosted-tasksets-IUK3VWSL.js} +1 -1
  165. package/dist/chunks/human-review-D6QCZLYN.js +2 -0
  166. package/dist/chunks/{import-SI24Z7EF.js → import-UCG75PN5.js} +1 -1
  167. package/dist/chunks/{learning-Y3UKNUGE.js → learning-3XDYMYBE.js} +1 -1
  168. package/dist/chunks/learning-OR4CYV4B.js +2 -0
  169. package/dist/chunks/local-harness-improvement-runtime-GZBMBZB2.js +2 -0
  170. package/dist/chunks/local-harness-taskset-review-YVP2ZQJG.js +2 -0
  171. package/dist/chunks/{model-projects-6YWVD2TS.js → model-projects-POZRHXTF.js} +1 -1
  172. package/dist/chunks/opchat-APJUUTT7.js +3 -0
  173. package/dist/chunks/opchat-bounded-chat-PBUSUAY2.js +2 -0
  174. package/dist/chunks/organizations-WK6EZ6L3.js +2 -0
  175. package/dist/chunks/{profile-TD5U3INY.js → profile-BQMS7ALQ.js} +1 -1
  176. package/dist/chunks/project-action-payload-CGV77JSA.js +2 -0
  177. package/dist/chunks/project-agent-XVFYTEUQ.js +2 -0
  178. package/dist/chunks/{published-experiment-source-SDXUVPE7.js → published-experiment-source-2CYFIRBL.js} +1 -1
  179. package/dist/chunks/{refiner-profile-service-56VYLZQJ.js → refiner-profile-service-OLJHA4DI.js} +1 -1
  180. package/dist/chunks/{runtime-Q7JUJO4D.js → runtime-32KYSVZR.js} +1 -1
  181. package/dist/chunks/sandbox-command-OY3VZXGG.js +2 -0
  182. package/dist/chunks/{sandbox-template-GOY7QQUY.js → sandbox-template-YOOSJ4FK.js} +1 -1
  183. package/dist/chunks/saved-work-L4KNWLZB.js +2 -0
  184. package/dist/chunks/setup-EU6CMRXQ.js +2 -0
  185. package/dist/chunks/{src-C3ZUESMK.js → src-3DJR7OAH.js} +1 -1
  186. package/dist/chunks/{src-MT4B43TD.js → src-HYOTHMRX.js} +111 -113
  187. package/dist/chunks/{standalone-experiment-turn-owner-TW5MTWIO.js → standalone-experiment-turn-owner-UYPA6XHW.js} +1 -1
  188. package/dist/chunks/{store-chat-resources-IRHBW2EC.js → store-chat-resources-HISLEZZM.js} +1 -1
  189. package/dist/chunks/{store-continual-support-reviews-3KK42L4I.js → store-continual-support-reviews-ORWHS57V.js} +1 -1
  190. package/dist/chunks/{store-conversation-serving-IVURK52V.js → store-conversation-serving-5UGYKEGJ.js} +1 -1
  191. package/dist/chunks/{store-create-improve-UTCLBXF2.js → store-create-improve-APLPTVYQ.js} +1 -1
  192. package/dist/chunks/{store-datasets-4AQOVAQY.js → store-datasets-HDW6IYBL.js} +1 -1
  193. package/dist/chunks/{store-evaluation-results-PK2P3IMH.js → store-evaluation-results-KB2UDCF3.js} +1 -1
  194. package/dist/chunks/{store-harness-workspaces-YEXB4IRV.js → store-harness-workspaces-TKX5PZWP.js} +1 -1
  195. package/dist/chunks/{store-human-review-O4BVHP25.js → store-human-review-IURNTX3C.js} +1 -1
  196. package/dist/chunks/{store-learned-preference-migration-validation-44SVX6YB.js → store-learned-preference-migration-validation-TH2LKQWV.js} +1 -1
  197. package/dist/chunks/{store-learning-SIUQIY5C.js → store-learning-WLUW2PWE.js} +1 -1
  198. package/dist/chunks/{store-learning-credentials-BUHR7SN6.js → store-learning-credentials-FDKCEDHK.js} +1 -1
  199. package/dist/chunks/{store-local-experiments-BHVTKPPE.js → store-local-experiments-M4V5RLHJ.js} +1 -1
  200. package/dist/chunks/{store-model-batch-review-RVAYUVK2.js → store-model-batch-review-DDZLWVTG.js} +1 -1
  201. package/dist/chunks/{store-model-configuration-6L3OYXF4.js → store-model-configuration-ATOFA5OH.js} +1 -1
  202. package/dist/chunks/{store-model-project-preparation-AAEKCF6V.js → store-model-project-preparation-ZRSCQEQR.js} +1 -1
  203. package/dist/chunks/{store-modification-recordings-LCPK6K2T.js → store-modification-recordings-YJIDUPVJ.js} +1 -1
  204. package/dist/chunks/{store-preference-comparison-5YVIQNVB.js → store-preference-comparison-JKURBESE.js} +1 -1
  205. package/dist/chunks/{store-task-inbox-L6IQTY26.js → store-task-inbox-L53OT6ZC.js} +1 -1
  206. package/dist/chunks/{store-task-inventory-QWS2C656.js → store-task-inventory-R2JJGAHW.js} +1 -1
  207. package/dist/chunks/{store-taskset-drafts-FRFL6ITK.js → store-taskset-drafts-FPNJPFPO.js} +1 -1
  208. package/dist/chunks/{store-training-FYXZU2FE.js → store-training-DIBW7OMP.js} +1 -1
  209. package/dist/chunks/{store-training-jobs-3N3VKPIY.js → store-training-jobs-K7I4SXWW.js} +1 -1
  210. package/dist/chunks/{store-training-models-VOFVGPZR.js → store-training-models-LCSB37YY.js} +1 -1
  211. package/dist/chunks/{taskset-UDDLFYKV.js → taskset-XI5SJBJL.js} +1 -1
  212. package/dist/chunks/{taskset-packages-WMG5DUBN.js → taskset-packages-FUQWNTSB.js} +1 -1
  213. package/dist/chunks/{taskset-packages-T6B6HYKZ.js → taskset-packages-GM6IUOTY.js} +1 -1
  214. package/dist/chunks/{teams-bot-YCUTDDDC.js → teams-bot-CYC5TR64.js} +1 -1
  215. package/dist/chunks/{tool-learning-ZQ6NSJ5K.js → tool-learning-52QZIJIR.js} +1 -1
  216. package/dist/chunks/{training-5UMT45UL.js → training-GDLLLXSV.js} +1 -1
  217. package/dist/chunks/training-RL7UUBER.js +2 -0
  218. package/dist/chunks/training-UJ62NOJJ.js +2 -0
  219. package/dist/chunks/training-hardware-MR4FUC4U.js +3 -0
  220. package/dist/chunks/training-hosted-V5CHG3M3.js +2 -0
  221. package/dist/chunks/{training-hosted-alphaedit-HSMRDJTD.js → training-hosted-alphaedit-R5PVATV4.js} +1 -1
  222. package/dist/chunks/{training-hosted-decision-7JALOU6O.js → training-hosted-decision-WNK5DE3M.js} +1 -1
  223. package/dist/chunks/{training-hosted-engram-SXO75MFG.js → training-hosted-engram-ZQDOKXAV.js} +1 -1
  224. package/dist/chunks/{training-hosted-learning-E2N32YU5.js → training-hosted-learning-UEBGSSNC.js} +1 -1
  225. package/dist/chunks/{training-hosted-modification-comparison-TXFDJFTG.js → training-hosted-modification-comparison-KKI5CKOH.js} +1 -1
  226. package/dist/chunks/{training-hosted-neuron-training-J42WK4EH.js → training-hosted-neuron-training-CFWEDRSR.js} +1 -1
  227. package/dist/chunks/{training-hosted-serving-report-BAEABGJH.js → training-hosted-serving-report-N4NF5AVW.js} +1 -1
  228. package/dist/chunks/{training-hosted-steering-T556BUBG.js → training-hosted-steering-4MDUQ2YV.js} +1 -1
  229. package/dist/chunks/{training-model-start-P3PXDWNT.js → training-model-start-NOA6TYQK.js} +1 -1
  230. package/dist/chunks/{web-search-ZEKJHZW4.js → web-search-FTVNZ7PH.js} +1 -1
  231. package/dist/cli.js +2 -2
  232. package/dist/index.js +1 -1
  233. package/dist/skills/manifest.json +3 -3
  234. package/dist/skills/openpond-cli/references/experiments-and-training.md +19 -0
  235. package/dist/web/assets/App-L7RV4D0A.js +54 -0
  236. package/dist/web/assets/{AppDialog-CxjDHVk9.js → AppDialog-B2V84J7f.js} +1 -1
  237. package/dist/web/assets/{AppTerminalPanel-CKJIVpKa.js → AppTerminalPanel-DfYpUDKT.js} +2 -2
  238. package/dist/web/assets/{AppToastContext-EpiT1dHs.js → AppToastContext-DuiPouLz.js} +1 -1
  239. package/dist/web/assets/{AppsView-BsMyPX_3.js → AppsView-B20RHDCy.js} +1 -1
  240. package/dist/web/assets/{AttachmentTypeIcon-BXvZy5gB.js → AttachmentTypeIcon-l-GRNxaz.js} +1 -1
  241. package/dist/web/assets/{BrowserSidebar-BIIV4aq4.js → BrowserSidebar-Ce0ToS2O.js} +1 -1
  242. package/dist/web/assets/{CartesianChart-brqLBqnF.js → CartesianChart-CtfMRAfp.js} +1 -1
  243. package/dist/web/assets/{ChatTimelineEntry-CwZbn16X.js → ChatTimelineEntry-DzcucW20.js} +1 -1
  244. package/dist/web/assets/{CollaborationTabs-BU4uc4tZ.js → CollaborationTabs-BpmKjNAC.js} +1 -1
  245. package/dist/web/assets/{CommandMenu-DkWpXR55.js → CommandMenu-JXsoxijv.js} +1 -1
  246. package/dist/web/assets/{CommunityView-CsSxJZGn.js → CommunityView-ggdn8pcH.js} +1 -1
  247. package/dist/web/assets/{ComposerAttachments-BdJGCYzI.js → ComposerAttachments-BMmALUs_.js} +1 -1
  248. package/dist/web/assets/{ComposerCreateImproveStrip-CWy0j1vv.js → ComposerCreateImproveStrip-DcM1bkfu.js} +1 -1
  249. package/dist/web/assets/{ConversationImportsSettings-DCmiakbZ.js → ConversationImportsSettings-BKNeARHI.js} +1 -1
  250. package/dist/web/assets/{DatasetReviewImport-DEnF_pGu.js → DatasetReviewImport-DyFOE0Q0.js} +1 -1
  251. package/dist/web/assets/{ExperimentTrainingDataWorkspace-WhwQ0QBi.js → ExperimentTrainingDataWorkspace-CfOyoMrq.js} +2 -2
  252. package/dist/web/assets/{FilePagePreview-BRhhz99q.js → FilePagePreview-B7bWObJN.js} +2 -2
  253. package/dist/web/assets/{GetStartedView-CLVD-qEi.js → GetStartedView-BYbFl93M.js} +1 -1
  254. package/dist/web/assets/{GettingStartedDialog-CMxaAMg-.js → GettingStartedDialog-UgreDozV.js} +1 -1
  255. package/dist/web/assets/{HostedModelLearningReview-Cn-j-rDo.js → HostedModelLearningReview-C_kng2U_.js} +1 -1
  256. package/dist/web/assets/HostedModelLearningSettings-aesD_ifF.js +1 -0
  257. package/dist/web/assets/{HtmlVisual-D5y2WG9L.js → HtmlVisual-nvl1x-jh.js} +1 -1
  258. package/dist/web/assets/{LabModelVersionDetailPage-BxRmYD6h.js → LabModelVersionDetailPage-DrdoNvI-.js} +1 -1
  259. package/dist/web/assets/{LabModelWorkspace-u2Ulm_z4.js → LabModelWorkspace-CHlhzG3q.js} +1 -1
  260. package/dist/web/assets/{LabSkillSidebar-C7IceJTJ.js → LabSkillSidebar-CqHeZzoj.js} +1 -1
  261. package/dist/web/assets/{LabsRoute-CbztQaEf.js → LabsRoute-DzEbPpMK.js} +4 -4
  262. package/dist/web/assets/{LearningBatchesPage-CJqgZNvM.js → LearningBatchesPage-A2dFQW2j.js} +1 -1
  263. package/dist/web/assets/{MainChatThread-DNMfrrRq.js → MainChatThread-BSvKu4e5.js} +2 -2
  264. package/dist/web/assets/{MainPane-CQQxSDPS.js → MainPane-DiWIAxMj.js} +6 -6
  265. package/dist/web/assets/{ModelProjectPageHeader-Dge19aE1.js → ModelProjectPageHeader-lu6iRXHK.js} +1 -1
  266. package/dist/web/assets/{NativeSetupTerminal-D4JnbpyD.js → NativeSetupTerminal-kZ-nFPE8.js} +2 -2
  267. package/dist/web/assets/{NativeSkillSidebar-Jzx1BeKV.js → NativeSkillSidebar-DkkD1uH2.js} +1 -1
  268. package/dist/web/assets/{NewProjectDialog-DcnGzEd9.js → NewProjectDialog-Dg8dMEpc.js} +1 -1
  269. package/dist/web/assets/{OutputsPage-Cmk15Vt_.js → OutputsPage-Dz190U9t.js} +1 -1
  270. package/dist/web/assets/{PageChrome-Cz_fCqtn.js → PageChrome-Bncv-ps0.js} +1 -1
  271. package/dist/web/assets/{ProjectsPage-BZ3Eo3Mz.js → ProjectsPage-DVkYvLtd.js} +1 -1
  272. package/dist/web/assets/{RightChatPanelStack-C6H2vU9N.js → RightChatPanelStack-CP4leenI.js} +1 -1
  273. package/dist/web/assets/RightSidebarHomePanel-C0etQXpt.js +1 -0
  274. package/dist/web/assets/{ScheduledWorkPage-CAkSwM0T.js → ScheduledWorkPage-DI0mgt82.js} +1 -1
  275. package/dist/web/assets/{SettingsView-DvQXGw3_.js → SettingsView-cCtkr089.js} +3 -3
  276. package/dist/web/assets/{TasksetDraftEditorPrimitives-JuU1k8vr.js → TasksetDraftEditorPrimitives-DCQTuswJ.js} +1 -1
  277. package/dist/web/assets/{TeamChatView-DmHjr8W9.js → TeamChatView-BBEomfQ7.js} +1 -1
  278. package/dist/web/assets/{TerminalOverlay-DlaM9d8F.js → TerminalOverlay-Dj5NUDMp.js} +1 -1
  279. package/dist/web/assets/{TrainingCreationPanel-ClpylNsr.js → TrainingCreationPanel-Ds4PLfsd.js} +1 -1
  280. package/dist/web/assets/{TrainingDraftPanel-6tH2xSDj.js → TrainingDraftPanel-BAuh_BF3.js} +1 -1
  281. package/dist/web/assets/{UsageSettingsSection-CzDqxOYM.js → UsageSettingsSection-DbzeatcW.js} +1 -1
  282. package/dist/web/assets/WorkSidebarPanel-BaNuXoZc.js +1 -0
  283. package/dist/web/assets/{WorkspaceDiffPanel-B4e0lyF7.js → WorkspaceDiffPanel-xk-ve1MO.js} +3 -3
  284. package/dist/web/assets/{WorkspaceEnvironmentMenu-D01ZkZZF.js → WorkspaceEnvironmentMenu-D8GSuoYz.js} +1 -1
  285. package/dist/web/assets/{WorkspaceFileLocation-C5s_njZb.js → WorkspaceFileLocation-Dl8M2ZKN.js} +1 -1
  286. package/dist/web/assets/{WorkspaceGitDialogs-DjPZ6KIh.js → WorkspaceGitDialogs-9BhLjYx4.js} +1 -1
  287. package/dist/web/assets/{WorkspaceMonacoEditor-CC4sfOiU.js → WorkspaceMonacoEditor-DYPuC7pj.js} +3 -3
  288. package/dist/web/assets/{WorkspacePdfPreview-vszQqFa4.js → WorkspacePdfPreview-B7BI9tLR.js} +2 -2
  289. package/dist/web/assets/{WorkspacePresentationPreview-DQTvhaRD.js → WorkspacePresentationPreview-sP7JUT7m.js} +1 -1
  290. package/dist/web/assets/{bot-Doyx3T4j.js → bot-D7M8ZtE6.js} +1 -1
  291. package/dist/web/assets/{chat-resources-Beh5lB36.js → chat-resources-DhKAnljP.js} +1 -1
  292. package/dist/web/assets/chevron-down-BAEcJitl.js +1 -0
  293. package/dist/web/assets/chevron-right-3G9s2cQ9.js +1 -0
  294. package/dist/web/assets/chevron-up-DTYF52H1.js +1 -0
  295. package/dist/web/assets/{chunk-C3TS766N-ppRhs95p.js → chunk-C3TS766N-DENE60SE.js} +1 -1
  296. package/dist/web/assets/{client-choice-storage-DitqKiIT.js → client-choice-storage-DYZsrVr9.js} +1 -1
  297. package/dist/web/assets/{client-DwZ92xtu.js → client-gy7zrd7a.js} +1 -1
  298. package/dist/web/assets/{cloud-upload-HdzNTgr2.js → cloud-upload-De-XSMUr.js} +1 -1
  299. package/dist/web/assets/{copy-DTQhoBNg.js → copy-DEK20zbZ.js} +1 -1
  300. package/dist/web/assets/{cssMode-BRTtfXxU.js → cssMode-Dau-Fhqf.js} +1 -1
  301. package/dist/web/assets/{external-link-H1629UU6.js → external-link-DwDry0Fb.js} +1 -1
  302. package/dist/web/assets/{folder-open-CAGdWOrr.js → folder-open-DOb4AjV6.js} +1 -1
  303. package/dist/web/assets/{folder-plus-C14cs2mE.js → folder-plus-BAouDaXv.js} +1 -1
  304. package/dist/web/assets/{git-commit-horizontal-DFUfuVvF.js → git-commit-horizontal-DZbHXcai.js} +1 -1
  305. package/dist/web/assets/{htmlMode-BVaCcL76.js → htmlMode-DlNEe6hu.js} +1 -1
  306. package/dist/web/assets/{icons-Bk2b68aC.js → icons-OQhKVrDc.js} +1 -1
  307. package/dist/web/assets/{image-0DPVY6Ev.js → image-BkYJDChH.js} +1 -1
  308. package/dist/web/assets/{index-B6XX_0h3.js → index-M_h2Ok4V.js} +2 -2
  309. package/dist/web/assets/{info-C8b_tafZ.js → info-Mj5lp4Ic.js} +1 -1
  310. package/dist/web/assets/{jsonMode-BCKKQmmV.js → jsonMode-CyOEyonV.js} +1 -1
  311. package/dist/web/assets/loader-circle-DXVtGvuV.js +1 -0
  312. package/dist/web/assets/{lspLanguageFeatures-DozmNUOx.js → lspLanguageFeatures-DAYPzatg.js} +1 -1
  313. package/dist/web/assets/{maximize-2-CByk9-zN.js → maximize-2-BwFXSX6b.js} +1 -1
  314. package/dist/web/assets/{message-square-C889vRqm.js → message-square-C2nqfNLn.js} +1 -1
  315. package/dist/web/assets/{monaco.contribution-BITdsRbn.js → monaco.contribution-BZcNCJER.js} +2 -2
  316. package/dist/web/assets/{monaco.contribution-DxAV1oS5.js → monaco.contribution-BZkfRhss.js} +2 -2
  317. package/dist/web/assets/{monaco.contribution-BqA-XZ44.js → monaco.contribution-D7_X8TXe.js} +2 -2
  318. package/dist/web/assets/{monaco.contribution-B9q6qbbo.js → monaco.contribution-KyLdVay7.js} +2 -2
  319. package/dist/web/assets/{monitor-BtxlcLuI.js → monitor-B0Qj5Wea.js} +1 -1
  320. package/dist/web/assets/{paperclip-BeIdaspf.js → paperclip-CmrRruxi.js} +1 -1
  321. package/dist/web/assets/{pdf-perlzwEB.js → pdf-BM-9_48p.js} +1 -1
  322. package/dist/web/assets/play-CkACZ6Zo.js +1 -0
  323. package/dist/web/assets/plus-CB258e62.js +1 -0
  324. package/dist/web/assets/{presentation-0bzvu6_u.js → presentation-BYxhoSIo.js} +1 -1
  325. package/dist/web/assets/{python-B9hOnkOI.js → python-B3Mj03I5.js} +1 -1
  326. package/dist/web/assets/{refresh-cw-D61-Ozk3.js → refresh-cw-CwEmO71D.js} +1 -1
  327. package/dist/web/assets/{save-iEMNZoPe.js → save-S--FOuce.js} +1 -1
  328. package/dist/web/assets/{settings-lists-C84qxFmP.js → settings-lists-ChqDppMP.js} +1 -1
  329. package/dist/web/assets/square-BmPfHjGU.js +1 -0
  330. package/dist/web/assets/{square-terminal-Djpzo2Qs.js → square-terminal-CawpQtCi.js} +1 -1
  331. package/dist/web/assets/{submit-issue-command-HfKzyxg5.js → submit-issue-command-CFitxxmO.js} +1 -1
  332. package/dist/web/assets/{toggleHighContrast-ClsXu39R.js → toggleHighContrast-D-cMCvXx.js} +1 -1
  333. package/dist/web/assets/training-CzbWtx75.js +1 -0
  334. package/dist/web/assets/{training-model-data-CIysl8wH.js → training-model-data-G-D64935.js} +1 -1
  335. package/dist/web/assets/{tsMode-nbmaMc-D.js → tsMode-9kzS1ijG.js} +1 -1
  336. package/dist/web/assets/{upload-C6ug8RD-.js → upload-CtYsSYrM.js} +1 -1
  337. package/dist/web/assets/{useAccountSettings-Dr9h4Qz_.js → useAccountSettings-DYYa6puz.js} +1 -1
  338. package/dist/web/assets/{useAgentInventory-ByCk2JAv.js → useAgentInventory-c5B_Tszj.js} +1 -1
  339. package/dist/web/assets/{useChatContextSelection-C0eMm2g6.js → useChatContextSelection-DOISZpTz.js} +1 -1
  340. package/dist/web/assets/{useLocalAgentSchedules-Do0y_leJ.js → useLocalAgentSchedules-QJ8RsMKm.js} +1 -1
  341. package/dist/web/assets/{useQuery-D2MQ7e5U.js → useQuery-DuTGOe2b.js} +1 -1
  342. package/dist/web/assets/{wifi-off-Dr-CapyW.js → wifi-off-BOfP4Vmg.js} +1 -1
  343. package/dist/web/assets/{workers-DKvM2NdM.js → workers-BwGpyrdj.js} +1 -1
  344. package/dist/web/assets/x-5_iy6IDd.js +1 -0
  345. package/dist/web/assets/{yaml-C02vq4ar.js → yaml-BU4IWV_7.js} +1 -1
  346. package/dist/web/index.html +1 -1
  347. package/docs/command-reference.md +1 -0
  348. package/package.json +1 -1
  349. package/dist/chunks/app-server-runtime-43MCH5SY.js +0 -2
  350. package/dist/chunks/apps-VNFGMQFG.js +0 -2
  351. package/dist/chunks/chunk-6D3FI2XT.js +0 -2
  352. package/dist/chunks/chunk-APKXXAUF.js +0 -2
  353. package/dist/chunks/chunk-JCLTFDVW.js +0 -2
  354. package/dist/chunks/chunk-KTIBXRWQ.js +0 -2
  355. package/dist/chunks/chunk-VEBW7NKD.js +0 -2
  356. package/dist/chunks/chunk-YDZBX4XQ.js +0 -2
  357. package/dist/chunks/cli-R7TAP6Z2.js +0 -2
  358. package/dist/chunks/connected-app-executor-LAEAQUJS.js +0 -2
  359. package/dist/chunks/connected-evidence-VKY6O2JW.js +0 -2
  360. package/dist/chunks/core-commands-5TNBVR72.js +0 -2
  361. package/dist/chunks/datasets-BIDZJYDC.js +0 -2
  362. package/dist/chunks/desktop-test-BY2MS3UL.js +0 -3
  363. package/dist/chunks/evaluation-coordination-FXB4DXZA.js +0 -2
  364. package/dist/chunks/experiment-improvements-JPDLKZXD.js +0 -2
  365. package/dist/chunks/experiments-IEN7RXLX.js +0 -2
  366. package/dist/chunks/experiments-signal-L32D36NH.js +0 -2
  367. package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +0 -2
  368. package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +0 -2
  369. package/dist/chunks/human-review-6V6EMNVN.js +0 -2
  370. package/dist/chunks/learning-LAXMGWSQ.js +0 -2
  371. package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +0 -2
  372. package/dist/chunks/local-harness-taskset-review-XQHQ6JCR.js +0 -2
  373. package/dist/chunks/opchat-SV67HVMX.js +0 -3
  374. package/dist/chunks/opchat-bounded-chat-KLMIYSZZ.js +0 -2
  375. package/dist/chunks/organizations-OZZFX7RG.js +0 -2
  376. package/dist/chunks/project-action-payload-TK6G4VMC.js +0 -2
  377. package/dist/chunks/project-agent-FFXPNXCO.js +0 -2
  378. package/dist/chunks/sandbox-command-4BCUDAED.js +0 -2
  379. package/dist/chunks/saved-work-M6PUHKCC.js +0 -2
  380. package/dist/chunks/setup-RMZ2BHLM.js +0 -2
  381. package/dist/chunks/training-5NT2YB2L.js +0 -2
  382. package/dist/chunks/training-UY6KRG4M.js +0 -2
  383. package/dist/chunks/training-hardware-UWQCRDMV.js +0 -3
  384. package/dist/chunks/training-hosted-CKSDRVL6.js +0 -2
  385. package/dist/web/assets/App-CCuh99JW.js +0 -54
  386. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +0 -1
  387. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +0 -1
  388. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +0 -1
  389. package/dist/web/assets/chevron-down-DX1hzujj.js +0 -1
  390. package/dist/web/assets/chevron-right-DHN0y3KC.js +0 -1
  391. package/dist/web/assets/chevron-up-_QrW88NF.js +0 -1
  392. package/dist/web/assets/loader-circle-y-SSPwpk.js +0 -1
  393. package/dist/web/assets/play-CHXXdkuO.js +0 -1
  394. package/dist/web/assets/plus-DFFWjhPw.js +0 -1
  395. package/dist/web/assets/square-BE_4JMR3.js +0 -1
  396. package/dist/web/assets/training-DWfghwfZ.js +0 -1
  397. package/dist/web/assets/x-Jx2jlP9u.js +0 -1
@@ -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-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-LSKMALD6.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(`
2
+ import{a as pt}from"./chunk-ESOIZG2G.js";import{a as D,b as Fe,d as de}from"./chunk-PKJHN666.js";import{b as mt,c as ft}from"./chunk-5LKEVB2P.js";import{a as Je,b as Ye,c as Ze,d as ce}from"./chunk-JH4RACOB.js";import{a as M,b as ue}from"./chunk-JVEIK4RH.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-OFV26C2U.js";import{g as ct}from"./chunk-USKCFST5.js";import{a as ze}from"./chunk-PYNW5OFA.js";import{b as et}from"./chunk-23YW5PAQ.js";import{a as Xe}from"./chunk-VFH5C6D2.js";import{b as Ge,d as Qe}from"./chunk-XLZMSD5K.js";import{k as Ke}from"./chunk-BQNU4HZW.js";import{a as ot,b as nt}from"./chunk-GW766ZSO.js";import{i as Be,p as Ue}from"./chunk-2ACX7IW5.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-WXG3G2O6.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
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-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-GZES7QXJ.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-M6PUHKCC.js")).createHostedSavedWork),w=await $(s.connectedApps,r,async()=>{let[o,m]=await Promise.all([import("./connected-app-executor-LAEAQUJS.js"),import("./app-server-connected-apps-ILXBFD3S.js")]);return{execute:o.createCloudConnectedAppToolExecutor(),list:m.listAppServerIntegrationConnections}}),v=await $(s.tasksets,r,async()=>(await import("./hosted-tasksets-V24IBVJX.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-TK6G4VMC.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};
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-OLJHA4DI.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-OLJHA4DI.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-5DVBKNV3.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-FTVNZ7PH.js")).createWebSearchExecutorFromEnv()),h=await $(s.scheduling,r,async()=>(await import("./saved-work-L4KNWLZB.js")).createHostedSavedWork),w=await $(s.connectedApps,r,async()=>{let[o,m]=await Promise.all([import("./connected-app-executor-DLC23O43.js"),import("./app-server-connected-apps-NH4667QJ.js")]);return{execute:o.createCloudConnectedAppToolExecutor(),list:m.listAppServerIntegrationConnections}}),v=await $(s.tasksets,r,async()=>(await import("./hosted-tasksets-IUK3VWSL.js")).executeHostedTasksetAction),l=s.backgroundReview??!r,d=!r&&!!v;await _e(t),l&&await(await import("./refiner-profile-service-OLJHA4DI.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-2CYFIRBL.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-YVP2ZQJG.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-CGV77JSA.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-GZBMBZB2.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-C6ZPMTX6.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-QAV2UGSB.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-UYPA6XHW.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-Y5UEF2Y7.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-GUHAIIPS.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,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-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)}
2
+ import{g as E,m as g,n as j}from"./chunk-BQNU4HZW.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{a as he,b as G,c as j,d as z,e as H,g as be,i as T,j as ve,k as S,l as Re,v as B,x as F}from"./chunk-NZDLL6JN.js";import{a as se,b as D,c as P}from"./chunk-RFQD6B44.js";import{a as ne,b as oe,c as re}from"./chunk-XRKFTPHD.js";import{L as fe,M as me,Q as ye,U as we,g as $,h as ce,k as le,m as de,n as pe,o as ue,p as ge}from"./chunk-JEMECEQH.js";import{d as y,e as ie,f as ae,g as L}from"./chunk-RPM4FDRX.js";import{b as C,c as Z,d as ee,f as w,h as R,i as te}from"./chunk-BSHAIAXY.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=await pe(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=await ue(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await ge(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await D();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await L({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ie();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ae(r,{baseUrl:C(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await D(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await L({handle:r,apiKey:i,baseUrl:C(e),apiBaseUrl:Z(e),chatApiBaseUrl:ee(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=R(e),r=await P(e,o),n=await fe(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=R(o),r=se(o),n=await me(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ce(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=R(r),a=await P(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await we(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=R(r),a=await P(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await ye(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await ve({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await P(n,i),s=R(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=te(c,i),k=(await de(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await Re(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await le(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=he(E);H(O);let J=v(e.token)||v(e.setRemoteToken),Oe=G(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${z(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?j(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${j(O)}`);try{await be({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await P(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");H(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=G(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${z(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=ne(),t=await re(e),r=`npm i -g ${e}@${t}`,n=oe(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
2
+ import{a as he,b as G,c as j,d as z,e as H,g as be,i as T,j as ve,k as S,l as Re,v as B,x as F}from"./chunk-HYUTDZ3N.js";import{a as se,b as D,c as P}from"./chunk-RFQD6B44.js";import{a as ne,b as oe,c as re}from"./chunk-XRKFTPHD.js";import{L as fe,M as me,Q as ye,U as we,g as $,h as ce,k as le,m as de,n as pe,o as ue,p as ge}from"./chunk-KHDCMVEJ.js";import{d as y,e as ie,f as ae,g as L}from"./chunk-RPM4FDRX.js";import{b as C,c as Z,d as ee,f as w,h as R,i as te}from"./chunk-BSHAIAXY.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=await pe(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=await ue(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await ge(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await D();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await L({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ie();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ae(r,{baseUrl:C(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await D(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await L({handle:r,apiKey:i,baseUrl:C(e),apiBaseUrl:Z(e),chatApiBaseUrl:ee(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=R(e),r=await P(e,o),n=await fe(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=R(o),r=se(o),n=await me(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ce(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=R(r),a=await P(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await we(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=R(r),a=await P(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await ye(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=R(t),i=await P(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await ve({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await P(n,i),s=R(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=te(c,i),k=(await de(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await Re(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await le(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=he(E);H(O);let J=v(e.token)||v(e.setRemoteToken),Oe=G(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${z(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?j(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${j(O)}`);try{await be({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await P(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");H(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=G(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${z(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=ne(),t=await re(e),r=`npm i -g ${e}@${t}`,n=oe(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as j}from"./chunk-Y4I6CFZJ.js";import{j as y}from"./chunk-BU6MW65V.js";import{f as i,m as s}from"./chunk-HIQPGYVH.js";import{c as H,d as w,f as k}from"./chunk-LK77GI6M.js";import{Bb as h,Eb as I,Fb as E,oa as v,pa as g,wb as f}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";var A=e.object({sourcePass:i,graders:j.shape.graders,mappings:j.shape.mappings,maximumCostUsd:e.number().finite().positive().max(1e4)}).strict(),C=e.object({externalDatasetBinding:v,scoring:A.optional(),modelId:e.string().min(1).max(300),maximumCostUsd:e.number().finite().positive().max(1e4)}).strict(),R=e.object({source:e.enum(["local","github","openpond_git"]),repositoryId:e.string().trim().min(1),profileId:e.string().trim().min(1)}).strict(),n=e.string().min(1).max(240),c=e.string().regex(/^[a-f0-9]{64}$/),x=e.object({schemaVersion:e.literal("openpond.experimentImprovement.v1"),id:n,operationId:n,requestHash:c,actorId:n,teamId:n,projectId:n.nullable(),ownerWorkspaceId:n,ownerRevision:e.number().int().nonnegative(),ownerSourceRevision:e.string().min(1).max(500),baseRelease:i,profileRef:R,baseProfileSourceRevision:e.string().min(1).max(500),evidence:e.object({manifest:f,result:h}).strict(),component:e.object({kind:e.enum(["skill","workflow","agent","instruction"]),path:e.string().min(1).max(2e3),workflowId:n.optional()}).strict(),mode:e.enum(["manual","llm_assisted"]),status:e.enum(["draft","authoring_queued","authoring","frozen","testing","ready_for_review","adopting","accepted","rolled_back","declined","failed","cancelled"]),revision:e.number().int().positive(),limits:e.object({maximumCostUsd:e.number().finite().positive(),maximumAuthoringSteps:e.number().int().min(1).max(500),maximumDurationMs:e.number().int().min(1e3).max(864e5)}).strict(),authoringSteps:e.number().int().nonnegative().max(500),work:e.object({sessionId:n,turnId:n,revision:e.number().int().positive(),startedAt:e.string().datetime()}).strict().nullable(),frozen:e.object({release:i,sourceRevision:e.string().min(1).max(500),profileSourceRevision:e.string().min(1).max(500),authoringHash:c,partitionHash:c,executableSourceHash:c,protectedClosureHash:c,candidateRevision:e.number().int().positive(),diff:e.array(e.object({path:e.string(),before:c.nullable(),after:c.nullable()}).strict()).max(1e4)}).strict().nullable(),test:e.object({recipe:C,recipeHash:e.string().regex(/^[a-f0-9]{64}$/),baselineOperationId:e.string(),candidateOperationId:e.string(),cancelRequestedAt:e.string().datetime().nullable(),dispatching:e.object({kind:e.enum(["baseline","candidate"]),token:n,pid:e.number().int().positive(),processStart:e.string().nullable(),startedAt:e.string().datetime()}).strict().nullable()}).strict().nullable(),comparison:e.object({baseline:e.object({manifest:f,result:h}).strict(),candidate:e.object({manifest:f,result:h}).strict(),frozenHash:c,humanProjection:w.optional()}).strict().nullable(),adoptionIntent:e.object({operationId:n,expectedOwnerRevision:e.number().int().nonnegative(),frozenHash:c,humanProjection:w.optional()}).strict().nullable(),acceptance:i.nullable(),rollback:i.nullable(),error:e.string().max(2e3).nullable(),createdAt:e.string().datetime(),updatedAt:e.string().datetime(),contentHash:c}).strict();function D(r){let t=x.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Improvement state integrity failed.");if(I(t.evidence),t.evidence.manifest.teamId!==t.teamId||t.evidence.result.status!=="completed"||!t.evidence.result.cases.some(o=>o.status==="completed"))throw new Error("Improvement requires usable completed owner evidence.");if(t.test&&(s(t.test.recipe)!==t.test.recipeHash||g(t.test.recipe.externalDatasetBinding).profileId!==t.profileRef.profileId))throw new Error("The test recipe changed its exact selected Profile.");if(t.comparison?.humanProjection){let o=k(t.comparison.humanProjection);if(o.teamId!==t.teamId||o.projectId!==t.projectId||s(o.baseline)!==s(t.comparison.baseline)||s(o.candidate)!==s(t.comparison.candidate))throw new Error("Human comparison projection differs from its exact owner evidence.")}if(t.comparison&&(I(t.comparison.baseline),I(t.comparison.candidate),!t.frozen||t.comparison.frozenHash!==s(t.frozen)||!E(t.comparison.baseline,t.comparison.candidate).comparable))throw new Error("Improvement comparison is not bound to a comparable frozen candidate.");if(t.status==="ready_for_review"&&(!t.frozen||!t.comparison))throw new Error("Improvement is missing qualification.");if(t.status==="adopting"&&(!t.adoptionIntent||!t.frozen||t.adoptionIntent.frozenHash!==s(t.frozen)))throw new Error("Improvement adoption intent is not bound to its tested revision.");if(t.status==="accepted"&&(!t.acceptance||!t.comparison||!t.frozen))throw new Error("Improvement acceptance is missing its exact qualification receipt.");if(t.status==="rolled_back"&&(!t.acceptance||!t.rollback))throw new Error("Profile rollback is missing its durable owner receipt.");return t}m(D,"verifyExperimentImprovementState");function X(r){return D({...r,contentHash:s(r)})}m(X,"sealExperimentImprovementState");var Y=e.object({states:e.array(x).max(50),nextCursor:n.nullable()}).strict(),T=e.object({operationId:n,ownerWorkspaceId:n,expectedOwnerRevision:e.number().int().nonnegative(),baseRelease:i,profileRef:R,profileSourceRevision:e.string().min(1).max(500),projectId:n.nullable(),evidence:i,component:x.shape.component,mode:x.shape.mode,limits:x.shape.limits}).strict(),Z=e.discriminatedUnion("operation",[e.object({operation:e.literal("list"),limit:e.number().int().min(1).max(50).default(30),cursor:n.optional()}).strict(),e.object({operation:e.literal("options"),evidence:i}).strict(),e.object({operation:e.literal("start"),request:T}).strict(),e.object({operation:e.enum(["read","humanComparisonOptions"]),id:n}).strict(),e.object({operation:e.literal("instructions"),id:n}).strict(),e.object({operation:e.literal("edit"),id:n,revision:e.number().int().positive(),expectedFileHash:c,text:e.string().max(25e4)}).strict(),e.object({operation:e.literal("mode"),id:n,revision:e.number().int().positive(),mode:e.enum(["manual","llm_assisted"])}).strict(),e.object({operation:e.literal("author"),id:n,revision:e.number().int().positive(),modelId:n,prompt:e.string().min(1).max(2e4)}).strict(),e.object({operation:e.enum(["freeze","finishAuthoring","useCandidate","discard","cancel","rollback"]),id:n,revision:e.number().int().positive()}).strict(),e.object({operation:e.literal("test"),id:n,revision:e.number().int().positive(),recipe:C}).strict(),e.object({operation:e.literal("compare"),id:n,revision:e.number().int().positive(),baseline:i,candidate:i,humanSelections:H.optional()}).strict()]),S=e.object({teamId:n,evidence:i,scoring:A.optional(),profiles:e.array(e.object({id:c,name:e.string(),profileRef:R,ownerWorkspaceId:n,ownerRevision:e.number().int().nonnegative(),baseRelease:i,profileSourceRevision:e.string(),components:e.array(e.object({kind:e.enum(["skill","instruction","agent","workflow"]),path:e.string(),agentId:e.string().optional(),workflowId:e.string().optional(),label:e.string(),binding:v}).strict()).max(500)}).strict()).max(100)}).strict(),O=e.object({candidateId:n,actorId:n,teamId:n,projectId:n.nullable(),candidateRevision:e.number().int().positive(),recipeHash:c,baseline:e.object({manifest:f,result:h}).strict(),candidate:e.object({manifest:f,result:h}).strict(),contentHash:c}).strict();function U(r){let t=O.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Accepted Human discovery integrity failed.");for(let o of[t.baseline,t.candidate])if(I(o),o.manifest.teamId!==t.teamId||o.manifest.lineage?.humanProjection)throw new Error("Discovery must retain original owner evidence.");return t}m(U,"verifyExperimentImprovementHumanOptions");function ee(r,t){if(!r.test||r.test.cancelRequestedAt)throw new Error("The paired test is unavailable.");let l={candidateId:r.id,actorId:r.actorId,teamId:r.teamId,projectId:r.projectId,candidateRevision:r.revision,recipeHash:r.test.recipeHash,...t};return U({...l,contentHash:s(l)})}m(ee,"sealExperimentImprovementHumanOptions");var a=e.string().trim().min(1).max(240),d=e.string().regex(/^[a-f0-9]{64}$/),_=e.object({schemaVersion:e.literal("openpond.advancedRefinerEvaluation.v1"),operationId:a,actorId:a,teamId:a,projectId:a.nullable(),mode:e.enum(["review_quality","downstream_adaptation"]),profileRef:e.object({source:e.enum(["local","github","openpond_git"]),repositoryId:a,profileId:a}).strict(),sourceRevision:e.string().min(1).max(500),baselineRelease:i,refinerRelease:i,evidence:i,externalDatasetBinding:v,adaptationDatasetBinding:v,privateClosureHash:d,adaptationTaskIds:e.array(a).min(1).max(1e4),holdoutTaskIds:e.array(a).min(1).max(1e4),adaptationSplit:e.enum(["train","validation","test","frozen_eval"]),holdoutSplit:e.enum(["train","validation","test","frozen_eval"]),environmentPolicy:e.discriminatedUnion("kind",[e.object({kind:e.literal("resettable"),environmentHash:d}).strict(),e.object({kind:e.literal("frozen_observations"),environmentHash:d}).strict()]),maximumCostUsd:e.number().finite().positive().max(1e4),maximumDurationMs:e.number().int().min(1e3).max(864e5),maximumModelSteps:e.number().int().min(1).max(1e3),contentHash:d}).strict();function M(r){let t=_.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Advanced Refiner evaluation admission changed.");let o=g(t.externalDatasetBinding);if(o.profileId!==t.profileRef.profileId||o.protectedProfileClosureHash!==t.privateClosureHash)throw new Error("Advanced evaluation changed its Profile or protected evaluator closure.");if(t.adaptationSplit===t.holdoutSplit||new Set([...t.adaptationTaskIds,...t.holdoutTaskIds]).size!==t.adaptationTaskIds.length+t.holdoutTaskIds.length)throw new Error("Adaptation and private holdout must be disjoint ordered cases.");let p=g(t.adaptationDatasetBinding);if(p.profileId!==o.profileId||p.packageHash!==o.packageHash||s(p.dataset)!==s(o.dataset)||s(p.target)!==s(o.target)||p.protectedProfileClosureHash!==o.protectedProfileClosureHash)throw new Error("This native advanced adapter needs separate adaptation and holdout recipes from the same exact released package and target.");if(p.split!==t.adaptationSplit||o.split!==t.holdoutSplit)throw new Error("Advanced split policies differ from their exact admitted recipes.");let q=new Set(o.population.map(u=>u.taskId)),z=new Set(p.population.map(u=>u.taskId));if(t.holdoutTaskIds.some(u=>!q.has(u))||t.adaptationTaskIds.some(u=>!z.has(u)))throw new Error("Advanced evaluation selected cases outside its exact Dataset recipe.");return t}m(M,"verifyAdvancedRefinerEvaluationPin");function ce(r){return M({...r,contentHash:s(r)})}m(ce,"sealAdvancedRefinerEvaluationPin");var B=e.object({pin:_,modelId:a,profileId:a,model:y,seed:e.number().int(),reasoningEffort:e.enum(["none","off","low","medium","high","xhigh","max"]).nullable()}).strict(),V=e.discriminatedUnion("operation",[e.object({operation:e.literal("start"),request:B}).strict(),e.object({operation:e.enum(["read","cancel","resume"]),id:a}).strict(),e.object({operation:e.literal("list")}).strict()]),W=e.object({taskId:a,sourceCaseHash:d,reviewSessionId:a,reviewTurnId:a,inputHarness:i,trigger:i,decision:e.enum(["no_action","route_deterministically","queue_refiner"]),outcome:i.nullable(),proposal:i.nullable(),validations:e.array(i).max(100),grade:e.object({id:a,contentHash:d,score:e.number().min(0).max(1).nullable(),passed:e.boolean(),failureClass:e.string().nullable()}).strict(),resetComplete:e.boolean()}).strict(),$=e.object({schemaVersion:e.literal("openpond.advancedRefinerReviewReceipt.v1"),id:a,runId:a,pinHash:d,ownerActorId:a,teamId:a,privateClosureHash:d,refinerRelease:i,cases:e.array(W).min(1).max(1e4),reviewScore:e.number().min(0).max(1).nullable(),completedCases:e.number().int().nonnegative(),noActionCases:e.number().int().nonnegative(),routedCases:e.number().int().nonnegative(),proposalCases:e.number().int().nonnegative(),costUsd:e.number().finite().nonnegative().nullable(),cleanupComplete:e.boolean(),createdAt:e.string().datetime(),contentHash:d}).strict();function de(r){return $.parse({...r,contentHash:s(r)})}m(de,"sealAdvancedRefinerReviewReceipt");var P=S.shape.profiles.element,me=S.extend({profiles:e.array(P.extend({components:e.array(P.shape.components.element.extend({adaptationSplits:e.array(e.object({split:e.enum(["train","validation","test","frozen_eval"]),taskIds:e.array(a)})),environmentHash:d,resettable:e.boolean(),reviewQuality:e.boolean()}))})),refinerReleases:e.array(i),activeRefiner:i.nullable(),models:e.array(e.object({id:a,profileId:a,name:e.string(),location:e.enum(["local","hosted"])}))}),L=e.object({operation:e.literal("prepare"),evidence:i,profileOptionId:a,componentLabel:a,mode:e.enum(["review_quality","downstream_adaptation"]),adaptationSplit:e.enum(["train","validation","test","frozen_eval"]),operationId:a,refinerRelease:i,maximumCostUsd:e.number().positive(),maximumDurationMs:e.number().int().positive(),maximumModelSteps:e.number().int().positive()}).strict(),le=e.union([V,L,e.object({operation:e.literal("options"),evidence:i}).strict()]),pe=e.object({modelRequests:e.number().int().nonnegative(),knownSpendUsd:e.number().nonnegative(),totalSpendUsd:e.number().nonnegative().nullable(),heldUsd:e.number().nonnegative(),uncertainRequests:e.number().int().nonnegative()}).strict();export{C as a,x as b,D as c,X as d,Y as e,T as f,Z as g,S as h,U as i,ee as j,_ as k,M as l,ce as m,B as n,V as o,W as p,$ as q,de as r,L as s,pe as t};
2
+ import{a as j}from"./chunk-UGDBMRCT.js";import{j as y}from"./chunk-BYVE4TMU.js";import{f as i,m as s}from"./chunk-HIQPGYVH.js";import{c as H,d as w,f as k}from"./chunk-LK77GI6M.js";import{Bb as h,Eb as I,Fb as E,oa as v,pa as g,wb as f}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";var A=e.object({sourcePass:i,graders:j.shape.graders,mappings:j.shape.mappings,maximumCostUsd:e.number().finite().positive().max(1e4)}).strict(),C=e.object({externalDatasetBinding:v,scoring:A.optional(),modelId:e.string().min(1).max(300),maximumCostUsd:e.number().finite().positive().max(1e4)}).strict(),R=e.object({source:e.enum(["local","github","openpond_git"]),repositoryId:e.string().trim().min(1),profileId:e.string().trim().min(1)}).strict(),n=e.string().min(1).max(240),c=e.string().regex(/^[a-f0-9]{64}$/),x=e.object({schemaVersion:e.literal("openpond.experimentImprovement.v1"),id:n,operationId:n,requestHash:c,actorId:n,teamId:n,projectId:n.nullable(),ownerWorkspaceId:n,ownerRevision:e.number().int().nonnegative(),ownerSourceRevision:e.string().min(1).max(500),baseRelease:i,profileRef:R,baseProfileSourceRevision:e.string().min(1).max(500),evidence:e.object({manifest:f,result:h}).strict(),component:e.object({kind:e.enum(["skill","workflow","agent","instruction"]),path:e.string().min(1).max(2e3),workflowId:n.optional()}).strict(),mode:e.enum(["manual","llm_assisted"]),status:e.enum(["draft","authoring_queued","authoring","frozen","testing","ready_for_review","adopting","accepted","rolled_back","declined","failed","cancelled"]),revision:e.number().int().positive(),limits:e.object({maximumCostUsd:e.number().finite().positive(),maximumAuthoringSteps:e.number().int().min(1).max(500),maximumDurationMs:e.number().int().min(1e3).max(864e5)}).strict(),authoringSteps:e.number().int().nonnegative().max(500),work:e.object({sessionId:n,turnId:n,revision:e.number().int().positive(),startedAt:e.string().datetime()}).strict().nullable(),frozen:e.object({release:i,sourceRevision:e.string().min(1).max(500),profileSourceRevision:e.string().min(1).max(500),authoringHash:c,partitionHash:c,executableSourceHash:c,protectedClosureHash:c,candidateRevision:e.number().int().positive(),diff:e.array(e.object({path:e.string(),before:c.nullable(),after:c.nullable()}).strict()).max(1e4)}).strict().nullable(),test:e.object({recipe:C,recipeHash:e.string().regex(/^[a-f0-9]{64}$/),baselineOperationId:e.string(),candidateOperationId:e.string(),cancelRequestedAt:e.string().datetime().nullable(),dispatching:e.object({kind:e.enum(["baseline","candidate"]),token:n,pid:e.number().int().positive(),processStart:e.string().nullable(),startedAt:e.string().datetime()}).strict().nullable()}).strict().nullable(),comparison:e.object({baseline:e.object({manifest:f,result:h}).strict(),candidate:e.object({manifest:f,result:h}).strict(),frozenHash:c,humanProjection:w.optional()}).strict().nullable(),adoptionIntent:e.object({operationId:n,expectedOwnerRevision:e.number().int().nonnegative(),frozenHash:c,humanProjection:w.optional()}).strict().nullable(),acceptance:i.nullable(),rollback:i.nullable(),error:e.string().max(2e3).nullable(),createdAt:e.string().datetime(),updatedAt:e.string().datetime(),contentHash:c}).strict();function D(r){let t=x.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Improvement state integrity failed.");if(I(t.evidence),t.evidence.manifest.teamId!==t.teamId||t.evidence.result.status!=="completed"||!t.evidence.result.cases.some(o=>o.status==="completed"))throw new Error("Improvement requires usable completed owner evidence.");if(t.test&&(s(t.test.recipe)!==t.test.recipeHash||g(t.test.recipe.externalDatasetBinding).profileId!==t.profileRef.profileId))throw new Error("The test recipe changed its exact selected Profile.");if(t.comparison?.humanProjection){let o=k(t.comparison.humanProjection);if(o.teamId!==t.teamId||o.projectId!==t.projectId||s(o.baseline)!==s(t.comparison.baseline)||s(o.candidate)!==s(t.comparison.candidate))throw new Error("Human comparison projection differs from its exact owner evidence.")}if(t.comparison&&(I(t.comparison.baseline),I(t.comparison.candidate),!t.frozen||t.comparison.frozenHash!==s(t.frozen)||!E(t.comparison.baseline,t.comparison.candidate).comparable))throw new Error("Improvement comparison is not bound to a comparable frozen candidate.");if(t.status==="ready_for_review"&&(!t.frozen||!t.comparison))throw new Error("Improvement is missing qualification.");if(t.status==="adopting"&&(!t.adoptionIntent||!t.frozen||t.adoptionIntent.frozenHash!==s(t.frozen)))throw new Error("Improvement adoption intent is not bound to its tested revision.");if(t.status==="accepted"&&(!t.acceptance||!t.comparison||!t.frozen))throw new Error("Improvement acceptance is missing its exact qualification receipt.");if(t.status==="rolled_back"&&(!t.acceptance||!t.rollback))throw new Error("Profile rollback is missing its durable owner receipt.");return t}m(D,"verifyExperimentImprovementState");function X(r){return D({...r,contentHash:s(r)})}m(X,"sealExperimentImprovementState");var Y=e.object({states:e.array(x).max(50),nextCursor:n.nullable()}).strict(),T=e.object({operationId:n,ownerWorkspaceId:n,expectedOwnerRevision:e.number().int().nonnegative(),baseRelease:i,profileRef:R,profileSourceRevision:e.string().min(1).max(500),projectId:n.nullable(),evidence:i,component:x.shape.component,mode:x.shape.mode,limits:x.shape.limits}).strict(),Z=e.discriminatedUnion("operation",[e.object({operation:e.literal("list"),limit:e.number().int().min(1).max(50).default(30),cursor:n.optional()}).strict(),e.object({operation:e.literal("options"),evidence:i}).strict(),e.object({operation:e.literal("start"),request:T}).strict(),e.object({operation:e.enum(["read","humanComparisonOptions"]),id:n}).strict(),e.object({operation:e.literal("instructions"),id:n}).strict(),e.object({operation:e.literal("edit"),id:n,revision:e.number().int().positive(),expectedFileHash:c,text:e.string().max(25e4)}).strict(),e.object({operation:e.literal("mode"),id:n,revision:e.number().int().positive(),mode:e.enum(["manual","llm_assisted"])}).strict(),e.object({operation:e.literal("author"),id:n,revision:e.number().int().positive(),modelId:n,prompt:e.string().min(1).max(2e4)}).strict(),e.object({operation:e.enum(["freeze","finishAuthoring","useCandidate","discard","cancel","rollback"]),id:n,revision:e.number().int().positive()}).strict(),e.object({operation:e.literal("test"),id:n,revision:e.number().int().positive(),recipe:C}).strict(),e.object({operation:e.literal("compare"),id:n,revision:e.number().int().positive(),baseline:i,candidate:i,humanSelections:H.optional()}).strict()]),S=e.object({teamId:n,evidence:i,scoring:A.optional(),profiles:e.array(e.object({id:c,name:e.string(),profileRef:R,ownerWorkspaceId:n,ownerRevision:e.number().int().nonnegative(),baseRelease:i,profileSourceRevision:e.string(),components:e.array(e.object({kind:e.enum(["skill","instruction","agent","workflow"]),path:e.string(),agentId:e.string().optional(),workflowId:e.string().optional(),label:e.string(),binding:v}).strict()).max(500)}).strict()).max(100)}).strict(),O=e.object({candidateId:n,actorId:n,teamId:n,projectId:n.nullable(),candidateRevision:e.number().int().positive(),recipeHash:c,baseline:e.object({manifest:f,result:h}).strict(),candidate:e.object({manifest:f,result:h}).strict(),contentHash:c}).strict();function U(r){let t=O.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Accepted Human discovery integrity failed.");for(let o of[t.baseline,t.candidate])if(I(o),o.manifest.teamId!==t.teamId||o.manifest.lineage?.humanProjection)throw new Error("Discovery must retain original owner evidence.");return t}m(U,"verifyExperimentImprovementHumanOptions");function ee(r,t){if(!r.test||r.test.cancelRequestedAt)throw new Error("The paired test is unavailable.");let l={candidateId:r.id,actorId:r.actorId,teamId:r.teamId,projectId:r.projectId,candidateRevision:r.revision,recipeHash:r.test.recipeHash,...t};return U({...l,contentHash:s(l)})}m(ee,"sealExperimentImprovementHumanOptions");var a=e.string().trim().min(1).max(240),d=e.string().regex(/^[a-f0-9]{64}$/),_=e.object({schemaVersion:e.literal("openpond.advancedRefinerEvaluation.v1"),operationId:a,actorId:a,teamId:a,projectId:a.nullable(),mode:e.enum(["review_quality","downstream_adaptation"]),profileRef:e.object({source:e.enum(["local","github","openpond_git"]),repositoryId:a,profileId:a}).strict(),sourceRevision:e.string().min(1).max(500),baselineRelease:i,refinerRelease:i,evidence:i,externalDatasetBinding:v,adaptationDatasetBinding:v,privateClosureHash:d,adaptationTaskIds:e.array(a).min(1).max(1e4),holdoutTaskIds:e.array(a).min(1).max(1e4),adaptationSplit:e.enum(["train","validation","test","frozen_eval"]),holdoutSplit:e.enum(["train","validation","test","frozen_eval"]),environmentPolicy:e.discriminatedUnion("kind",[e.object({kind:e.literal("resettable"),environmentHash:d}).strict(),e.object({kind:e.literal("frozen_observations"),environmentHash:d}).strict()]),maximumCostUsd:e.number().finite().positive().max(1e4),maximumDurationMs:e.number().int().min(1e3).max(864e5),maximumModelSteps:e.number().int().min(1).max(1e3),contentHash:d}).strict();function M(r){let t=_.parse(r),{contentHash:l,...b}=t;if(s(b)!==l)throw new Error("Advanced Refiner evaluation admission changed.");let o=g(t.externalDatasetBinding);if(o.profileId!==t.profileRef.profileId||o.protectedProfileClosureHash!==t.privateClosureHash)throw new Error("Advanced evaluation changed its Profile or protected evaluator closure.");if(t.adaptationSplit===t.holdoutSplit||new Set([...t.adaptationTaskIds,...t.holdoutTaskIds]).size!==t.adaptationTaskIds.length+t.holdoutTaskIds.length)throw new Error("Adaptation and private holdout must be disjoint ordered cases.");let p=g(t.adaptationDatasetBinding);if(p.profileId!==o.profileId||p.packageHash!==o.packageHash||s(p.dataset)!==s(o.dataset)||s(p.target)!==s(o.target)||p.protectedProfileClosureHash!==o.protectedProfileClosureHash)throw new Error("This native advanced adapter needs separate adaptation and holdout recipes from the same exact released package and target.");if(p.split!==t.adaptationSplit||o.split!==t.holdoutSplit)throw new Error("Advanced split policies differ from their exact admitted recipes.");let q=new Set(o.population.map(u=>u.taskId)),z=new Set(p.population.map(u=>u.taskId));if(t.holdoutTaskIds.some(u=>!q.has(u))||t.adaptationTaskIds.some(u=>!z.has(u)))throw new Error("Advanced evaluation selected cases outside its exact Dataset recipe.");return t}m(M,"verifyAdvancedRefinerEvaluationPin");function ce(r){return M({...r,contentHash:s(r)})}m(ce,"sealAdvancedRefinerEvaluationPin");var B=e.object({pin:_,modelId:a,profileId:a,model:y,seed:e.number().int(),reasoningEffort:e.enum(["none","off","low","medium","high","xhigh","max"]).nullable()}).strict(),V=e.discriminatedUnion("operation",[e.object({operation:e.literal("start"),request:B}).strict(),e.object({operation:e.enum(["read","cancel","resume"]),id:a}).strict(),e.object({operation:e.literal("list")}).strict()]),W=e.object({taskId:a,sourceCaseHash:d,reviewSessionId:a,reviewTurnId:a,inputHarness:i,trigger:i,decision:e.enum(["no_action","route_deterministically","queue_refiner"]),outcome:i.nullable(),proposal:i.nullable(),validations:e.array(i).max(100),grade:e.object({id:a,contentHash:d,score:e.number().min(0).max(1).nullable(),passed:e.boolean(),failureClass:e.string().nullable()}).strict(),resetComplete:e.boolean()}).strict(),$=e.object({schemaVersion:e.literal("openpond.advancedRefinerReviewReceipt.v1"),id:a,runId:a,pinHash:d,ownerActorId:a,teamId:a,privateClosureHash:d,refinerRelease:i,cases:e.array(W).min(1).max(1e4),reviewScore:e.number().min(0).max(1).nullable(),completedCases:e.number().int().nonnegative(),noActionCases:e.number().int().nonnegative(),routedCases:e.number().int().nonnegative(),proposalCases:e.number().int().nonnegative(),costUsd:e.number().finite().nonnegative().nullable(),cleanupComplete:e.boolean(),createdAt:e.string().datetime(),contentHash:d}).strict();function de(r){return $.parse({...r,contentHash:s(r)})}m(de,"sealAdvancedRefinerReviewReceipt");var P=S.shape.profiles.element,me=S.extend({profiles:e.array(P.extend({components:e.array(P.shape.components.element.extend({adaptationSplits:e.array(e.object({split:e.enum(["train","validation","test","frozen_eval"]),taskIds:e.array(a)})),environmentHash:d,resettable:e.boolean(),reviewQuality:e.boolean()}))})),refinerReleases:e.array(i),activeRefiner:i.nullable(),models:e.array(e.object({id:a,profileId:a,name:e.string(),location:e.enum(["local","hosted"])}))}),L=e.object({operation:e.literal("prepare"),evidence:i,profileOptionId:a,componentLabel:a,mode:e.enum(["review_quality","downstream_adaptation"]),adaptationSplit:e.enum(["train","validation","test","frozen_eval"]),operationId:a,refinerRelease:i,maximumCostUsd:e.number().positive(),maximumDurationMs:e.number().int().positive(),maximumModelSteps:e.number().int().positive()}).strict(),le=e.union([V,L,e.object({operation:e.literal("options"),evidence:i}).strict()]),pe=e.object({modelRequests:e.number().int().nonnegative(),knownSpendUsd:e.number().nonnegative(),totalSpendUsd:e.number().nonnegative().nullable(),heldUsd:e.number().nonnegative(),uncertainRequests:e.number().int().nonnegative()}).strict();export{C as a,x as b,D as c,X as d,Y as e,T as f,Z as g,S as h,U as i,ee as j,_ as k,M as l,ce as m,B as n,V as o,W as p,$ as q,de as r,L as s,pe as t};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{c as _}from"./chunk-OUJ63LMU.js";import{a as J}from"./chunk-PACLKDTN.js";import{b as U}from"./chunk-RHMULF56.js";import{I as z,K as V,ja as M,na as G,v as O}from"./chunk-HG2YFMVU.js";import{aa as N}from"./chunk-BU6MW65V.js";import{Pb as F,Rb as q,v as C,z as A}from"./chunk-D6L6UNUQ.js";import{d as H,e as b,ga as x,ja as j}from"./chunk-ZY32SZ2P.js";import{f as T}from"./chunk-HNQPEOJD.js";import{c as I,d as S,e as W,j as $,m as L,n as c}from"./chunk-RCT3O3HQ.js";import{A as P}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";import Y from"node:path";import{constants as K}from"node:fs";import{open as ae,realpath as X}from"node:fs/promises";async function Q(e){let i=e.attempt.profileNative,p=P.array($).max(16).parse(e.attempt.artifactRefs??[]);if(!p.length)return[];if(!i||!e.storeDir)throw new Error("The actual retained artifact owner is unavailable.");await e.authorize();let t=await e.events(i.turnId);if(c(t)!==i.traceHash||t.some(r=>r.sessionId!==i.sessionId||r.turnId!==i.turnId))throw new Error("The saved artifacts differ from their actual retained case trace.");let o=[],l=0;for(let r of p){let f=t.filter(d=>(d.action==="work_output_save"||d.action==="sandbox_save_output")&&d.status==="completed").flatMap(d=>{let k=P.object({outputRef:M}).passthrough().safeParse(d.data);return k.success?[k.data.outputRef]:[]}).filter(d=>`${i.sessionId}/${d.id}/${d.revision}/${d.title}`===r.id&&d.sourceTaskId===i.sessionId&&d.sourceTurnId===i.turnId&&d.sha256===r.contentHash&&d.sizeBytes===r.sizeBytes&&d.contentType===r.mediaType);if(f.length!==1)throw new Error("The selected artifact has no unique actual saved output.");let s=f[0];if(s.location.kind!=="local"&&(s.location.kind!=="managed"||!e.readManaged)||s.sizeBytes>G)throw new Error("The retained artifact has no supported local byte owner.");if((l+=s.sizeBytes)>2e7)throw new Error("The retained artifacts exceed their aggregate grading byte limit.");await e.authorize(),e.signal?.throwIfAborted();let a;if(s.location.kind==="managed")a=await e.readManaged(s,e.signal);else if(s.location.kind==="local"){let d=await X(Y.join(e.storeDir,"work","outputs")),k=await X(s.location.path);if(!k.startsWith(`${d}${Y.sep}`))throw new Error("The artifact escaped canonical output storage.");let w=await ae(k,K.O_RDONLY|K.O_NOFOLLOW);try{let g=await w.stat();if(!g.isFile()||g.size!==s.sizeBytes)throw new Error("The artifact bytes changed.");a=await w.readFile()}finally{await w.close()}}else throw new Error("The saved artifact has no admitted byte owner.");if(a.length!==s.sizeBytes||L(a)!==s.sha256)throw new Error("The artifact bytes differ from their sealed receipt.");await e.authorize(),o.push({reference:r,title:s.title,contentType:s.contentType,base64:a.toString("base64"),...s.contentType.startsWith("text/")||s.contentType==="application/json"?{text:new TextDecoder("utf8",{fatal:!0}).decode(a)}:{}})}return await e.authorize(),o}h(Q,"readLocalProfileArtifacts");import oe from"node:path";async function Z(e,i){if(e.limits.maximumSpendUsd===null)return;let p=process.env.OPENPOND_API_KEY?.trim(),t=process.env.OPENPOND_OPCHAT_API_URL?.trim();if(!p||!t)throw new Error("Profile evaluation requires an admitted hosted spend ceiling.");let o=new URL(`${t.replace(/\/+$/,"")}/experiment-budget`);if(o.protocol!=="https:"||o.username||o.password||o.search||o.hash)throw new Error("Profile evaluation spend authority URL is invalid.");o.searchParams.set("runId",e.id),o.searchParams.set("manifestHash",e.contentHash);let l=await fetch(o,{headers:{Authorization:`Bearer ${p}`},signal:i});if(!l.ok)throw new Error("The exact Profile evaluation spend ceiling is unavailable.");let r=P.object({runId:P.string(),manifestHash:P.string(),maximumCostUsd:P.number().positive()}).strict().parse(await l.json());if(r.runId!==e.id||r.manifestHash!==e.contentHash||r.maximumCostUsd!==e.limits.maximumSpendUsd)throw new Error("Profile evaluation spend authority differs from its admitted manifest.")}h(Z,"assertProfileEvaluationSpendAuthority");async function ee(e){e.signal?.throwIfAborted();let i,p,t=h(()=>{},"rejectCancellation"),o=new Promise((s,a)=>{t=a}),l=h((s,a)=>{p||(p=new Error(s),e.onInterrupt?.(a),e.interrupt?(i=e.interrupt(s),i.catch(()=>{})):t(p))},"cancel"),r=h(()=>l("Profile evaluation run cancelled.","cancelled"),"aborted"),f=setTimeout(()=>l(`Profile evaluation case exceeded its ${e.timeoutMs}ms timeout.`,"timed_out"),e.timeoutMs);e.signal?.addEventListener("abort",r,{once:!0});try{e.signal?.aborted&&r();let s=await Promise.race([e.send(),o]);if(i){let a=await i;if(a.status==="in_progress"||!a.completedAt)throw new Error("Profile evaluation cleanup remains unconfirmed.")}if(s.status==="in_progress"||!s.completedAt)throw new Error("Workflow evaluation turn did not settle.");return s}catch(s){if(i){let a=await i;if(a.status==="in_progress"||!a.completedAt)throw new Error("Profile evaluation cleanup remains unconfirmed.",{cause:s})}throw s}finally{clearTimeout(f),e.signal?.removeEventListener("abort",r)}}h(ee,"awaitProfileEvaluationTurn");function te(e){let i=e.manifest.profileEvaluation,p=e.manifest.policy;if(!i||p.kind!=="model"||e.manifest.execution.kind!=="harness")throw new Error("Profile evaluation requires a released source and model policy.");if(i.profileId!==e.profileRef.profileId||i.profileId!==e.binding.profileId||i.sourceRevision!==e.binding.sourceRevision||i.harnessRelease.id!==e.binding.harnessRelease.id||i.harnessRelease.contentHash!==e.binding.harnessRelease.contentHash||(e.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?i.target.kind!=="workflow"||i.target.workflowId!==e.binding.workflowId:i.target.kind==="workflow"||c(i.target)!==c(e.binding.target)))throw new Error("Profile evaluation binding differs from its admitted source.");if(p.model.provider!==e.modelRef.providerId||p.model.model!==e.modelRef.modelId||p.configurationHash!==e.modelConfigurationHash)throw new Error("Workflow evaluation model differs from its admitted configuration.");return async t=>{if(c(t.source)!==c(i))throw new Error("Workflow evaluation case differs from its admitted Profile source.");t.signal?.throwIfAborted(),await(e.assertSpendAuthority??Z)(e.manifest,t.signal);let o=!!(e.attachments?.length||e.requiredOutputs?.length),l=o&&!e.ownedSessionMetadata?.localProfileExperiment&&e.profileRef.source==="local"&&(e.modelRef.providerId==="codex"||U(e.modelRef.providerId)),r=await e.createSession({...o?{experience:"work"}:{},provider:e.modelRef.providerId,modelRef:e.modelRef,currentProfile:e.profileRef,...e.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?{profileWorkflowBinding:e.binding}:{profileComponentBinding:e.binding},hiddenFromDefaultSidebar:!0,metadata:{profileEvaluationRun:{id:e.manifest.id,contentHash:e.manifest.contentHash},taskId:t.task.id,seed:t.seed,...o&&e.profileRef.source==="local"?{workspaceTarget:"local"}:{},...o?{profileEvaluationOutputs:e.requiredOutputs??[]}:{},...e.ownedSessionMetadata}}),f=[...o?[l?`This is a local evaluation run. Complete the requested task using its public inputs. Save these required files at their declared paths relative to the current task workspace: ${JSON.stringify(e.requiredOutputs??[])}. The app preserves those declared files automatically when the turn finishes; work_save_output is not a shell command and is not needed here. For headless tools that write user preferences, use writable configuration, cache and profile directories within this task workspace and a bounded command timeout. Send the requested final response to finish the case. Private grading runs afterward; do not wait for grader feedback.`:"This is an evaluation run. Complete the requested task using its public inputs. work_exec starts in writable Work storage; inputs are ../inputs and released policy source is ../harness. When work_finish is available, create every declared output in Work and call work_finish with the path of your complete working response file, then send a short final answer. Otherwise save each required output with work_save_output and send your final response. Private grading runs after your final response; do not wait for grader feedback."]:[],typeof t.task.input=="string"?t.task.input:JSON.stringify(t.task.input),...Object.keys(t.task.policyVisibleContext).length?[`Policy-visible task context:
2
+ import{c as _}from"./chunk-ER2VONWQ.js";import{a as J}from"./chunk-XBAB3HMA.js";import{b as U}from"./chunk-RHMULF56.js";import{I as z,K as V,ja as M,na as G,v as O}from"./chunk-WXG3G2O6.js";import{aa as N}from"./chunk-BYVE4TMU.js";import{Pb as F,Rb as q,v as C,z as A}from"./chunk-D6L6UNUQ.js";import{d as H,e as b,ga as x,ja as j}from"./chunk-ZY32SZ2P.js";import{f as T}from"./chunk-HNQPEOJD.js";import{c as I,d as S,e as W,j as $,m as L,n as c}from"./chunk-RCT3O3HQ.js";import{A as P}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";import Y from"node:path";import{constants as K}from"node:fs";import{open as ae,realpath as X}from"node:fs/promises";async function Q(e){let i=e.attempt.profileNative,p=P.array($).max(16).parse(e.attempt.artifactRefs??[]);if(!p.length)return[];if(!i||!e.storeDir)throw new Error("The actual retained artifact owner is unavailable.");await e.authorize();let t=await e.events(i.turnId);if(c(t)!==i.traceHash||t.some(r=>r.sessionId!==i.sessionId||r.turnId!==i.turnId))throw new Error("The saved artifacts differ from their actual retained case trace.");let o=[],l=0;for(let r of p){let f=t.filter(d=>(d.action==="work_output_save"||d.action==="sandbox_save_output")&&d.status==="completed").flatMap(d=>{let k=P.object({outputRef:M}).passthrough().safeParse(d.data);return k.success?[k.data.outputRef]:[]}).filter(d=>`${i.sessionId}/${d.id}/${d.revision}/${d.title}`===r.id&&d.sourceTaskId===i.sessionId&&d.sourceTurnId===i.turnId&&d.sha256===r.contentHash&&d.sizeBytes===r.sizeBytes&&d.contentType===r.mediaType);if(f.length!==1)throw new Error("The selected artifact has no unique actual saved output.");let s=f[0];if(s.location.kind!=="local"&&(s.location.kind!=="managed"||!e.readManaged)||s.sizeBytes>G)throw new Error("The retained artifact has no supported local byte owner.");if((l+=s.sizeBytes)>2e7)throw new Error("The retained artifacts exceed their aggregate grading byte limit.");await e.authorize(),e.signal?.throwIfAborted();let a;if(s.location.kind==="managed")a=await e.readManaged(s,e.signal);else if(s.location.kind==="local"){let d=await X(Y.join(e.storeDir,"work","outputs")),k=await X(s.location.path);if(!k.startsWith(`${d}${Y.sep}`))throw new Error("The artifact escaped canonical output storage.");let w=await ae(k,K.O_RDONLY|K.O_NOFOLLOW);try{let g=await w.stat();if(!g.isFile()||g.size!==s.sizeBytes)throw new Error("The artifact bytes changed.");a=await w.readFile()}finally{await w.close()}}else throw new Error("The saved artifact has no admitted byte owner.");if(a.length!==s.sizeBytes||L(a)!==s.sha256)throw new Error("The artifact bytes differ from their sealed receipt.");await e.authorize(),o.push({reference:r,title:s.title,contentType:s.contentType,base64:a.toString("base64"),...s.contentType.startsWith("text/")||s.contentType==="application/json"?{text:new TextDecoder("utf8",{fatal:!0}).decode(a)}:{}})}return await e.authorize(),o}h(Q,"readLocalProfileArtifacts");import oe from"node:path";async function Z(e,i){if(e.limits.maximumSpendUsd===null)return;let p=process.env.OPENPOND_API_KEY?.trim(),t=process.env.OPENPOND_OPCHAT_API_URL?.trim();if(!p||!t)throw new Error("Profile evaluation requires an admitted hosted spend ceiling.");let o=new URL(`${t.replace(/\/+$/,"")}/experiment-budget`);if(o.protocol!=="https:"||o.username||o.password||o.search||o.hash)throw new Error("Profile evaluation spend authority URL is invalid.");o.searchParams.set("runId",e.id),o.searchParams.set("manifestHash",e.contentHash);let l=await fetch(o,{headers:{Authorization:`Bearer ${p}`},signal:i});if(!l.ok)throw new Error("The exact Profile evaluation spend ceiling is unavailable.");let r=P.object({runId:P.string(),manifestHash:P.string(),maximumCostUsd:P.number().positive()}).strict().parse(await l.json());if(r.runId!==e.id||r.manifestHash!==e.contentHash||r.maximumCostUsd!==e.limits.maximumSpendUsd)throw new Error("Profile evaluation spend authority differs from its admitted manifest.")}h(Z,"assertProfileEvaluationSpendAuthority");async function ee(e){e.signal?.throwIfAborted();let i,p,t=h(()=>{},"rejectCancellation"),o=new Promise((s,a)=>{t=a}),l=h((s,a)=>{p||(p=new Error(s),e.onInterrupt?.(a),e.interrupt?(i=e.interrupt(s),i.catch(()=>{})):t(p))},"cancel"),r=h(()=>l("Profile evaluation run cancelled.","cancelled"),"aborted"),f=setTimeout(()=>l(`Profile evaluation case exceeded its ${e.timeoutMs}ms timeout.`,"timed_out"),e.timeoutMs);e.signal?.addEventListener("abort",r,{once:!0});try{e.signal?.aborted&&r();let s=await Promise.race([e.send(),o]);if(i){let a=await i;if(a.status==="in_progress"||!a.completedAt)throw new Error("Profile evaluation cleanup remains unconfirmed.")}if(s.status==="in_progress"||!s.completedAt)throw new Error("Workflow evaluation turn did not settle.");return s}catch(s){if(i){let a=await i;if(a.status==="in_progress"||!a.completedAt)throw new Error("Profile evaluation cleanup remains unconfirmed.",{cause:s})}throw s}finally{clearTimeout(f),e.signal?.removeEventListener("abort",r)}}h(ee,"awaitProfileEvaluationTurn");function te(e){let i=e.manifest.profileEvaluation,p=e.manifest.policy;if(!i||p.kind!=="model"||e.manifest.execution.kind!=="harness")throw new Error("Profile evaluation requires a released source and model policy.");if(i.profileId!==e.profileRef.profileId||i.profileId!==e.binding.profileId||i.sourceRevision!==e.binding.sourceRevision||i.harnessRelease.id!==e.binding.harnessRelease.id||i.harnessRelease.contentHash!==e.binding.harnessRelease.contentHash||(e.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?i.target.kind!=="workflow"||i.target.workflowId!==e.binding.workflowId:i.target.kind==="workflow"||c(i.target)!==c(e.binding.target)))throw new Error("Profile evaluation binding differs from its admitted source.");if(p.model.provider!==e.modelRef.providerId||p.model.model!==e.modelRef.modelId||p.configurationHash!==e.modelConfigurationHash)throw new Error("Workflow evaluation model differs from its admitted configuration.");return async t=>{if(c(t.source)!==c(i))throw new Error("Workflow evaluation case differs from its admitted Profile source.");t.signal?.throwIfAborted(),await(e.assertSpendAuthority??Z)(e.manifest,t.signal);let o=!!(e.attachments?.length||e.requiredOutputs?.length),l=o&&!e.ownedSessionMetadata?.localProfileExperiment&&e.profileRef.source==="local"&&(e.modelRef.providerId==="codex"||U(e.modelRef.providerId)),r=await e.createSession({...o?{experience:"work"}:{},provider:e.modelRef.providerId,modelRef:e.modelRef,currentProfile:e.profileRef,...e.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?{profileWorkflowBinding:e.binding}:{profileComponentBinding:e.binding},hiddenFromDefaultSidebar:!0,metadata:{profileEvaluationRun:{id:e.manifest.id,contentHash:e.manifest.contentHash},taskId:t.task.id,seed:t.seed,...o&&e.profileRef.source==="local"?{workspaceTarget:"local"}:{},...o?{profileEvaluationOutputs:e.requiredOutputs??[]}:{},...e.ownedSessionMetadata}}),f=[...o?[l?`This is a local evaluation run. Complete the requested task using its public inputs. Save these required files at their declared paths relative to the current task workspace: ${JSON.stringify(e.requiredOutputs??[])}. The app preserves those declared files automatically when the turn finishes; work_save_output is not a shell command and is not needed here. For headless tools that write user preferences, use writable configuration, cache and profile directories within this task workspace and a bounded command timeout. Send the requested final response to finish the case. Private grading runs afterward; do not wait for grader feedback.`:"This is an evaluation run. Complete the requested task using its public inputs. work_exec starts in writable Work storage; inputs are ../inputs and released policy source is ../harness. When work_finish is available, create every declared output in Work and call work_finish with the path of your complete working response file, then send a short final answer. Otherwise save each required output with work_save_output and send your final response. Private grading runs after your final response; do not wait for grader feedback."]:[],typeof t.task.input=="string"?t.task.input:JSON.stringify(t.task.input),...Object.keys(t.task.policyVisibleContext).length?[`Policy-visible task context:
3
3
  ${JSON.stringify(t.task.policyVisibleContext)}`]:[]].join(`
4
4
 
5
5
  `)||" ";await e.admitSession?.(r);try{let s=!1,a=await ee({signal:t.signal,timeoutMs:e.manifest.limits.timeoutMs,onInterrupt:h(n=>{s=n==="timed_out",e.onInterrupt?.(n)},"onInterrupt"),...e.interruptSessionTurn?{interrupt:h(n=>e.interruptSessionTurn(r.id,n),"interrupt")}:{},send:h(()=>{let n={prompt:f,...e.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?{workflowInput:{}}:e.binding.target.kind==="agent_action"?{workflowInput:t.task.input}:{},modelRef:e.modelRef,approvalPolicy:"on-request",...o?{sandbox:"workspace-write",codexPermissionMode:"default"}:{},...e.attachments?.length?{attachments:e.attachments}:{}};return e.modelRef.providerId==="codex"?e.sendTurn(r.id,n,{nativeTimeoutMs:e.manifest.limits.timeoutMs}):e.sendTurn(r.id,n)},"send")});if(a.status==="in_progress"||!a.completedAt)throw new Error("Workflow evaluation turn did not settle.");if(await e.validateTerminalTurn?.(r,a),!a.harnessSnapshot||a.harnessSnapshot.harnessRelease.id!==i.harnessRelease.id||a.harnessSnapshot.harnessRelease.contentHash!==i.harnessRelease.contentHash)throw new Error("Workflow evaluation turn executed a different Harness release.");if(!a.modelRef||c(a.modelRef)!==c(e.modelRef))throw new Error("Workflow evaluation turn executed a different model.");let d=await e.runtimeEventsForTurn(a.id),k=d.filter(n=>n.name==="workspace_action_result"&&(n.action==="sandbox_save_output"||n.action==="work_output_save")&&n.status==="completed"&&n.turnId===a.id).flatMap(n=>D(n.data)).filter(n=>n.sourceTaskId===r.id&&n.sourceTurnId===a.id&&n.location.kind!=="external"),g=(e.requiredOutputs??[]).flatMap(n=>{let y=[...k].reverse().find(B=>B.title===n.path&&B.contentType===n.mediaType&&(n.maxBytes===null||B.sizeBytes<=n.maxBytes));return y?[y]:[]}).map(n=>({id:`${r.id}/${n.id}/${n.revision}/${n.title}`,contentHash:n.sha256,mediaType:n.contentType,sizeBytes:n.sizeBytes})),v=-1;for(let n=d.length-1;n>=0;n-=1)if(d[n]?.name.endsWith(".delta")){v=n;break}let R=d.flatMap((n,y)=>n.name.endsWith(".delta")&&y!==v?[]:[n.id]);if(R.length+g.length>1e4)throw new Error("Profile evaluation produced more than 10,000 substantive evidence references.");let u=J(d,i.target.kind,a.status),m=Math.min(e.manifest.limits.maxOutputBytes,e.maximumOutputBytes??e.manifest.limits.maxOutputBytes);if(!Number.isSafeInteger(m)||m<1)throw new Error("Profile evaluation requires a positive bounded output limit.");let E=Buffer.byteLength(u,"utf8")>m;if(E&&!e.retainOutputLimitEvidence)throw new Error(`Profile evaluation case exceeded its ${m}-byte output limit.`);return E&&e.onOutputLimit?.(c(u)),{evidence:{output:{text:E?"":u},runtimeEventRefs:R,artifactRefs:g.map(n=>n.id),...E?{infrastructureError:`Profile evaluation case exceeded its ${m}-byte output limit.`}:a.status!=="completed"?{infrastructureError:a.error??`Workflow evaluation turn ${a.status}.`}:{}},traceHash:c(d),retainedEvidenceRef:{sessionId:r.id,turnId:a.id},artifactRefs:g,startedAt:a.startedAt,completedAt:a.completedAt,latencyMs:Math.max(0,Date.parse(a.completedAt)-Date.parse(a.startedAt)),costUsd:null,terminal:a.status==="completed"&&!E,failureClass:a.status==="completed"&&!E?null:a.status==="interrupted"?s?"timeout":"cancelled":"infrastructure_failure"}}finally{await e.settleSession?.(r.id)}}}h(te,"createProfileWorkflowEvaluationExecutor");function D(e,i=0){if(e==null||i>8)return[];let p=M.safeParse(e);return p.success?[p.data]:Array.isArray(e)?e.flatMap(t=>D(t,i+1)):typeof e!="object"?[]:Object.values(e).flatMap(t=>D(t,i+1))}h(D,"findFileOutputs");var re=P.object({manifest:C,taskset:x,profileRef:O,binding:P.union([H,b]),modelRef:T,modelConfigurationHash:S,taskId:I,seed:P.string().trim().min(1).max(500)}).strict();function De(e){return async(i,p)=>{let t=re.parse(i),o=await e.selectedProfile();if(!o||c(o.ref)!==c(t.profileRef)||o.sourceRevision!==t.binding.sourceRevision)throw new Error("Evaluation Profile differs from the app-server's authorized selection.");let l=await e.loadCatalog({ref:o.ref,sourceRevision:o.sourceRevision,harnessRelease:t.binding.harnessRelease}),r=t.manifest.profileEvaluation,f=await _({manifest:t.manifest,taskset:t.taskset,selected:{profileRef:o.ref,sourceRevision:o.sourceRevision,harnessRelease:t.binding.harnessRelease},loadCatalog:e.loadCatalog,resolveExternalDataset:e.resolveExternalDataset}),s=f?.definition??l.definitions.find(u=>u.id===r?.definitionId);if(A(t.manifest,t.taskset,f?.catalog??{schemaVersion:"openpond.profileEvaluations.v1",definitions:l.definitions,suites:l.suites}),!r||!s||(f?c(f.catalog):l.catalogHash)!==r.catalogHash||c(s)!==r.definitionHash||c(s.target)!==c(r.target)||s.tasksetRelease.id!==t.manifest.tasksetRelease.id||s.tasksetRelease.contentHash!==t.manifest.tasksetRelease.contentHash||!s.taskIds.includes(t.taskId)||!s.seeds.includes(t.seed)||t.manifest.population.filter(u=>u.taskId===t.taskId&&u.seed===t.seed).length!==1)throw new Error("Evaluation case differs from its released definition or admitted population.");let a=t.taskset.tasks.find(u=>u.id===t.taskId),d=j(a);if(d.artifactRefs.length!==a.artifactRefs.length||d.artifactRefs.length>z.maxAttachments)throw new Error("Evaluation case has an unauthorized task attachment.");if(d.artifactRefs.length&&!e.storeDir)throw new Error("Evaluation case attachment storage is unavailable.");let k=f?.packageValue??(d.artifactRefs.length||a.requiredOutputs?.length?await e.loadTasksetPackage(s,o.ref.profileId,t.binding.harnessRelease):null);if(k&&(k.contentHash!==t.manifest.packageHash||k.taskset.contentHash!==t.taskset.contentHash))throw new Error("Evaluation case Taskset differs from its frozen package or admitted manifest.");let w=d.artifactRefs.map(u=>{if(u.mediaType!=="application/pdf"||u.sizeBytes>z.maxAttachmentBytes)throw new Error(`Evaluation case attachment ${u.id} is not an admitted PDF.`);let m=k?.files.find(E=>E.asset.id===u.id);if(!m||c(m.asset)!==c(u))throw new Error(`Evaluation case attachment ${u.id} differs from its frozen Taskset file.`);return N(m),V.parse({id:u.id,name:oe.basename(u.path),kind:"file",mediaType:u.mediaType,sizeBytes:u.sizeBytes,contentsBase64:m.base64})}),g=te({manifest:t.manifest,profileRef:o.ref,binding:t.binding,modelRef:t.modelRef,modelConfigurationHash:t.modelConfigurationHash,createSession:e.createSession,sendTurn:e.sendTurn,...e.admitSession?{admitSession:h(u=>e.admitSession(u,t.manifest,t.taskId,t.seed,w),"admitSession")}:{},...e.settleSession?{settleSession:e.settleSession}:{},interruptSessionTurn:e.interruptSessionTurn,runtimeEventsForTurn:h(u=>e.store.runtimeEventsForTurn(u),"runtimeEventsForTurn"),attachments:w,requiredOutputs:a.requiredOutputs??[]});f&&await f.authorize(),p?.throwIfAborted();let v=await g({task:d,seed:t.seed,source:r,...p?{signal:p}:{}}),R=await Q({storeDir:e.storeDir,readManaged:e.readManagedArtifact,attempt:{artifactRefs:v.artifactRefs,profileNative:v.retainedEvidenceRef?.sessionId&&v.retainedEvidenceRef.turnId?{sessionId:v.retainedEvidenceRef.sessionId,turnId:v.retainedEvidenceRef.turnId,traceHash:v.traceHash}:null},events:h(u=>e.store.runtimeEventsForTurn(u),"events"),signal:p,authorize:h(async()=>{p?.throwIfAborted();let u=await e.selectedProfile();if(!u||c(u)!==c(o))throw new Error("The current artifact Profile authority changed.");f&&await f.authorize()},"authorize")});return{...v,evidence:{...v.evidence,artifacts:R,caseOwner:{...v.retainedEvidenceRef,traceHash:v.traceHash}}}}}h(De,"createProfileEvaluationCaseService");var ie=P.object({manifest:C,taskset:x,profileRef:O,binding:P.union([H,b]),modelRef:T,modelConfigurationHash:S}).strict();function Ve(e){let i=new Map,p=h(async(t,o)=>{let l=await e.selectedProfile();if(!l||c(l.ref)!==c(t.profileRef)||l.sourceRevision!==t.binding.sourceRevision)throw new Error("Evaluation Profile differs from the app-server's authorized selection.");let r=await e.loadCatalog({ref:l.ref,sourceRevision:l.sourceRevision,harnessRelease:t.binding.harnessRelease}),f=await _({manifest:t.manifest,taskset:t.taskset,selected:{profileRef:l.ref,sourceRevision:l.sourceRevision,harnessRelease:t.binding.harnessRelease},loadCatalog:e.loadCatalog,resolveExternalDataset:e.resolveExternalDataset}),s=f?.catalog??{schemaVersion:"openpond.profileEvaluations.v1",definitions:r.definitions,suites:r.suites};if(A(t.manifest,t.taskset,s),!e.privateGrading&&(t.taskset.graders.some(m=>m.kind==="model_judge"||m.kind==="custom_verifier")||t.taskset.metrics?.aggregation==="custom"))throw new Error("Profile evaluation cannot run this Taskset's model judge, custom verifier, or custom metric in the current app-server runtime.");let a=t.manifest.profileEvaluation,d=t.manifest.policy;if(a.profileId!==l.ref.profileId||a.sourceRevision!==t.binding.sourceRevision||a.harnessRelease.id!==t.binding.harnessRelease.id||a.harnessRelease.contentHash!==t.binding.harnessRelease.contentHash||(t.binding.schemaVersion==="openpond.profileWorkflowBinding.v1"?a.target.kind!=="workflow"||a.target.workflowId!==t.binding.workflowId:a.target.kind==="workflow"||c(a.target)!==c(t.binding.target))||d.kind!=="model"||d.model.provider!==t.modelRef.providerId||d.model.model!==t.modelRef.modelId||d.configurationHash!==t.modelConfigurationHash)throw new Error("Evaluation request differs from its admitted Profile workflow or model configuration.");let k=s.definitions.find(m=>m.id===a.definitionId),w=e.privateGrading?f?.packageValue??await(e.loadTasksetPackage?e.loadTasksetPackage(k,l.ref.profileId,a.harnessRelease):Promise.reject(new Error("The current private Taskset owner is unavailable."))):null,g=w?await e.privateGrading?.(t.manifest,w,o):void 0;await g?.authorize();let v=await e.store.getProfileEvaluationRun(t.manifest.id);if(v){if(v.manifest.contentHash!==t.manifest.contentHash||c(v.profileRef)!==c(l.ref))throw new Error(`Profile evaluation run ${t.manifest.id} already exists with another manifest.`);return v}f&&await f.authorize(),o?.throwIfAborted();let R=await q({manifest:t.manifest,taskset:t.taskset,catalog:s,...g?{customVerifier:g.customVerifier,modelJudge:g.modelJudge,metricSource:g.metricSource,metricExecutor:g.metricExecutor}:{},execute:h(({task:m,seed:E,signal:n})=>e.executeCase({...t,taskId:m.id,seed:E},n),"execute"),...o?{signal:o}:{},saveGrade:h(async m=>(await e.store.saveProfileEvaluationGrade(m),{id:m.contentHash,contentHash:m.contentHash,mediaType:"application/json",sizeBytes:null}),"saveGrade"),saveReceipt:h(async m=>{await e.store.saveProfileEvaluationReceipt(m)},"saveReceipt"),loadCompletedMember:h(async({receiptId:m})=>{let E=await e.store.getProfileEvaluationReceipt(m);if(!E)return null;let n=E.graderEvidenceRefs[0],y=n&&await e.store.getProfileEvaluationGrade(n.contentHash);if(!y)throw new Error(`Retained Profile evaluation receipt ${m} is missing its grade.`);return{receipt:E,grade:y}},"loadCompletedMember")});await g?.authorize(),f&&await f.authorize();let u={profileRef:l.ref,manifest:t.manifest,metric:R.metric,gradeRefs:R.grades.map(m=>({id:m.contentHash,contentHash:m.contentHash})),receiptRefs:R.receipts.map(m=>({id:m.id,contentHash:m.contentHash})),passRate:R.passRate,passed:R.passed,completedAt:new Date().toISOString()};return e.store.saveProfileEvaluationRun({...u,contentHash:c(u)})},"run");return(t,o)=>{let l=ie.parse(t),r=i.get(l.manifest.id);if(r){if(r.manifestHash!==l.manifest.contentHash)throw new Error(`Profile evaluation run ${l.manifest.id} is already running with another manifest.`);return r.promise}let f=p(l,o);return i.set(l.manifest.id,{manifestHash:l.manifest.contentHash,promise:f}),f.finally(()=>{i.get(l.manifest.id)?.promise===f&&i.delete(l.manifest.id)}).catch(()=>{}),f}}h(Ve,"createProfileEvaluationRunService");var se=P.object({id:I,suiteId:I,createdAt:W,modelRef:T,hostModelConfigurationHash:S.optional()}).strict();function Xe(e){let i=new Map,p=h(async t=>{let o=await e.selectedWorkflows(),l=await e.loadCatalog({ref:o.profileRef,sourceRevision:o.sourceRevision,harnessRelease:o.harnessRelease}),r={schemaVersion:"openpond.profileEvaluations.v1",definitions:l.definitions,suites:l.suites},f=r.suites.find(w=>w.id===t.suiteId);if(!f)throw new Error(`Profile evaluation suite ${t.suiteId} is absent from the selected release.`);let s=[];for(let w of f.definitionIds)s.push(await e.prepareRun({id:`suite-${c([t.id,w]).slice(0,32)}`,createdAt:t.createdAt,definitionId:w,modelRef:t.modelRef,...t.hostModelConfigurationHash?{hostModelConfigurationHash:t.hostModelConfigurationHash}:{}}));let a=await e.store.getProfileEvaluationSuiteRun(t.id);if(a){if(a.suiteId!==f.id||a.catalogHash!==c(r)||a.profileId!==o.profileRef.profileId||a.sourceRevision!==o.sourceRevision||a.harnessRelease.id!==o.harnessRelease.id||a.harnessRelease.contentHash!==o.harnessRelease.contentHash||a.createdAt!==t.createdAt)throw new Error(`Profile evaluation suite run ${t.id} already exists with another request.`);for(let[w,g]of a.members.entries()){let v=await e.store.getProfileEvaluationRun(g.runManifest.id);if(!v||v.contentHash!==g.runHash||v.manifest.contentHash!==g.runManifest.contentHash||v.manifest.contentHash!==s[w]?.manifest.contentHash)throw new Error("Retained Profile evaluation suite is missing member evidence.");let R=v.manifest.policy;if(R.kind!=="model"||R.model.provider!==t.modelRef.providerId||R.model.model!==t.modelRef.modelId)throw new Error(`Profile evaluation suite run ${t.id} already exists with another model.`)}return a}let d=[];for(let[w,g]of f.definitionIds.entries()){let v=s[w],R=await e.executeRun(v);d.push({definitionId:g,manifest:R.manifest,runHash:R.contentHash,passed:R.passed,score:R.metric.value})}let k=F({id:t.id,suiteId:f.id,catalog:r,members:d,createdAt:t.createdAt,completedAt:new Date().toISOString()});return e.store.saveProfileEvaluationSuiteRun(o.profileRef,r,k)},"run");return t=>{let o=se.parse(t),l=c(o),r=i.get(o.id);if(r){if(r.requestHash!==l)throw new Error(`Profile evaluation suite run ${o.id} is already running with another request.`);return r.promise}let f=p(o);return i.set(o.id,{requestHash:l,promise:f}),f.finally(()=>{i.get(o.id)?.promise===f&&i.delete(o.id)}).catch(()=>{}),f}}h(Xe,"createProfileEvaluationSuiteService");export{Q as a,te as b,De as c,Ve as d,Xe as e};