openpond 0.2.67 → 0.2.69

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 (573) hide show
  1. package/dist/app-server.d.ts +668 -1
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/account-context-V3KLSNKS.js +12 -0
  4. package/dist/chunks/{acp-NASAJV5E.js → acp-ER6CUXG2.js} +1 -1
  5. package/dist/chunks/{acp-agent-C3CRF6DT.js → acp-agent-AYJ5RPVF.js} +1 -1
  6. package/dist/chunks/actions-command-BBUS3HDK.js +2 -0
  7. package/dist/chunks/{app-layer-XIEZ6ALX.js → app-layer-JCEWGUDH.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-IB6M35NS.js → app-server-connected-apps-ILXBFD3S.js} +1 -1
  9. package/dist/chunks/app-server-evaluations-RRLYWLPK.js +2 -0
  10. package/dist/chunks/app-server-harness-services-XXM336NU.js +2 -0
  11. package/dist/chunks/app-server-runtime-43MCH5SY.js +2 -0
  12. package/dist/chunks/apps-VNFGMQFG.js +2 -0
  13. package/dist/chunks/{chunk-W3ZILZUL.js → chunk-22RLEU3Q.js} +1 -1
  14. package/dist/chunks/chunk-2PXKSAG6.js +2 -0
  15. package/dist/chunks/{chunk-XEU4J4GJ.js → chunk-2TGHZXJE.js} +2 -2
  16. package/dist/chunks/{chunk-AXO6OHJB.js → chunk-3A2Y7UK3.js} +1 -1
  17. package/dist/chunks/chunk-3Z4VM2LF.js +4 -0
  18. package/dist/chunks/{chunk-V3T2OJBZ.js → chunk-4BUM6JEC.js} +2 -2
  19. package/dist/chunks/chunk-4G3GTEVS.js +23 -0
  20. package/dist/chunks/{chunk-43QYVOYA.js → chunk-4KNPCJR4.js} +1 -1
  21. package/dist/chunks/chunk-4KTGYHCE.js +2 -0
  22. package/dist/chunks/chunk-4PUOWSDE.js +13 -0
  23. package/dist/chunks/chunk-55YD4UTW.js +2 -0
  24. package/dist/chunks/chunk-5G7BQAUA.js +2 -0
  25. package/dist/chunks/chunk-65FJWWXG.js +2 -0
  26. package/dist/chunks/{chunk-4EZI4KCT.js → chunk-65WRWLUD.js} +1 -1
  27. package/dist/chunks/chunk-6D3FI2XT.js +2 -0
  28. package/dist/chunks/chunk-7EQLW2KM.js +12 -0
  29. package/dist/chunks/{chunk-5TPYBXWM.js → chunk-7NCM6GBN.js} +1 -1
  30. package/dist/chunks/chunk-7OFD6TFD.js +2 -0
  31. package/dist/chunks/chunk-7OKZCJHS.js +3 -0
  32. package/dist/chunks/{chunk-ADOCQA4D.js → chunk-7PKDJHT6.js} +1 -1
  33. package/dist/chunks/chunk-7RJOCGQ6.js +2 -0
  34. package/dist/chunks/{chunk-YR5URT73.js → chunk-7RSQOC5M.js} +3 -3
  35. package/dist/chunks/{chunk-FVK4W27G.js → chunk-AFH462DO.js} +1 -1
  36. package/dist/chunks/{chunk-GUG2SWRZ.js → chunk-AFKFN25T.js} +1 -1
  37. package/dist/chunks/chunk-AFYYIJ6K.js +2 -0
  38. package/dist/chunks/{chunk-U3MVH2YT.js → chunk-APKXXAUF.js} +1 -1
  39. package/dist/chunks/chunk-AQUZCWM3.js +2 -0
  40. package/dist/chunks/chunk-AUO5DCEU.js +2 -0
  41. package/dist/chunks/chunk-AYOMVI7J.js +2 -0
  42. package/dist/chunks/{chunk-RWRKUO5D.js → chunk-B66QCXH2.js} +1 -1
  43. package/dist/chunks/chunk-BDZDWHBJ.js +6 -0
  44. package/dist/chunks/chunk-BU6MW65V.js +10 -0
  45. package/dist/chunks/{chunk-P6NQYXN6.js → chunk-CCZ276IA.js} +1 -1
  46. package/dist/chunks/{chunk-YONDU5TN.js → chunk-CIZI6Z7D.js} +1 -1
  47. package/dist/chunks/{chunk-ATFV2NA4.js → chunk-CO23RRN7.js} +1 -1
  48. package/dist/chunks/{chunk-QAFXQHHG.js → chunk-D6L6UNUQ.js} +2 -2
  49. package/dist/chunks/chunk-DDOIPTOM.js +2 -0
  50. package/dist/chunks/{chunk-CSU7RDA5.js → chunk-DKOVZ6R2.js} +3 -3
  51. package/dist/chunks/chunk-DRLP7GIU.js +2 -0
  52. package/dist/chunks/{chunk-XDFXKRTI.js → chunk-DWF3FCY4.js} +1 -1
  53. package/dist/chunks/chunk-DXJC3QW7.js +2 -0
  54. package/dist/chunks/{chunk-IDILAYCW.js → chunk-E2JB5OCO.js} +1 -1
  55. package/dist/chunks/{chunk-GI7LTJV3.js → chunk-EDYCSW22.js} +1 -1
  56. package/dist/chunks/{chunk-4JYTFEND.js → chunk-EFP75UEX.js} +1 -1
  57. package/dist/chunks/{chunk-CX7HKSQ4.js → chunk-EGP6DF34.js} +2 -2
  58. package/dist/chunks/{chunk-D5OFN47Z.js → chunk-ESYPMD7Q.js} +1 -1
  59. package/dist/chunks/{chunk-36FNNR5N.js → chunk-EWDDDHJN.js} +1 -1
  60. package/dist/chunks/{chunk-PWKJ5KLZ.js → chunk-EXYSD45J.js} +1 -1
  61. package/dist/chunks/{chunk-R6VI7MX5.js → chunk-EYTTZ5H4.js} +1 -1
  62. package/dist/chunks/{chunk-WD6ANOLL.js → chunk-FNGZ4UDZ.js} +1 -1
  63. package/dist/chunks/{chunk-YKTJPCYZ.js → chunk-G4FRBT7G.js} +4 -4
  64. package/dist/chunks/{chunk-JFZ6USNQ.js → chunk-G7X73SBG.js} +1 -1
  65. package/dist/chunks/{chunk-ULJZ7NUF.js → chunk-GY7YSD6J.js} +1 -1
  66. package/dist/chunks/{chunk-CWAQOFLP.js → chunk-GYYJ47GX.js} +1 -1
  67. package/dist/chunks/chunk-HG2YFMVU.js +4 -0
  68. package/dist/chunks/{chunk-YQBL5P6R.js → chunk-HKVFU3B3.js} +1 -1
  69. package/dist/chunks/{chunk-VEXJV5H5.js → chunk-IIT66347.js} +4 -4
  70. package/dist/chunks/{chunk-B2K5WQZE.js → chunk-IO5DZUKL.js} +1 -1
  71. package/dist/chunks/chunk-J256AEEE.js +2 -0
  72. package/dist/chunks/{chunk-CRDKBFRN.js → chunk-JEMECEQH.js} +1 -1
  73. package/dist/chunks/{chunk-YMCF5GR2.js → chunk-JQOVC35K.js} +1 -1
  74. package/dist/chunks/{chunk-6LFTQBXP.js → chunk-JT5YQ52I.js} +1 -1
  75. package/dist/chunks/chunk-JVMSN7LH.js +2 -0
  76. package/dist/chunks/{chunk-HORMGT2Q.js → chunk-JXYJQT5Q.js} +1 -1
  77. package/dist/chunks/{chunk-WDKZMXIU.js → chunk-K7KBFM2T.js} +1 -1
  78. package/dist/chunks/{chunk-UBTP3QWI.js → chunk-KCLMA2IH.js} +1 -1
  79. package/dist/chunks/chunk-KDER7R45.js +2 -0
  80. package/dist/chunks/{chunk-R6MMWEH4.js → chunk-KP2MYTP5.js} +1 -1
  81. package/dist/chunks/{chunk-TV2LE2BD.js → chunk-KU4TPDPH.js} +2 -2
  82. package/dist/chunks/{chunk-WJSJXK2N.js → chunk-KUE46HTH.js} +1 -1
  83. package/dist/chunks/chunk-LSKMALD6.js +161 -0
  84. package/dist/chunks/chunk-LVXL7T5O.js +2 -0
  85. package/dist/chunks/{chunk-TSQ2I6XV.js → chunk-M4A7G4S5.js} +2 -2
  86. package/dist/chunks/{chunk-MX7KV5DA.js → chunk-M4ZHFDRJ.js} +1 -1
  87. package/dist/chunks/chunk-M5X7XKXY.js +12 -0
  88. package/dist/chunks/{chunk-XT5WUQGT.js → chunk-MIFVX5PK.js} +1 -1
  89. package/dist/chunks/{chunk-4VZJQRQI.js → chunk-MOXIGLN2.js} +1 -1
  90. package/dist/chunks/{chunk-UKSSFB4Q.js → chunk-N5EAVX4G.js} +1 -1
  91. package/dist/chunks/{chunk-4B7EGNYX.js → chunk-NMMHXYDJ.js} +1 -1
  92. package/dist/chunks/{chunk-EBOTNBUS.js → chunk-NRYC4NH6.js} +1 -1
  93. package/dist/chunks/chunk-NSSZ2ZIU.js +2 -0
  94. package/dist/chunks/chunk-NW6WGGSL.js +2 -0
  95. package/dist/chunks/{chunk-7P5SH3CI.js → chunk-NZDLL6JN.js} +1 -1
  96. package/dist/chunks/{chunk-4TTXNVCE.js → chunk-OFJPOTES.js} +1 -1
  97. package/dist/chunks/chunk-OUJ63LMU.js +2 -0
  98. package/dist/chunks/{chunk-SD2XDZQW.js → chunk-P4QM63L3.js} +1 -1
  99. package/dist/chunks/chunk-PACLKDTN.js +2 -0
  100. package/dist/chunks/{chunk-VPAEFG7X.js → chunk-PAYFJHPO.js} +1 -1
  101. package/dist/chunks/{chunk-OPTJYDZN.js → chunk-PHZZBXDO.js} +1 -1
  102. package/dist/chunks/{chunk-HPTEJBP4.js → chunk-PKJHN666.js} +1 -1
  103. package/dist/chunks/{chunk-HNDAGZCF.js → chunk-PLROXHG2.js} +1 -1
  104. package/dist/chunks/{chunk-UNE52L3Y.js → chunk-PNPV2LDE.js} +1 -1
  105. package/dist/chunks/{chunk-2RSGVLZT.js → chunk-PSY6IRJE.js} +8 -8
  106. package/dist/chunks/{chunk-SVNEPXU3.js → chunk-Q73RKX7I.js} +1 -1
  107. package/dist/chunks/{chunk-IF5A3XWP.js → chunk-Q7FBVLLB.js} +1 -1
  108. package/dist/chunks/{chunk-V5AOM5MZ.js → chunk-Q7P34B2O.js} +1 -1
  109. package/dist/chunks/{chunk-375PADDM.js → chunk-QLGP2OAQ.js} +1 -1
  110. package/dist/chunks/{chunk-QQLS5FB7.js → chunk-QUNQM2E3.js} +1 -1
  111. package/dist/chunks/chunk-R2FYCJL6.js +2 -0
  112. package/dist/chunks/{chunk-6HQUIKC5.js → chunk-R4EEGWXB.js} +1 -1
  113. package/dist/chunks/chunk-R6I623SZ.js +11 -0
  114. package/dist/chunks/chunk-RCQYEHHD.js +2 -0
  115. package/dist/chunks/{chunk-26ID6A5C.js → chunk-RCRZXHAI.js} +1 -1
  116. package/dist/chunks/{chunk-TGULVWPV.js → chunk-RFQD6B44.js} +1 -1
  117. package/dist/chunks/{chunk-3WJQ4IGK.js → chunk-RPM4FDRX.js} +1 -1
  118. package/dist/chunks/{chunk-MCBRB5D6.js → chunk-RY46UPBO.js} +4 -4
  119. package/dist/chunks/{chunk-K3LS5SK7.js → chunk-SDHG6CKU.js} +1 -1
  120. package/dist/chunks/{chunk-XKZ4PFMQ.js → chunk-SO4GMSNP.js} +1 -1
  121. package/dist/chunks/{chunk-O6ZYDHEJ.js → chunk-SSHE6B7Z.js} +1 -1
  122. package/dist/chunks/{chunk-SH7POUVX.js → chunk-SV7ZBEK2.js} +6 -6
  123. package/dist/chunks/{chunk-SODAOLAP.js → chunk-TB5P3FWM.js} +1 -1
  124. package/dist/chunks/{chunk-BJXPQIVD.js → chunk-U7D6Q744.js} +1 -1
  125. package/dist/chunks/chunk-U7X5ZLAL.js +2 -0
  126. package/dist/chunks/{chunk-N54CPLVD.js → chunk-UANH7U3Y.js} +1 -1
  127. package/dist/chunks/{chunk-BUZ7CBJC.js → chunk-UGFSAG4U.js} +1 -1
  128. package/dist/chunks/chunk-ULTV6INR.js +2 -0
  129. package/dist/chunks/{chunk-V3ILZQER.js → chunk-UMAVVMXL.js} +7 -7
  130. package/dist/chunks/chunk-V24VHT76.js +2 -0
  131. package/dist/chunks/chunk-VEBW7NKD.js +2 -0
  132. package/dist/chunks/chunk-VJR2GNRY.js +2 -0
  133. package/dist/chunks/{chunk-JD76ANPN.js → chunk-VJYOKU3C.js} +1 -1
  134. package/dist/chunks/{chunk-H2XG5N7D.js → chunk-VWWKWYSQ.js} +1 -1
  135. package/dist/chunks/chunk-WCNPGKST.js +2 -0
  136. package/dist/chunks/chunk-WD4KAKEX.js +2 -0
  137. package/dist/chunks/chunk-WGQ3FMRF.js +2 -0
  138. package/dist/chunks/{chunk-6C3CXME7.js → chunk-WNXUSELC.js} +1 -1
  139. package/dist/chunks/{chunk-RS526BG7.js → chunk-WZ35ICTE.js} +3 -3
  140. package/dist/chunks/chunk-XHACK2KR.js +2 -0
  141. package/dist/chunks/chunk-XOPHFUUY.js +2 -0
  142. package/dist/chunks/{chunk-ZVMQLIRA.js → chunk-XT4CSKHM.js} +1 -1
  143. package/dist/chunks/{chunk-KQD36SBJ.js → chunk-XY7HFXLH.js} +1 -1
  144. package/dist/chunks/{chunk-UXO33ST5.js → chunk-XYZV3FKD.js} +1 -1
  145. package/dist/chunks/{chunk-GC6RJBRZ.js → chunk-Y2WNZWT2.js} +1 -1
  146. package/dist/chunks/chunk-Y4I6CFZJ.js +2 -0
  147. package/dist/chunks/chunk-YDZBX4XQ.js +2 -0
  148. package/dist/chunks/chunk-YI6ME6PU.js +22 -0
  149. package/dist/chunks/{chunk-H42UW6IF.js → chunk-YXMYK5P7.js} +1 -1
  150. package/dist/chunks/{chunk-QFL2VQKX.js → chunk-Z33RVGP6.js} +1 -1
  151. package/dist/chunks/chunk-Z5CQXPIS.js +6 -0
  152. package/dist/chunks/{chunk-OY4B7Y3T.js → chunk-ZDEIVUUI.js} +1 -1
  153. package/dist/chunks/{chunk-XGJG2ZKE.js → chunk-ZIQJDTQB.js} +1 -1
  154. package/dist/chunks/{chunk-IR2Y2VQY.js → chunk-ZYLLPRPU.js} +1 -1
  155. package/dist/chunks/cli-R7TAP6Z2.js +2 -0
  156. package/dist/chunks/{command-NWOZXU57.js → command-LNOVZQSK.js} +3 -3
  157. package/dist/chunks/{configuration-command-ZEIBQKB3.js → configuration-command-C3QBDFND.js} +1 -1
  158. package/dist/chunks/connected-app-executor-LAEAQUJS.js +2 -0
  159. package/dist/chunks/connected-evidence-VKY6O2JW.js +2 -0
  160. package/dist/chunks/{connected-starting-assets-66Y46ZPM.js → connected-starting-assets-5LAJ7CZY.js} +1 -1
  161. package/dist/chunks/{connection-GDWPMHPC.js → connection-VMBXW5PD.js} +1 -1
  162. package/dist/chunks/{continual-TNPTWTKK.js → continual-FVOLGGOE.js} +1 -1
  163. package/dist/chunks/core-commands-5TNBVR72.js +2 -0
  164. package/dist/chunks/dataset-preparation-authoring-UUYFWWCT.js +4 -0
  165. package/dist/chunks/datasets-BIDZJYDC.js +2 -0
  166. package/dist/chunks/desktop-test-BY2MS3UL.js +3 -0
  167. package/dist/chunks/dist-2MKJC6HN.js +2 -0
  168. package/dist/chunks/{dist-GR56E3QK.js → dist-DKE7RJZN.js} +1 -1
  169. package/dist/chunks/evaluation-coordination-FXB4DXZA.js +2 -0
  170. package/dist/chunks/experiment-improvements-JPDLKZXD.js +2 -0
  171. package/dist/chunks/experiments-IEN7RXLX.js +2 -0
  172. package/dist/chunks/experiments-signal-L32D36NH.js +2 -0
  173. package/dist/chunks/{extension-UH34ZF7N.js → extension-3EKIT6BB.js} +1 -1
  174. package/dist/chunks/{help-O53DTZGN.js → help-PLQJOP4P.js} +1 -1
  175. package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +2 -0
  176. package/dist/chunks/host-profile-external-dataset-KSEPXY2S.js +2 -0
  177. package/dist/chunks/hosted-app-server-composition-GZES7QXJ.js +2 -0
  178. package/dist/chunks/hosted-experiment-improvement-VG2WE7XZ.js +3 -0
  179. package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +2 -0
  180. package/dist/chunks/hosted-profile-candidate-PTGQLPZO.js +3 -0
  181. package/dist/chunks/hosted-profile-compiler-FS5R6CHJ.js +2 -0
  182. package/dist/chunks/hosted-profile-evaluation-control-UUEZEMXU.js +2 -0
  183. package/dist/chunks/hosted-profile-evaluation-inspection-4F7OEF4T.js +3 -0
  184. package/dist/chunks/hosted-profile-evaluation-preparation-LIJJZDHQ.js +3 -0
  185. package/dist/chunks/hosted-tasksets-V24IBVJX.js +2 -0
  186. package/dist/chunks/human-review-6V6EMNVN.js +2 -0
  187. package/dist/chunks/{import-OBAKUJPM.js → import-SI24Z7EF.js} +2 -2
  188. package/dist/chunks/{learning-CRR6NRPN.js → learning-LAXMGWSQ.js} +1 -1
  189. package/dist/chunks/learning-Y3UKNUGE.js +2 -0
  190. package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +2 -0
  191. package/dist/chunks/local-harness-taskset-review-XQHQ6JCR.js +2 -0
  192. package/dist/chunks/{model-projects-HP4DELCP.js → model-projects-6YWVD2TS.js} +1 -1
  193. package/dist/chunks/opchat-SV67HVMX.js +3 -0
  194. package/dist/chunks/opchat-bounded-chat-KLMIYSZZ.js +2 -0
  195. package/dist/chunks/organizations-OZZFX7RG.js +2 -0
  196. package/dist/chunks/{profile-3WZJ65CT.js → profile-TD5U3INY.js} +1 -1
  197. package/dist/chunks/project-action-payload-TK6G4VMC.js +2 -0
  198. package/dist/chunks/project-agent-FFXPNXCO.js +2 -0
  199. package/dist/chunks/published-experiment-source-SDXUVPE7.js +2 -0
  200. package/dist/chunks/refiner-profile-service-56VYLZQJ.js +2 -0
  201. package/dist/chunks/{runtime-XP4DEGR3.js → runtime-Q7JUJO4D.js} +2 -2
  202. package/dist/chunks/sandbox-command-4BCUDAED.js +2 -0
  203. package/dist/chunks/{sandbox-template-YFMHEMUQ.js → sandbox-template-GOY7QQUY.js} +1 -1
  204. package/dist/chunks/saved-work-M6PUHKCC.js +2 -0
  205. package/dist/chunks/{send-turn-D3GTSSHI.js → send-turn-YLY3YNEQ.js} +1 -1
  206. package/dist/chunks/setup-RMZ2BHLM.js +2 -0
  207. package/dist/chunks/{src-GQPWOPYA.js → src-C3ZUESMK.js} +1 -1
  208. package/dist/chunks/src-MT4B43TD.js +424 -0
  209. package/dist/chunks/standalone-experiment-turn-owner-TW5MTWIO.js +2 -0
  210. package/dist/chunks/store-chat-resources-IRHBW2EC.js +2 -0
  211. package/dist/chunks/{store-continual-support-reviews-VVRQO2JK.js → store-continual-support-reviews-3KK42L4I.js} +1 -1
  212. package/dist/chunks/store-conversation-serving-IVURK52V.js +2 -0
  213. package/dist/chunks/{store-create-improve-2XI36AET.js → store-create-improve-UTCLBXF2.js} +1 -1
  214. package/dist/chunks/{store-datasets-UFY422NG.js → store-datasets-4AQOVAQY.js} +1 -1
  215. package/dist/chunks/store-evaluation-results-PK2P3IMH.js +7 -0
  216. package/dist/chunks/{store-harness-workspaces-SGUEYDO2.js → store-harness-workspaces-YEXB4IRV.js} +1 -1
  217. package/dist/chunks/store-human-review-O4BVHP25.js +7 -0
  218. package/dist/chunks/store-learned-preference-migration-validation-44SVX6YB.js +2 -0
  219. package/dist/chunks/{store-learning-BFOT4QVT.js → store-learning-SIUQIY5C.js} +1 -1
  220. package/dist/chunks/{store-learning-credentials-DYTMWQTC.js → store-learning-credentials-BUHR7SN6.js} +1 -1
  221. package/dist/chunks/store-local-experiments-BHVTKPPE.js +97 -0
  222. package/dist/chunks/store-model-batch-review-RVAYUVK2.js +2 -0
  223. package/dist/chunks/{store-model-configuration-NJFWSYSA.js → store-model-configuration-6L3OYXF4.js} +1 -1
  224. package/dist/chunks/store-model-project-preparation-AAEKCF6V.js +2 -0
  225. package/dist/chunks/store-modification-recordings-LCPK6K2T.js +9 -0
  226. package/dist/chunks/{store-preference-comparison-MZAYONCK.js → store-preference-comparison-5YVIQNVB.js} +1 -1
  227. package/dist/chunks/{store-sidebar-file-bookmarks-J3JEVAYR.js → store-sidebar-file-bookmarks-WLMYDA4E.js} +1 -1
  228. package/dist/chunks/{store-sidebar-preferences-2JHTFXJK.js → store-sidebar-preferences-AFMYIDWT.js} +1 -1
  229. package/dist/chunks/{store-subagents-PUBQVWSU.js → store-subagents-KFPVSTRO.js} +1 -1
  230. package/dist/chunks/{store-task-inbox-3BREANOX.js → store-task-inbox-L6IQTY26.js} +1 -1
  231. package/dist/chunks/{store-task-inventory-5HRZCDUT.js → store-task-inventory-QWS2C656.js} +1 -1
  232. package/dist/chunks/store-taskset-drafts-FRFL6ITK.js +9 -0
  233. package/dist/chunks/{store-training-S3FXWLT6.js → store-training-FYXZU2FE.js} +1 -1
  234. package/dist/chunks/{store-training-jobs-2LCXPA7G.js → store-training-jobs-3N3VKPIY.js} +1 -1
  235. package/dist/chunks/{store-training-models-7AMKS7ZW.js → store-training-models-VOFVGPZR.js} +1 -1
  236. package/dist/chunks/{taskset-PLKWRT4X.js → taskset-UDDLFYKV.js} +1 -1
  237. package/dist/chunks/taskset-catalog-RZYEBCRQ.js +2 -0
  238. package/dist/chunks/taskset-packages-T6B6HYKZ.js +2 -0
  239. package/dist/chunks/taskset-packages-WMG5DUBN.js +2 -0
  240. package/dist/chunks/{teams-bot-VQXUA7U4.js → teams-bot-YCUTDDDC.js} +1 -1
  241. package/dist/chunks/tool-learning-ZQ6NSJ5K.js +2 -0
  242. package/dist/chunks/training-5NT2YB2L.js +2 -0
  243. package/dist/chunks/training-5UMT45UL.js +2 -0
  244. package/dist/chunks/training-UY6KRG4M.js +2 -0
  245. package/dist/chunks/{training-error-LQKCOQDJ.js → training-error-WF463UNZ.js} +1 -1
  246. package/dist/chunks/{training-hardware-ESXRWUIK.js → training-hardware-UWQCRDMV.js} +1 -1
  247. package/dist/chunks/training-hosted-CKSDRVL6.js +2 -0
  248. package/dist/chunks/training-hosted-alphaedit-HSMRDJTD.js +2 -0
  249. package/dist/chunks/training-hosted-decision-7JALOU6O.js +2 -0
  250. package/dist/chunks/training-hosted-engram-SXO75MFG.js +2 -0
  251. package/dist/chunks/{training-hosted-learning-WQ2IP5FP.js → training-hosted-learning-E2N32YU5.js} +1 -1
  252. package/dist/chunks/training-hosted-modification-comparison-TXFDJFTG.js +2 -0
  253. package/dist/chunks/training-hosted-neuron-training-J42WK4EH.js +2 -0
  254. package/dist/chunks/training-hosted-serving-report-BAEABGJH.js +2 -0
  255. package/dist/chunks/training-hosted-steering-T556BUBG.js +2 -0
  256. package/dist/chunks/training-model-start-P3PXDWNT.js +2 -0
  257. package/dist/chunks/web-search-ZEKJHZW4.js +2 -0
  258. package/dist/chunks/{workspaces-MCS2AQX6.js → workspaces-EK62ANTB.js} +1 -1
  259. package/dist/cli.js +1 -1
  260. package/dist/index.js +1 -1
  261. package/dist/sandbox/runtime-handle.d.ts +3 -5
  262. package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
  263. package/dist/sandbox/types/billing.d.ts +140 -6
  264. package/dist/sandbox/types/io.d.ts +3 -0
  265. package/dist/sandbox/types/responses.d.ts +11 -1
  266. package/dist/sandbox/types/snapshots.d.ts +52 -3
  267. package/dist/sandbox-template/manifest.js +1 -1
  268. package/dist/skills/manifest.json +3 -3
  269. package/dist/skills/openpond-cli/references/experiments-and-training.md +461 -1
  270. package/dist/web/assets/App-CCuh99JW.js +54 -0
  271. package/dist/web/assets/{AppDialog-BvskhHE9.js → AppDialog-CxjDHVk9.js} +1 -1
  272. package/dist/web/assets/AppTerminalPanel-CKJIVpKa.js +2 -0
  273. package/dist/web/assets/{AppToastContext-D2788RqX.js → AppToastContext-EpiT1dHs.js} +1 -1
  274. package/dist/web/assets/AppsView-BsMyPX_3.js +1 -0
  275. package/dist/web/assets/{AttachmentTypeIcon-DVluUHuc.js → AttachmentTypeIcon-BXvZy5gB.js} +1 -1
  276. package/dist/web/assets/BrowserSidebar-BIIV4aq4.js +1 -0
  277. package/dist/web/assets/{CartesianChart-DdBZ69lI.js → CartesianChart-brqLBqnF.js} +1 -1
  278. package/dist/web/assets/ChatTimelineEntry-CwZbn16X.js +8 -0
  279. package/dist/web/assets/{CollaborationTabs-ba6WupeJ.js → CollaborationTabs-BU4uc4tZ.js} +1 -1
  280. package/dist/web/assets/{CommandMenu-D7wTaEgl.js → CommandMenu-DkWpXR55.js} +1 -1
  281. package/dist/web/assets/CommunityView-CsSxJZGn.js +1 -0
  282. package/dist/web/assets/{ComposerAttachments-aO90qXYz.js → ComposerAttachments-BdJGCYzI.js} +1 -1
  283. package/dist/web/assets/{ComposerCreateImproveStrip-BPUJBSyS.js → ComposerCreateImproveStrip-CWy0j1vv.js} +1 -1
  284. package/dist/web/assets/{ConversationImportsSettings-Bo836wKJ.js → ConversationImportsSettings-DCmiakbZ.js} +1 -1
  285. package/dist/web/assets/DatasetReviewImport-DEnF_pGu.js +1 -0
  286. package/dist/web/assets/ExperimentTrainingDataWorkspace-WhwQ0QBi.js +2 -0
  287. package/dist/web/assets/{FilePagePreview-C6wIp6uX.js → FilePagePreview-BRhhz99q.js} +2 -2
  288. package/dist/web/assets/{GetStartedView-CxMv8q-h.js → GetStartedView-CLVD-qEi.js} +1 -1
  289. package/dist/web/assets/{GettingStartedDialog-CEb0cS-o.js → GettingStartedDialog-CMxaAMg-.js} +1 -1
  290. package/dist/web/assets/HostedModelLearningReview-Cn-j-rDo.js +1 -0
  291. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +1 -0
  292. package/dist/web/assets/{HtmlVisual-CCuUkYT8.js → HtmlVisual-D5y2WG9L.js} +10 -10
  293. package/dist/web/assets/LabModelVersionDetailPage-BxRmYD6h.js +1 -0
  294. package/dist/web/assets/{TrainingRunLineage-PXzWR65d.css → LabModelWorkspace-DOrgCk9Z.css} +1 -1
  295. package/dist/web/assets/LabModelWorkspace-u2Ulm_z4.js +1 -0
  296. package/dist/web/assets/{LabSkillSidebar-CFROlATQ.js → LabSkillSidebar-C7IceJTJ.js} +1 -1
  297. package/dist/web/assets/LabsRoute-C9Y0GU34.css +1 -0
  298. package/dist/web/assets/LabsRoute-CbztQaEf.js +74 -0
  299. package/dist/web/assets/LearningBatchesPage-B1NZTBSv.css +1 -0
  300. package/dist/web/assets/LearningBatchesPage-CJqgZNvM.js +26 -0
  301. package/dist/web/assets/MainChatThread-DNMfrrRq.js +2 -0
  302. package/dist/web/assets/{MainPane-BOWkynGB.css → MainPane-BZlNLfTM.css} +1 -1
  303. package/dist/web/assets/MainPane-CQQxSDPS.js +13 -0
  304. package/dist/web/assets/ModelProjectPageHeader-Dge19aE1.js +1 -0
  305. package/dist/web/assets/NativeSetupTerminal-D4JnbpyD.js +2 -0
  306. package/dist/web/assets/{NativeSkillSidebar-MAJWS4mL.js → NativeSkillSidebar-Jzx1BeKV.js} +1 -1
  307. package/dist/web/assets/{NewProjectDialog-MQiUBVx3.js → NewProjectDialog-DcnGzEd9.js} +1 -1
  308. package/dist/web/assets/{OutputsPage-DpF-aRTu.js → OutputsPage-Cmk15Vt_.js} +1 -1
  309. package/dist/web/assets/{PageChrome-8gH2hyDb.js → PageChrome-Cz_fCqtn.js} +1 -1
  310. package/dist/web/assets/{ProjectsPage-BQ98oGyu.js → ProjectsPage-BZ3Eo3Mz.js} +1 -1
  311. package/dist/web/assets/RightChatPanelStack-C6H2vU9N.js +1 -0
  312. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +1 -0
  313. package/dist/web/assets/{ScheduledWorkPage-CGCqZz_H.js → ScheduledWorkPage-CAkSwM0T.js} +1 -1
  314. package/dist/web/assets/{SettingsView-CqpMFLxy.js → SettingsView-DvQXGw3_.js} +3 -3
  315. package/dist/web/assets/{TasksetDraftEditorPrimitives-DJvIvzBb.js → TasksetDraftEditorPrimitives-JuU1k8vr.js} +1 -1
  316. package/dist/web/assets/TeamChatView-DmHjr8W9.js +1 -0
  317. package/dist/web/assets/{TerminalOverlay-D--M876l.js → TerminalOverlay-DlaM9d8F.js} +1 -1
  318. package/dist/web/assets/{TrainingCreationPanel-DDUoHQHU.js → TrainingCreationPanel-ClpylNsr.js} +1 -1
  319. package/dist/web/assets/{TrainingDraftPanel-CwLXn3Z7.js → TrainingDraftPanel-6tH2xSDj.js} +1 -1
  320. package/dist/web/assets/{UsageSettingsSection-CGwPregx.js → UsageSettingsSection-CzDqxOYM.js} +2 -2
  321. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +1 -0
  322. package/dist/web/assets/WorkspaceDiffPanel-B4e0lyF7.js +11 -0
  323. package/dist/web/assets/WorkspaceEnvironmentMenu-D01ZkZZF.js +35 -0
  324. package/dist/web/assets/{WorkspaceFileLocation-D-ctFM4d.js → WorkspaceFileLocation-C5s_njZb.js} +1 -1
  325. package/dist/web/assets/{WorkspaceGitDialogs-CQ28j3R7.js → WorkspaceGitDialogs-DjPZ6KIh.js} +1 -1
  326. package/dist/web/assets/{WorkspaceMonacoEditor-BrZs6-EW.js → WorkspaceMonacoEditor-CC4sfOiU.js} +3 -3
  327. package/dist/web/assets/{WorkspacePdfPreview-CU6PSjjN.js → WorkspacePdfPreview-vszQqFa4.js} +2 -2
  328. package/dist/web/assets/{WorkspacePresentationPreview-IjXVXpIy.js → WorkspacePresentationPreview-DQTvhaRD.js} +1 -1
  329. package/dist/web/assets/api-client-DJRVOFzS.js +1 -0
  330. package/dist/web/assets/{app-models-CKXrDTEU.js → app-models-BUdzQbXo.js} +1 -1
  331. package/dist/web/assets/bot-Doyx3T4j.js +1 -0
  332. package/dist/web/assets/{browser-sidebar-links-D9v2cyJa.js → browser-sidebar-links-PVPCrsDJ.js} +1 -1
  333. package/dist/web/assets/chat-resources-Beh5lB36.js +1 -0
  334. package/dist/web/assets/chevron-down-DX1hzujj.js +1 -0
  335. package/dist/web/assets/chevron-right-DHN0y3KC.js +1 -0
  336. package/dist/web/assets/chevron-up-_QrW88NF.js +1 -0
  337. package/dist/web/assets/{chunk-TLSP5JKG-BrrVo5rJ.js → chunk-3BYFS4RO-ztZjcMmt.js} +1 -1
  338. package/dist/web/assets/chunk-AG6UJ3DI-D9KZjTYP.js +1 -0
  339. package/dist/web/assets/chunk-C3TS766N-ppRhs95p.js +1 -0
  340. package/dist/web/assets/chunk-GCUWJUUM-Dy6oUNJ6.js +9 -0
  341. package/dist/web/assets/chunk-GS5HEE4M-C0RLeIsy.js +1 -0
  342. package/dist/web/assets/{chunk-H3JZ3P5T-CzpTARDY.js → chunk-H3JZ3P5T-DolwEJXo.js} +2 -2
  343. package/dist/web/assets/chunk-Q4RGCEOI-Cr-dg4Nk.js +1 -0
  344. package/dist/web/assets/client-DwZ92xtu.js +1 -0
  345. package/dist/web/assets/{client-choice-storage-DUWsS4X0.js → client-choice-storage-DitqKiIT.js} +1 -1
  346. package/dist/web/assets/cloud-upload-HdzNTgr2.js +1 -0
  347. package/dist/web/assets/common-BWVSBnpX.js +1 -0
  348. package/dist/web/assets/copy-DTQhoBNg.js +1 -0
  349. package/dist/web/assets/create-pipeline-DsZzNkt9.js +1 -0
  350. package/dist/web/assets/{cssMode-SclUkqPt.js → cssMode-BRTtfXxU.js} +1 -1
  351. package/dist/web/assets/dataset-workspaces-BTPi71mz.js +1 -0
  352. package/dist/web/assets/external-link-H1629UU6.js +1 -0
  353. package/dist/web/assets/folder-open-CAGdWOrr.js +1 -0
  354. package/dist/web/assets/folder-plus-C14cs2mE.js +1 -0
  355. package/dist/web/assets/git-commit-horizontal-DFUfuVvF.js +1 -0
  356. package/dist/web/assets/{htmlMode-X3mQtOeh.js → htmlMode-BVaCcL76.js} +1 -1
  357. package/dist/web/assets/icons-Bk2b68aC.js +1 -0
  358. package/dist/web/assets/image-0DPVY6Ev.js +1 -0
  359. package/dist/web/assets/{index-LXNhSUEL.js → index-B6XX_0h3.js} +2 -2
  360. package/dist/web/assets/info-C8b_tafZ.js +1 -0
  361. package/dist/web/assets/{intake-contracts-wCkD2ErR.js → intake-contracts-B8JZKYwb.js} +1 -1
  362. package/dist/web/assets/{jsonMode-BoKiIdHd.js → jsonMode-BCKKQmmV.js} +1 -1
  363. package/dist/web/assets/loader-circle-y-SSPwpk.js +1 -0
  364. package/dist/web/assets/{lspLanguageFeatures-CO2mzpy1.js → lspLanguageFeatures-DozmNUOx.js} +1 -1
  365. package/dist/web/assets/maximize-2-CByk9-zN.js +1 -0
  366. package/dist/web/assets/message-square-C889vRqm.js +1 -0
  367. package/dist/web/assets/{monaco.contribution-wacA5FjV.js → monaco.contribution-B9q6qbbo.js} +2 -2
  368. package/dist/web/assets/{monaco.contribution-CVe3mWSY.js → monaco.contribution-BITdsRbn.js} +2 -2
  369. package/dist/web/assets/{monaco.contribution-hrusiaZi.js → monaco.contribution-BqA-XZ44.js} +2 -2
  370. package/dist/web/assets/{monaco.contribution-C7CAQIKF.js → monaco.contribution-DxAV1oS5.js} +2 -2
  371. package/dist/web/assets/monitor-BtxlcLuI.js +1 -0
  372. package/dist/web/assets/paperclip-BeIdaspf.js +1 -0
  373. package/dist/web/assets/{pdf-Ct3M2mVw.js → pdf-perlzwEB.js} +1 -1
  374. package/dist/web/assets/play-CHXXdkuO.js +1 -0
  375. package/dist/web/assets/plus-DFFWjhPw.js +1 -0
  376. package/dist/web/assets/{ponder-desktop-D-zB6X4L.js → ponder-desktop-Ca-9KggQ.js} +1 -1
  377. package/dist/web/assets/presentation-0bzvu6_u.js +1 -0
  378. package/dist/web/assets/{profile-ref-CCxrOCio.js → profile-ref-D8lxL7dW.js} +1 -1
  379. package/dist/web/assets/{python-C0-pUUAU.js → python-B9hOnkOI.js} +1 -1
  380. package/dist/web/assets/refresh-cw-D61-Ozk3.js +1 -0
  381. package/dist/web/assets/{requests-DjSt-duM.js → requests-DmeUYik4.js} +1 -1
  382. package/dist/web/assets/reward-checks-DJJZYgf8.js +7 -0
  383. package/dist/web/assets/save-iEMNZoPe.js +1 -0
  384. package/dist/web/assets/schemas-Brv9Vmnk.js +64 -0
  385. package/dist/web/assets/settings-BC-bzgk6.js +21 -0
  386. package/dist/web/assets/settings-lists-C84qxFmP.js +5 -0
  387. package/dist/web/assets/square-BE_4JMR3.js +1 -0
  388. package/dist/web/assets/square-terminal-Djpzo2Qs.js +1 -0
  389. package/dist/web/assets/{submit-issue-command-Gk3RKrY-.js → submit-issue-command-HfKzyxg5.js} +1 -1
  390. package/dist/web/assets/{toggleHighContrast-BnYUBgZB.js → toggleHighContrast-ClsXu39R.js} +1 -1
  391. package/dist/web/assets/training-DWfghwfZ.js +1 -0
  392. package/dist/web/assets/{training-model-data-CxR3xpmK.js → training-model-data-CIysl8wH.js} +4 -4
  393. package/dist/web/assets/{tsMode-BVNyOY8h.js → tsMode-nbmaMc-D.js} +1 -1
  394. package/dist/web/assets/upload-C6ug8RD-.js +1 -0
  395. package/dist/web/assets/{useAccountSettings-4_XfwJQi.js → useAccountSettings-Dr9h4Qz_.js} +1 -1
  396. package/dist/web/assets/{useAgentInventory-CVuamyT3.js → useAgentInventory-ByCk2JAv.js} +1 -1
  397. package/dist/web/assets/useChatContextSelection-C0eMm2g6.js +1 -0
  398. package/dist/web/assets/{useLocalAgentSchedules-CmwN4ohy.js → useLocalAgentSchedules-Do0y_leJ.js} +1 -1
  399. package/dist/web/assets/useQuery-D2MQ7e5U.js +1 -0
  400. package/dist/web/assets/wifi-off-Dr-CapyW.js +1 -0
  401. package/dist/web/assets/work-outputs-D_8TovAK.js +1 -0
  402. package/dist/web/assets/{workers-CjtQ2aBD.js → workers-DKvM2NdM.js} +1 -1
  403. package/dist/web/assets/x-Jx2jlP9u.js +1 -0
  404. package/dist/web/assets/{yaml-N1KUjBZ8.js → yaml-C02vq4ar.js} +1 -1
  405. package/dist/web/index.html +1 -1
  406. package/docs/command-reference.md +104 -3
  407. package/package.json +1 -1
  408. package/dist/chunks/account-context-TIJOM22A.js +0 -12
  409. package/dist/chunks/actions-command-BYPLSGZL.js +0 -2
  410. package/dist/chunks/app-server-evaluations-5YZUFXQ2.js +0 -2
  411. package/dist/chunks/app-server-harness-services-N5F5QVZI.js +0 -2
  412. package/dist/chunks/app-server-runtime-HJ2N57DL.js +0 -2
  413. package/dist/chunks/apps-WJTW64NW.js +0 -2
  414. package/dist/chunks/chunk-263WS3TB.js +0 -2
  415. package/dist/chunks/chunk-27JGS3KB.js +0 -12
  416. package/dist/chunks/chunk-2UZHLO2V.js +0 -23
  417. package/dist/chunks/chunk-2W22IXHB.js +0 -2
  418. package/dist/chunks/chunk-46RMTR2Z.js +0 -2
  419. package/dist/chunks/chunk-4JJ4RYIB.js +0 -6
  420. package/dist/chunks/chunk-4NN5OLKW.js +0 -161
  421. package/dist/chunks/chunk-543QHE3D.js +0 -2
  422. package/dist/chunks/chunk-5QOFUGYQ.js +0 -2
  423. package/dist/chunks/chunk-5ZNE43XC.js +0 -10
  424. package/dist/chunks/chunk-6IS5OLI5.js +0 -2
  425. package/dist/chunks/chunk-7HAGSE7L.js +0 -2
  426. package/dist/chunks/chunk-AXYAEWWA.js +0 -2
  427. package/dist/chunks/chunk-B7XJBP4U.js +0 -2
  428. package/dist/chunks/chunk-BBIA24GD.js +0 -10
  429. package/dist/chunks/chunk-CJDGLPNX.js +0 -4
  430. package/dist/chunks/chunk-DAEUVT2I.js +0 -6
  431. package/dist/chunks/chunk-FCXDPVGJ.js +0 -3
  432. package/dist/chunks/chunk-FE2ENE3U.js +0 -2
  433. package/dist/chunks/chunk-H6EUFJJK.js +0 -2
  434. package/dist/chunks/chunk-IOSBGCRT.js +0 -2
  435. package/dist/chunks/chunk-IXZ5ZGIL.js +0 -12
  436. package/dist/chunks/chunk-K6DB5QWG.js +0 -2
  437. package/dist/chunks/chunk-LI56PPCN.js +0 -2
  438. package/dist/chunks/chunk-OE2OOWEQ.js +0 -2
  439. package/dist/chunks/chunk-OYIFH2OM.js +0 -2
  440. package/dist/chunks/chunk-QOUOU7FE.js +0 -22
  441. package/dist/chunks/chunk-R5GRESW3.js +0 -2
  442. package/dist/chunks/chunk-TERKCK4I.js +0 -2
  443. package/dist/chunks/chunk-TS5HNRZB.js +0 -2
  444. package/dist/chunks/chunk-V3KEG6MI.js +0 -2
  445. package/dist/chunks/chunk-WGISITX6.js +0 -4
  446. package/dist/chunks/chunk-XD4ZIQZ2.js +0 -2
  447. package/dist/chunks/chunk-XHU4BZQY.js +0 -13
  448. package/dist/chunks/chunk-ZWEY66RT.js +0 -2
  449. package/dist/chunks/cli-HV32F7HD.js +0 -2
  450. package/dist/chunks/connected-app-executor-DFHWNMRM.js +0 -2
  451. package/dist/chunks/connected-evidence-WOM6N5HO.js +0 -2
  452. package/dist/chunks/core-commands-GWRHH53F.js +0 -2
  453. package/dist/chunks/dataset-preparation-authoring-WJ2XEUO7.js +0 -4
  454. package/dist/chunks/datasets-XIMF54QN.js +0 -2
  455. package/dist/chunks/desktop-test-HF42V2EP.js +0 -3
  456. package/dist/chunks/dist-T6ES2TSM.js +0 -2
  457. package/dist/chunks/evaluation-coordination-WZT6FDMS.js +0 -2
  458. package/dist/chunks/experiment-improvements-H35VS6XZ.js +0 -2
  459. package/dist/chunks/experiments-F54C32EE.js +0 -2
  460. package/dist/chunks/experiments-signal-ONIGTGYR.js +0 -2
  461. package/dist/chunks/host-profile-evaluation-tools-LMCJ3MDJ.js +0 -2
  462. package/dist/chunks/host-profile-external-dataset-4HOXANWK.js +0 -2
  463. package/dist/chunks/hosted-app-server-composition-Y64A2A2B.js +0 -2
  464. package/dist/chunks/hosted-experiment-improvement-B2V2WIUI.js +0 -3
  465. package/dist/chunks/hosted-harness-runtime-C7I4KSDK.js +0 -2
  466. package/dist/chunks/hosted-profile-candidate-CXPVEEYQ.js +0 -3
  467. package/dist/chunks/hosted-profile-compiler-FGCI2VRW.js +0 -2
  468. package/dist/chunks/hosted-profile-evaluation-control-INNUYMBD.js +0 -2
  469. package/dist/chunks/hosted-profile-evaluation-inspection-UPTBRYMS.js +0 -3
  470. package/dist/chunks/hosted-profile-evaluation-preparation-TIQSVKLQ.js +0 -3
  471. package/dist/chunks/hosted-tasksets-7VMYOTIO.js +0 -2
  472. package/dist/chunks/human-review-7XC77NQP.js +0 -2
  473. package/dist/chunks/learning-3XDGIYUL.js +0 -2
  474. package/dist/chunks/local-harness-improvement-runtime-UIKQSAMM.js +0 -2
  475. package/dist/chunks/local-harness-taskset-review-6KJN3EQL.js +0 -2
  476. package/dist/chunks/opchat-NWYWWIA7.js +0 -3
  477. package/dist/chunks/opchat-bounded-chat-ICURZM6R.js +0 -2
  478. package/dist/chunks/organizations-7DBQGCCV.js +0 -2
  479. package/dist/chunks/project-action-payload-7DRABTHY.js +0 -2
  480. package/dist/chunks/project-agent-AXJOWXRU.js +0 -2
  481. package/dist/chunks/published-experiment-source-YBBPLNF2.js +0 -2
  482. package/dist/chunks/refiner-profile-service-ATEFPF5O.js +0 -2
  483. package/dist/chunks/sandbox-command-CF2PJCFX.js +0 -2
  484. package/dist/chunks/saved-work-3OAVRBH3.js +0 -2
  485. package/dist/chunks/setup-RHIMFI2Y.js +0 -2
  486. package/dist/chunks/src-V236S6MV.js +0 -424
  487. package/dist/chunks/standalone-experiment-turn-owner-CDRMGLWW.js +0 -2
  488. package/dist/chunks/store-chat-resources-P4EKCLSY.js +0 -2
  489. package/dist/chunks/store-conversation-serving-YFEZYQD3.js +0 -2
  490. package/dist/chunks/store-evaluation-results-VBH4R2U7.js +0 -7
  491. package/dist/chunks/store-human-review-RFCVZ3HP.js +0 -7
  492. package/dist/chunks/store-learned-preference-migration-validation-FNBGGZU6.js +0 -2
  493. package/dist/chunks/store-local-experiments-XPXGYXNM.js +0 -97
  494. package/dist/chunks/store-model-batch-review-J2L5JQV2.js +0 -2
  495. package/dist/chunks/store-model-project-preparation-OCLIFKI2.js +0 -2
  496. package/dist/chunks/store-taskset-drafts-BNKUVHPA.js +0 -9
  497. package/dist/chunks/taskset-packages-SXBLYHSP.js +0 -2
  498. package/dist/chunks/taskset-packages-V5T4V7YN.js +0 -2
  499. package/dist/chunks/tool-learning-47XQKELE.js +0 -2
  500. package/dist/chunks/training-7VQNCOGH.js +0 -2
  501. package/dist/chunks/training-VKLPNCMC.js +0 -2
  502. package/dist/chunks/training-hosted-NNE6BP6S.js +0 -2
  503. package/dist/chunks/training-hosted-serving-report-VZ4SMLMG.js +0 -2
  504. package/dist/chunks/training-model-start-G7YDZ7ZG.js +0 -2
  505. package/dist/chunks/web-search-56QRZGPR.js +0 -2
  506. package/dist/web/assets/App-DmEA-Lia.js +0 -53
  507. package/dist/web/assets/AppTerminalPanel-ScQKJV4z.js +0 -2
  508. package/dist/web/assets/AppsView-B1uNg9IQ.js +0 -1
  509. package/dist/web/assets/BrowserSidebar-DfVQoJHn.js +0 -1
  510. package/dist/web/assets/ChatTimelineEntry-Bbc6HRks.js +0 -8
  511. package/dist/web/assets/CommunityView-mO58f2B0.js +0 -1
  512. package/dist/web/assets/HostedModelLearningReview-BQIS7hkd.js +0 -1
  513. package/dist/web/assets/HostedModelLearningSettings-BQ-YeFMT.js +0 -1
  514. package/dist/web/assets/LabModelVersionDetailPage-BkHeVbAx.js +0 -1
  515. package/dist/web/assets/LabsRoute-CE45yAXJ.css +0 -1
  516. package/dist/web/assets/LabsRoute-YA9YckKj.js +0 -101
  517. package/dist/web/assets/MainChatThread-DpyPgGKW.js +0 -2
  518. package/dist/web/assets/MainPane-WOeodByM.js +0 -10
  519. package/dist/web/assets/NativeSetupTerminal-fmG2c65K.js +0 -2
  520. package/dist/web/assets/RightChatPanelStack-Bs7A4dLs.js +0 -1
  521. package/dist/web/assets/RightSidebarHomePanel-C-D4kba2.js +0 -1
  522. package/dist/web/assets/TeamChatView-DjmIaLO1.js +0 -1
  523. package/dist/web/assets/TrainingRunLineage-CtYe1KGX.js +0 -1
  524. package/dist/web/assets/WorkSidebarPanel-C6wWuo7U.js +0 -1
  525. package/dist/web/assets/WorkspaceDiffPanel-JDOUmrC-.js +0 -11
  526. package/dist/web/assets/WorkspaceEnvironmentMenu-sfL5LZeB.js +0 -35
  527. package/dist/web/assets/api-client-Dgz-fOMl.js +0 -1
  528. package/dist/web/assets/bot-Cd761lRF.js +0 -1
  529. package/dist/web/assets/chat-resources-BUDXdoG0.js +0 -1
  530. package/dist/web/assets/chevron-down-DEbd6Ek-.js +0 -1
  531. package/dist/web/assets/chevron-right-DLYNg_Oq.js +0 -1
  532. package/dist/web/assets/chevron-up-DFJJccDl.js +0 -1
  533. package/dist/web/assets/chunk-GHPCQXG5-DKDBSd8H.js +0 -9
  534. package/dist/web/assets/chunk-GJRXJL6G-luaxRTYI.js +0 -1
  535. package/dist/web/assets/chunk-JDQVAG3R-C0-rh1aR.js +0 -1
  536. package/dist/web/assets/chunk-XMVSQIK4-BBU7r_NH.js +0 -1
  537. package/dist/web/assets/client-BNjO4Xi8.js +0 -1
  538. package/dist/web/assets/cloud-upload-CoM1FGeB.js +0 -1
  539. package/dist/web/assets/common-CFsO2ppZ.js +0 -1
  540. package/dist/web/assets/copy-BGOhV6Pk.js +0 -1
  541. package/dist/web/assets/create-pipeline-DRR0Qeec.js +0 -1
  542. package/dist/web/assets/createLucideIcon-Bv-_eGcE.js +0 -1
  543. package/dist/web/assets/external-link-CVXsNeO3.js +0 -1
  544. package/dist/web/assets/folder-open-MnOmh19D.js +0 -1
  545. package/dist/web/assets/folder-plus-BRddLBtO.js +0 -1
  546. package/dist/web/assets/git-commit-horizontal-Bm4rkXug.js +0 -1
  547. package/dist/web/assets/icons-CZxmQtZs.js +0 -1
  548. package/dist/web/assets/image-BViGUAiq.js +0 -1
  549. package/dist/web/assets/info-DYPIbKKD.js +0 -1
  550. package/dist/web/assets/loader-circle-JFgFNsP5.js +0 -1
  551. package/dist/web/assets/maximize-2-DXZCQO0b.js +0 -1
  552. package/dist/web/assets/message-square-cOCAL8J1.js +0 -1
  553. package/dist/web/assets/models-route-CWcJuOd0.js +0 -1
  554. package/dist/web/assets/monitor-B35XSAvn.js +0 -1
  555. package/dist/web/assets/paperclip-CKgDxioG.js +0 -1
  556. package/dist/web/assets/play-DzqLr7fM.js +0 -1
  557. package/dist/web/assets/plus-Ddp1vXnw.js +0 -1
  558. package/dist/web/assets/presentation-B0S9v7ib.js +0 -1
  559. package/dist/web/assets/refresh-cw-D45mW-vs.js +0 -1
  560. package/dist/web/assets/reward-checks-D139zwha.js +0 -7
  561. package/dist/web/assets/save-Gu4R_82E.js +0 -1
  562. package/dist/web/assets/schemas-C9IwV7NS.js +0 -64
  563. package/dist/web/assets/settings-DdonLCIN.js +0 -21
  564. package/dist/web/assets/settings-lists-CFHFtO0D.js +0 -5
  565. package/dist/web/assets/square-Dqduqyyu.js +0 -1
  566. package/dist/web/assets/square-terminal-DS3zwi6X.js +0 -1
  567. package/dist/web/assets/training-QBuGBGJd.js +0 -2
  568. package/dist/web/assets/upload-ABSJxuUM.js +0 -1
  569. package/dist/web/assets/useQuery-CCjwL8VI.js +0 -1
  570. package/dist/web/assets/wifi-off-DGJH7Pke.js +0 -1
  571. package/dist/web/assets/work-outputs-CnbRtTLg.js +0 -1
  572. package/dist/web/assets/x-B-_zJVOZ.js +0 -1
  573. /package/dist/chunks/{chunk-SFR32TMJ.js → chunk-JXLDEYRW.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b as oe}from"./chunk-BUZ7CBJC.js";import{b as be}from"./chunk-O6ZYDHEJ.js";import{f as J}from"./chunk-TS5HNRZB.js";import{m as L}from"./chunk-HIQPGYVH.js";import{l as ye}from"./chunk-263WS3TB.js";import{l as W}from"./chunk-XHU4BZQY.js";import{v as B}from"./chunk-ZY32SZ2P.js";import{I as Ee,K as Te}from"./chunk-SH7POUVX.js";import{c as M,d as z,e as ve,n as y}from"./chunk-RCT3O3HQ.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{f as Ie}from"./chunk-UGOK7VTC.js";import{a as u}from"./chunk-FTQLQJQV.js";var c=Object.freeze({eventBytes:65536,actionBytes:16384,resultBytes:8192,stateBytes:8192,eventsPerAppend:32,eventsPerEpisode:256,episodeBytes:2097152,assetBytes:1048576,assetsPerEpisode:16,queueBytes:52428800,queueEvents:5e3,queueAgeSeconds:86400,capabilities:32,consultationRounds:3,consultationBytes:65536,manifestSeconds:300}),s=M,g=z,w=ve,K=e.enum(["codex","claude_code","opencode","openpond"]),h=e.object({id:M,contentHash:z}).strict(),C=e.object({teamId:M,projectId:M}).strict();function T(n,t){return e.preprocess((o,i)=>{try{B(o,t)}catch{return i.addIssue({code:"custom",message:"Tool learning data exceeds its JSON boundary."}),e.NEVER}return o},n)}u(T,"boundedToolLearningSchema");function x(n){return e.string().max(n).refine(t=>new TextEncoder().encode(t).byteLength<=n,"Tool learning text exceeds its UTF-8 byte limit.")}u(x,"toolLearningText");var ze=T(e.record(e.string().min(1).max(120),e.union([x(2e3),e.number().finite(),e.boolean(),e.null()])).refine(n=>Object.keys(n).length<=32,"Use at most 32 explicit state fields."),c.stateBytes),j=e.object({application:e.string().trim().min(1).max(200),version:e.string().trim().min(1).max(200),state:ze,fingerprint:z}).strict(),Y=e.object({id:M,contentHash:z,mediaType:e.enum(["text/plain","application/json","text/x-python","text/x-diff"]),sizeBytes:e.number().int().nonnegative().max(c.assetBytes),purpose:e.enum(["action","result","state","verification"])}).strict(),Le=e.object({policyRevision:e.number().int().positive(),policyHash:z,redactedFields:e.number().int().nonnegative().max(1e4),omittedFields:e.number().int().nonnegative().max(1e4),truncated:e.boolean()}).strict();function E(n,t=c.eventBytes){return B(n,t),y(n)}u(E,"toolLearningContentHash");var Q=x(c.actionBytes),xe=e.string().min(1).max(1e3).refine(n=>!n.startsWith("/")&&!n.includes("\\")&&!/^[A-Za-z]:/u.test(n)&&n.split("/").every(t=>t!==""&&t!=="."&&t!==".."),"Use a workspace-relative artifact path."),P=T(e.discriminatedUnion("kind",[e.object({kind:e.literal("python"),code:Q}).strict(),e.object({kind:e.literal("shell"),command:Q,shell:e.string().min(1).max(120)}).strict(),e.object({kind:e.literal("tool_arguments"),arguments:e.record(e.string().min(1).max(200),e.json())}).strict(),e.object({kind:e.literal("edit"),patch:Q,baseFiles:e.array(e.object({path:xe,contentHash:g.nullable()}).strict()).min(1).max(32)}).strict()]),c.actionBytes),yt=e.discriminatedUnion("kind",[e.object({kind:e.literal("replacement"),expectedActionHash:g,environmentFingerprint:g,action:P}).strict(),e.object({kind:e.literal("patch"),expectedActionHash:g,environmentFingerprint:g,files:e.array(e.object({path:xe,expectedContentHash:g,patch:Q}).strict()).min(1).max(16)}).strict()]);var Ve=e.object({intent:x(2e3),tool:e.object({name:e.string().min(1).max(200),version:e.string().max(200).nullable(),server:e.string().max(200).nullable()}).strict(),action:P,actionHash:g,environment:j,contextAssets:e.array(Y).max(c.assetsPerEpisode),selection:e.discriminatedUnion("kind",[e.object({kind:e.literal("eligible_attempt")}).strict(),e.object({kind:e.literal("unchanged_control"),numerator:e.number().int().positive(),denominator:e.number().int().positive(),policyHash:g}).strict()])}).strict().superRefine((n,t)=>{E(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Action bytes differ from their hash."}),n.selection.kind==="unchanged_control"&&n.selection.numerator>n.selection.denominator&&t.addIssue({code:"custom",path:["selection"],message:"Sampling probability cannot exceed one."})}),Ke=e.enum(["validation_failure","execution_failure","process_failure","timeout","cancelled","infrastructure_failure","authorization_denied","outcome_failure","unknown_failure"]),ie={attempt:h,actionHash:g,execution:e.enum(["not_executed","executed","unknown"]),sideEffects:e.enum(["none","possible","observed","unknown"]),resultExcerpt:x(c.resultBytes),resultHash:g.nullable(),assets:e.array(Y).max(c.assetsPerEpisode)},$e=e.discriminatedUnion("outcome",[e.object({...ie,outcome:e.literal("succeeded"),exitCode:e.literal(0).nullable()}).strict(),e.object({...ie,outcome:e.literal("failed"),classification:Ke,errorCode:e.string().min(1).max(200),message:x(2e3),exitCode:e.number().int().min(-255).max(255).nullable()}).strict(),e.object({...ie,outcome:e.literal("incomplete"),reason:e.enum(["completion_not_observed","observer_restarted","transport_interrupted","coverage_gap"])}).strict()]).superRefine((n,t)=>{n.execution==="not_executed"&&n.sideEffects!=="none"&&t.addIssue({code:"custom",path:["sideEffects"],message:"An unexecuted action cannot claim tool effects."}),n.outcome==="succeeded"&&n.execution!=="executed"&&t.addIssue({code:"custom",path:["execution"],message:"Successful execution requires an observed execution."}),n.outcome==="failed"&&(n.classification==="validation_failure"&&n.execution!=="not_executed"&&t.addIssue({code:"custom",path:["execution"],message:"Pre-execution validation failure must be unexecuted."}),n.classification==="process_failure"&&(n.execution!=="executed"||n.exitCode===null||n.exitCode===0)&&t.addIssue({code:"custom",path:["exitCode"],message:"Process failure requires a nonzero observed exit."}))}),Xe=e.object({failedAttempt:h,failedObservation:h,replacementAttempt:h,goalId:s,basis:e.enum(["explicit_relation","artifact_lineage","unverified"]),attributionEvidence:e.array(h).max(16)}).strict().superRefine((n,t)=>{n.failedAttempt.id===n.replacementAttempt.id&&t.addIssue({code:"custom",message:"A recovery must reference a different attempt."}),n.basis!=="unverified"&&n.attributionEvidence.length===0&&t.addIssue({code:"custom",path:["attributionEvidence"],message:"Recovery attribution needs retained evidence."})}),Ge=e.object({attempt:h,actionHash:g,outcome:e.enum(["passed","failed","unknown"]),verifierRelease:h.nullable(),verifierReceipt:h.nullable(),environmentFingerprint:g,resetStateHash:g.nullable(),outputArtifacts:e.array(Y).max(c.assetsPerEpisode),reason:x(2e3)}).strict().superRefine((n,t)=>{n.outcome!=="unknown"&&(!n.verifierRelease||!n.verifierReceipt)&&t.addIssue({code:"custom",message:"A verification outcome requires an exact verifier and execution receipt."})}),$=e.object({schemaVersion:e.literal("openpond.toolEpisodeEvent.v1"),operationId:s,installationId:s,episodeId:s,eventId:s,sessionId:s,parentSessionId:s.nullable(),turnId:s.nullable(),callId:s,occurredAt:w,sequence:e.number().int().nonnegative(),adapterVersion:e.string().min(1).max(200),sanitization:Le,contentHash:g}).strict(),R=T(e.discriminatedUnion("eventKind",[$.extend({eventKind:e.literal("attempt"),payload:Ve}).strict(),$.extend({eventKind:e.literal("observation"),payload:$e}).strict(),$.extend({eventKind:e.literal("recovery_link"),payload:Xe}).strict(),$.extend({eventKind:e.literal("verification"),payload:Ge}).strict(),$.extend({eventKind:e.literal("lineage"),payload:e.object({relation:e.enum(["fork","split","reopen"]),parentEpisode:h,parentSessionId:s,reason:x(1e3)}).strict()}).strict()]).superRefine((n,t)=>{let{contentHash:o,...i}=n;E(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Episode event content hash mismatch."})}),c.eventBytes);function ae(n){let t=E(n);if(!n||typeof n!="object"||Array.isArray(n)||Object.hasOwn(n,"contentHash"))throw new Error("tool_episode_unsigned_envelope_required");return R.parse({...n,contentHash:t})}u(ae,"sealToolEpisodeEvent");var Se=T(e.object({schemaVersion:e.literal("openpond.toolEpisodeAppend.v1"),operationId:s,installationId:s,events:e.array(R).min(1).max(c.eventsPerAppend)}).strict().superRefine((n,t)=>{n.events.some(o=>o.installationId!==n.installationId)&&t.addIssue({code:"custom",path:["events"],message:"Append events must belong to the exact installation."}),new Set(n.events.map(o=>o.eventId)).size!==n.events.length&&t.addIssue({code:"custom",path:["events"],message:"Append event IDs must be unique."})}),c.eventBytes*c.eventsPerAppend),Re=e.object({schemaVersion:e.literal("openpond.toolEpisodeAppendReceipt.v1"),operationId:s,requestHash:g,installationId:s,teamId:s,projectId:s,receivedAt:w,events:e.array(e.object({eventId:s,contentHash:g,state:e.enum(["retained","already_retained","privacy_rejected"]),receiptId:s,reason:e.string().max(200).nullable()}).strict()).min(1).max(c.eventsPerAppend),learningEnrollment:e.literal(!1)}).strict();var V=e.object({revision:e.number().int().positive(),permittedTools:e.array(e.string().min(1).max(200)).min(1).max(100),workspaceRootHashes:e.array(g).min(1).max(32),permittedFields:e.array(e.enum(["action","intent","state","result_excerpt","artifact_reference"])).min(1).max(5),unchangedControls:e.object({numerator:e.number().int().nonnegative(),denominator:e.number().int().positive()}).strict(),maximumEventBytes:e.number().int().positive().max(c.eventBytes),maximumEpisodeBytes:e.number().int().positive().max(c.episodeBytes),maximumEpisodeEvents:e.number().int().positive().max(c.eventsPerEpisode),maximumQueueBytes:e.number().int().positive().max(c.queueBytes),maximumQueueEvents:e.number().int().positive().max(c.queueEvents),maximumQueueAgeSeconds:e.number().int().positive().max(c.queueAgeSeconds),rawRetentionDays:e.number().int().min(1).max(30),purposes:e.array(e.enum(["capture","consultation"])).min(1).max(2),modelUpdates:e.literal("requires_separate_review"),variantGeneration:e.literal("disabled")}).strict().superRefine((n,t)=>{n.unchangedControls.numerator>n.unchangedControls.denominator&&t.addIssue({code:"custom",path:["unchangedControls"],message:"Sampling probability cannot exceed one."});for(let o of["permittedTools","workspaceRootHashes","permittedFields","purposes"])new Set(n[o]).size!==n[o].length&&t.addIssue({code:"custom",path:[o],message:"Policy entries must be unique."});(n.maximumEpisodeBytes<n.maximumEventBytes||n.maximumQueueBytes<n.maximumEventBytes)&&t.addIssue({code:"custom",message:"Episode and queue capacities must fit one permitted event."})}),We=e.object({receipt:h.nullable(),start:e.enum(["observed","documented","unsupported","unqualified"]),resume:e.enum(["observed","documented","unsupported","unqualified"]),compaction:e.enum(["observed","documented","unsupported","unqualified"]),executionFailure:e.enum(["observed","documented","unsupported","unqualified"]),processFailure:e.enum(["observed","documented","unsupported","unqualified"]),validationFailure:e.enum(["observed","documented","unsupported","unqualified"]),nestedCalls:e.enum(["observed","documented","unsupported","unqualified"]),contextRefresh:e.enum(["session_start","start_resume","start_resume_compaction","revision_aware_turn","unqualified"]),gaps:e.array(e.string().min(1).max(500)).max(32)}).strict().superRefine((n,t)=>{Object.values(n).includes("observed")&&!n.receipt&&t.addIssue({code:"custom",path:["receipt"],message:"Observed coverage requires a qualification receipt."})}),we=T(e.object({schemaVersion:e.literal("openpond.toolLearningRegistration.v1"),operationId:s,installationId:s,projectId:s,machineSourceId:s,client:K,clientVersion:e.string().min(1).max(200),adapterRelease:h,collectionPolicy:V}).strict(),c.eventBytes),H=e.object({schemaVersion:e.literal("openpond.toolLearningInstallation.v1"),id:s,revision:e.number().int().positive(),scope:C,ownerUserId:s,machineSourceId:s,client:K,clientVersion:e.string().min(1).max(200),adapterRelease:h,state:e.enum(["pending_client_trust","enabled","disabled","revoked"]),collectionPolicy:V,collectionPolicyHash:g,coverage:We,credential:e.object({id:s,expiresAt:w,revokedAt:w.nullable(),capabilities:e.array(e.enum(["episode_append","manifest_read","consultation_submit","consultation_read"])).min(1).max(4)}).strict().nullable(),createdAt:w,updatedAt:w}).strict(),Ne=e.object({operationId:s,expectedRevision:e.number().int().positive(),state:e.enum(["enabled","disabled","revoked"])}).strict(),Ct=e.object({schemaVersion:e.literal("openpond.toolEpisodeOrigin.v1"),installationId:s,projectId:s,ownerUserId:s,episode:h,event:h,appendReceipt:h,purpose:e.literal("private_dataset_evidence"),trainingConsent:e.literal("not_granted")}).strict();import{DatabaseSync as Qe}from"node:sqlite";import{chmodSync as Ce,closeSync as Ze,existsSync as je,lstatSync as ce,mkdirSync as et,openSync as tt}from"node:fs";import{join as He}from"node:path";var Z=e.object({id:s,application:e.string().min(1).max(200),versions:e.array(e.string().min(1).max(200)).min(1).max(32),tools:e.array(e.string().min(1).max(200)).min(1).max(32),mode:e.literal("recovery"),routingInstruction:x(2e3),qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),receipt:h}).strict(),e.object({kind:e.literal("learned"),receipt:h,trainingRun:h,adapter:h,evaluation:h,activation:h}).strict()])}).strict(),Je=e.object({schemaVersion:e.literal("openpond.toolLearningManifest.v1"),installationId:s,scope:C,revision:e.number().int().positive(),contentHash:g,issuedAt:w,expiresAt:w,modelRelease:h,responseSchema:e.literal("openpond.toolLearningDecision.v1"),capabilities:e.array(Z).max(c.capabilities)}).strict().superRefine((n,t)=>{let{contentHash:o,...i}=n;E(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Manifest content hash mismatch."});let a=Date.parse(n.expiresAt)-Date.parse(n.issuedAt);(a<=0||a>c.manifestSeconds*1e3)&&t.addIssue({code:"custom",path:["expiresAt"],message:"Manifest expiry exceeds the supported lifetime."}),new Set(n.capabilities.map(l=>l.id)).size!==n.capabilities.length&&t.addIssue({code:"custom",path:["capabilities"],message:"Capability IDs must be unique."})}),Oe=T(Je,c.consultationBytes),O=T(e.object({schemaVersion:e.literal("openpond.toolLearningConsultation.v1"),operationId:s,installationId:s,scope:C,sessionId:s,callId:s,capabilityId:s,manifestHash:g,modelRelease:h,mode:e.literal("recovery"),intent:x(2e3),action:P,actionHash:g,environment:j,contextHash:g,failure:e.object({message:x(c.resultBytes),observation:h}).strict(),round:e.number().int().min(1).max(c.consultationRounds)}).strict().superRefine((n,t)=>{E(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Consultation action hash mismatch."}),E({intent:n.intent,environment:n.environment,failure:n.failure})!==n.contextHash&&t.addIssue({code:"custom",path:["contextHash"],message:"Consultation context hash mismatch."})}),c.consultationBytes),se=e.discriminatedUnion("decision",[e.object({decision:e.literal("proceed")}).strict(),e.object({decision:e.literal("revise"),issues:e.array(e.object({category:e.string().min(1).max(120),feedback:x(2e3)}).strict()).min(1).max(8)}).strict(),e.object({decision:e.literal("needs_context"),missing:e.array(e.object({field:e.string().min(1).max(120),reason:x(500)}).strict()).min(1).max(8)}).strict()]),Ae={operationId:s,installationId:s,capabilityId:s,manifestHash:g,modelRelease:h,actionHash:g,contextHash:g},Ye=T(e.discriminatedUnion("state",[e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ae,state:e.literal("completed"),decision:se,usageReceipt:h,completedAt:w}).strict(),e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ae,state:e.literal("unavailable"),reason:e.enum(["disabled","revoked","expired_manifest","unsupported_scope","budget_exhausted","timeout","invalid_output","cancelled","dispatch_uncertain"]),usageReceipt:h.nullable()}).strict()]),c.consultationBytes);function re(n,t){let o=O.parse(n),i=Ye.parse(t);for(let a of["operationId","installationId","capabilityId","manifestHash","actionHash","contextHash"])if(o[a]!==i[a])throw new Error(`tool_learning_consultation_${a}_mismatch`);if(o.modelRelease.id!==i.modelRelease.id||o.modelRelease.contentHash!==i.modelRelease.contentHash)throw new Error("tool_learning_consultation_model_mismatch");return i}u(re,"assertToolLearningConsultationResponse");function le(n,t){let o=R.parse(n),i=V.parse(t);if(!i.purposes.includes("capture"))throw new Error("tool_learning_capture_not_enabled");if(o.sanitization.policyRevision!==i.revision||o.sanitization.policyHash!==E(i))throw new Error("tool_learning_capture_policy_changed");if(new TextEncoder().encode(JSON.stringify(o)).byteLength>i.maximumEventBytes)throw new Error("tool_learning_event_policy_limit");let a=u(l=>i.permittedFields.includes(l),"permits");if(o.eventKind==="attempt"){if(!i.permittedTools.includes(o.payload.tool.name))throw new Error("tool_learning_tool_outside_collection_policy");if(!a("action")||!a("intent")&&o.payload.intent!==""||!a("state")&&Object.keys(o.payload.environment.state).length>0||!a("artifact_reference")&&o.payload.contextAssets.length>0)throw new Error("tool_learning_attempt_field_outside_collection_policy")}if(o.eventKind==="observation"&&(!a("result_excerpt")&&(o.payload.resultExcerpt!==""||o.payload.outcome==="failed"&&o.payload.message!=="")||!a("artifact_reference")&&o.payload.assets.length>0))throw new Error("tool_learning_result_field_outside_collection_policy");if(o.eventKind==="verification"&&(!a("result_excerpt")&&o.payload.reason!==""||!a("artifact_reference")&&o.payload.outputArtifacts.length>0))throw new Error("tool_learning_verification_field_outside_collection_policy");if(o.eventKind==="lineage"&&!a("intent")&&o.payload.reason!=="")throw new Error("tool_learning_lineage_field_outside_collection_policy")}u(le,"assertToolEpisodeCapturePolicy");var de=e.object({schemaVersion:e.literal("openpond.localToolLearningInstallation.v1"),id:s,teamId:s,projectId:s,client:K,workspaceRoot:e.string().min(1).max(4e3),enabled:e.boolean(),policy:V,createdAt:e.iso.datetime({offset:!0})}).strict(),X=class{static{u(this,"ToolLearningLocalStore")}db;constructor(n){let t=He(n,"tool-learning");if(je(t)&&ce(t).isSymbolicLink())throw new Error("tool_learning_directory_symlink_forbidden");et(t,{recursive:!0,mode:448}),Ce(t,448);let o=He(t,"queue.sqlite");if(je(o)){if(!ce(o).isFile()||ce(o).isSymbolicLink())throw new Error("tool_learning_queue_file_invalid")}else Ze(tt(o,"wx",384));Ce(o,384),this.db=new Qe(o),this.db.exec("PRAGMA busy_timeout = 3000; PRAGMA journal_mode = WAL; PRAGMA synchronous = FULL;"),this.db.exec(`
2
+ import{b as oe}from"./chunk-UGFSAG4U.js";import{b as be}from"./chunk-SSHE6B7Z.js";import{f as J}from"./chunk-WD4KAKEX.js";import{m as L}from"./chunk-HIQPGYVH.js";import{o as ye}from"./chunk-DXJC3QW7.js";import{l as W}from"./chunk-4PUOWSDE.js";import{v as B}from"./chunk-ZY32SZ2P.js";import{I as Ee,K as Te}from"./chunk-SV7ZBEK2.js";import{c as M,d as z,e as Ie,n as y}from"./chunk-RCT3O3HQ.js";import{f as ve}from"./chunk-UGOK7VTC.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as u}from"./chunk-FTQLQJQV.js";var c=Object.freeze({eventBytes:65536,actionBytes:16384,resultBytes:8192,stateBytes:8192,eventsPerAppend:32,eventsPerEpisode:256,episodeBytes:2097152,assetBytes:1048576,assetsPerEpisode:16,queueBytes:52428800,queueEvents:5e3,queueAgeSeconds:86400,capabilities:32,consultationRounds:3,consultationBytes:65536,manifestSeconds:300}),s=M,g=z,w=Ie,K=e.enum(["codex","claude_code","opencode","openpond"]),h=e.object({id:M,contentHash:z}).strict(),C=e.object({teamId:M,projectId:M}).strict();function T(n,t){return e.preprocess((o,i)=>{try{B(o,t)}catch{return i.addIssue({code:"custom",message:"Tool learning data exceeds its JSON boundary."}),e.NEVER}return o},n)}u(T,"boundedToolLearningSchema");function x(n){return e.string().max(n).refine(t=>new TextEncoder().encode(t).byteLength<=n,"Tool learning text exceeds its UTF-8 byte limit.")}u(x,"toolLearningText");var ze=T(e.record(e.string().min(1).max(120),e.union([x(2e3),e.number().finite(),e.boolean(),e.null()])).refine(n=>Object.keys(n).length<=32,"Use at most 32 explicit state fields."),c.stateBytes),j=e.object({application:e.string().trim().min(1).max(200),version:e.string().trim().min(1).max(200),state:ze,fingerprint:z}).strict(),Y=e.object({id:M,contentHash:z,mediaType:e.enum(["text/plain","application/json","text/x-python","text/x-diff"]),sizeBytes:e.number().int().nonnegative().max(c.assetBytes),purpose:e.enum(["action","result","state","verification"])}).strict(),Le=e.object({policyRevision:e.number().int().positive(),policyHash:z,redactedFields:e.number().int().nonnegative().max(1e4),omittedFields:e.number().int().nonnegative().max(1e4),truncated:e.boolean()}).strict();function E(n,t=c.eventBytes){return B(n,t),y(n)}u(E,"toolLearningContentHash");var Q=x(c.actionBytes),xe=e.string().min(1).max(1e3).refine(n=>!n.startsWith("/")&&!n.includes("\\")&&!/^[A-Za-z]:/u.test(n)&&n.split("/").every(t=>t!==""&&t!=="."&&t!==".."),"Use a workspace-relative artifact path."),P=T(e.discriminatedUnion("kind",[e.object({kind:e.literal("python"),code:Q}).strict(),e.object({kind:e.literal("shell"),command:Q,shell:e.string().min(1).max(120)}).strict(),e.object({kind:e.literal("tool_arguments"),arguments:e.record(e.string().min(1).max(200),e.json())}).strict(),e.object({kind:e.literal("edit"),patch:Q,baseFiles:e.array(e.object({path:xe,contentHash:g.nullable()}).strict()).min(1).max(32)}).strict()]),c.actionBytes),yt=e.discriminatedUnion("kind",[e.object({kind:e.literal("replacement"),expectedActionHash:g,environmentFingerprint:g,action:P}).strict(),e.object({kind:e.literal("patch"),expectedActionHash:g,environmentFingerprint:g,files:e.array(e.object({path:xe,expectedContentHash:g,patch:Q}).strict()).min(1).max(16)}).strict()]);var Ve=e.object({intent:x(2e3),tool:e.object({name:e.string().min(1).max(200),version:e.string().max(200).nullable(),server:e.string().max(200).nullable()}).strict(),action:P,actionHash:g,environment:j,contextAssets:e.array(Y).max(c.assetsPerEpisode),selection:e.discriminatedUnion("kind",[e.object({kind:e.literal("eligible_attempt")}).strict(),e.object({kind:e.literal("unchanged_control"),numerator:e.number().int().positive(),denominator:e.number().int().positive(),policyHash:g}).strict()])}).strict().superRefine((n,t)=>{E(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Action bytes differ from their hash."}),n.selection.kind==="unchanged_control"&&n.selection.numerator>n.selection.denominator&&t.addIssue({code:"custom",path:["selection"],message:"Sampling probability cannot exceed one."})}),Ke=e.enum(["validation_failure","execution_failure","process_failure","timeout","cancelled","infrastructure_failure","authorization_denied","outcome_failure","unknown_failure"]),ie={attempt:h,actionHash:g,execution:e.enum(["not_executed","executed","unknown"]),sideEffects:e.enum(["none","possible","observed","unknown"]),resultExcerpt:x(c.resultBytes),resultHash:g.nullable(),assets:e.array(Y).max(c.assetsPerEpisode)},$e=e.discriminatedUnion("outcome",[e.object({...ie,outcome:e.literal("succeeded"),exitCode:e.literal(0).nullable()}).strict(),e.object({...ie,outcome:e.literal("failed"),classification:Ke,errorCode:e.string().min(1).max(200),message:x(2e3),exitCode:e.number().int().min(-255).max(255).nullable()}).strict(),e.object({...ie,outcome:e.literal("incomplete"),reason:e.enum(["completion_not_observed","observer_restarted","transport_interrupted","coverage_gap"])}).strict()]).superRefine((n,t)=>{n.execution==="not_executed"&&n.sideEffects!=="none"&&t.addIssue({code:"custom",path:["sideEffects"],message:"An unexecuted action cannot claim tool effects."}),n.outcome==="succeeded"&&n.execution!=="executed"&&t.addIssue({code:"custom",path:["execution"],message:"Successful execution requires an observed execution."}),n.outcome==="failed"&&(n.classification==="validation_failure"&&n.execution!=="not_executed"&&t.addIssue({code:"custom",path:["execution"],message:"Pre-execution validation failure must be unexecuted."}),n.classification==="process_failure"&&(n.execution!=="executed"||n.exitCode===null||n.exitCode===0)&&t.addIssue({code:"custom",path:["exitCode"],message:"Process failure requires a nonzero observed exit."}))}),Xe=e.object({failedAttempt:h,failedObservation:h,replacementAttempt:h,goalId:s,basis:e.enum(["explicit_relation","artifact_lineage","unverified"]),attributionEvidence:e.array(h).max(16)}).strict().superRefine((n,t)=>{n.failedAttempt.id===n.replacementAttempt.id&&t.addIssue({code:"custom",message:"A recovery must reference a different attempt."}),n.basis!=="unverified"&&n.attributionEvidence.length===0&&t.addIssue({code:"custom",path:["attributionEvidence"],message:"Recovery attribution needs retained evidence."})}),Ge=e.object({attempt:h,actionHash:g,outcome:e.enum(["passed","failed","unknown"]),verifierRelease:h.nullable(),verifierReceipt:h.nullable(),environmentFingerprint:g,resetStateHash:g.nullable(),outputArtifacts:e.array(Y).max(c.assetsPerEpisode),reason:x(2e3)}).strict().superRefine((n,t)=>{n.outcome!=="unknown"&&(!n.verifierRelease||!n.verifierReceipt)&&t.addIssue({code:"custom",message:"A verification outcome requires an exact verifier and execution receipt."})}),$=e.object({schemaVersion:e.literal("openpond.toolEpisodeEvent.v1"),operationId:s,installationId:s,episodeId:s,eventId:s,sessionId:s,parentSessionId:s.nullable(),turnId:s.nullable(),callId:s,occurredAt:w,sequence:e.number().int().nonnegative(),adapterVersion:e.string().min(1).max(200),sanitization:Le,contentHash:g}).strict(),R=T(e.discriminatedUnion("eventKind",[$.extend({eventKind:e.literal("attempt"),payload:Ve}).strict(),$.extend({eventKind:e.literal("observation"),payload:$e}).strict(),$.extend({eventKind:e.literal("recovery_link"),payload:Xe}).strict(),$.extend({eventKind:e.literal("verification"),payload:Ge}).strict(),$.extend({eventKind:e.literal("lineage"),payload:e.object({relation:e.enum(["fork","split","reopen"]),parentEpisode:h,parentSessionId:s,reason:x(1e3)}).strict()}).strict()]).superRefine((n,t)=>{let{contentHash:o,...i}=n;E(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Episode event content hash mismatch."})}),c.eventBytes);function ae(n){let t=E(n);if(!n||typeof n!="object"||Array.isArray(n)||Object.hasOwn(n,"contentHash"))throw new Error("tool_episode_unsigned_envelope_required");return R.parse({...n,contentHash:t})}u(ae,"sealToolEpisodeEvent");var Se=T(e.object({schemaVersion:e.literal("openpond.toolEpisodeAppend.v1"),operationId:s,installationId:s,events:e.array(R).min(1).max(c.eventsPerAppend)}).strict().superRefine((n,t)=>{n.events.some(o=>o.installationId!==n.installationId)&&t.addIssue({code:"custom",path:["events"],message:"Append events must belong to the exact installation."}),new Set(n.events.map(o=>o.eventId)).size!==n.events.length&&t.addIssue({code:"custom",path:["events"],message:"Append event IDs must be unique."})}),c.eventBytes*c.eventsPerAppend),Re=e.object({schemaVersion:e.literal("openpond.toolEpisodeAppendReceipt.v1"),operationId:s,requestHash:g,installationId:s,teamId:s,projectId:s,receivedAt:w,events:e.array(e.object({eventId:s,contentHash:g,state:e.enum(["retained","already_retained","privacy_rejected"]),receiptId:s,reason:e.string().max(200).nullable()}).strict()).min(1).max(c.eventsPerAppend),learningEnrollment:e.literal(!1)}).strict();var V=e.object({revision:e.number().int().positive(),permittedTools:e.array(e.string().min(1).max(200)).min(1).max(100),workspaceRootHashes:e.array(g).min(1).max(32),permittedFields:e.array(e.enum(["action","intent","state","result_excerpt","artifact_reference"])).min(1).max(5),unchangedControls:e.object({numerator:e.number().int().nonnegative(),denominator:e.number().int().positive()}).strict(),maximumEventBytes:e.number().int().positive().max(c.eventBytes),maximumEpisodeBytes:e.number().int().positive().max(c.episodeBytes),maximumEpisodeEvents:e.number().int().positive().max(c.eventsPerEpisode),maximumQueueBytes:e.number().int().positive().max(c.queueBytes),maximumQueueEvents:e.number().int().positive().max(c.queueEvents),maximumQueueAgeSeconds:e.number().int().positive().max(c.queueAgeSeconds),rawRetentionDays:e.number().int().min(1).max(30),purposes:e.array(e.enum(["capture","consultation"])).min(1).max(2),modelUpdates:e.literal("requires_separate_review"),variantGeneration:e.literal("disabled")}).strict().superRefine((n,t)=>{n.unchangedControls.numerator>n.unchangedControls.denominator&&t.addIssue({code:"custom",path:["unchangedControls"],message:"Sampling probability cannot exceed one."});for(let o of["permittedTools","workspaceRootHashes","permittedFields","purposes"])new Set(n[o]).size!==n[o].length&&t.addIssue({code:"custom",path:[o],message:"Policy entries must be unique."});(n.maximumEpisodeBytes<n.maximumEventBytes||n.maximumQueueBytes<n.maximumEventBytes)&&t.addIssue({code:"custom",message:"Episode and queue capacities must fit one permitted event."})}),We=e.object({receipt:h.nullable(),start:e.enum(["observed","documented","unsupported","unqualified"]),resume:e.enum(["observed","documented","unsupported","unqualified"]),compaction:e.enum(["observed","documented","unsupported","unqualified"]),executionFailure:e.enum(["observed","documented","unsupported","unqualified"]),processFailure:e.enum(["observed","documented","unsupported","unqualified"]),validationFailure:e.enum(["observed","documented","unsupported","unqualified"]),nestedCalls:e.enum(["observed","documented","unsupported","unqualified"]),contextRefresh:e.enum(["session_start","start_resume","start_resume_compaction","revision_aware_turn","unqualified"]),gaps:e.array(e.string().min(1).max(500)).max(32)}).strict().superRefine((n,t)=>{Object.values(n).includes("observed")&&!n.receipt&&t.addIssue({code:"custom",path:["receipt"],message:"Observed coverage requires a qualification receipt."})}),we=T(e.object({schemaVersion:e.literal("openpond.toolLearningRegistration.v1"),operationId:s,installationId:s,projectId:s,machineSourceId:s,client:K,clientVersion:e.string().min(1).max(200),adapterRelease:h,collectionPolicy:V}).strict(),c.eventBytes),H=e.object({schemaVersion:e.literal("openpond.toolLearningInstallation.v1"),id:s,revision:e.number().int().positive(),scope:C,ownerUserId:s,machineSourceId:s,client:K,clientVersion:e.string().min(1).max(200),adapterRelease:h,state:e.enum(["pending_client_trust","enabled","disabled","revoked"]),collectionPolicy:V,collectionPolicyHash:g,coverage:We,credential:e.object({id:s,expiresAt:w,revokedAt:w.nullable(),capabilities:e.array(e.enum(["episode_append","manifest_read","consultation_submit","consultation_read"])).min(1).max(4)}).strict().nullable(),createdAt:w,updatedAt:w}).strict(),Ne=e.object({operationId:s,expectedRevision:e.number().int().positive(),state:e.enum(["enabled","disabled","revoked"])}).strict(),Ct=e.object({schemaVersion:e.literal("openpond.toolEpisodeOrigin.v1"),installationId:s,projectId:s,ownerUserId:s,episode:h,event:h,appendReceipt:h,purpose:e.literal("private_dataset_evidence"),trainingConsent:e.literal("not_granted")}).strict();import{DatabaseSync as Qe}from"node:sqlite";import{chmodSync as Ce,closeSync as Ze,existsSync as je,lstatSync as ce,mkdirSync as et,openSync as tt}from"node:fs";import{join as He}from"node:path";var Z=e.object({id:s,application:e.string().min(1).max(200),versions:e.array(e.string().min(1).max(200)).min(1).max(32),tools:e.array(e.string().min(1).max(200)).min(1).max(32),mode:e.literal("recovery"),routingInstruction:x(2e3),qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),receipt:h}).strict(),e.object({kind:e.literal("learned"),receipt:h,trainingRun:h,adapter:h,evaluation:h,activation:h}).strict()])}).strict(),Je=e.object({schemaVersion:e.literal("openpond.toolLearningManifest.v1"),installationId:s,scope:C,revision:e.number().int().positive(),contentHash:g,issuedAt:w,expiresAt:w,modelRelease:h,responseSchema:e.literal("openpond.toolLearningDecision.v1"),capabilities:e.array(Z).max(c.capabilities)}).strict().superRefine((n,t)=>{let{contentHash:o,...i}=n;E(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Manifest content hash mismatch."});let a=Date.parse(n.expiresAt)-Date.parse(n.issuedAt);(a<=0||a>c.manifestSeconds*1e3)&&t.addIssue({code:"custom",path:["expiresAt"],message:"Manifest expiry exceeds the supported lifetime."}),new Set(n.capabilities.map(l=>l.id)).size!==n.capabilities.length&&t.addIssue({code:"custom",path:["capabilities"],message:"Capability IDs must be unique."})}),Oe=T(Je,c.consultationBytes),O=T(e.object({schemaVersion:e.literal("openpond.toolLearningConsultation.v1"),operationId:s,installationId:s,scope:C,sessionId:s,callId:s,capabilityId:s,manifestHash:g,modelRelease:h,mode:e.literal("recovery"),intent:x(2e3),action:P,actionHash:g,environment:j,contextHash:g,failure:e.object({message:x(c.resultBytes),observation:h}).strict(),round:e.number().int().min(1).max(c.consultationRounds)}).strict().superRefine((n,t)=>{E(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Consultation action hash mismatch."}),E({intent:n.intent,environment:n.environment,failure:n.failure})!==n.contextHash&&t.addIssue({code:"custom",path:["contextHash"],message:"Consultation context hash mismatch."})}),c.consultationBytes),se=e.discriminatedUnion("decision",[e.object({decision:e.literal("proceed")}).strict(),e.object({decision:e.literal("revise"),issues:e.array(e.object({category:e.string().min(1).max(120),feedback:x(2e3)}).strict()).min(1).max(8)}).strict(),e.object({decision:e.literal("needs_context"),missing:e.array(e.object({field:e.string().min(1).max(120),reason:x(500)}).strict()).min(1).max(8)}).strict()]),Ae={operationId:s,installationId:s,capabilityId:s,manifestHash:g,modelRelease:h,actionHash:g,contextHash:g},Ye=T(e.discriminatedUnion("state",[e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ae,state:e.literal("completed"),decision:se,usageReceipt:h,completedAt:w}).strict(),e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ae,state:e.literal("unavailable"),reason:e.enum(["disabled","revoked","expired_manifest","unsupported_scope","budget_exhausted","timeout","invalid_output","cancelled","dispatch_uncertain"]),usageReceipt:h.nullable()}).strict()]),c.consultationBytes);function re(n,t){let o=O.parse(n),i=Ye.parse(t);for(let a of["operationId","installationId","capabilityId","manifestHash","actionHash","contextHash"])if(o[a]!==i[a])throw new Error(`tool_learning_consultation_${a}_mismatch`);if(o.modelRelease.id!==i.modelRelease.id||o.modelRelease.contentHash!==i.modelRelease.contentHash)throw new Error("tool_learning_consultation_model_mismatch");return i}u(re,"assertToolLearningConsultationResponse");function le(n,t){let o=R.parse(n),i=V.parse(t);if(!i.purposes.includes("capture"))throw new Error("tool_learning_capture_not_enabled");if(o.sanitization.policyRevision!==i.revision||o.sanitization.policyHash!==E(i))throw new Error("tool_learning_capture_policy_changed");if(new TextEncoder().encode(JSON.stringify(o)).byteLength>i.maximumEventBytes)throw new Error("tool_learning_event_policy_limit");let a=u(l=>i.permittedFields.includes(l),"permits");if(o.eventKind==="attempt"){if(!i.permittedTools.includes(o.payload.tool.name))throw new Error("tool_learning_tool_outside_collection_policy");if(!a("action")||!a("intent")&&o.payload.intent!==""||!a("state")&&Object.keys(o.payload.environment.state).length>0||!a("artifact_reference")&&o.payload.contextAssets.length>0)throw new Error("tool_learning_attempt_field_outside_collection_policy")}if(o.eventKind==="observation"&&(!a("result_excerpt")&&(o.payload.resultExcerpt!==""||o.payload.outcome==="failed"&&o.payload.message!=="")||!a("artifact_reference")&&o.payload.assets.length>0))throw new Error("tool_learning_result_field_outside_collection_policy");if(o.eventKind==="verification"&&(!a("result_excerpt")&&o.payload.reason!==""||!a("artifact_reference")&&o.payload.outputArtifacts.length>0))throw new Error("tool_learning_verification_field_outside_collection_policy");if(o.eventKind==="lineage"&&!a("intent")&&o.payload.reason!=="")throw new Error("tool_learning_lineage_field_outside_collection_policy")}u(le,"assertToolEpisodeCapturePolicy");var de=e.object({schemaVersion:e.literal("openpond.localToolLearningInstallation.v1"),id:s,teamId:s,projectId:s,client:K,workspaceRoot:e.string().min(1).max(4e3),enabled:e.boolean(),policy:V,createdAt:e.iso.datetime({offset:!0})}).strict(),X=class{static{u(this,"ToolLearningLocalStore")}db;constructor(n){let t=He(n,"tool-learning");if(je(t)&&ce(t).isSymbolicLink())throw new Error("tool_learning_directory_symlink_forbidden");et(t,{recursive:!0,mode:448}),Ce(t,448);let o=He(t,"queue.sqlite");if(je(o)){if(!ce(o).isFile()||ce(o).isSymbolicLink())throw new Error("tool_learning_queue_file_invalid")}else Ze(tt(o,"wx",384));Ce(o,384),this.db=new Qe(o),this.db.exec("PRAGMA busy_timeout = 3000; PRAGMA journal_mode = WAL; PRAGMA synchronous = FULL;"),this.db.exec(`
3
3
  CREATE TABLE IF NOT EXISTS installations (id TEXT PRIMARY KEY, payload TEXT NOT NULL);
4
4
  CREATE TABLE IF NOT EXISTS events (
5
5
  id TEXT PRIMARY KEY, installation_id TEXT NOT NULL, episode_id TEXT NOT NULL,
@@ -30,4 +30,4 @@ import{b as oe}from"./chunk-BUZ7CBJC.js";import{b as be}from"./chunk-O6ZYDHEJ.js
30
30
  PRIMARY KEY(installation_id, operation_id)
31
31
  );
32
32
  CREATE INDEX IF NOT EXISTS consultation_requests_expiry ON consultation_requests(expires_at);
33
- `),this.expireCaptureBoundaries(),this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now())}close(){this.db.close()}captureBoundary(n,t,o,i){this.expireCaptureBoundaries();let a=this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND call_id = ? AND phase = ?").get(n,t,o,i);if(!a)return null;let l=R.parse(JSON.parse(String(a.payload))),p=this.installation(n);return!p?.enabled||l.sanitization.policyHash!==E(p.policy)?null:l}retainCaptureBoundary(n,t=Date.now()){let o=R.parse(n);if(o.eventKind!=="attempt"&&o.eventKind!=="observation")throw new Error("tool_learning_capture_boundary_kind");return this.transaction(()=>{this.expireCaptureBoundaries(t);let i=this.installation(o.installationId);if(!i?.enabled)return null;le(o,i.policy);let a=this.captureBoundary(o.installationId,o.sessionId,o.callId,o.eventKind);if(a)return a;let l=JSON.stringify(o),p=Buffer.byteLength(l),d=this.retainedUsage(),I=this.retainedUsage(i.id);return Number(d.count)>=c.queueEvents||Number(I.count)>=i.policy.maximumQueueEvents||Number(I.bytes)+p>i.policy.maximumQueueBytes||Number(d.bytes)+p>c.queueBytes?(this.recordDropped(o.installationId),null):(this.db.prepare("INSERT INTO capture_boundaries VALUES (?, ?, ?, ?, ?, ?, ?)").run(o.installationId,o.sessionId,o.callId,o.eventKind,l,p,t+i.policy.maximumQueueAgeSeconds*1e3),o)})}recordDropped(n){this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, 1) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + 1").run(n)}recordClientObservation(n,t){if(!["start","resume","compact","turn_context","pre_tool","post_tool","failure"].includes(t))throw new Error("tool_learning_unknown_client_observation");this.installation(n)?.enabled&&this.db.prepare("INSERT INTO client_observations VALUES (?, ?, ?, 1) ON CONFLICT(installation_id, event_name) DO UPDATE SET observed_at = excluded.observed_at, count = count + 1").run(n,t,new Date().toISOString())}hasRecoveryCandidateContext(n,t,o=Date.now()){return this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND phase = 'observation' AND expires_at > ? ORDER BY json_extract(payload, '$.occurredAt') DESC LIMIT 33").all(n,t,o).slice(0,32).some(a=>{let l=R.parse(JSON.parse(a.payload));return l.eventKind==="observation"&&l.payload.outcome==="failed"&&Date.parse(l.occurredAt)>=o-6e5})}clientObservations(n){return this.db.prepare("SELECT event_name AS event, observed_at AS observedAt, count FROM client_observations WHERE installation_id = ? ORDER BY event_name").all(n)}consultationRequest(n,t){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let o=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND operation_id = ?").get(n,t);return o?O.parse(JSON.parse(String(o.payload))):null}consultationForCall(n,t,o){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let i=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND json_extract(payload, '$.sessionId') = ? AND json_extract(payload, '$.callId') = ? ORDER BY expires_at DESC LIMIT 1").get(n,t,o);return i?O.parse(JSON.parse(String(i.payload))):null}retainConsultationRequest(n){let t=O.parse(n);return this.transaction(()=>{let o=this.consultationRequest(t.installationId,t.operationId);if(o){if(E(o)!==E(t))throw new Error("tool_learning_consultation_identity_conflict");return o}let i=this.installation(t.installationId);if(!i?.enabled||i.teamId!==t.scope.teamId||i.projectId!==t.scope.projectId||!i.policy.purposes.includes("consultation"))throw new Error("tool_learning_consultation_disabled");let a=JSON.stringify(t),l=Buffer.byteLength(a),p=this.retainedUsage(),d=this.retainedUsage(i.id);if(Number(p.count)>=c.queueEvents||Number(d.count)>=i.policy.maximumQueueEvents||Number(d.bytes)+l>i.policy.maximumQueueBytes||Number(p.bytes)+l>c.queueBytes)throw new Error("tool_learning_consultation_capacity_reached");return this.db.prepare("INSERT INTO consultation_requests VALUES (?, ?, ?, ?, ?)").run(t.installationId,t.operationId,a,l,Date.now()+i.policy.maximumQueueAgeSeconds*1e3),t})}retainedUsage(n){let o=`SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM (SELECT installation_id, size_bytes FROM events UNION ALL SELECT installation_id, size_bytes FROM capture_boundaries UNION ALL SELECT installation_id, size_bytes FROM consultation_requests)${n===void 0?"":" WHERE installation_id = ?"}`;return n===void 0?this.db.prepare(o).get():this.db.prepare(o).get(n)}expireCaptureBoundaries(n=Date.now()){this.db.prepare("DELETE FROM capture_boundaries WHERE expires_at <= ?").run(n)}installation(n){let t=this.db.prepare("SELECT payload FROM installations WHERE id = ?").get(n);return t?de.parse(JSON.parse(String(t.payload))):null}installations(){return this.db.prepare("SELECT payload FROM installations ORDER BY id").all().map(n=>de.parse(JSON.parse(String(n.payload))))}configure(n){let t=de.parse(n);return this.transaction(()=>{let o=this.installation(t.id);if(o&&["teamId","projectId","client","workspaceRoot"].some(i=>o[i]!==t[i]))throw new Error("tool_learning_installation_scope_immutable");if(o&&(t.policy.revision<o.policy.revision||t.policy.revision===o.policy.revision&&E(t.policy)!==E(o.policy)))throw new Error("tool_learning_capture_policy_revision_conflict");this.db.prepare("INSERT INTO installations VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET payload = excluded.payload").run(t.id,JSON.stringify(t))}),t}append(n,t=Date.now()){let o=R.parse(n),i=JSON.stringify(o),a=Buffer.byteLength(i);return this.transaction(()=>{let l=this.installation(o.installationId);if(!l?.enabled)return"disabled";let p=l.policy;if(!p.purposes.includes("capture"))return"disabled";le(o,p);let d=this.db.prepare("SELECT content_hash, installation_id FROM events WHERE id = ?").get(o.eventId);if(d){if(d.content_hash!==o.contentHash||d.installation_id!==o.installationId)throw new Error("tool_learning_event_identity_conflict");return"already_retained"}this.db.prepare("INSERT INTO counters(installation_id) VALUES (?) ON CONFLICT DO NOTHING").run(l.id);let I=t-p.maximumQueueAgeSeconds*1e3,f=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(l.id,I).changes;if(this.db.prepare("UPDATE counters SET expired = expired + ? WHERE installation_id = ?").run(f,l.id),Date.parse(o.occurredAt)<I||Date.parse(o.occurredAt)>t+3e5)return this.db.prepare("UPDATE counters SET expired = expired + 1 WHERE installation_id = ?").run(l.id),"expired";let r=this.retainedUsage(),m=this.retainedUsage(l.id),_=this.db.prepare("SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ? AND episode_id = ?").get(l.id,o.episodeId);return Number(r.count)>=c.queueEvents||Number(r.bytes)+a>c.queueBytes||Number(m.count)>=p.maximumQueueEvents||Number(m.bytes)+a>p.maximumQueueBytes||Number(_.count)>=p.maximumEpisodeEvents||Number(_.bytes)+a>p.maximumEpisodeBytes?(this.db.prepare("UPDATE counters SET dropped = dropped + 1 WHERE installation_id = ?").run(l.id),"queue_full"):(this.db.prepare("INSERT INTO events VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(o.eventId,l.id,o.episodeId,o.sanitization.policyHash,o.contentHash,i,a,t),"retained")})}pending(n,t=c.eventsPerAppend){if(!Number.isInteger(t)||t<1||t>c.eventsPerAppend)throw new Error("tool_learning_queue_page_limit");this.expire(n);let o=this.installation(n);return!o?.enabled||!o.policy.purposes.includes("capture")?[]:this.db.prepare("SELECT payload FROM events WHERE installation_id = ? AND policy_hash = ? ORDER BY received_at, id LIMIT ?").all(n,E(o.policy),t).map(i=>R.parse(JSON.parse(String(i.payload))))}acknowledge(n,t){if(t.length>c.eventsPerAppend)throw new Error("tool_learning_ack_limit");this.transaction(()=>{for(let o of t){let i=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND id = ? AND content_hash = ?").run(n,o.eventId,o.contentHash);o.state==="privacy_rejected"&&Number(i.changes)>0&&this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + excluded.dropped").run(n,i.changes)}})}status(n){this.expire(n);let t=this.installation(n),o=this.db.prepare("SELECT COUNT(*) AS events, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ?").get(n),i=this.db.prepare("SELECT dropped, expired FROM counters WHERE installation_id = ?").get(n),a=t?.enabled&&t.policy.purposes.includes("capture")?Number(this.db.prepare("SELECT COUNT(*) AS count FROM events WHERE installation_id = ? AND policy_hash = ?").get(n,E(t.policy)).count):0;return{pendingEvents:Number(o.events),pendingBytes:Number(o.bytes),droppedEvents:Number(i?.dropped??0),expiredEvents:Number(i?.expired??0),blockedByPolicyEvents:Number(o.events)-a}}transaction(n){this.db.exec("BEGIN IMMEDIATE");try{let t=n();return this.db.exec("COMMIT"),t}catch(t){throw this.db.exec("ROLLBACK"),t}}expire(n){let t=this.installation(n);t&&this.transaction(()=>{let o=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(n,Date.now()-t.policy.maximumQueueAgeSeconds*1e3).changes;this.db.prepare("INSERT INTO counters(installation_id, expired) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET expired = expired + excluded.expired").run(n,o)})}};var pe=e.object({state:e.enum(["incomplete","ambiguous","awaiting_owner_review"]),issues:e.array(e.enum(["missing_attempt","missing_observation","completion_not_observed","conflicting_observations","reference_mismatch","lineage_mismatch","mixed_scope","conflicting_event"])).max(8),groups:e.array(e.object({key:g,application:e.string().min(1).max(200),applicationVersion:e.string().min(1).max(200),tool:e.object({name:e.string().min(1).max(200),version:e.string().max(200).nullable(),server:e.string().max(200).nullable()}).strict(),environmentFingerprints:e.array(g).max(c.eventsPerEpisode),attempts:e.array(h).max(c.eventsPerEpisode)}).strict()).max(c.eventsPerEpisode)}).strict();function nt(n){let t=e.array(R).max(c.eventsPerEpisode).parse(n),o=new Set,i=new Set,a=new Map,l=t[0];for(let r of t){l&&(r.installationId!==l.installationId||r.episodeId!==l.episodeId)&&i.add("mixed_scope"),r.parentSessionId===r.sessionId&&i.add("lineage_mismatch");let m=a.get(r.eventId);m&&m.contentHash!==r.contentHash?i.add("conflicting_event"):a.set(r.eventId,r)}let p=[...a.values()].filter(r=>r.eventKind==="attempt"),d=new Map,I=new Map;p.length||o.add("missing_attempt");for(let r of a.values()){if(r.eventKind!=="observation")continue;let m=a.get(r.payload.attempt.id);m?m.eventKind!=="attempt"||m.contentHash!==r.payload.attempt.contentHash||m.payload.actionHash!==r.payload.actionHash?i.add("reference_mismatch"):(m.sessionId!==r.sessionId||m.callId!==r.callId||m.parentSessionId&&r.parentSessionId&&m.parentSessionId!==r.parentSessionId||m.turnId&&r.turnId&&m.turnId!==r.turnId)&&i.add("lineage_mismatch"):o.add("missing_attempt");let _=d.get(r.payload.attempt.id)??[];_.push(r),d.set(r.payload.attempt.id,_)}let f=new Map;for(let r of p){let m=JSON.stringify([r.sessionId,r.callId]),_=I.get(m);_&&_!==r.contentHash&&i.add("lineage_mismatch"),I.set(m,r.contentHash);let v=d.get(r.eventId)??[];if(!v.length)o.add("missing_observation");else{let N=v.filter(A=>A.payload.outcome!=="incomplete");N.length||o.add("completion_not_observed"),new Set(N.map(A=>L(A.payload))).size>1&&i.add("conflicting_observations")}let{environment:S,tool:b}=r.payload,U=L([S.application,S.version,b.name,b.version,b.server]),D=f.get(U)??{application:S.application,applicationVersion:S.version,tool:b,fingerprints:new Set,attempts:[]};D.fingerprints.add(S.fingerprint),D.attempts.push({id:r.eventId,contentHash:r.contentHash}),f.set(U,D)}return pe.parse({state:i.size?"ambiguous":o.size?"incomplete":"awaiting_owner_review",issues:[...new Set([...i,...o])].sort(),groups:[...f].sort(([r],[m])=>r.localeCompare(m)).map(([r,m])=>({key:r,application:m.application,applicationVersion:m.applicationVersion,tool:m.tool,environmentFingerprints:[...m.fingerprints].sort(),attempts:m.attempts.sort((_,v)=>_.id.localeCompare(v.id))}))})}u(nt,"assembleToolLearningEpisode");var ot=e.object({installation:H,apiKey:oe}).strict(),it=e.object({items:e.array(H).max(30),nextCursor:s.nullable()}).strict(),at=e.object({installationId:s,scope:C,items:e.array(e.object({episodeId:s,eventCount:e.number().int().positive(),lastReceivedAt:e.iso.datetime()}).strict()).max(30),nextCursor:s.nullable(),learningEnrollment:e.literal(!1)}).strict(),st=e.object({installationId:s,episodeId:s,scope:C,events:e.array(R).max(c.eventsPerEpisode),state:pe.shape.state,assembly:pe,verificationAuthority:e.literal("not_granted"),learningEnrollment:e.literal(!1)}).strict(),rt=e.object({operationId:s,expectedRevision:e.number().int().positive()}).strict(),lt=e.object({installationId:s,operationId:s,purgedEvents:e.number().int().nonnegative(),learningEnrollment:e.literal(!1)}).strict(),ue=T(e.object({registration:we,credential:e.object({apiKey:oe,expiresAt:e.iso.datetime()}).strict()}).strict(),c.eventBytes),ct=T(e.object({operationId:s,expectedRevision:e.number().int().positive(),episodeId:s,failure:h,recovery:h,taskDefinition:W,familyKey:s,split:e.literal("train"),proposedTarget:se,saveToPrivateDataset:e.literal(!0),targetApproval:e.literal("pending_owner_review")}).strict(),c.eventBytes),dt=T(e.object({installationId:s,projectId:s,operationId:s,source:W,evidence:W,originHash:e.string().regex(/^[a-f0-9]{64}$/),requestHash:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),targetApproval:e.literal("pending_owner_review"),learningEnrollment:e.literal(!1)}).strict(),c.eventBytes),Ue=T(e.object({operationId:s,expectedRevision:e.number().int().nonnegative(),state:e.enum(["enabled","disabled"]),modelId:s,qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),evaluationRunId:s}).strict(),e.object({kind:e.literal("learned"),evaluationRunId:s,baselineRunId:s,trainingRunId:s}).strict()]),capabilities:e.array(Z.omit({qualification:!0})).min(1).max(16),limits:e.object({maxOutputTokens:e.number().int().min(128).max(2048),maximumCallUsd:e.number().positive().max(1),maximumDayUsd:e.number().positive().max(10),maximumSessionCalls:e.number().int().min(1).max(20),maximumDayCalls:e.number().int().min(1).max(200)}).strict()}).strict(),c.eventBytes),pt=T(e.object({installationId:s,scope:e.object({teamId:s,projectId:s}).strict(),revision:e.number().int().positive(),operationId:s,requestHash:e.string().regex(/^[a-f0-9]{64}$/),configuration:Ue,modelRelease:h,policySystemPrompt:e.string().min(1).max(16384),capabilities:e.array(Z).max(16),updatedAt:e.iso.datetime()}).strict(),c.eventBytes);var q=class extends Error{static{u(this,"OpenPondToolLearningError")}constructor(n,t){super(`Tool learning request failed (${n}): ${t}`),this.status=n,this.code=t,this.name="OpenPondToolLearningError"}status;code},De=class{static{u(this,"OpenPondToolLearningClient")}#o;#e;constructor(n){this.#e={...n};let t=new URL(n.baseUrl);if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash||!n.apiKey.trim()||!n.teamId.trim()||!n.projectId.trim())throw new Error("tool_learning_client_scope_required");this.#o=t.toString().replace(/\/+$/,"")}async register(n,t){let o=ue.parse(n);if(o.registration.projectId!==this.#e.projectId)throw new Error("tool_learning_project_mismatch");let i=ot.parse(await this.#t("installations","POST",o,t));if(this.#n(i.installation,o.registration.installationId),i.apiKey!==o.credential.apiKey)throw new Error("tool_learning_credential_mismatch");let a=i.installation;if(a.client!==o.registration.client||a.clientVersion!==o.registration.clientVersion||a.machineSourceId!==o.registration.machineSourceId||L(a.adapterRelease)!==L(o.registration.adapterRelease)||L(a.collectionPolicy)!==L(o.registration.collectionPolicy)||a.collectionPolicyHash!==L(o.registration.collectionPolicy)||a.credential?.expiresAt!==o.credential.expiresAt)throw new Error("tool_learning_registration_receipt_mismatch");return i}async installation(n,t){let o=H.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"GET",void 0,t));return this.#n(o,n),o}async installations(n,t){let o=it.parse(await this.#t(`installations?projectId=${encodeURIComponent(this.#e.projectId)}${n?`&after=${encodeURIComponent(n)}`:""}`,"GET",void 0,t));for(let i of o.items)this.#n(i,i.id);if(o.nextCursor!==null&&o.nextCursor!==o.items.at(-1)?.id)throw new Error("tool_learning_installation_cursor_mismatch");return o}async episodes(n,t,o){let i=at.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes${t?`?after=${encodeURIComponent(t)}`:""}`,"GET",void 0,o));if(i.installationId!==n||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.nextCursor!==null&&i.nextCursor!==i.items.at(-1)?.episodeId)throw new Error("tool_learning_episode_page_mismatch");return i}async episode(n,t,o){let i=st.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes/${encodeURIComponent(t)}`,"GET",void 0,o));if(i.installationId!==n||i.episodeId!==t||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.events.some(a=>a.installationId!==n||a.episodeId!==t))throw new Error("tool_learning_episode_scope_mismatch");if(i.state!==i.assembly.state||L(nt(i.events))!==L(i.assembly))throw new Error("tool_learning_episode_assembly_mismatch");return i}async purge(n,t,o){let i=rt.parse(t),a=lt.parse(await this.#t(`installations/${encodeURIComponent(n)}/purge`,"POST",i,o));if(a.installationId!==n||a.operationId!==i.operationId)throw new Error("tool_learning_purge_scope_mismatch");return a}async project(n,t,o){let i=ct.parse(t),a=dt.parse(await this.#t(`installations/${encodeURIComponent(n)}/project`,"POST",i,o));if(a.installationId!==n||a.projectId!==this.#e.projectId||a.operationId!==i.operationId||a.requestHash!==L(i))throw new Error("tool_learning_projection_scope_mismatch");return a}async setState(n,t,o){let i=Ne.parse(t),a=H.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"PATCH",i,o));if(this.#n(a,n),a.state!==i.state)throw new Error("tool_learning_state_mismatch");return a}async append(n,t){let o=Se.parse(n),i=Re.parse(await this.#t("episodes","POST",o,t));if(i.operationId!==o.operationId||i.installationId!==o.installationId||i.teamId!==this.#e.teamId||i.projectId!==this.#e.projectId||i.requestHash!==L(o)||i.events.length!==o.events.length||new Set(i.events.map(a=>a.eventId)).size!==i.events.length)throw new Error("tool_learning_append_receipt_mismatch");for(let a of i.events){let l=o.events.find(p=>p.eventId===a.eventId);if(!l||l.contentHash!==a.contentHash)throw new Error("tool_learning_append_event_mismatch")}return i}async routing(n,t){return this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"GET",void 0,t))}async configureRouting(n,t,o){let i=Ue.parse(t),a=this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"POST",i,o));if(a.operationId!==i.operationId||a.requestHash!==L(i)||L(a.configuration)!==L(i))throw new Error("tool_learning_routing_receipt_mismatch");return a}#i(n,t){let o=pt.parse(t);if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_routing_scope_mismatch");return o}async manifest(n,t){let o=Oe.parse(await this.#t(`installations/${encodeURIComponent(n)}/manifest`,"GET",void 0,t));if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_manifest_scope_mismatch");if(Date.parse(o.expiresAt)<=Date.now()||Date.parse(o.issuedAt)>Date.now()+3e4)throw new Error("tool_learning_manifest_expired");return o}async consult(n,t){let o=O.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return re(o,await this.#t("consultations","POST",o,t))}async consultation(n,t){let o=O.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return re(o,await this.#t(`installations/${encodeURIComponent(o.installationId)}/consultations/${encodeURIComponent(o.operationId)}`,"GET",void 0,t))}#n(n,t){if(n.id!==t||n.scope.teamId!==this.#e.teamId||n.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_installation_scope_mismatch")}async#t(n,t,o,i){o!==void 0&&B(o,c.eventBytes*c.eventsPerAppend);let a=AbortSignal.timeout(3e4),l=await(this.#e.fetch??globalThis.fetch)(`${this.#o}/v1/tool-learning/${n}`,{method:t,redirect:"error",signal:i?AbortSignal.any([i,a]):a,headers:{Authorization:`Bearer ${this.#e.apiKey}`,"X-OpenPond-Team-Id":this.#e.teamId,Accept:"application/json",...o===void 0?{}:{"Content-Type":"application/json"}},...o===void 0?{}:{body:JSON.stringify(o)}}),p=await ye(l,c.eventBytes*c.eventsPerAppend,"Tool learning response");if(!l.ok){let d=e.object({code:e.string().regex(/^[a-z0-9_]+$/).max(200)}).passthrough().safeParse(p);throw new q(l.status,d.success?d.data.code:"tool_learning_request_failed")}return p}};var vn=u(()=>be,"nativeToolLearningClientVersion"),ut=u((n,t)=>typeof n[t]=="string"?n[t].trim():"","optionString"),Be=e.object({schemaVersion:e.literal("openpond.toolLearningLocalCredential.v1"),apiOrigin:e.string().url().refine(n=>new URL(n).origin===n),teamId:s,projectId:s,ownerAccount:e.string().nullable(),workspaceRoot:e.string().min(1),locallyEnabled:e.boolean(),environment:j.nullable().default(null),prepared:ue,installation:H.nullable()}).strict(),Tn=u(n=>Ie({home:ut(n,"home")||void 0}),"toolLearningHome"),Pe=u(n=>`tool-learning:installation:${s.parse(n)}`,"toolLearningCredentialId");async function k(n,t){let o=await Ee(n,Pe(t));if(!o)throw new Error("Tool learning installation is not configured in this OpenPond home.");let i=Be.parse(o.value);if(i.prepared.registration.installationId!==t||i.prepared.registration.projectId!==i.projectId)throw new Error("Tool learning credential scope does not match its installation.");return{...o,value:i}}u(k,"loadToolLearningCredential");async function qe(n,t,o){let i=Be.parse(t);return Te(n,Pe(i.prepared.registration.installationId),i,o)}u(qe,"saveToolLearningCredential");function G(n){return new De({baseUrl:n.apiOrigin,apiKey:n.prepared.credential.apiKey,teamId:n.teamId,projectId:n.projectId})}u(G,"toolLearningProducer");function F(n,t,o){let i=t.prepared.registration;if(!["openpond","claude_code","opencode","codex"].includes(i.client))throw new Error("This client has not been qualified for installation.");return n.configure({schemaVersion:"openpond.localToolLearningInstallation.v1",id:i.installationId,teamId:t.teamId,projectId:t.projectId,client:i.client,workspaceRoot:t.workspaceRoot,enabled:t.locallyEnabled&&o?.state==="enabled",policy:i.collectionPolicy,createdAt:o?.createdAt??new Date().toISOString()})}u(F,"configureLocalToolLearning");async function ee(n,t,o,i){let a=G(o),l=o.prepared.registration.installationId;if(!o.locallyEnabled)return F(t,o,null),{installationId:l,deliveredEvents:0,rejectedEvents:0,local:t.status(l),learningEnrollment:!1};let p=u(async()=>{F(t,o,null);let r=await k(n,l);r.value.locallyEnabled&&await qe(n,{...r.value,locallyEnabled:!1},r.revision)},"suspend"),d;try{d=await a.installation(l,i)}catch(r){throw r instanceof q&&[401,403].includes(r.status)&&await p(),r}if(d.state!=="enabled"&&await p(),d.collectionPolicyHash!==E(o.prepared.registration.collectionPolicy))throw await p(),new Error("Tool learning collection policy changed. Reconfigure this installation before uploading.");F(t,o,d);let I=0,f=0;for(let r=0;r<16;r++){let m=t.pending(l);if(!m.length)break;let _=await a.append({schemaVersion:"openpond.toolEpisodeAppend.v1",installationId:l,operationId:`tool-append-${y([l,m.map(v=>[v.eventId,v.contentHash])])}`,events:m},i).catch(async v=>{throw v instanceof q&&[401,403].includes(v.status)&&await p(),v});t.acknowledge(l,_.events),I+=_.events.filter(v=>v.state!=="privacy_rejected").length,f+=_.events.filter(v=>v.state==="privacy_rejected").length}return{installationId:l,deliveredEvents:I,rejectedEvents:f,local:t.status(l),learningEnrollment:!1}}u(ee,"flushToolLearning");import{realpath as mt}from"node:fs/promises";function ht(n,t){let o=Buffer.from(n),i=Math.min(o.length,t);for(;i<o.length&&(o[i]&192)===128;)i--;return o.subarray(0,i).toString("utf8")}u(ht,"boundedExcerpt");function ke(n){try{B(n,32768)}catch{return!0}let t=JSON.stringify(n);if(/(?:^|[\s/\\'"=])\.env(?:[.\s/\\'";]|$)/u.test(t))return!0;let o=J(t);return o.secretStatus!=="passed"||o.piiStatus!=="passed"}u(ke,"privatePayload");async function Bn(n,t){let o=await mt(t.workspaceRoot),i=new X(n),a=[],l=AbortSignal.timeout(2e3);try{let p=i.installations().filter(d=>d.enabled&&d.client===t.client&&d.workspaceRoot===o&&(!t.installationId||d.id===t.installationId)&&d.policy.permittedTools.includes(t.tool));for(let d of p){let I=await k(n,d.id),f=I.value;if(!f.locallyEnabled||f.prepared.registration.clientVersion!==t.clientVersion||f.workspaceRoot!==o||f.installation?.state!=="enabled"||t.accountScope&&(f.apiOrigin!==t.accountScope.apiOrigin||f.ownerAccount!==t.accountScope.accountHandle||f.installation.ownerUserId!==t.accountScope.ownerUserId||t.accountScope.teamId&&t.accountScope.teamId!==f.teamId))continue;F(i,f,f.installation);let r=d.policy,m=y(r);if(!r.purposes.includes("capture")||!r.workspaceRootHashes.includes(y(o)))continue;let _=u(ne=>r.permittedFields.includes(ne),"permits"),v=`tool-boundary-${y([d.id,t.sessionId,t.callId,t.phase])}`,S={schemaVersion:"openpond.toolEpisodeEvent.v1",operationId:v,installationId:d.id,episodeId:`tool-episode-${y([d.id,t.sessionId,t.callId])}`,eventId:v,sessionId:t.sessionId,parentSessionId:t.parentSessionId??null,turnId:t.turnId??null,callId:t.callId,occurredAt:new Date().toISOString(),sequence:t.phase==="attempt"?0:1,adapterVersion:f.prepared.registration.adapterRelease.id,sanitization:{policyRevision:r.revision,policyHash:m,redactedFields:0,omittedFields:0,truncated:!1}};if(t.phase==="attempt"){if(!_("action"))continue;let ne=t.invalidArguments===void 0?{kind:"tool_arguments",arguments:t.arguments}:{kind:"tool_arguments",arguments:{invalidArguments:t.invalidArguments}},me=P.safeParse(ne);if(!me.success){i.recordDropped(d.id);continue}let he=me.data,ge=t.environment??f.environment??{application:t.tool,version:t.clientVersion,state:{workspaceRootHash:y(o)},fingerprint:y([t.tool,t.clientVersion,o])},Me=j.parse(_("state")?ge:{...ge,state:{}}),fe={intent:_("intent")?t.intent??"":"",tool:{name:t.tool,version:t.clientVersion,server:null},action:he,actionHash:y(he),environment:Me,contextAssets:[],selection:{kind:"eligible_attempt"}};if(ke(fe)){i.recordDropped(d.id);continue}let _e=i.retainCaptureBoundary(ae({...S,eventKind:"attempt",payload:fe}));_e&&a.push({installationId:d.id,event:_e});continue}let b=i.captureBoundary(d.id,t.sessionId,t.callId,"attempt");if(!b||b.eventKind!=="attempt"||!t.result)continue;let U=r.unchangedControls;if(!(t.result.outcome!=="succeeded"||i.hasRecoveryCandidateContext(d.id,t.sessionId)||parseInt(y([d.id,t.sessionId,t.callId]).slice(0,8),16)/4294967296<U.numerator/U.denominator))continue;if((!t.result.text||Buffer.byteLength(t.result.text)>8192)&&Buffer.byteLength(t.result.text)>8192){i.recordDropped(d.id);continue}let N={attempt:{id:b.eventId,contentHash:b.contentHash},actionHash:b.payload.actionHash,execution:t.result.execution,sideEffects:t.result.sideEffects,resultExcerpt:_("result_excerpt")?t.result.text:"",resultHash:_("result_excerpt")?y(t.result.text):null,assets:[]},A=t.result.outcome==="succeeded"?{...N,outcome:"succeeded",exitCode:t.result.exitCode??null}:t.result.outcome==="incomplete"?{...N,outcome:"incomplete",reason:"completion_not_observed"}:{...N,outcome:"failed",classification:t.result.classification??"unknown_failure",errorCode:t.result.classification??"unknown_failure",message:_("result_excerpt")?ht(t.result.text,2e3):"",exitCode:t.result.exitCode??null};if(ke(A)){i.recordDropped(d.id);continue}let te=i.retainCaptureBoundary(ae({...S,episodeId:b.episodeId,eventKind:"observation",payload:A}));if(te){i.append(b),i.append(te),a.push({installationId:d.id,event:te});try{await ee(n,i,f,l)}catch{}}}return a.map(d=>({installationId:d.installationId,eventId:d.event.eventId,contentHash:d.event.contentHash}))}finally{i.close()}}u(Bn,"captureLocalToolBoundary");var gt=e.object({sessionId:e.string().min(1).max(200),failedCallId:e.string().min(1).max(200),capabilityId:e.string().min(1).max(200),intent:e.string().max(2e3)}).strict();async function Xn(n,t,o,i){let a=gt.parse(o),{value:l}=await k(n,t);if(!l.locallyEnabled||l.installation?.state!=="enabled")throw new Error("tool_learning_consultation_disabled");let p=new X(n);try{F(p,l,l.installation);let d=p.captureBoundary(t,a.sessionId,a.failedCallId,"attempt"),I=p.captureBoundary(t,a.sessionId,a.failedCallId,"observation");if(!d||d.eventKind!=="attempt"||!I||I.eventKind!=="observation"||I.payload.outcome!=="failed")throw new Error("tool_learning_observed_failure_required");let f=J(a.intent);if(f.secretStatus!=="passed"||f.piiStatus!=="passed")throw new Error("tool_learning_consultation_privacy_blocked");let r=G(l),m={message:I.payload.message,observation:{id:I.eventId,contentHash:I.contentHash}},_=y({intent:a.intent,environment:d.payload.environment,failure:m}),v=p.consultationForCall(t,a.sessionId,a.failedCallId);if(v){let N=v.operationId;if(v.contextHash!==_||v.capabilityId!==a.capabilityId)return{operationId:N,response:{state:"unavailable",reason:"failure_already_submitted"},recovery:"Read the original consultation with openpond_consult_status. Changing context or capability does not authorize another paid call."};try{return{operationId:N,response:await r.consultation(v,i)}}catch(A){if(!(A instanceof q)||A.status!==404||A.code!=="tool_learning_consultation_not_found")throw A;return Fe(r,v,i)}}let S=await r.manifest(t,i),b=S.capabilities.find(N=>N.id===a.capabilityId);if(!b||b.application!==d.payload.environment.application||!b.versions.includes(d.payload.environment.version)||!b.tools.includes(d.payload.tool.name))throw new Error("tool_learning_consultation_scope_unsupported");let U=`tool-consult-${y([t,a.sessionId,a.failedCallId,a.capabilityId,d.payload.actionHash,_,S.modelRelease])}`,D=O.parse({schemaVersion:"openpond.toolLearningConsultation.v1",operationId:U,installationId:t,scope:S.scope,sessionId:a.sessionId,callId:a.failedCallId,capabilityId:a.capabilityId,manifestHash:S.contentHash,modelRelease:S.modelRelease,mode:"recovery",intent:a.intent,action:d.payload.action,actionHash:d.payload.actionHash,environment:d.payload.environment,contextHash:_,failure:m,round:1});return p.retainConsultationRequest(D),await ee(n,p,l,i),Fe(r,D,i)}finally{p.close()}}u(Xn,"consultLocalToolLearning");async function Gn(n,t,o,i){let{value:a}=await k(n,t);if(!a.locallyEnabled)throw new Error("tool_learning_consultation_disabled");let l=new X(n);try{let p=l.consultationRequest(t,o);if(!p)throw new Error("tool_learning_consultation_request_not_retained");return{operationId:o,response:await G(a).consultation(p,i)}}finally{l.close()}}u(Gn,"readLocalToolConsultation");async function Fe(n,t,o){try{return{operationId:t.operationId,response:await n.consult(t,o)}}catch(i){let a=i instanceof q&&i.status>=400&&i.status<500&&i.status!==408;return{operationId:t.operationId,response:{state:"unavailable",reason:a?i.code:"dispatch_uncertain"},recovery:a?"Resolve the reported admission error. Keep this original operation ID; do not create a replacement paid request.":"Use openpond_consult_status with this operationId; do not create a replacement request."}}}u(Fe,"submitLocalToolConsultation");export{c as a,s as b,g as c,h as d,C as e,T as f,j as g,R as h,Se as i,Re as j,we as k,H as l,Ne as m,Z as n,Oe as o,O as p,se as q,re as r,X as s,De as t,vn as u,Be as v,Tn as w,Pe as x,k as y,qe as z,G as A,F as B,ee as C,Bn as D,gt as E,Xn as F,Gn as G};
33
+ `),this.expireCaptureBoundaries(),this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now())}close(){this.db.close()}captureBoundary(n,t,o,i){this.expireCaptureBoundaries();let a=this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND call_id = ? AND phase = ?").get(n,t,o,i);if(!a)return null;let l=R.parse(JSON.parse(String(a.payload))),p=this.installation(n);return!p?.enabled||l.sanitization.policyHash!==E(p.policy)?null:l}retainCaptureBoundary(n,t=Date.now()){let o=R.parse(n);if(o.eventKind!=="attempt"&&o.eventKind!=="observation")throw new Error("tool_learning_capture_boundary_kind");return this.transaction(()=>{this.expireCaptureBoundaries(t);let i=this.installation(o.installationId);if(!i?.enabled)return null;le(o,i.policy);let a=this.captureBoundary(o.installationId,o.sessionId,o.callId,o.eventKind);if(a)return a;let l=JSON.stringify(o),p=Buffer.byteLength(l),d=this.retainedUsage(),I=this.retainedUsage(i.id);return Number(d.count)>=c.queueEvents||Number(I.count)>=i.policy.maximumQueueEvents||Number(I.bytes)+p>i.policy.maximumQueueBytes||Number(d.bytes)+p>c.queueBytes?(this.recordDropped(o.installationId),null):(this.db.prepare("INSERT INTO capture_boundaries VALUES (?, ?, ?, ?, ?, ?, ?)").run(o.installationId,o.sessionId,o.callId,o.eventKind,l,p,t+i.policy.maximumQueueAgeSeconds*1e3),o)})}recordDropped(n){this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, 1) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + 1").run(n)}recordClientObservation(n,t){if(!["start","resume","compact","turn_context","pre_tool","post_tool","failure"].includes(t))throw new Error("tool_learning_unknown_client_observation");this.installation(n)?.enabled&&this.db.prepare("INSERT INTO client_observations VALUES (?, ?, ?, 1) ON CONFLICT(installation_id, event_name) DO UPDATE SET observed_at = excluded.observed_at, count = count + 1").run(n,t,new Date().toISOString())}hasRecoveryCandidateContext(n,t,o=Date.now()){return this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND phase = 'observation' AND expires_at > ? ORDER BY json_extract(payload, '$.occurredAt') DESC LIMIT 33").all(n,t,o).slice(0,32).some(a=>{let l=R.parse(JSON.parse(a.payload));return l.eventKind==="observation"&&l.payload.outcome==="failed"&&Date.parse(l.occurredAt)>=o-6e5})}clientObservations(n){return this.db.prepare("SELECT event_name AS event, observed_at AS observedAt, count FROM client_observations WHERE installation_id = ? ORDER BY event_name").all(n)}consultationRequest(n,t){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let o=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND operation_id = ?").get(n,t);return o?O.parse(JSON.parse(String(o.payload))):null}consultationForCall(n,t,o){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let i=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND json_extract(payload, '$.sessionId') = ? AND json_extract(payload, '$.callId') = ? ORDER BY expires_at DESC LIMIT 1").get(n,t,o);return i?O.parse(JSON.parse(String(i.payload))):null}retainConsultationRequest(n){let t=O.parse(n);return this.transaction(()=>{let o=this.consultationRequest(t.installationId,t.operationId);if(o){if(E(o)!==E(t))throw new Error("tool_learning_consultation_identity_conflict");return o}let i=this.installation(t.installationId);if(!i?.enabled||i.teamId!==t.scope.teamId||i.projectId!==t.scope.projectId||!i.policy.purposes.includes("consultation"))throw new Error("tool_learning_consultation_disabled");let a=JSON.stringify(t),l=Buffer.byteLength(a),p=this.retainedUsage(),d=this.retainedUsage(i.id);if(Number(p.count)>=c.queueEvents||Number(d.count)>=i.policy.maximumQueueEvents||Number(d.bytes)+l>i.policy.maximumQueueBytes||Number(p.bytes)+l>c.queueBytes)throw new Error("tool_learning_consultation_capacity_reached");return this.db.prepare("INSERT INTO consultation_requests VALUES (?, ?, ?, ?, ?)").run(t.installationId,t.operationId,a,l,Date.now()+i.policy.maximumQueueAgeSeconds*1e3),t})}retainedUsage(n){let o=`SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM (SELECT installation_id, size_bytes FROM events UNION ALL SELECT installation_id, size_bytes FROM capture_boundaries UNION ALL SELECT installation_id, size_bytes FROM consultation_requests)${n===void 0?"":" WHERE installation_id = ?"}`;return n===void 0?this.db.prepare(o).get():this.db.prepare(o).get(n)}expireCaptureBoundaries(n=Date.now()){this.db.prepare("DELETE FROM capture_boundaries WHERE expires_at <= ?").run(n)}installation(n){let t=this.db.prepare("SELECT payload FROM installations WHERE id = ?").get(n);return t?de.parse(JSON.parse(String(t.payload))):null}installations(){return this.db.prepare("SELECT payload FROM installations ORDER BY id").all().map(n=>de.parse(JSON.parse(String(n.payload))))}configure(n){let t=de.parse(n);return this.transaction(()=>{let o=this.installation(t.id);if(o&&["teamId","projectId","client","workspaceRoot"].some(i=>o[i]!==t[i]))throw new Error("tool_learning_installation_scope_immutable");if(o&&(t.policy.revision<o.policy.revision||t.policy.revision===o.policy.revision&&E(t.policy)!==E(o.policy)))throw new Error("tool_learning_capture_policy_revision_conflict");this.db.prepare("INSERT INTO installations VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET payload = excluded.payload").run(t.id,JSON.stringify(t))}),t}append(n,t=Date.now()){let o=R.parse(n),i=JSON.stringify(o),a=Buffer.byteLength(i);return this.transaction(()=>{let l=this.installation(o.installationId);if(!l?.enabled)return"disabled";let p=l.policy;if(!p.purposes.includes("capture"))return"disabled";le(o,p);let d=this.db.prepare("SELECT content_hash, installation_id FROM events WHERE id = ?").get(o.eventId);if(d){if(d.content_hash!==o.contentHash||d.installation_id!==o.installationId)throw new Error("tool_learning_event_identity_conflict");return"already_retained"}this.db.prepare("INSERT INTO counters(installation_id) VALUES (?) ON CONFLICT DO NOTHING").run(l.id);let I=t-p.maximumQueueAgeSeconds*1e3,f=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(l.id,I).changes;if(this.db.prepare("UPDATE counters SET expired = expired + ? WHERE installation_id = ?").run(f,l.id),Date.parse(o.occurredAt)<I||Date.parse(o.occurredAt)>t+3e5)return this.db.prepare("UPDATE counters SET expired = expired + 1 WHERE installation_id = ?").run(l.id),"expired";let r=this.retainedUsage(),m=this.retainedUsage(l.id),_=this.db.prepare("SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ? AND episode_id = ?").get(l.id,o.episodeId);return Number(r.count)>=c.queueEvents||Number(r.bytes)+a>c.queueBytes||Number(m.count)>=p.maximumQueueEvents||Number(m.bytes)+a>p.maximumQueueBytes||Number(_.count)>=p.maximumEpisodeEvents||Number(_.bytes)+a>p.maximumEpisodeBytes?(this.db.prepare("UPDATE counters SET dropped = dropped + 1 WHERE installation_id = ?").run(l.id),"queue_full"):(this.db.prepare("INSERT INTO events VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(o.eventId,l.id,o.episodeId,o.sanitization.policyHash,o.contentHash,i,a,t),"retained")})}pending(n,t=c.eventsPerAppend){if(!Number.isInteger(t)||t<1||t>c.eventsPerAppend)throw new Error("tool_learning_queue_page_limit");this.expire(n);let o=this.installation(n);return!o?.enabled||!o.policy.purposes.includes("capture")?[]:this.db.prepare("SELECT payload FROM events WHERE installation_id = ? AND policy_hash = ? ORDER BY received_at, id LIMIT ?").all(n,E(o.policy),t).map(i=>R.parse(JSON.parse(String(i.payload))))}acknowledge(n,t){if(t.length>c.eventsPerAppend)throw new Error("tool_learning_ack_limit");this.transaction(()=>{for(let o of t){let i=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND id = ? AND content_hash = ?").run(n,o.eventId,o.contentHash);o.state==="privacy_rejected"&&Number(i.changes)>0&&this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + excluded.dropped").run(n,i.changes)}})}status(n){this.expire(n);let t=this.installation(n),o=this.db.prepare("SELECT COUNT(*) AS events, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ?").get(n),i=this.db.prepare("SELECT dropped, expired FROM counters WHERE installation_id = ?").get(n),a=t?.enabled&&t.policy.purposes.includes("capture")?Number(this.db.prepare("SELECT COUNT(*) AS count FROM events WHERE installation_id = ? AND policy_hash = ?").get(n,E(t.policy)).count):0;return{pendingEvents:Number(o.events),pendingBytes:Number(o.bytes),droppedEvents:Number(i?.dropped??0),expiredEvents:Number(i?.expired??0),blockedByPolicyEvents:Number(o.events)-a}}transaction(n){this.db.exec("BEGIN IMMEDIATE");try{let t=n();return this.db.exec("COMMIT"),t}catch(t){throw this.db.exec("ROLLBACK"),t}}expire(n){let t=this.installation(n);t&&this.transaction(()=>{let o=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(n,Date.now()-t.policy.maximumQueueAgeSeconds*1e3).changes;this.db.prepare("INSERT INTO counters(installation_id, expired) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET expired = expired + excluded.expired").run(n,o)})}};var pe=e.object({state:e.enum(["incomplete","ambiguous","awaiting_owner_review"]),issues:e.array(e.enum(["missing_attempt","missing_observation","completion_not_observed","conflicting_observations","reference_mismatch","lineage_mismatch","mixed_scope","conflicting_event"])).max(8),groups:e.array(e.object({key:g,application:e.string().min(1).max(200),applicationVersion:e.string().min(1).max(200),tool:e.object({name:e.string().min(1).max(200),version:e.string().max(200).nullable(),server:e.string().max(200).nullable()}).strict(),environmentFingerprints:e.array(g).max(c.eventsPerEpisode),attempts:e.array(h).max(c.eventsPerEpisode)}).strict()).max(c.eventsPerEpisode)}).strict();function nt(n){let t=e.array(R).max(c.eventsPerEpisode).parse(n),o=new Set,i=new Set,a=new Map,l=t[0];for(let r of t){l&&(r.installationId!==l.installationId||r.episodeId!==l.episodeId)&&i.add("mixed_scope"),r.parentSessionId===r.sessionId&&i.add("lineage_mismatch");let m=a.get(r.eventId);m&&m.contentHash!==r.contentHash?i.add("conflicting_event"):a.set(r.eventId,r)}let p=[...a.values()].filter(r=>r.eventKind==="attempt"),d=new Map,I=new Map;p.length||o.add("missing_attempt");for(let r of a.values()){if(r.eventKind!=="observation")continue;let m=a.get(r.payload.attempt.id);m?m.eventKind!=="attempt"||m.contentHash!==r.payload.attempt.contentHash||m.payload.actionHash!==r.payload.actionHash?i.add("reference_mismatch"):(m.sessionId!==r.sessionId||m.callId!==r.callId||m.parentSessionId&&r.parentSessionId&&m.parentSessionId!==r.parentSessionId||m.turnId&&r.turnId&&m.turnId!==r.turnId)&&i.add("lineage_mismatch"):o.add("missing_attempt");let _=d.get(r.payload.attempt.id)??[];_.push(r),d.set(r.payload.attempt.id,_)}let f=new Map;for(let r of p){let m=JSON.stringify([r.sessionId,r.callId]),_=I.get(m);_&&_!==r.contentHash&&i.add("lineage_mismatch"),I.set(m,r.contentHash);let v=d.get(r.eventId)??[];if(!v.length)o.add("missing_observation");else{let N=v.filter(A=>A.payload.outcome!=="incomplete");N.length||o.add("completion_not_observed"),new Set(N.map(A=>L(A.payload))).size>1&&i.add("conflicting_observations")}let{environment:S,tool:b}=r.payload,U=L([S.application,S.version,b.name,b.version,b.server]),D=f.get(U)??{application:S.application,applicationVersion:S.version,tool:b,fingerprints:new Set,attempts:[]};D.fingerprints.add(S.fingerprint),D.attempts.push({id:r.eventId,contentHash:r.contentHash}),f.set(U,D)}return pe.parse({state:i.size?"ambiguous":o.size?"incomplete":"awaiting_owner_review",issues:[...new Set([...i,...o])].sort(),groups:[...f].sort(([r],[m])=>r.localeCompare(m)).map(([r,m])=>({key:r,application:m.application,applicationVersion:m.applicationVersion,tool:m.tool,environmentFingerprints:[...m.fingerprints].sort(),attempts:m.attempts.sort((_,v)=>_.id.localeCompare(v.id))}))})}u(nt,"assembleToolLearningEpisode");var ot=e.object({installation:H,apiKey:oe}).strict(),it=e.object({items:e.array(H).max(30),nextCursor:s.nullable()}).strict(),at=e.object({installationId:s,scope:C,items:e.array(e.object({episodeId:s,eventCount:e.number().int().positive(),lastReceivedAt:e.iso.datetime()}).strict()).max(30),nextCursor:s.nullable(),learningEnrollment:e.literal(!1)}).strict(),st=e.object({installationId:s,episodeId:s,scope:C,events:e.array(R).max(c.eventsPerEpisode),state:pe.shape.state,assembly:pe,verificationAuthority:e.literal("not_granted"),learningEnrollment:e.literal(!1)}).strict(),rt=e.object({operationId:s,expectedRevision:e.number().int().positive()}).strict(),lt=e.object({installationId:s,operationId:s,purgedEvents:e.number().int().nonnegative(),learningEnrollment:e.literal(!1)}).strict(),ue=T(e.object({registration:we,credential:e.object({apiKey:oe,expiresAt:e.iso.datetime()}).strict()}).strict(),c.eventBytes),ct=T(e.object({operationId:s,expectedRevision:e.number().int().positive(),episodeId:s,failure:h,recovery:h,taskDefinition:W,familyKey:s,split:e.literal("train"),proposedTarget:se,saveToPrivateDataset:e.literal(!0),targetApproval:e.literal("pending_owner_review")}).strict(),c.eventBytes),dt=T(e.object({installationId:s,projectId:s,operationId:s,source:W,evidence:W,originHash:e.string().regex(/^[a-f0-9]{64}$/),requestHash:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),targetApproval:e.literal("pending_owner_review"),learningEnrollment:e.literal(!1)}).strict(),c.eventBytes),Ue=T(e.object({operationId:s,expectedRevision:e.number().int().nonnegative(),state:e.enum(["enabled","disabled"]),modelId:s,qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),evaluationRunId:s}).strict(),e.object({kind:e.literal("learned"),evaluationRunId:s,baselineRunId:s,trainingRunId:s}).strict()]),capabilities:e.array(Z.omit({qualification:!0})).min(1).max(16),limits:e.object({maxOutputTokens:e.number().int().min(128).max(2048),maximumCallUsd:e.number().positive().max(1),maximumDayUsd:e.number().positive().max(10),maximumSessionCalls:e.number().int().min(1).max(20),maximumDayCalls:e.number().int().min(1).max(200)}).strict()}).strict(),c.eventBytes),pt=T(e.object({installationId:s,scope:e.object({teamId:s,projectId:s}).strict(),revision:e.number().int().positive(),operationId:s,requestHash:e.string().regex(/^[a-f0-9]{64}$/),configuration:Ue,modelRelease:h,policySystemPrompt:e.string().min(1).max(16384),capabilities:e.array(Z).max(16),updatedAt:e.iso.datetime()}).strict(),c.eventBytes);var q=class extends Error{static{u(this,"OpenPondToolLearningError")}constructor(n,t){super(`Tool learning request failed (${n}): ${t}`),this.status=n,this.code=t,this.name="OpenPondToolLearningError"}status;code},De=class{static{u(this,"OpenPondToolLearningClient")}#o;#e;constructor(n){this.#e={...n};let t=new URL(n.baseUrl);if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash||!n.apiKey.trim()||!n.teamId.trim()||!n.projectId.trim())throw new Error("tool_learning_client_scope_required");this.#o=t.toString().replace(/\/+$/,"")}async register(n,t){let o=ue.parse(n);if(o.registration.projectId!==this.#e.projectId)throw new Error("tool_learning_project_mismatch");let i=ot.parse(await this.#t("installations","POST",o,t));if(this.#n(i.installation,o.registration.installationId),i.apiKey!==o.credential.apiKey)throw new Error("tool_learning_credential_mismatch");let a=i.installation;if(a.client!==o.registration.client||a.clientVersion!==o.registration.clientVersion||a.machineSourceId!==o.registration.machineSourceId||L(a.adapterRelease)!==L(o.registration.adapterRelease)||L(a.collectionPolicy)!==L(o.registration.collectionPolicy)||a.collectionPolicyHash!==L(o.registration.collectionPolicy)||a.credential?.expiresAt!==o.credential.expiresAt)throw new Error("tool_learning_registration_receipt_mismatch");return i}async installation(n,t){let o=H.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"GET",void 0,t));return this.#n(o,n),o}async installations(n,t){let o=it.parse(await this.#t(`installations?projectId=${encodeURIComponent(this.#e.projectId)}${n?`&after=${encodeURIComponent(n)}`:""}`,"GET",void 0,t));for(let i of o.items)this.#n(i,i.id);if(o.nextCursor!==null&&o.nextCursor!==o.items.at(-1)?.id)throw new Error("tool_learning_installation_cursor_mismatch");return o}async episodes(n,t,o){let i=at.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes${t?`?after=${encodeURIComponent(t)}`:""}`,"GET",void 0,o));if(i.installationId!==n||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.nextCursor!==null&&i.nextCursor!==i.items.at(-1)?.episodeId)throw new Error("tool_learning_episode_page_mismatch");return i}async episode(n,t,o){let i=st.parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes/${encodeURIComponent(t)}`,"GET",void 0,o));if(i.installationId!==n||i.episodeId!==t||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.events.some(a=>a.installationId!==n||a.episodeId!==t))throw new Error("tool_learning_episode_scope_mismatch");if(i.state!==i.assembly.state||L(nt(i.events))!==L(i.assembly))throw new Error("tool_learning_episode_assembly_mismatch");return i}async purge(n,t,o){let i=rt.parse(t),a=lt.parse(await this.#t(`installations/${encodeURIComponent(n)}/purge`,"POST",i,o));if(a.installationId!==n||a.operationId!==i.operationId)throw new Error("tool_learning_purge_scope_mismatch");return a}async project(n,t,o){let i=ct.parse(t),a=dt.parse(await this.#t(`installations/${encodeURIComponent(n)}/project`,"POST",i,o));if(a.installationId!==n||a.projectId!==this.#e.projectId||a.operationId!==i.operationId||a.requestHash!==L(i))throw new Error("tool_learning_projection_scope_mismatch");return a}async setState(n,t,o){let i=Ne.parse(t),a=H.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"PATCH",i,o));if(this.#n(a,n),a.state!==i.state)throw new Error("tool_learning_state_mismatch");return a}async append(n,t){let o=Se.parse(n),i=Re.parse(await this.#t("episodes","POST",o,t));if(i.operationId!==o.operationId||i.installationId!==o.installationId||i.teamId!==this.#e.teamId||i.projectId!==this.#e.projectId||i.requestHash!==L(o)||i.events.length!==o.events.length||new Set(i.events.map(a=>a.eventId)).size!==i.events.length)throw new Error("tool_learning_append_receipt_mismatch");for(let a of i.events){let l=o.events.find(p=>p.eventId===a.eventId);if(!l||l.contentHash!==a.contentHash)throw new Error("tool_learning_append_event_mismatch")}return i}async routing(n,t){return this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"GET",void 0,t))}async configureRouting(n,t,o){let i=Ue.parse(t),a=this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"POST",i,o));if(a.operationId!==i.operationId||a.requestHash!==L(i)||L(a.configuration)!==L(i))throw new Error("tool_learning_routing_receipt_mismatch");return a}#i(n,t){let o=pt.parse(t);if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_routing_scope_mismatch");return o}async manifest(n,t){let o=Oe.parse(await this.#t(`installations/${encodeURIComponent(n)}/manifest`,"GET",void 0,t));if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_manifest_scope_mismatch");if(Date.parse(o.expiresAt)<=Date.now()||Date.parse(o.issuedAt)>Date.now()+3e4)throw new Error("tool_learning_manifest_expired");return o}async consult(n,t){let o=O.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return re(o,await this.#t("consultations","POST",o,t))}async consultation(n,t){let o=O.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return re(o,await this.#t(`installations/${encodeURIComponent(o.installationId)}/consultations/${encodeURIComponent(o.operationId)}`,"GET",void 0,t))}#n(n,t){if(n.id!==t||n.scope.teamId!==this.#e.teamId||n.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_installation_scope_mismatch")}async#t(n,t,o,i){o!==void 0&&B(o,c.eventBytes*c.eventsPerAppend);let a=AbortSignal.timeout(3e4),l=await(this.#e.fetch??globalThis.fetch)(`${this.#o}/v1/tool-learning/${n}`,{method:t,redirect:"error",signal:i?AbortSignal.any([i,a]):a,headers:{Authorization:`Bearer ${this.#e.apiKey}`,"X-OpenPond-Team-Id":this.#e.teamId,Accept:"application/json",...o===void 0?{}:{"Content-Type":"application/json"}},...o===void 0?{}:{body:JSON.stringify(o)}}),p=await ye(l,c.eventBytes*c.eventsPerAppend,"Tool learning response");if(!l.ok){let d=e.object({code:e.string().regex(/^[a-z0-9_]+$/).max(200)}).passthrough().safeParse(p);throw new q(l.status,d.success?d.data.code:"tool_learning_request_failed")}return p}};var vn=u(()=>be,"nativeToolLearningClientVersion"),ut=u((n,t)=>typeof n[t]=="string"?n[t].trim():"","optionString"),Be=e.object({schemaVersion:e.literal("openpond.toolLearningLocalCredential.v1"),apiOrigin:e.string().url().refine(n=>new URL(n).origin===n),teamId:s,projectId:s,ownerAccount:e.string().nullable(),workspaceRoot:e.string().min(1),locallyEnabled:e.boolean(),environment:j.nullable().default(null),prepared:ue,installation:H.nullable()}).strict(),Tn=u(n=>ve({home:ut(n,"home")||void 0}),"toolLearningHome"),Pe=u(n=>`tool-learning:installation:${s.parse(n)}`,"toolLearningCredentialId");async function k(n,t){let o=await Ee(n,Pe(t));if(!o)throw new Error("Tool learning installation is not configured in this OpenPond home.");let i=Be.parse(o.value);if(i.prepared.registration.installationId!==t||i.prepared.registration.projectId!==i.projectId)throw new Error("Tool learning credential scope does not match its installation.");return{...o,value:i}}u(k,"loadToolLearningCredential");async function qe(n,t,o){let i=Be.parse(t);return Te(n,Pe(i.prepared.registration.installationId),i,o)}u(qe,"saveToolLearningCredential");function G(n){return new De({baseUrl:n.apiOrigin,apiKey:n.prepared.credential.apiKey,teamId:n.teamId,projectId:n.projectId})}u(G,"toolLearningProducer");function F(n,t,o){let i=t.prepared.registration;if(!["openpond","claude_code","opencode","codex"].includes(i.client))throw new Error("This client has not been qualified for installation.");return n.configure({schemaVersion:"openpond.localToolLearningInstallation.v1",id:i.installationId,teamId:t.teamId,projectId:t.projectId,client:i.client,workspaceRoot:t.workspaceRoot,enabled:t.locallyEnabled&&o?.state==="enabled",policy:i.collectionPolicy,createdAt:o?.createdAt??new Date().toISOString()})}u(F,"configureLocalToolLearning");async function ee(n,t,o,i){let a=G(o),l=o.prepared.registration.installationId;if(!o.locallyEnabled)return F(t,o,null),{installationId:l,deliveredEvents:0,rejectedEvents:0,local:t.status(l),learningEnrollment:!1};let p=u(async()=>{F(t,o,null);let r=await k(n,l);r.value.locallyEnabled&&await qe(n,{...r.value,locallyEnabled:!1},r.revision)},"suspend"),d;try{d=await a.installation(l,i)}catch(r){throw r instanceof q&&[401,403].includes(r.status)&&await p(),r}if(d.state!=="enabled"&&await p(),d.collectionPolicyHash!==E(o.prepared.registration.collectionPolicy))throw await p(),new Error("Tool learning collection policy changed. Reconfigure this installation before uploading.");F(t,o,d);let I=0,f=0;for(let r=0;r<16;r++){let m=t.pending(l);if(!m.length)break;let _=await a.append({schemaVersion:"openpond.toolEpisodeAppend.v1",installationId:l,operationId:`tool-append-${y([l,m.map(v=>[v.eventId,v.contentHash])])}`,events:m},i).catch(async v=>{throw v instanceof q&&[401,403].includes(v.status)&&await p(),v});t.acknowledge(l,_.events),I+=_.events.filter(v=>v.state!=="privacy_rejected").length,f+=_.events.filter(v=>v.state==="privacy_rejected").length}return{installationId:l,deliveredEvents:I,rejectedEvents:f,local:t.status(l),learningEnrollment:!1}}u(ee,"flushToolLearning");import{realpath as mt}from"node:fs/promises";function ht(n,t){let o=Buffer.from(n),i=Math.min(o.length,t);for(;i<o.length&&(o[i]&192)===128;)i--;return o.subarray(0,i).toString("utf8")}u(ht,"boundedExcerpt");function ke(n){try{B(n,32768)}catch{return!0}let t=JSON.stringify(n);if(/(?:^|[\s/\\'"=])\.env(?:[.\s/\\'";]|$)/u.test(t))return!0;let o=J(t);return o.secretStatus!=="passed"||o.piiStatus!=="passed"}u(ke,"privatePayload");async function Bn(n,t){let o=await mt(t.workspaceRoot),i=new X(n),a=[],l=AbortSignal.timeout(2e3);try{let p=i.installations().filter(d=>d.enabled&&d.client===t.client&&d.workspaceRoot===o&&(!t.installationId||d.id===t.installationId)&&d.policy.permittedTools.includes(t.tool));for(let d of p){let I=await k(n,d.id),f=I.value;if(!f.locallyEnabled||f.prepared.registration.clientVersion!==t.clientVersion||f.workspaceRoot!==o||f.installation?.state!=="enabled"||t.accountScope&&(f.apiOrigin!==t.accountScope.apiOrigin||f.ownerAccount!==t.accountScope.accountHandle||f.installation.ownerUserId!==t.accountScope.ownerUserId||t.accountScope.teamId&&t.accountScope.teamId!==f.teamId))continue;F(i,f,f.installation);let r=d.policy,m=y(r);if(!r.purposes.includes("capture")||!r.workspaceRootHashes.includes(y(o)))continue;let _=u(ne=>r.permittedFields.includes(ne),"permits"),v=`tool-boundary-${y([d.id,t.sessionId,t.callId,t.phase])}`,S={schemaVersion:"openpond.toolEpisodeEvent.v1",operationId:v,installationId:d.id,episodeId:`tool-episode-${y([d.id,t.sessionId,t.callId])}`,eventId:v,sessionId:t.sessionId,parentSessionId:t.parentSessionId??null,turnId:t.turnId??null,callId:t.callId,occurredAt:new Date().toISOString(),sequence:t.phase==="attempt"?0:1,adapterVersion:f.prepared.registration.adapterRelease.id,sanitization:{policyRevision:r.revision,policyHash:m,redactedFields:0,omittedFields:0,truncated:!1}};if(t.phase==="attempt"){if(!_("action"))continue;let ne=t.invalidArguments===void 0?{kind:"tool_arguments",arguments:t.arguments}:{kind:"tool_arguments",arguments:{invalidArguments:t.invalidArguments}},me=P.safeParse(ne);if(!me.success){i.recordDropped(d.id);continue}let he=me.data,ge=t.environment??f.environment??{application:t.tool,version:t.clientVersion,state:{workspaceRootHash:y(o)},fingerprint:y([t.tool,t.clientVersion,o])},Me=j.parse(_("state")?ge:{...ge,state:{}}),fe={intent:_("intent")?t.intent??"":"",tool:{name:t.tool,version:t.clientVersion,server:null},action:he,actionHash:y(he),environment:Me,contextAssets:[],selection:{kind:"eligible_attempt"}};if(ke(fe)){i.recordDropped(d.id);continue}let _e=i.retainCaptureBoundary(ae({...S,eventKind:"attempt",payload:fe}));_e&&a.push({installationId:d.id,event:_e});continue}let b=i.captureBoundary(d.id,t.sessionId,t.callId,"attempt");if(!b||b.eventKind!=="attempt"||!t.result)continue;let U=r.unchangedControls;if(!(t.result.outcome!=="succeeded"||i.hasRecoveryCandidateContext(d.id,t.sessionId)||parseInt(y([d.id,t.sessionId,t.callId]).slice(0,8),16)/4294967296<U.numerator/U.denominator))continue;if((!t.result.text||Buffer.byteLength(t.result.text)>8192)&&Buffer.byteLength(t.result.text)>8192){i.recordDropped(d.id);continue}let N={attempt:{id:b.eventId,contentHash:b.contentHash},actionHash:b.payload.actionHash,execution:t.result.execution,sideEffects:t.result.sideEffects,resultExcerpt:_("result_excerpt")?t.result.text:"",resultHash:_("result_excerpt")?y(t.result.text):null,assets:[]},A=t.result.outcome==="succeeded"?{...N,outcome:"succeeded",exitCode:t.result.exitCode??null}:t.result.outcome==="incomplete"?{...N,outcome:"incomplete",reason:"completion_not_observed"}:{...N,outcome:"failed",classification:t.result.classification??"unknown_failure",errorCode:t.result.classification??"unknown_failure",message:_("result_excerpt")?ht(t.result.text,2e3):"",exitCode:t.result.exitCode??null};if(ke(A)){i.recordDropped(d.id);continue}let te=i.retainCaptureBoundary(ae({...S,episodeId:b.episodeId,eventKind:"observation",payload:A}));if(te){i.append(b),i.append(te),a.push({installationId:d.id,event:te});try{await ee(n,i,f,l)}catch{}}}return a.map(d=>({installationId:d.installationId,eventId:d.event.eventId,contentHash:d.event.contentHash}))}finally{i.close()}}u(Bn,"captureLocalToolBoundary");var gt=e.object({sessionId:e.string().min(1).max(200),failedCallId:e.string().min(1).max(200),capabilityId:e.string().min(1).max(200),intent:e.string().max(2e3)}).strict();async function Xn(n,t,o,i){let a=gt.parse(o),{value:l}=await k(n,t);if(!l.locallyEnabled||l.installation?.state!=="enabled")throw new Error("tool_learning_consultation_disabled");let p=new X(n);try{F(p,l,l.installation);let d=p.captureBoundary(t,a.sessionId,a.failedCallId,"attempt"),I=p.captureBoundary(t,a.sessionId,a.failedCallId,"observation");if(!d||d.eventKind!=="attempt"||!I||I.eventKind!=="observation"||I.payload.outcome!=="failed")throw new Error("tool_learning_observed_failure_required");let f=J(a.intent);if(f.secretStatus!=="passed"||f.piiStatus!=="passed")throw new Error("tool_learning_consultation_privacy_blocked");let r=G(l),m={message:I.payload.message,observation:{id:I.eventId,contentHash:I.contentHash}},_=y({intent:a.intent,environment:d.payload.environment,failure:m}),v=p.consultationForCall(t,a.sessionId,a.failedCallId);if(v){let N=v.operationId;if(v.contextHash!==_||v.capabilityId!==a.capabilityId)return{operationId:N,response:{state:"unavailable",reason:"failure_already_submitted"},recovery:"Read the original consultation with openpond_consult_status. Changing context or capability does not authorize another paid call."};try{return{operationId:N,response:await r.consultation(v,i)}}catch(A){if(!(A instanceof q)||A.status!==404||A.code!=="tool_learning_consultation_not_found")throw A;return Fe(r,v,i)}}let S=await r.manifest(t,i),b=S.capabilities.find(N=>N.id===a.capabilityId);if(!b||b.application!==d.payload.environment.application||!b.versions.includes(d.payload.environment.version)||!b.tools.includes(d.payload.tool.name))throw new Error("tool_learning_consultation_scope_unsupported");let U=`tool-consult-${y([t,a.sessionId,a.failedCallId,a.capabilityId,d.payload.actionHash,_,S.modelRelease])}`,D=O.parse({schemaVersion:"openpond.toolLearningConsultation.v1",operationId:U,installationId:t,scope:S.scope,sessionId:a.sessionId,callId:a.failedCallId,capabilityId:a.capabilityId,manifestHash:S.contentHash,modelRelease:S.modelRelease,mode:"recovery",intent:a.intent,action:d.payload.action,actionHash:d.payload.actionHash,environment:d.payload.environment,contextHash:_,failure:m,round:1});return p.retainConsultationRequest(D),await ee(n,p,l,i),Fe(r,D,i)}finally{p.close()}}u(Xn,"consultLocalToolLearning");async function Gn(n,t,o,i){let{value:a}=await k(n,t);if(!a.locallyEnabled)throw new Error("tool_learning_consultation_disabled");let l=new X(n);try{let p=l.consultationRequest(t,o);if(!p)throw new Error("tool_learning_consultation_request_not_retained");return{operationId:o,response:await G(a).consultation(p,i)}}finally{l.close()}}u(Gn,"readLocalToolConsultation");async function Fe(n,t,o){try{return{operationId:t.operationId,response:await n.consult(t,o)}}catch(i){let a=i instanceof q&&i.status>=400&&i.status<500&&i.status!==408;return{operationId:t.operationId,response:{state:"unavailable",reason:a?i.code:"dispatch_uncertain"},recovery:a?"Resolve the reported admission error. Keep this original operation ID; do not create a replacement paid request.":"Use openpond_consult_status with this operationId; do not create a replacement request."}}}u(Fe,"submitLocalToolConsultation");export{c as a,s as b,g as c,h as d,C as e,T as f,j as g,R as h,Se as i,Re as j,we as k,H as l,Ne as m,Z as n,Oe as o,O as p,se as q,re as r,X as s,De as t,vn as u,Be as v,Tn as w,Pe as x,k as y,qe as z,G as A,F as B,ee as C,Bn as D,gt as E,Xn as F,Gn as G};
@@ -0,0 +1,23 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{A as He,C as K,D as J,E as O,G as Me,N as je,O as z,P as L,S as ae,U as Fe,W as re,X as E,Y as _e,Z as G,_ as C,a as Q,b as me,c as Z,h as se,i as Re,j as Se,k as xe,l as De,p as Pe,r as Ee,s as q,t as B,y as Ae,z as Ie}from"./chunk-KU4TPDPH.js";import{d as ye}from"./chunk-I6VMRQF4.js";import{ha as we,ja as be}from"./chunk-D6L6UNUQ.js";import{L as H,M as te,N as _,Q as Te,o as ve}from"./chunk-4PUOWSDE.js";import{ga as ee,v as ue}from"./chunk-ZY32SZ2P.js";import{i as Y,l as F,m as W,n as i}from"./chunk-RCT3O3HQ.js";import{A as x}from"./chunk-X2J2P5ZT.js";import{a as f}from"./chunk-FTQLQJQV.js";var Xe=new Set(["taskset.json","capabilities.json","data/tasks.jsonl","tasks/tasks.jsonl","graders/graders.json","fixtures/grader-fixtures.json","metrics/policy.json","assets/manifest.json","environment/contract.json","environment/taskset.ts","rubrics/preference-review.md","comparisons/policy.json"]);function oe(t){return Xe.has(B.parse(t))}f(oe,"isManagedTasksetDraftFilePath");function Be(t){let e=z(t.source),s=z(t.edited),o=t.preparation;if(o.authoringGraph!=="bound"||!e.modelResources||e.learningResources||s.modelResources||s.learningResources)throw new Error("Bound task editing requires its source Reward and an ordinary edited workspace.");if(e.contentHash!==o.sourcePackageHash||!te(H(e.taskset),o.sourceTasksetRef))throw new Error("Bound draft differs from its retained source package.");let n=f(k=>k.taskset.graders.map(S=>S.kind==="custom_verifier"?{...S,exportName:S.exportName??"verify"}:S),"normalizedGraders");if(i(n(e))!==i(n(s)))throw new Error("Edit the saved Reward in Rewards before changing this Taskset's graders.");let c=e.modelResources,v=new Map(c.assets.map(k=>[k.id,k])),a=J(s),h=J(e),p=f(k=>{let{id:S,revision:fe,contentHash:le,metadata:pe,...Je}=k,{javascriptEnvironment:nt,...ge}=pe;return{...Je,metadata:{...ge,resources:ge.resources??[]}}},"environmentContent"),m=f(k=>{if(!k)return null;let{id:S,revision:fe,contentHash:le,...pe}=k.execution.javascript;return pe},"javascriptContent"),y=i(p(e.environment))===i(p(s.environment))&&i(m(h))===i(m(a)),D=y?e.environment:s.environment,u=y?h:a,b=new Set([...c.assets.map(k=>k.id),...s.taskset.tasks.flatMap(k=>k.privilegedContextRef?[k.privilegedContextRef]:[]),...[s.environment.actionSchemaRef,s.environment.observationSchemaRef,s.environment.stateSchemaRef].flatMap(k=>k?[k.id]:[]),...a?.assets.map(k=>k.id)??[]]),M=new Set([...b,...s.taskset.tasks.flatMap(k=>[...k.artifactRefs.map(S=>S.id),...(k.requiredOutputs??[]).flatMap(S=>S.schemaRef?[S.schemaRef.id]:[])])]),A=Ye(e,s,M);for(let k of b){let S=A.find(le=>le.asset.id===k);if(!S)throw new Error(`Bound Taskset asset is missing: ${k}.`);let fe=new TextDecoder("utf-8",{fatal:!0}).decode(K(S));v.set(k,Te.parse(_({schemaVersion:"openpond.learningTextAsset.v1",id:k,revision:1,asset:S.asset,text:fe})))}let R=je(s),{contentHash:$,...T}=c.taskDefinition,{policy:V,environment:ie,environmentRelease:N,tools:r,capabilities:d,verifierSetRelease:g}=s.taskset,l=ve.parse(_({...T,instructions:R,execution:{policy:V,environment:ie,environmentRelease:N,tools:r,capabilities:d,verifierSetRelease:g}})),{contentHash:w,...P}=s.taskset,j=ee.parse(_({...P,tasks:s.taskset.tasks.map(k=>c.instructionMode==="per_task"?k:{...k,policyVisibleContext:{...k.policyVisibleContext,instructions:R}})})),I=De({owner:o.lineage.owner,source:{...c,taskset:e.taskset,executionResources:{environment:e.environment,verifierSet:e.verifierSet}},rewardBinding:c.rewardBinding,rewards:c.rewards,assets:[...v.values()],edits:{taskset:j,taskDefinition:l,executionResources:{environment:D,verifierSet:s.verifierSet},...u?{execution:u.execution}:{}}}),U=Se.parse(I.taskset.metadata.modelTasksetDerivation);if(I.taskset.id!==o.tasksetId||I.taskset.revision!==o.tasksetRevision||i({...U,schemaVersion:o.lineage.schemaVersion})!==i(o.lineage))throw new Error("Bound draft differs from its retained ownership lineage.");let{taskset:ce,executionResources:de,...Ke}=I;return L({schemaVersion:"openpond.tasksetPackage.v1",taskset:ce,...de,modelResources:Ke,files:A})}f(Be,"publishBoundModelTasksetDraftPackage");function Ye(t,e,s){let o=e.files,n=new Map(t.files.map(a=>[a.asset.id,{file:a,assetHash:i(a.asset)}])),c=f(a=>{let h=n.get(a.asset.id);return h!==void 0&&h.file.base64===a.base64&&h.assetHash===i(a.asset)},"isSourceFile"),v=t.files.filter(a=>oe(a.asset.path)).map(a=>{let h=`source-artifact-${i({packageHash:t.contentHash,assetId:a.asset.id})}`;return{original:a,asset:{...a.asset,id:h,path:`source-artifacts/${t.contentHash}/${i(a.asset.path)}/${a.asset.path.split("/").at(-1)}`}}});for(let{original:a,asset:h}of v){let p=v.filter(u=>i({...u.original.asset,id:a.asset.id})===i(a.asset)),y=e.files.find(u=>u.asset.id===h.id)??p.flatMap(u=>e.files.filter(b=>i(b.asset)===i(u.asset)))[0];if(!y||y.base64!==a.base64||!p.some(u=>i(u.asset)===i(y.asset)))throw new Error(`Retained Taskset source artifact differs from its original bytes: ${a.asset.id}.`);let D=o.filter(u=>u.asset.path===a.asset.path||u.asset.id===a.asset.id);if(D.some(u=>u.asset.path!==a.asset.path||u.asset.id!==a.asset.id&&u.asset.id!==`taskset-file-${i(a.asset.path)}`&&!c(u)))throw new Error(`Retained Taskset source artifact conflicts with an authored file: ${a.asset.id}.`);o=[...o.filter(u=>u.asset.id!==h.id&&u.asset.id!==a.asset.id&&(!D.includes(u)||c(u))),a]}for(let a of t.files.filter(h=>!o.some(p=>p.asset.id===h.asset.id))){if(a.asset.path==="environment/execution.json"){let m=se.safeParse(JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(K(a))));if(m.success&&i(O(m.data))===i(a))continue}let h=o.filter(m=>m.asset.path===a.asset.path),p=f(m=>i({...m.asset,id:a.asset.id})===i(a.asset)&&m.base64===a.base64,"sameEnvelope");if(s.has(a.asset.id)||!h.length||h.some(m=>!p(m)))throw new Error(`Retained Taskset source alias differs from its original bytes: ${a.asset.id}.`);o=[...o,a]}return o}f(Ye,"retainSourceFileIdentities");function Mt(t){let e=Ee.parse(t.request),s=Pe.parse(t.owner),o=z(t.source);if(o.learningResources)throw new Error("Reviewed Tasksets require their reviewed authoring workflow.");if(o.contentHash!==e.sourcePackageHash)throw new Error("Taskset draft source package changed.");if(o.modelResources){let h=xe({owner:s,source:{...o.modelResources,taskset:o.taskset,executionResources:{environment:o.environment,verifierSet:o.verifierSet}},rewardBinding:o.modelResources.rewardBinding,rewards:o.modelResources.rewards,assets:o.modelResources.assets}),p=h.taskset.metadata.modelTasksetDerivation;return q.parse({schemaVersion:"openpond.modelTasksetDraftPreparation.v1",draftId:`model-taskset-draft-${i({owner:s,operationId:e.operationId})}`,requestHash:i(e),sourcePackageHash:o.contentHash,sourceTasksetRef:H(o.taskset),tasksetId:h.taskset.id,tasksetRevision:h.taskset.revision,lineage:{...p,schemaVersion:"openpond.modelTasksetAuthoring.v1"},authoringGraph:"bound"})}let n=Ie(o.taskset),c=n&&i(n.owner)===i(s),v=c?n.root:H(o.taskset),a={schemaVersion:"openpond.modelTasksetAuthoring.v1",owner:s,root:v,parent:H(o.taskset)};return q.parse({schemaVersion:"openpond.modelTasksetDraftPreparation.v1",draftId:`model-taskset-draft-${i({owner:s,operationId:e.operationId})}`,requestHash:i(e),sourcePackageHash:o.contentHash,sourceTasksetRef:H(o.taskset),tasksetId:Ae(a),tasksetRevision:c?o.taskset.revision+1:1,lineage:a})}f(Mt,"prepareModelTasksetDraft");function Ce(t){let e=q.parse(t.preparation);if(!te(e.sourceTasksetRef,e.lineage.parent))throw new Error("Taskset draft preparation differs from its source lineage.");if(e.authoringGraph==="bound"){if(!t.source)throw new Error("Bound Taskset authoring requires its retained source package.");return Be({preparation:e,source:t.source,edited:t.edited})}let s=Qe(t.edited),{contentHash:o,...n}=s.verifierSet,c=be({...n,id:`${e.tasksetId}-verifiers`,revision:e.tasksetRevision,calibrationReceiptRefs:[],metadata:{sourceVerifierSet:H(s.verifierSet)}}),{contentHash:v,...a}=s.taskset,h=ee.parse(_({...a,id:e.tasksetId,revision:e.tasksetRevision,verifierSetRelease:{id:c.id,contentHash:c.contentHash},metadata:{modelTasksetAuthoring:e.lineage,...s.taskset.metadata.environmentResources===void 0?{}:{environmentResources:s.taskset.metadata.environmentResources},...s.taskset.metadata.ordinaryAuthoring===void 0?{}:{ordinaryAuthoring:s.taskset.metadata.ordinaryAuthoring}}})),p=J(s),m=p?[...s.files.filter(y=>y.asset.id!==Re(s.taskset)),O({...p.execution,verifierSet:c})]:s.files;return L({schemaVersion:"openpond.tasksetPackage.v1",taskset:h,environment:s.environment,verifierSet:c,files:m})}f(Ce,"publishModelTasksetDraftPackage");function Qe(t){let e=z(t);if(e.modelResources||e.learningResources)throw new Error("This Taskset requires its bound or reviewed authoring workflow.");return e}f(Qe,"requireOrdinaryPackage");function $e(t,e,s,o){if(t.environment.entrypoint!=="openpond.javascript-environment.v1")return{taskset:t,inventory:s,generatedFiles:[]};let n="environment/execution.json",c=e.get(n);if(!c||c.length>524288)throw new Error("Authored tool environment requires its bounded private execution declaration.");let v=se.parse(JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(c))),a=f(R=>{if(!R)return null;let $=s.find(T=>T.asset.id===R.id&&T.asset.path===R.path);if(!$)throw new Error(`Authored environment dependency is missing: ${R.id}.`);return $.asset},"repin"),{contentHash:h,...p}=v.javascript,m=ye.parse(_({...p,id:`javascript-${t.id}`,revision:t.revision,module:a(v.javascript.module)}));if(i(m.tools)!==i(t.environment.metadata.portableTools)||i(m.tools.map(R=>R.name))!==i(t.environment.toolNames))throw new Error("Authored environment tools differ from the Taskset's declared tools.");let y=we({schemaVersion:"openpond.environmentRelease.v1",id:`environment-${t.id}`,revision:t.revision,contract:Fe(t),actionSchemaRef:a(v.environment.actionSchemaRef),observationSchemaRef:a(v.environment.observationSchemaRef),stateSchemaRef:a(v.environment.stateSchemaRef),artifactCollection:v.environment.artifactCollection,adapterConformanceHashes:{},metadata:{javascriptEnvironment:H(m),resources:t.environment.resources??[]}}),D=E.parse({...t,environment:{...t.environment,metadata:{...t.environment.metadata,portableExecutionResources:{environment:y}}}}),u=ae({taskset:D,adapterId:o}),b=O({javascript:m,environment:y,verifierSet:u.verifierSetRelease}),M=[...s.filter(R=>R.sourcePath!==n),{asset:b.asset,sourcePath:n}],A=E.parse({...D,metadata:{...D.metadata,portableFileInventory:M}});return{taskset:E.parse({...A,contentHash:G(A)}),inventory:M,generatedFiles:[{path:n,role:"environment",content:new TextDecoder().decode(K(b))}]}}f($e,"prepareAuthoredToolEnvironment");var ne=x.array(x.object({asset:Y,sourcePath:x.string().min(1)}).strict()).max(1e4),Ze=new Set(["taskset.json","capabilities.json","data/tasks.jsonl","graders/graders.json","fixtures/grader-fixtures.json","environment/taskset.ts"]);function We(t){return Ze.has(t)}f(We,"isGeneratedTasksetPublicationFilePath");function Ve(t,e,s,o=He){let n=E.parse(t);for(let r of n.tasks)for(let d of r.requiredOutputs??[])if(Q(d.metadata)&&d.submissionMode!=="structured_json")throw new Error("Sampling schema requires a structured output.");if(n.metadata.taskDefinition!==void 0||n.metadata.rewardBinding!==void 0){for(let r of n.tasks)for(let d of re(r).requiredOutputs??[]){let g=Q(d.metadata);if(!g)continue;let l=re(r).artifactRefs.find(U=>U.id===g.schemaRef.id);if(!l||i(l)!==i(g.schemaRef)||!d.schemaRef)throw new Error("Sampling schema must match an ordinary declared policy artifact.");let w=f((U,ce)=>r.assets?.find(de=>de.id===U)?.artifactRef??ce,"sourcePath"),P=e.get(w(d.schemaRef.id,d.schemaRef.path)),j=e.get(w(l.id,l.path));if(!P||!j)throw new Error("Sampling schema source bytes are missing.");let I=Z(P,d.schemaRef.contentHash);me(I,g,j)}return{taskset:n,generatedFiles:[]}}let c=new Map,v=0;for(let[r,d]of e){if(B.parse(r),v+=d.byteLength,c.size>=1e4||v>o*3/4)throw new Error("Taskset source exceeds the package byte limit.");c.set(r,d.slice())}let a=n.metrics?.customAggregator,h=a?c.get(a.module):void 0;if(a&&!h)throw new Error("Declared Taskset metric module is missing.");let p=a&&h?{...n.metrics,customAggregator:{...a,contentHash:W(h)}}:n.metrics,m=new Map,y=new Set,D=[],u=f((r,d,g,l)=>{let w=c.get(d);if(!w)throw new Error(`Declared Taskset file is missing: ${d}.`);return{id:r,path:d,contentHash:W(w),sizeBytes:w.byteLength,mediaType:g,visibility:l}},"ref"),b=f((r,d=r.path)=>{let g=m.get(r.id);if(g&&i(g)!==i({asset:r,sourcePath:d}))throw new Error(`Conflicting Taskset file identity: ${r.id}.`);let l=c.get(d);if(!l||l.length!==r.sizeBytes||W(l)!==r.contentHash)throw new Error(`Taskset file differs from its declared bytes: ${r.id}.`);m.set(r.id,{asset:r,sourcePath:d}),y.add(d)},"add");for(let r of n.tasks){let d={};for(let l of r.requiredOutputs??[])if(l.submissionMode==="structured_json"){if(!l.schemaRef||l.mediaType!=="application/json")throw new Error("Structured outputs require a JSON schemaRef and application/json.");let w=r.metadata.portableTaskRecord?.requiredOutputs?.find(I=>I.path===l.path)?.schemaRef,P=w?.id===l.schemaRef?w.path:l.schemaRef,j=u(l.schemaRef,P,"application/schema+json","policy");if(w&&w.id===l.schemaRef&&w.visibility!=="policy")throw new Error("Structured output schema must be policy-visible.");Z(c.get(P),j.contentHash),d[l.schemaRef]=j}Object.keys(d).length&&(r.metadata={...r.metadata,outputSchemaRefs:d});let g=re(r);for(let l of g.artifactRefs)b(l,r.assets?.find(w=>w.id===l.id)?.artifactRef??l.path);for(let l of g.requiredOutputs??[])l.schemaRef&&b(l.schemaRef);for(let l of g.requiredOutputs??[]){let w=Q(l.metadata);if(!w)continue;let P=m.get(w.schemaRef.id);if(!P||i(P.asset)!==i(w.schemaRef)||!g.artifactRefs.some(I=>I.id===w.schemaRef.id)||!l.schemaRef)throw new Error("Sampling schema must match an ordinary declared policy artifact.");let j=Z(c.get(m.get(l.schemaRef.id).sourcePath),l.schemaRef.contentHash);me(j,w,c.get(P.sourcePath))}}for(let r of n.environment.resources??[])b(u(r.id,r.path,r.mediaType??"application/octet-stream",r.visibility==="policy_visible"?"policy":"host_private"));let M=n.graders.map(r=>{if(r.kind==="custom_verifier"){let d=u(`verifier-${r.id}`,r.module,"application/javascript","host_private"),g=Y.safeParse(r.metadata.portableVerifierRef);return g.success&&g.data.contentHash===d.contentHash&&g.data.sizeBytes===d.sizeBytes&&(d=g.data),b(d,r.module),{...r,metadata:{...r.metadata,portableVerifierRef:d}}}if(r.kind==="human"||r.kind==="model_judge"){let d=new TextEncoder().encode(r.rubric),g=`graders/rubric-${W(d)}.md`;c.set(g,d);let l=u(`rubric-${r.id}`,g,"text/markdown","verifier"),w=Y.safeParse(r.metadata.portableRubricRef);if(w.success&&w.data.contentHash===l.contentHash&&w.data.sizeBytes===l.sizeBytes){if(w.data.visibility==="policy")throw new Error("A grader rubric cannot become policy-visible.");l=w.data}return b(l,g),D.push({path:g,role:"verifier",content:r.rubric}),{...r,metadata:{...r.metadata,portableRubricRef:l}}}return r});a&&![...m.values()].some(r=>r.asset.path===a.module&&r.sourcePath===a.module&&r.asset.visibility!=="policy")&&b(u(`metric-${i(a.module)}`,a.module,"application/javascript","host_private"));let A=ne.parse(n.metadata.portableFileInventory??[]);for(let r of[...c.keys()].sort())if(!y.has(r)){let d=A.find(g=>g.sourcePath===r&&!m.has(g.asset.id));b(d?{...u(d.asset.id,r,d.asset.mediaType,d.asset.visibility),path:d.asset.path}:u(`taskset-file-${i(r)}`,r,"application/octet-stream","host_private"),r)}let{importedPackageHash:R,derivedPortableMetadata:$,...T}=n.metadata,V={...n.environment.metadata};if(V.portableExecutionResources!==void 0){let r=x.object({environment:x.unknown(),verifierSet:x.unknown().optional()}).parse(V.portableExecutionResources);V.portableExecutionResources={environment:r.environment}}let ie=E.parse({...n,graders:M,metrics:p,environment:{...n.environment,metadata:V},metadata:{...T,...R===void 0?{}:{sourceImportedPackageHash:R},portableFileInventory:ne.parse([...m.values()].sort((r,d)=>r.asset.id.localeCompare(d.asset.id)))}}),N=$e(ie,c,[...m.values()],s);return{taskset:E.parse({...N.taskset,contentHash:G(N.taskset)}),generatedFiles:[...D,...N.generatedFiles]}}f(Ve,"prepareAuthoredTasksetSource");var X=class extends Error{static{f(this,"TasksetDraftPublishError")}issues;constructor(e){super(e.map(s=>s.message).join(`
3
+ `)),this.name="TasksetDraftPublishError",this.issues=e}};function os(t){let e=t.now??new Date().toISOString(),s=t.id?.trim()||`taskset-draft-${globalThis.crypto.randomUUID()}`;return C.parse({schemaVersion:"openpond.tasksetDraft.v1",id:s,revision:1,profileId:t.profileId,modelScope:t.modelScope??null,name:t.name?.trim()??"",objective:"",purpose:"general",benchmark:null,preferenceComparison:null,status:"draft",sourceRefs:[],datasetArtifact:null,policy:{policyVisibleFields:["input"],privilegedFields:["expectedOutput"],hiddenGraderRefs:[],connectedAppScopes:[]},environment:{protocolVersion:"openpond.taskEnvironment.v1",kind:"chat",entrypoint:"openpond-chat-v1",stateful:!1,deterministicSeeds:!0,toolNames:[],lifecycle:["create","reset","step","grade","cleanup"],defaultTimeoutMs:12e4,networkPolicy:"none",resources:[],metadata:{}},output:{mode:"text",jsonSchema:null,renderer:null},capabilities:{schemaVersion:"openpond.tasksetCapabilities.v1",taskKind:"chat",supportedSignals:["demonstration","preference","correction","feedback","reward","label"],compatibleMethods:["none"],rewardKinds:["none"],requiresTools:!1,requiresState:!1,requiresPrivilegedGrading:!0,environmentPlacements:["local","remote","colocated"],exportable:!0,portabilityBlockers:[]},metrics:{schemaVersion:"openpond.tasksetMetricPolicy.v1",primaryMetric:"score",aggregation:"mean_score",missingReward:"zero",customAggregator:null},review:{enabled:!1,candidateCount:2,minimumSamples:100,allowTies:!0,allowRejectAll:!0,rubric:"",criteria:[]},tasks:[],graders:[],graderFixtures:[],learningSignals:{demonstrations:[],preferences:[],corrections:[],feedback:[],rewards:[],labels:[]},publishedTasksetRef:null,createdAt:e,updatedAt:e,metadata:{}})}f(os,"createTasksetDraft");function qe(t){let e=[];t.name.trim()||e.push({code:"name_missing",message:"Name is required.",path:"name"}),t.objective.trim()||e.push({code:"objective_missing",message:"Objective is required.",path:"objective"}),!t.datasetArtifact&&t.tasks.length===0&&e.push({code:"tasks_missing",message:"Add at least one task or Dataset artifact.",path:"tasks"});let s=new Set(t.sourceRefs.map(o=>o.id));for(let o of t.tasks)for(let n of o.sourceRefs)s.has(n)||e.push({code:"task_source_missing",message:`Task ${o.id} references missing source ${n}.`,path:`tasks.${o.id}.sourceRefs`});return e}f(qe,"draftPublishIssues");function Oe(t){let e=C.parse(t.draft),s=t.now??new Date().toISOString(),o=qe(e);if(o.length)throw new X(o);let n=e.modelScope?.source;if(n&&t.tasksetId&&t.tasksetId!==n.tasksetId)throw new Error("Taskset draft publication differs from its prepared identity.");let c=n?.tasksetId||t.tasksetId?.trim()||e.publishedTasksetRef?.id||e.id.replace(/-draft$/,""),v=n?.tasksetRevision??(e.publishedTasksetRef?.id===c?e.publishedTasksetRef.revision+1:1),a=e.sourceRefs.length?e.sourceRefs:[et(e,c,s)],h=a[0].id,p=e.tasks.map(T=>Me.parse({...T,sourceRefs:T.sourceRefs.length?T.sourceRefs:[h],metadata:{exampleOrigin:"expert_authored",...T.metadata}})),m=e.capabilities.compatibleMethods.find(T=>T!=="none"&&T!=="retrieval")??null,y=tt(e),D=e.graders.filter(T=>T.rewardEligible&&T.weight>0&&T.kind!=="human"),u=m===null&&y==="verifiable_reward"&&D.length>0,b=m??(u?"grpo":null),M=E.parse({schemaVersion:"openpond.taskset.v1",id:c,revision:v,profileId:e.profileId,profileRelease:null,createImproveRunId:null,name:e.name,objective:e.objective,purpose:e.purpose,benchmark:e.benchmark,preferenceComparison:e.preferenceComparison,status:"needs_review",sourceRefs:a,datasetArtifact:e.datasetArtifact??null,policy:e.policy,environment:e.environment,capabilities:u?{...e.capabilities,compatibleMethods:["grpo"],rewardKinds:[...new Set(D.map(T=>T.kind==="model_judge"?"model_judge":"deterministic"))]}:e.capabilities,metrics:e.metrics,tasks:p,graders:e.graders,graderFixtures:e.graderFixtures,learningSignals:e.learningSignals,authoringProvenance:{schemaVersion:"openpond.taskAuthoringProvenance.v1",model:null,modelConfig:{},skillHash:i("openpond-taskset-draft-authoring-v1"),promptTemplateVersion:"taskset-draft-v1",buildIntent:y,buildSpecification:null,evidenceHashes:a.map(T=>T.sourceHash),tasksetSdkVersion:"draft-v1",sourceCommit:null,repairHistory:[],createdAt:s},readiness:null,contentHash:"00000000",createdAt:v===1?e.createdAt:s,updatedAt:s,metadata:{...e.metadata,...n?{modelTasksetAuthoring:n.lineage}:{},tasksetReviewPolicy:e.review,tasksetOutputContract:e.output,...t.sourcePackageHash?{sourcePackageHash:t.sourcePackageHash}:{},...b?{trainingMethod:b}:{},diagnosis:{schemaVersion:"openpond.capabilityDiagnosis.v1",summary:e.objective,stableBehavior:[e.objective],changingKnowledge:[],requiredContext:[],requiredTools:e.environment.toolNames,intervention:b==="dpo"?"preference":b==="grpo"||b==="ppo"?"grpo_rft":b==="sft"?"sft":"no_training",trainingEligible:b!==null,rationale:b?[`The author selected ${b.toUpperCase()} compatibility.`]:["The Taskset is currently configured for evaluation only."],confidence:1}}}),A=E.parse({...M,contentHash:G(M)}),$=_e(A,{purpose:"publication"}).issues.filter(T=>T.severity==="error");if($.length)throw new X($.map(T=>({code:T.code,message:T.message,path:T.path})));return A}f(Oe,"publishTasksetDraft");function et(t,e,s){let o=i({draftId:t.id,draftRevision:t.revision,tasks:t.tasks});return{schemaVersion:"openpond.generatedDatasetSource.v1",kind:"generated",id:`source-${e}`,profileId:t.profileId,title:`${t.name} manual authoring`,sourceHash:o,occurredAt:s,licensingStatus:"approved",secretScanStatus:"passed",piiScanStatus:"passed",generatorId:"openpond-taskset-draft",generatorVersion:"1",seed:0,generatorHash:o,metadata:{draftId:t.id,draftRevision:t.revision}}}f(et,"generatedDraftSource");function tt(t){return t.metadata.buildIntent==="discovery"||!t.graders.length&&!t.learningSignals.preferences.length&&!t.learningSignals.rewards.length&&!t.learningSignals.labels.length?"discovery":t.learningSignals.preferences.length?"preferences":t.learningSignals.rewards.length?"verifiable_reward":t.learningSignals.labels.length?"rubric":!t.capabilities.compatibleMethods.some(e=>e!=="none"&&e!=="retrieval")&&t.graders.some(e=>e.rewardEligible&&e.weight>0&&e.kind!=="human")?"verifiable_reward":"demonstrations"}f(tt,"buildIntentForDraft");function Ts(t){let e=[];t.output.renderer&&e.push({relativePath:t.output.renderer.module,source:`export async function ${t.output.renderer.exportName}(output: unknown) {
4
+ // Return artifact paths or bytes derived from the model's structured output.
5
+ return output;
6
+ }
7
+ `});for(let s of t.graders)s.kind==="custom_verifier"&&e.push({relativePath:s.module,source:`export async function ${s.exportName}(input: { output: unknown; task: unknown }) {
8
+ return { passed: false, score: 0, feedback: "Implement this verifier." };
9
+ }
10
+ `});t.metrics.customAggregator&&e.push({relativePath:t.metrics.customAggregator.module,source:`export function ${t.metrics.customAggregator.exportName}(scores: number[]) {
11
+ return scores.length ? scores.reduce((sum, score) => sum + score, 0) / scores.length : 0;
12
+ }
13
+ `});for(let s of e)B.parse(s.relativePath);return e}f(Ts,"configuredTasksetDraftFiles");function ze(t){let e=C.parse(t);return new Map([["taskset.json",F(e)],["tasks/tasks.jsonl",at(e.tasks)],["graders/graders.json",F(e.graders)],["fixtures/grader-fixtures.json",F(e.graderFixtures)],["metrics/policy.json",F(e.metrics)],["assets/manifest.json",F(e.tasks.flatMap(s=>s.assets??[]))],["environment/contract.json",F(e.environment)],["rubrics/preference-review.md",st(e)],["comparisons/policy.json",F(e.review)]])}f(ze,"renderTasksetDraftManifests");function st(t){let e=t.review.criteria.length?`
14
+
15
+ ## Criteria
16
+
17
+ ${t.review.criteria.map(s=>`- **${s.label}** (${s.weight}): ${s.description}`).join(`
18
+ `)}`:"";return`# Preference review rubric
19
+
20
+ ${t.review.rubric}${e}
21
+ `}f(st,"rubricMarkdown");function at(t){return t.length?`${t.map(e=>JSON.stringify(e)).join(`
22
+ `)}
23
+ `:""}f(at,"jsonLines");var Le=64*1024*1024,Ge=x.string().regex(/^[a-f0-9]{64}$/),Ne=x.object({path:B,contentHash:Ge,sizeBytes:x.number().int().nonnegative(),base64:x.string()}).strict(),Ue=x.object({schemaVersion:x.literal("openpond.tasksetDraftWorkspace.v1"),draft:C,files:x.array(Ne).max(1e4)}).strict(),rt=Ue.extend({contentHash:Ge}).strict();function Ms(t,e=Le){ue(t,e);let s=Ue.parse(t);return s.files.sort((o,n)=>o.path<n.path?-1:o.path>n.path?1:0),he({...s,contentHash:i(s)},e)}f(Ms,"createTasksetDraftWorkspace");function he(t,e=Le){ue(t,e);let s=rt.parse(t),{contentHash:o,...n}=s;if(i(n)!==o)throw new Error("Taskset draft workspace differs from its retained bytes.");let c=null,v=new Set;for(let a of s.files){if(oe(a.path))throw new Error("Managed Taskset files are represented by the draft document.");if(c!==null&&c>=a.path)throw new Error("Taskset draft file paths must be unique and sorted.");let h=a.path.split("/");for(let p=1;p<h.length;p++)if(v.has(h.slice(0,p).join("/")))throw new Error("A Taskset draft file occupies another file's directory.");ke(a),v.add(a.path),c=a.path}return s}f(he,"validateTasksetDraftWorkspace");function ke(t){let e=Ne.parse(t),s;try{s=atob(e.base64)}catch{throw new Error("Taskset draft file contains invalid base64.")}if(btoa(s)!==e.base64)throw new Error("Taskset draft file contains noncanonical base64.");let o=new Uint8Array(s.length);for(let n=0;n<s.length;n++)o[n]=s.charCodeAt(n);if(o.byteLength!==e.sizeBytes||W(o)!==e.contentHash)throw new Error("Taskset draft file differs from its retained bytes.");return o}f(ke,"decodeTasksetDraftWorkspaceFile");function ot(t){let e=he(t.workspace,t.maximumBytes),s=t.preparation===null?null:q.parse(t.preparation);if(s?e.draft.id!==s.draftId||e.draft.modelScope?.modelId!==s.lineage.owner.modelId||e.draft.profileId!==s.lineage.owner.scopeId||i(e.draft.modelScope?.source??null)!==i(s):e.draft.modelScope?.source!==void 0)throw new Error("Taskset draft differs from its retained source preparation.");let o=Oe({draft:e.draft,now:e.draft.updatedAt,sourcePackageHash:t.sourceWorkspaceHash??e.contentHash}),n=new Map(e.files.map(p=>[p.path,ke(p)]));for(let[p,m]of ze(e.draft))We(p)||n.set(p,new TextEncoder().encode(m));let c=Ve(o,n,t.adapterId,t.maximumBytes);for(let p of c.generatedFiles)n.set(p.path,new TextEncoder().encode(p.content));let v=ae({taskset:c.taskset,adapterId:t.adapterId}),a=ne.parse(c.taskset.metadata.portableFileInventory),h=L({schemaVersion:"openpond.tasksetPackage.v1",taskset:v.tasksetRelease,environment:v.environmentRelease,verifierSet:v.verifierSetRelease,files:a.map(p=>{let m=n.get(p.sourcePath);if(!m)throw new Error(`Captured Taskset file is missing: ${p.sourcePath}.`);return{asset:p.asset,base64:Buffer.from(m).toString("base64")}})},t.maximumBytes);return s?Ce({preparation:s,edited:h,source:t.source}):h}f(ot,"compileTasksetDraftWorkspace");function Ls(t){if(!t.workspace.draft.modelScope)throw new Error("Taskset draft requires a Model owner.");return ot(t)}f(Ls,"compileModelTasksetDraftWorkspace");export{oe as a,Mt as b,Ce as c,os as d,ne as e,We as f,Ve as g,Ts as h,rt as i,Ms as j,he as k,ke as l,ot as m,Ls as n};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as P}from"./chunk-MCBRB5D6.js";import{f as O}from"./chunk-CJDGLPNX.js";import{b as A}from"./chunk-OQPJ7FJF.js";import{a as m}from"./chunk-2LJCJOJ7.js";import{b as d,e as f}from"./chunk-JCLTFDVW.js";import{a as n}from"./chunk-FTQLQJQV.js";async function N(t,e,r,s={}){let o=await(s.apiFetch??d)(t,e,s.path??A,{method:"POST",signal:s.signal,body:JSON.stringify(r)}),i=await o.json().catch(()=>({})),c=o.status!==404&&o.status!==405&&o.status!==501;return o.ok?{ok:typeof i.ok=="boolean"?i.ok:!0,status:o.status,endpointAvailable:c,output:g(i),data:E(i)}:{ok:!1,status:o.status,endpointAvailable:c,output:g(i)??(c?`Connected app tool call failed with status ${o.status}.`:`Connected app tool-call endpoint is not available (${o.status}).`),data:E(i)}}n(N,"executeConnectedAppToolCall");function g(t){return typeof t.output=="string"&&t.output.trim()?t.output.trim():typeof t.message=="string"&&t.message.trim()?t.message.trim():typeof t.error=="string"&&t.error.trim()?t.error.trim():null}n(g,"responsePayloadMessage");function E(t){return"data"in t?t.data:"result"in t?t.result:null}n(E,"responsePayloadData");var h=A;function z(t={}){let e=t.env??process.env,r=t.apiFetch??d,s=t.loadAccountContext??P;return async(o,i)=>{if(I(e.OPENPOND_CONNECTED_APP_TOOL_EXECUTOR))return l(o.provider,"Cloud connected app execution is disabled.");let c=D(o),C=O.safeParse(c);if(!C.success)return l(o.provider,L(C.error));let u;try{u=await v({env:e,loadAccountContext:s})}catch(a){return l(o.provider,T(a))}try{let a=await N(u.apiBaseUrl,u.apiKey,C.data,{path:u.path,signal:i?.signal,apiFetch:r});return a.endpointAvailable?{ok:a.ok,output:a.output,data:a.data}:l(o.provider,`Cloud connected app connector endpoint is not available (${a.status}).`)}catch(a){if(a instanceof Error&&a.name==="AbortError")throw a;return l(o.provider,`Cloud connected app connector request failed: ${T(a)}`)}}}n(z,"createCloudConnectedAppToolExecutor");async function v(t={}){let e=t.env??process.env,r=y(e.OPENPOND_CONNECTED_APP_TOOL_PATH),s=e.OPENPOND_CONNECTED_APP_API_KEY?.trim()||e.OPENPOND_SANDBOX_API_KEY?.trim()||e.OPENPOND_API_KEY?.trim();if(s)return{apiBaseUrl:_(e,null),apiKey:s,path:r};let i=await(t.loadAccountContext??P)(),c=i.token?.trim();if(!c)throw new Error("OpenPond account API key is required for connected app connector execution.");return{apiBaseUrl:_(e,i.apiBaseUrl),apiKey:c,path:r}}n(v,"resolveCloudConnectedAppToolTarget");function _(t,e){return p(t.OPENPOND_CONNECTED_APP_API_URL)??U(t.OPENPOND_SANDBOX_API_URL)??p(t.OPENPOND_SANDBOX_BASE_URL)??p(t.OPENPOND_API_URL)??p(e)??f}n(_,"resolveCloudConnectedAppApiBaseUrl");function D(t){return{provider:t.provider,operation:t.operation,toolName:t.toolName,sessionId:t.sessionId,turnId:t.turnId,toolCallId:t.toolCallId,userPrompt:t.userPrompt,connectionIds:t.connectionIds,capabilityIds:t.capabilityIds,args:t.args}}n(D,"cloudConnectedAppToolPayload");function U(t){let e=x(t);return e?p(m(e,{apiBaseUrl:e})):null}n(U,"apiBaseUrlFromSandboxApiUrl");function p(t){let e=x(t);if(!e)return null;try{let r=new URL(e);return r.pathname=b(r.pathname),r.search="",r.hash="",r.toString().replace(/\/$/,"")}catch{return e.replace(/\/v1\/sandboxes\/?$/i,"").replace(/\/api\/sandboxes\/?$/i,"").replace(/\/sandboxes\/?$/i,"").replace(/\/v1\/?$/i,"").replace(/\/+$/,"")}}n(p,"normalizeApiBaseUrl");function b(t){let e=t.replace(/\/+$/,"");return e=e.replace(/\/v1\/sandboxes$/i,"").replace(/\/api\/sandboxes$/i,"").replace(/\/sandboxes$/i,"").replace(/\/v1$/i,""),e||"/"}n(b,"normalizeApiBasePath");function x(t){let e=t?.trim();return e?e.replace(/\/+$/,""):null}n(x,"normalizeOptionalUrl");function y(t){let e=t?.trim()||h;return e.startsWith("/")?e:`/${e}`}n(y,"normalizeToolPath");function l(t,e){return{ok:!1,output:`${e} No ${t} provider API call was made.`}}n(l,"connectorUnavailable");function I(t){let e=t?.trim().toLowerCase();return e==="0"||e==="false"||e==="off"||e==="disabled"}n(I,"isDisabled");function L(t){return t.issues?.[0]?.message??"Connected app tool call request is invalid."}n(L,"connectedAppToolCallValidationMessage");function T(t){return t instanceof Error?t.message:"Unknown error"}n(T,"errorMessage");export{h as a,z as b,v as c};
2
+ import{a as P}from"./chunk-RY46UPBO.js";import{f as O}from"./chunk-HG2YFMVU.js";import{b as A}from"./chunk-OQPJ7FJF.js";import{a as m}from"./chunk-2LJCJOJ7.js";import{b as d,e as f}from"./chunk-JCLTFDVW.js";import{a as n}from"./chunk-FTQLQJQV.js";async function N(t,e,r,s={}){let o=await(s.apiFetch??d)(t,e,s.path??A,{method:"POST",signal:s.signal,body:JSON.stringify(r)}),i=await o.json().catch(()=>({})),c=o.status!==404&&o.status!==405&&o.status!==501;return o.ok?{ok:typeof i.ok=="boolean"?i.ok:!0,status:o.status,endpointAvailable:c,output:g(i),data:E(i)}:{ok:!1,status:o.status,endpointAvailable:c,output:g(i)??(c?`Connected app tool call failed with status ${o.status}.`:`Connected app tool-call endpoint is not available (${o.status}).`),data:E(i)}}n(N,"executeConnectedAppToolCall");function g(t){return typeof t.output=="string"&&t.output.trim()?t.output.trim():typeof t.message=="string"&&t.message.trim()?t.message.trim():typeof t.error=="string"&&t.error.trim()?t.error.trim():null}n(g,"responsePayloadMessage");function E(t){return"data"in t?t.data:"result"in t?t.result:null}n(E,"responsePayloadData");var h=A;function z(t={}){let e=t.env??process.env,r=t.apiFetch??d,s=t.loadAccountContext??P;return async(o,i)=>{if(I(e.OPENPOND_CONNECTED_APP_TOOL_EXECUTOR))return l(o.provider,"Cloud connected app execution is disabled.");let c=D(o),C=O.safeParse(c);if(!C.success)return l(o.provider,L(C.error));let u;try{u=await v({env:e,loadAccountContext:s})}catch(a){return l(o.provider,T(a))}try{let a=await N(u.apiBaseUrl,u.apiKey,C.data,{path:u.path,signal:i?.signal,apiFetch:r});return a.endpointAvailable?{ok:a.ok,output:a.output,data:a.data}:l(o.provider,`Cloud connected app connector endpoint is not available (${a.status}).`)}catch(a){if(a instanceof Error&&a.name==="AbortError")throw a;return l(o.provider,`Cloud connected app connector request failed: ${T(a)}`)}}}n(z,"createCloudConnectedAppToolExecutor");async function v(t={}){let e=t.env??process.env,r=y(e.OPENPOND_CONNECTED_APP_TOOL_PATH),s=e.OPENPOND_CONNECTED_APP_API_KEY?.trim()||e.OPENPOND_SANDBOX_API_KEY?.trim()||e.OPENPOND_API_KEY?.trim();if(s)return{apiBaseUrl:_(e,null),apiKey:s,path:r};let i=await(t.loadAccountContext??P)(),c=i.token?.trim();if(!c)throw new Error("OpenPond account API key is required for connected app connector execution.");return{apiBaseUrl:_(e,i.apiBaseUrl),apiKey:c,path:r}}n(v,"resolveCloudConnectedAppToolTarget");function _(t,e){return p(t.OPENPOND_CONNECTED_APP_API_URL)??U(t.OPENPOND_SANDBOX_API_URL)??p(t.OPENPOND_SANDBOX_BASE_URL)??p(t.OPENPOND_API_URL)??p(e)??f}n(_,"resolveCloudConnectedAppApiBaseUrl");function D(t){return{provider:t.provider,operation:t.operation,toolName:t.toolName,sessionId:t.sessionId,turnId:t.turnId,toolCallId:t.toolCallId,userPrompt:t.userPrompt,connectionIds:t.connectionIds,capabilityIds:t.capabilityIds,args:t.args}}n(D,"cloudConnectedAppToolPayload");function U(t){let e=x(t);return e?p(m(e,{apiBaseUrl:e})):null}n(U,"apiBaseUrlFromSandboxApiUrl");function p(t){let e=x(t);if(!e)return null;try{let r=new URL(e);return r.pathname=b(r.pathname),r.search="",r.hash="",r.toString().replace(/\/$/,"")}catch{return e.replace(/\/v1\/sandboxes\/?$/i,"").replace(/\/api\/sandboxes\/?$/i,"").replace(/\/sandboxes\/?$/i,"").replace(/\/v1\/?$/i,"").replace(/\/+$/,"")}}n(p,"normalizeApiBaseUrl");function b(t){let e=t.replace(/\/+$/,"");return e=e.replace(/\/v1\/sandboxes$/i,"").replace(/\/api\/sandboxes$/i,"").replace(/\/sandboxes$/i,"").replace(/\/v1$/i,""),e||"/"}n(b,"normalizeApiBasePath");function x(t){let e=t?.trim();return e?e.replace(/\/+$/,""):null}n(x,"normalizeOptionalUrl");function y(t){let e=t?.trim()||h;return e.startsWith("/")?e:`/${e}`}n(y,"normalizeToolPath");function l(t,e){return{ok:!1,output:`${e} No ${t} provider API call was made.`}}n(l,"connectorUnavailable");function I(t){let e=t?.trim().toLowerCase();return e==="0"||e==="false"||e==="off"||e==="disabled"}n(I,"isDisabled");function L(t){return t.issues?.[0]?.message??"Connected app tool call request is invalid."}n(L,"connectedAppToolCallValidationMessage");function T(t){return t instanceof Error?t.message:"Unknown error"}n(T,"errorMessage");export{h as a,z as b,v as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{B as h,k as a,l as t,o as s,t as l,w as c,z as u}from"./chunk-4PUOWSDE.js";import{Wa as m}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";var r=t.shape.id,S=e.object({schemaVersion:e.literal("openpond.modelBatchReviewInspection.v1"),packageHash:e.string().regex(/^[a-f0-9]{64}$/),definition:s,binding:m,evidence:e.array(c).min(1).max(1e4),decisions:e.array(h).min(1).max(1e4)}).strict(),p=e.object({schemaVersion:e.literal("openpond.modelBatchReviewRequest.v1"),operationId:r,modelId:r,expectedModelRevision:e.number().int().positive(),tasksetRef:t,rewardBindingRef:t.nullable(),definition:e.object({name:e.string().trim().min(1).max(500).optional(),instructions:e.string().trim().min(1).max(2e4).optional(),inputSchema:a.optional(),outputSchema:a.optional(),requiredOutputs:s.shape.requiredOutputs}).strict(),examples:e.array(e.object({evidence:t,input:a.optional(),expected:a.nullable().optional(),evaluatorContext:a.nullable().optional(),proposedTarget:a.nullable().optional()}).strict()).max(1e4)}).strict(),w=e.object({schemaVersion:e.literal("openpond.modelBatchReviewReceipt.v1"),operationId:r,modelId:r,source:l,evidence:e.array(c).min(1).max(1e4),proposals:e.array(u).max(1e4)}).strict();var i=t.shape.id,o=e.string().regex(/^[a-f0-9]{64}$/),y=e.object({schemaVersion:e.literal("openpond.datasetTrainingReviewRequest.v1"),teamId:i,operationId:i,dataset:t,packageHash:o,taskIds:e.array(i).min(1).max(1e4).nullable().default(null),purpose:e.enum(["supervised_training","reward_training"]),rewardBindingRef:t.nullable().default(null),definition:p.shape.definition.default({}),targetSource:e.enum(["none","expected_output","approved_parent"]).default("none"),shareWithWorkspace:e.literal(!0)}).strict().superRefine((n,d)=>{n.taskIds&&new Set(n.taskIds).size!==n.taskIds.length&&d.addIssue({code:"custom",path:["taskIds"],message:"Select each Dataset task once."}),n.purpose!=="supervised_training"&&n.targetSource!=="none"&&d.addIssue({code:"custom",path:["targetSource"],message:"Target proposals require a supervised review."})}),T=e.object({schemaVersion:e.literal("openpond.datasetTrainingReviewSource.v1"),dataset:t,packageHash:o,taskCount:e.number().int().nonnegative(),definition:p.shape.definition,rewardBinding:t.nullable(),hasParentTargets:e.boolean()}).strict(),R=e.object({schemaVersion:e.literal("openpond.datasetTrainingReviewReceipt.v1"),id:i,teamId:i,actorId:i,operationId:i,requestHash:o,dataset:t,packageHash:o,purpose:e.enum(["supervised_training","reward_training"]),shareWithWorkspace:e.literal(!0),source:t,definition:t,evidence:e.array(t).min(1).max(1e4),proposals:e.array(t.pick({id:!0,revision:!0})).max(1e4),createdAt:e.string().datetime({offset:!0})}).strict(),B=R.extend({contentHash:o}).strict();export{S as a,p as b,w as c,y as d,T as e,R as f,B as g};