openpond 0.2.62 → 0.2.63

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 (496) hide show
  1. package/README.md +2 -0
  2. package/dist/app-server.d.ts +1053 -63
  3. package/dist/app-server.js +1 -1
  4. package/dist/chunks/{acp-DYRBDJRU.js → acp-H3MJCPHX.js} +1 -1
  5. package/dist/chunks/{acp-agent-UTLP7C3I.js → acp-agent-DWA7272M.js} +1 -1
  6. package/dist/chunks/actions-command-IIYOO4LL.js +2 -0
  7. package/dist/chunks/{app-layer-N2H3RBEN.js → app-layer-K7H2WJ56.js} +1 -1
  8. package/dist/chunks/app-server-connected-apps-RM5E2VWF.js +2 -0
  9. package/dist/chunks/app-server-evaluations-XGMGS67X.js +2 -0
  10. package/dist/chunks/app-server-harness-services-BHD6S5II.js +2 -0
  11. package/dist/chunks/app-server-runtime-LFIL6F7D.js +2 -0
  12. package/dist/chunks/apps-QKAHJGQ4.js +2 -0
  13. package/dist/chunks/chunk-25XXZS3E.js +2 -0
  14. package/dist/chunks/chunk-27JGS3KB.js +12 -0
  15. package/dist/chunks/{chunk-7JBB4PXS.js → chunk-2HAWOMZK.js} +1 -1
  16. package/dist/chunks/chunk-2LJCJOJ7.js +2 -0
  17. package/dist/chunks/{chunk-CN5OXQ7A.js → chunk-3YXYBYWK.js} +1 -1
  18. package/dist/chunks/{chunk-GEKORCMN.js → chunk-42V4NV2F.js} +1 -1
  19. package/dist/chunks/{chunk-VAJSRUAB.js → chunk-4FNCBA3Y.js} +1 -1
  20. package/dist/chunks/{chunk-F7D4BMTO.js → chunk-4L6DU6Z2.js} +1 -1
  21. package/dist/chunks/{chunk-SZKFNKWO.js → chunk-4SZ3HKHU.js} +1 -1
  22. package/dist/chunks/chunk-5EP2DZLJ.js +2 -0
  23. package/dist/chunks/chunk-5FU5RLML.js +2 -0
  24. package/dist/chunks/{chunk-6SH4B7DV.js → chunk-5MHYGMJG.js} +1 -1
  25. package/dist/chunks/{chunk-MEK7DLX3.js → chunk-6EBCS57F.js} +1 -1
  26. package/dist/chunks/chunk-6RS4NAOY.js +2 -0
  27. package/dist/chunks/{chunk-NVHZRKXB.js → chunk-7HRLWPPZ.js} +1 -1
  28. package/dist/chunks/chunk-7O6Z3VOZ.js +2 -0
  29. package/dist/chunks/{chunk-P74RR2GB.js → chunk-7WYL2IDD.js} +1 -1
  30. package/dist/chunks/chunk-7YLXGILH.js +2 -0
  31. package/dist/chunks/chunk-7ZLXFKRI.js +2 -0
  32. package/dist/chunks/{chunk-NWOK6NLE.js → chunk-AH26AQN7.js} +1 -1
  33. package/dist/chunks/chunk-AHOBCBVZ.js +2 -0
  34. package/dist/chunks/chunk-B5R53U74.js +2 -0
  35. package/dist/chunks/{chunk-NKZNPTLA.js → chunk-BPZOABMC.js} +1 -1
  36. package/dist/chunks/{chunk-2IIBCCOK.js → chunk-BSPFY3Y5.js} +1 -1
  37. package/dist/chunks/{chunk-5OSM75X5.js → chunk-BU27SLZP.js} +2 -2
  38. package/dist/chunks/chunk-C2AXMKK4.js +2 -0
  39. package/dist/chunks/{chunk-AMO5DVKM.js → chunk-C2LAEGOW.js} +2 -2
  40. package/dist/chunks/{chunk-GNCEZ3UP.js → chunk-CZ5R4JXZ.js} +1 -1
  41. package/dist/chunks/{chunk-JIFUGA3U.js → chunk-DABBHWSF.js} +1 -1
  42. package/dist/chunks/{chunk-VK4TPZTA.js → chunk-DLANLLKH.js} +1 -1
  43. package/dist/chunks/{chunk-WGLVSGFA.js → chunk-DQI5TE6A.js} +2 -2
  44. package/dist/chunks/chunk-DTTFUANI.js +12 -0
  45. package/dist/chunks/{chunk-4TM75R7V.js → chunk-DUL6DXOI.js} +1 -1
  46. package/dist/chunks/{chunk-TGEGXTPR.js → chunk-ELX7VRSU.js} +1 -1
  47. package/dist/chunks/chunk-ERL2M773.js +3 -0
  48. package/dist/chunks/{chunk-4PZWGNX4.js → chunk-ERT32RZA.js} +4 -4
  49. package/dist/chunks/{chunk-RTJCELRR.js → chunk-EZRUWIP6.js} +1 -1
  50. package/dist/chunks/{chunk-LJDBR3RN.js → chunk-F6UQ6PPK.js} +1 -1
  51. package/dist/chunks/chunk-F7QTIHXX.js +2 -0
  52. package/dist/chunks/chunk-FAKDGLZQ.js +8 -0
  53. package/dist/chunks/{chunk-FFWOTZQM.js → chunk-FVRII5XO.js} +1 -1
  54. package/dist/chunks/{chunk-C7M2WBWZ.js → chunk-FYYYECHE.js} +51 -49
  55. package/dist/chunks/chunk-G32BO6M5.js +4 -0
  56. package/dist/chunks/{chunk-NBE74GLF.js → chunk-G6OR5NB6.js} +1 -1
  57. package/dist/chunks/{chunk-GQGLPKU4.js → chunk-GGJUWIGR.js} +1 -1
  58. package/dist/chunks/{chunk-VSQXDS6H.js → chunk-GPL2Z65R.js} +1 -1
  59. package/dist/chunks/{chunk-INO67SEN.js → chunk-GS6ZUSIN.js} +2 -2
  60. package/dist/chunks/{chunk-47AXSBPV.js → chunk-GVARQXYI.js} +1 -1
  61. package/dist/chunks/chunk-GXCUH2VV.js +17 -0
  62. package/dist/chunks/{chunk-OCC43RSJ.js → chunk-GXZCMO6S.js} +1 -1
  63. package/dist/chunks/{chunk-CLFYRN46.js → chunk-H6C4MAUN.js} +1 -1
  64. package/dist/chunks/{chunk-HBLN4OLY.js → chunk-HUCBKXTU.js} +1 -1
  65. package/dist/chunks/{chunk-M5IX6VUA.js → chunk-IHB5GTOJ.js} +2 -2
  66. package/dist/chunks/{chunk-J3B2GM4A.js → chunk-IWWXIUAQ.js} +1 -1
  67. package/dist/chunks/chunk-J572ANHX.js +13 -0
  68. package/dist/chunks/{chunk-AKZPMKWP.js → chunk-J7ZTPXRQ.js} +1 -1
  69. package/dist/chunks/{chunk-CJUVHE4U.js → chunk-JORRZ4BB.js} +1 -1
  70. package/dist/chunks/chunk-JSQRLLN6.js +2 -0
  71. package/dist/chunks/chunk-KCOTDUGW.js +2 -0
  72. package/dist/chunks/{chunk-NK4JKB7C.js → chunk-KHTAAVC2.js} +1 -1
  73. package/dist/chunks/{chunk-LRRBYIGH.js → chunk-LK2K3SPM.js} +2 -2
  74. package/dist/chunks/{chunk-557XSPVS.js → chunk-LKKMLBOH.js} +1 -1
  75. package/dist/chunks/{chunk-U456UP3N.js → chunk-LSZJ5M3X.js} +1 -1
  76. package/dist/chunks/chunk-M3FLEZ4E.js +4 -0
  77. package/dist/chunks/{chunk-Y2KPHVZK.js → chunk-M3SCON53.js} +1 -1
  78. package/dist/chunks/{chunk-VPDG2V2R.js → chunk-MEGKXGW3.js} +1 -1
  79. package/dist/chunks/chunk-MPNJ2BB4.js +2 -0
  80. package/dist/chunks/{chunk-4RZBGKT7.js → chunk-N33D7KCW.js} +1 -1
  81. package/dist/chunks/chunk-N42HT64M.js +2 -0
  82. package/dist/chunks/{chunk-SD64CLJX.js → chunk-N4VHLJBZ.js} +1 -1
  83. package/dist/chunks/chunk-NEJLJ2XY.js +2 -0
  84. package/dist/chunks/chunk-NG2L6D7G.js +2 -0
  85. package/dist/chunks/{chunk-GV3LFSMI.js → chunk-NLYZ5K7U.js} +1 -1
  86. package/dist/chunks/{chunk-F4TJ7WQV.js → chunk-NT7N6KLE.js} +1 -1
  87. package/dist/chunks/{chunk-PAE3PQEC.js → chunk-NZTCH6K5.js} +1 -1
  88. package/dist/chunks/{chunk-BEI4YULC.js → chunk-OG33QAG6.js} +1 -1
  89. package/dist/chunks/chunk-OTUBJV6C.js +6 -0
  90. package/dist/chunks/{chunk-RH43WLBX.js → chunk-PBTXLQAU.js} +1 -1
  91. package/dist/chunks/{chunk-3R4MSE2S.js → chunk-QJ6KUVAR.js} +1 -1
  92. package/dist/chunks/{chunk-7JXZNCBC.js → chunk-QU4UE73E.js} +1 -1
  93. package/dist/chunks/{chunk-WQMXEZVE.js → chunk-R6VJDOQM.js} +3 -3
  94. package/dist/chunks/{chunk-FUSCTBJI.js → chunk-R6WMY6AH.js} +1 -1
  95. package/dist/chunks/{chunk-EIX2V2KU.js → chunk-RDSVU6F6.js} +1 -1
  96. package/dist/chunks/{chunk-R4PDSOB4.js → chunk-RFMME46Z.js} +1 -1
  97. package/dist/chunks/{chunk-GW5SE3FM.js → chunk-RZUCVF2Q.js} +1 -1
  98. package/dist/chunks/{chunk-UC3FXTDL.js → chunk-SFKZITAG.js} +5 -5
  99. package/dist/chunks/{chunk-5A6ER3M2.js → chunk-SHJY5RLU.js} +1 -1
  100. package/dist/chunks/chunk-SI5W5LBV.js +2 -0
  101. package/dist/chunks/chunk-SO42ZB5K.js +2 -0
  102. package/dist/chunks/{chunk-2UDAKLJ4.js → chunk-TCOTXCV6.js} +1 -1
  103. package/dist/chunks/{chunk-QCSLEMZF.js → chunk-U2K7QJCG.js} +1 -1
  104. package/dist/chunks/{chunk-ISIXFK6U.js → chunk-UH4JSSRL.js} +28 -28
  105. package/dist/chunks/{chunk-X4ZT22SG.js → chunk-UPWJSNL5.js} +1 -1
  106. package/dist/chunks/chunk-URNMC46H.js +157 -0
  107. package/dist/chunks/{chunk-NLQ2UPN2.js → chunk-V7KR74NO.js} +1 -1
  108. package/dist/chunks/{chunk-HXZXDDKW.js → chunk-VHXDWAEH.js} +1 -1
  109. package/dist/chunks/{chunk-NE4ESZPT.js → chunk-W2TICQ62.js} +1 -1
  110. package/dist/chunks/chunk-WP2L2NY2.js +2 -0
  111. package/dist/chunks/chunk-WSOUMXH3.js +24 -0
  112. package/dist/chunks/chunk-WWQNMC7C.js +6 -0
  113. package/dist/chunks/chunk-XMHIQ3SK.js +5 -0
  114. package/dist/chunks/{chunk-5MTN6KXV.js → chunk-XNOMIWEY.js} +1 -1
  115. package/dist/chunks/{chunk-ZXT7V64X.js → chunk-XOB6FKQV.js} +1 -1
  116. package/dist/chunks/chunk-Y766IN7Y.js +2 -0
  117. package/dist/chunks/chunk-YCZZ62C2.js +2 -0
  118. package/dist/chunks/chunk-YM4PSVFW.js +4 -0
  119. package/dist/chunks/chunk-YNQWJWIC.js +10 -0
  120. package/dist/chunks/{chunk-GSWBNJGZ.js → chunk-Z3BWCFLV.js} +1 -1
  121. package/dist/chunks/{chunk-GOIKLFXK.js → chunk-ZG6353RM.js} +1 -1
  122. package/dist/chunks/{chunk-T6C5BNXK.js → chunk-ZPTKR3GB.js} +1 -1
  123. package/dist/chunks/{chunk-MNXNZDDW.js → chunk-ZYVHOVKL.js} +1 -1
  124. package/dist/chunks/chunk-ZZHXQCNB.js +22 -0
  125. package/dist/chunks/cli-PSXMIJTF.js +2 -0
  126. package/dist/chunks/{configuration-command-BU2RPG33.js → configuration-command-XYKMXIWF.js} +1 -1
  127. package/dist/chunks/connected-app-executor-6G2LA3PQ.js +2 -0
  128. package/dist/chunks/connected-evidence-IRXYN6YD.js +2 -0
  129. package/dist/chunks/{connected-starting-assets-V5QXRK5Q.js → connected-starting-assets-JONPTII6.js} +1 -1
  130. package/dist/chunks/{continual-FLW6DAJK.js → continual-Z7MO2PF6.js} +1 -1
  131. package/dist/chunks/core-commands-WWN7X3XC.js +2 -0
  132. package/dist/chunks/dataset-preparation-authoring-F3OZIQSP.js +4 -0
  133. package/dist/chunks/datasets-2PC2HP7N.js +2 -0
  134. package/dist/chunks/desktop-test-VU6AFAMO.js +3 -0
  135. package/dist/chunks/dist-47AYOIH6.js +2 -0
  136. package/dist/chunks/{dist-DCSLPBO2.js → dist-MXBEBM4D.js} +1 -1
  137. package/dist/chunks/evaluation-coordination-UOWZHHC5.js +2 -0
  138. package/dist/chunks/experiment-improvements-EB2CV5RA.js +2 -0
  139. package/dist/chunks/experiments-SZQYR6MH.js +2 -0
  140. package/dist/chunks/experiments-signal-2KJCP25D.js +2 -0
  141. package/dist/chunks/{help-PXUUREHZ.js → help-7HXFWIKS.js} +1 -1
  142. package/dist/chunks/host-profile-evaluation-tools-Y2LQ4WQN.js +2 -0
  143. package/dist/chunks/host-profile-external-dataset-FRIGXOO7.js +2 -0
  144. package/dist/chunks/hosted-app-server-composition-PGKQNDW6.js +2 -0
  145. package/dist/chunks/hosted-experiment-improvement-UXC542SZ.js +3 -0
  146. package/dist/chunks/hosted-harness-runtime-6PEI7F2U.js +2 -0
  147. package/dist/chunks/hosted-profile-candidate-HM44BIUX.js +3 -0
  148. package/dist/chunks/hosted-profile-compiler-UAZ4PHYE.js +2 -0
  149. package/dist/chunks/hosted-profile-evaluation-control-EUL57FAB.js +2 -0
  150. package/dist/chunks/hosted-profile-evaluation-inspection-7USY75Z4.js +3 -0
  151. package/dist/chunks/hosted-profile-evaluation-preparation-2LSMZQNA.js +3 -0
  152. package/dist/chunks/{hosted-tasksets-X2YCFYEJ.js → hosted-tasksets-WGXGXJ7E.js} +1 -1
  153. package/dist/chunks/human-review-M26UKGJL.js +2 -0
  154. package/dist/chunks/{import-JWZSZCE4.js → import-6SI4BEKS.js} +2 -2
  155. package/dist/chunks/learning-HM3NWOV5.js +2 -0
  156. package/dist/chunks/local-harness-improvement-runtime-QGWFWNSR.js +2 -0
  157. package/dist/chunks/local-harness-taskset-review-KS4WPMN6.js +2 -0
  158. package/dist/chunks/model-projects-YUAMBQTO.js +2 -0
  159. package/dist/chunks/opchat-AG4CWVY4.js +3 -0
  160. package/dist/chunks/opchat-bounded-chat-IQMP5IIO.js +2 -0
  161. package/dist/chunks/organizations-KDKX77XZ.js +2 -0
  162. package/dist/chunks/{profile-ELE2D7HU.js → profile-O5HL5DTQ.js} +1 -1
  163. package/dist/chunks/project-action-payload-QA24HYGF.js +2 -0
  164. package/dist/chunks/project-agent-XBOOM5TS.js +2 -0
  165. package/dist/chunks/published-experiment-source-GZGN354O.js +2 -0
  166. package/dist/chunks/refiner-profile-service-BJMOYKTC.js +2 -0
  167. package/dist/chunks/{runtime-776NUSE7.js → runtime-XBA744HJ.js} +2 -2
  168. package/dist/chunks/sandbox-command-5ECGS7DG.js +2 -0
  169. package/dist/chunks/{sandbox-template-WP6YCGBK.js → sandbox-template-27U3FQN7.js} +1 -1
  170. package/dist/chunks/saved-work-KUNVTJ7O.js +2 -0
  171. package/dist/chunks/{send-turn-RPB65PME.js → send-turn-FIPWOXWV.js} +1 -1
  172. package/dist/chunks/src-BLWX6DRG.js +424 -0
  173. package/dist/chunks/{src-2R4CMCJ5.js → src-PU7QTFO5.js} +1 -1
  174. package/dist/chunks/standalone-experiment-turn-owner-XIE46VNH.js +2 -0
  175. package/dist/chunks/store-chat-resources-YOEJ2BI6.js +2 -0
  176. package/dist/chunks/{store-continual-support-reviews-R62D2HD6.js → store-continual-support-reviews-FOMYYS25.js} +1 -1
  177. package/dist/chunks/{store-conversation-serving-25O7BAR2.js → store-conversation-serving-K324SQTO.js} +1 -1
  178. package/dist/chunks/{store-create-improve-T5E2GUKK.js → store-create-improve-3LQMIYAP.js} +1 -1
  179. package/dist/chunks/{store-datasets-5Y4U5L3R.js → store-datasets-3KSX7RSO.js} +1 -1
  180. package/dist/chunks/store-evaluation-results-LHCCNNE6.js +7 -0
  181. package/dist/chunks/{store-harness-evaluation-review-settings-I2R3HPO3.js → store-harness-evaluation-review-settings-AAN7KKJ5.js} +1 -1
  182. package/dist/chunks/{store-harness-refinement-candidates-SUT45FQX.js → store-harness-refinement-candidates-3PHL3BUY.js} +1 -1
  183. package/dist/chunks/store-harness-workspaces-ZHNCNWVI.js +2 -0
  184. package/dist/chunks/store-human-review-QJY3ZPPF.js +7 -0
  185. package/dist/chunks/store-learned-preference-migration-validation-X32SRBOM.js +2 -0
  186. package/dist/chunks/{store-learning-MFS4DGQR.js → store-learning-DW3QLQXU.js} +1 -1
  187. package/dist/chunks/{store-learning-credentials-BECWEG2Y.js → store-learning-credentials-67QNTPA7.js} +1 -1
  188. package/dist/chunks/{store-local-experiments-LOH4F4TF.js → store-local-experiments-QTVHJAEP.js} +1 -1
  189. package/dist/chunks/store-model-batch-review-PBYQZJJJ.js +2 -0
  190. package/dist/chunks/store-model-configuration-3SU73CMS.js +3 -0
  191. package/dist/chunks/store-model-project-preparation-TFCG2F2F.js +2 -0
  192. package/dist/chunks/store-ponder-history-WDLMXBIJ.js +2 -0
  193. package/dist/chunks/store-ponder-hosted-DX6E2BVW.js +4 -0
  194. package/dist/chunks/{store-preference-comparison-RNIFLJRW.js → store-preference-comparison-DWV5XSMY.js} +1 -1
  195. package/dist/chunks/{store-schedules-DVQ2PP4F.js → store-schedules-2KUY4T6M.js} +1 -1
  196. package/dist/chunks/{store-sidebar-file-bookmarks-LXWFFYCZ.js → store-sidebar-file-bookmarks-A4XCS7RM.js} +1 -1
  197. package/dist/chunks/{store-sidebar-preferences-4HH7LX6N.js → store-sidebar-preferences-V2PKRXUZ.js} +1 -1
  198. package/dist/chunks/{store-subagents-JLW4GD4Q.js → store-subagents-UGVEFA6M.js} +1 -1
  199. package/dist/chunks/store-task-inbox-QABI4ZAH.js +33 -0
  200. package/dist/chunks/{store-task-inventory-NJXRXFLC.js → store-task-inventory-GEQIZELY.js} +1 -1
  201. package/dist/chunks/store-taskset-drafts-GXABQR5G.js +9 -0
  202. package/dist/chunks/{store-training-VRLU6NFX.js → store-training-CQV7PL3V.js} +1 -1
  203. package/dist/chunks/{store-training-jobs-3ZHG4LGI.js → store-training-jobs-XKN6K66J.js} +18 -10
  204. package/dist/chunks/{store-training-models-KWQD5PRP.js → store-training-models-Q7DTTR4S.js} +1 -1
  205. package/dist/chunks/{store-usage-ZRS3ILF2.js → store-usage-XGAX7NLB.js} +1 -1
  206. package/dist/chunks/{taskset-QDMCQQDJ.js → taskset-ARKJQKYQ.js} +1 -1
  207. package/dist/chunks/taskset-packages-X4K65DTW.js +2 -0
  208. package/dist/chunks/taskset-packages-XK7FSD45.js +2 -0
  209. package/dist/chunks/{teams-bot-GF272RGC.js → teams-bot-UTQAJA6H.js} +1 -1
  210. package/dist/chunks/training-3IWW4256.js +2 -0
  211. package/dist/chunks/{training-DF5UEPY3.js → training-RVIESURJ.js} +1 -1
  212. package/dist/chunks/training-error-2EWDOQ4G.js +2 -0
  213. package/dist/chunks/training-hosted-PFJHYTEU.js +2 -0
  214. package/dist/chunks/training-hosted-checkpoint-evaluation-JJPP7KFW.js +2 -0
  215. package/dist/chunks/training-hosted-feedback-5B2KJGOT.js +2 -0
  216. package/dist/chunks/training-hosted-learning-Y7NHRY4V.js +2 -0
  217. package/dist/chunks/training-hosted-report-UVGTPDOK.js +2 -0
  218. package/dist/chunks/training-hosted-serving-report-OX4A5OKB.js +2 -0
  219. package/dist/chunks/training-hosted-workers-LST4ZUXN.js +2 -0
  220. package/dist/chunks/training-model-start-ROLS3E4V.js +2 -0
  221. package/dist/chunks/{web-search-5RUXYIOF.js → web-search-7FBUBZ66.js} +1 -1
  222. package/dist/chunks/{workspaces-JRY2IE7H.js → workspaces-G3CMY7ZA.js} +1 -1
  223. package/dist/cli.js +1 -1
  224. package/dist/index.js +1 -1
  225. package/dist/sandbox/url.d.ts +3 -1
  226. package/dist/skills/LICENSE +21 -0
  227. package/dist/skills/manifest.json +168 -0
  228. package/dist/skills/openpond-agent-authoring/SKILL.md +9 -3
  229. package/dist/skills/openpond-agent-authoring/references/profile-layout.md +1 -1
  230. package/dist/skills/openpond-agent-authoring/references/validation-and-repair.md +2 -2
  231. package/dist/skills/openpond-cli/SKILL.md +11 -7
  232. package/dist/skills/openpond-cli/references/experiments-and-training.md +1 -1
  233. package/dist/skills/openpond-refiner-authoring/SKILL.md +4 -0
  234. package/dist/skills/openpond-skill-authoring/SKILL.md +5 -1
  235. package/dist/web/assets/App-DY2R8Z6r.js +53 -0
  236. package/dist/web/assets/{AppDialog-BurL61qE.js → AppDialog-8Y0FYalT.js} +1 -1
  237. package/dist/web/assets/AppTerminalPanel-YcnBD5DF.js +2 -0
  238. package/dist/web/assets/{AppToastContext-DZLErwj0.js → AppToastContext-BiQbbVxq.js} +1 -1
  239. package/dist/web/assets/AppsView-Dtte4h6e.js +1 -0
  240. package/dist/web/assets/{AttachmentTypeIcon-CpMSfHCK.js → AttachmentTypeIcon-DgADV7dn.js} +1 -1
  241. package/dist/web/assets/BrowserSidebar-BUqDvEv9.js +1 -0
  242. package/dist/web/assets/{CartesianChart-CEbM980A.js → CartesianChart-J4ChOjvG.js} +1 -1
  243. package/dist/web/assets/ChatTimelineEntry-DC93wlDa.js +8 -0
  244. package/dist/web/assets/ChatTimelineEntry-DztFb85D.css +1 -0
  245. package/dist/web/assets/{CollaborationTabs-DrKJmJZK.js → CollaborationTabs-CFCpk2Ck.js} +1 -1
  246. package/dist/web/assets/CommandMenu-EPPjB14H.js +1 -0
  247. package/dist/web/assets/{CommunityView-BzpIq1lD.js → CommunityView-Okydjpqm.js} +1 -1
  248. package/dist/web/assets/ComposerAttachments-RXCiE88M.js +2 -0
  249. package/dist/web/assets/{ComposerCreateImproveStrip-ChplO9YP.js → ComposerCreateImproveStrip-CSngc8-V.js} +1 -1
  250. package/dist/web/assets/{ConversationImportsSettings-DRHgc7j_.js → ConversationImportsSettings-DS73kyfj.js} +1 -1
  251. package/dist/web/assets/FilePagePreview-Qc4B0vue.js +2 -0
  252. package/dist/web/assets/{GetStartedView-CaBk_mX6.js → GetStartedView-DGFPQ1We.js} +1 -1
  253. package/dist/web/assets/{GettingStartedDialog-JtFLyU3F.js → GettingStartedDialog-DFBYQdHz.js} +1 -1
  254. package/dist/web/assets/{HostedModelLearningReview-hhcjDifK.js → HostedModelLearningReview-BDu3FlcU.js} +1 -1
  255. package/dist/web/assets/{HostedModelLearningSettings-CY8198Y1.js → HostedModelLearningSettings-CHaTHwC8.js} +1 -1
  256. package/dist/web/assets/HtmlVisual-C7GlEVfH.css +1 -0
  257. package/dist/web/assets/HtmlVisual-D9Mh7xds.js +81 -0
  258. package/dist/web/assets/LabModelVersionDetailPage-DgY7lAu5.js +1 -0
  259. package/dist/web/assets/{LabSkillSidebar-HibUEEko.js → LabSkillSidebar-BwtlThO7.js} +1 -1
  260. package/dist/web/assets/LabsRoute-BV7ZJGEw.js +101 -0
  261. package/dist/web/assets/MainChatThread-pzHKd_YN.js +2 -0
  262. package/dist/web/assets/MainPane-6OlLiKKb.js +10 -0
  263. package/dist/web/assets/MainPane-Dje-hfUM.css +1 -0
  264. package/dist/web/assets/NativeSetupTerminal-CPDChcMi.js +2 -0
  265. package/dist/web/assets/NativeSkillSidebar-BEJvt5_H.js +1 -0
  266. package/dist/web/assets/{NewProjectDialog-t9Imnb__.js → NewProjectDialog-CjrjgkTN.js} +1 -1
  267. package/dist/web/assets/{OutputsPage-CeGq_F1S.js → OutputsPage-jzx93QQ3.js} +1 -1
  268. package/dist/web/assets/{PageChrome-VHME5V8j.js → PageChrome-C1M13qG2.js} +1 -1
  269. package/dist/web/assets/{ProjectsPage-2TMZoEPB.js → ProjectsPage-DZrjlMp2.js} +1 -1
  270. package/dist/web/assets/RightChatPanelStack-BsxJg9sy.js +1 -0
  271. package/dist/web/assets/RightSidebarHomePanel-CCVQ9LMB.js +1 -0
  272. package/dist/web/assets/ScheduledWorkPage-Cw1ja2GF.js +1 -0
  273. package/dist/web/assets/{SettingsView-Y8f98GSE.css → SettingsView-Cc0376pY.css} +1 -1
  274. package/dist/web/assets/SettingsView-CckoIki3.js +5 -0
  275. package/dist/web/assets/TasksetDraftEditorPrimitives-ByC8bDjp.js +1 -0
  276. package/dist/web/assets/TeamChatView-OprnSKLF.js +1 -0
  277. package/dist/web/assets/{TerminalOverlay-DlhRpi-X.js → TerminalOverlay-d7A2F9Lx.js} +2 -2
  278. package/dist/web/assets/TrainingCreationPanel-Cyn6R6I6.js +1 -0
  279. package/dist/web/assets/{TrainingDraftPanel-BhhZPPuY.js → TrainingDraftPanel-Mpb5e7t5.js} +1 -1
  280. package/dist/web/assets/TrainingRunLineage-PXzWR65d.css +1 -0
  281. package/dist/web/assets/TrainingRunLineage-VcKz7dIR.js +1 -0
  282. package/dist/web/assets/{UsageSettingsSection-DTZslBeW.js → UsageSettingsSection-FhYymrfc.js} +2 -2
  283. package/dist/web/assets/WorkSidebarPanel-u87uptH0.js +1 -0
  284. package/dist/web/assets/WorkspaceDiffPanel-B5rlW7bA.js +11 -0
  285. package/dist/web/assets/WorkspaceEnvironmentMenu-C8y3537a.js +35 -0
  286. package/dist/web/assets/{WorkspaceFileLocation-ChEeZffU.js → WorkspaceFileLocation-LrEWj4UK.js} +1 -1
  287. package/dist/web/assets/{WorkspaceGitDialogs-D_RUXhTi.js → WorkspaceGitDialogs-NRIMXnkS.js} +1 -1
  288. package/dist/web/assets/{WorkspaceMonacoEditor-BJxaiDrj.js → WorkspaceMonacoEditor-CvDGjKAL.js} +3 -3
  289. package/dist/web/assets/WorkspacePdfPreview-BZ0BbnHv.js +2 -0
  290. package/dist/web/assets/{WorkspacePresentationPreview-A28Poeca.js → WorkspacePresentationPreview-DJrjrvT0.js} +1 -1
  291. package/dist/web/assets/app-models-CUA9XB9U.js +1 -0
  292. package/dist/web/assets/bot-6OhUEmkE.js +1 -0
  293. package/dist/web/assets/browser-sidebar-links-ZyYiYBBd.js +1 -0
  294. package/dist/web/assets/chat-resources-CI8KFVO5.js +1 -0
  295. package/dist/web/assets/{chevron-down-dYn0pd4Q.js → chevron-down-jmVA1BIf.js} +1 -1
  296. package/dist/web/assets/chevron-right-BYmDQ7ti.js +1 -0
  297. package/dist/web/assets/chevron-up-CstyLXH3.js +1 -0
  298. package/dist/web/assets/{chunk-ZFYI4P6C-BmsNtSkR.js → chunk-ONGOAEY6-C__DQmRT.js} +5 -5
  299. package/dist/web/assets/{chunk-BYNVSWIQ-DWh9SmdB.js → chunk-SQBYHWZU-DumrB9SB.js} +1 -1
  300. package/dist/web/assets/{client-choice-storage-DTTLbrYt.js → client-choice-storage-BdQ_YDuk.js} +1 -1
  301. package/dist/web/assets/{cloud-upload-CRMPCFnq.js → cloud-upload-Ck1ufAr8.js} +1 -1
  302. package/dist/web/assets/contracts-BLiqJxBv.js +1 -0
  303. package/dist/web/assets/{copy-DR4ielPn.js → copy-CPkbMfXt.js} +1 -1
  304. package/dist/web/assets/{createLucideIcon-DmttVQ_a.js → createLucideIcon-CXQny8HU.js} +1 -1
  305. package/dist/web/assets/{cssMode-d-2GuNvW.js → cssMode-CYxYl_om.js} +1 -1
  306. package/dist/web/assets/{external-link-B4rPiZEp.js → external-link-CDKOLG_v.js} +1 -1
  307. package/dist/web/assets/{folder-open-BrIUcUk_.js → folder-open-CEtOb_lK.js} +1 -1
  308. package/dist/web/assets/{folder-plus-DwImGEt-.js → folder-plus-CVMYZs3e.js} +1 -1
  309. package/dist/web/assets/{git-commit-horizontal-Ds1mkrlW.js → git-commit-horizontal-DDyhPjxS.js} +1 -1
  310. package/dist/web/assets/{htmlMode-s15GR0Fn.js → htmlMode-DoY4V_j0.js} +1 -1
  311. package/dist/web/assets/icons-D7jkCa2d.js +1 -0
  312. package/dist/web/assets/{image-CY-sHbfQ.js → image-B-PjDSwU.js} +1 -1
  313. package/dist/web/assets/{index-DYrLeSyY.js → index-D9WbJMSq.js} +2 -2
  314. package/dist/web/assets/index-g7UqJhnX.css +1 -0
  315. package/dist/web/assets/{info-aSvM8YlJ.js → info-CCnw-K3b.js} +1 -1
  316. package/dist/web/assets/intake-contracts-BW0Y0C2R.js +1 -0
  317. package/dist/web/assets/{jsonMode-vos9H2hz.js → jsonMode-CeOpZdPj.js} +1 -1
  318. package/dist/web/assets/loader-circle-CPaJeTDy.js +1 -0
  319. package/dist/web/assets/{lspLanguageFeatures-pQmEaoMt.js → lspLanguageFeatures-DAbgLCqZ.js} +1 -1
  320. package/dist/web/assets/{maximize-2-DgF6ZVOM.js → maximize-2-BZX38cpr.js} +1 -1
  321. package/dist/web/assets/message-square-CvgSecgD.js +1 -0
  322. package/dist/web/assets/{monaco.contribution-BPwsKvRB.js → monaco.contribution-CF2JDhi4.js} +2 -2
  323. package/dist/web/assets/{monaco.contribution-CJlccVX3.js → monaco.contribution-cbDqt48m.js} +2 -2
  324. package/dist/web/assets/{monaco.contribution-BbMpa0_-.js → monaco.contribution-m2ze2EsL.js} +2 -2
  325. package/dist/web/assets/{monaco.contribution-pWurLXbm.js → monaco.contribution-yeyow_-Q.js} +2 -2
  326. package/dist/web/assets/{monitor-DlEV241C.js → monitor-By0s4hxb.js} +1 -1
  327. package/dist/web/assets/{paperclip-fnRZSIRc.js → paperclip-BJ2QgJLa.js} +1 -1
  328. package/dist/web/assets/{pdf-CT3zVKCE.js → pdf-C4x-1jjP.js} +1 -1
  329. package/dist/web/assets/pdf.worker.min-BrEVksTu.js +1 -0
  330. package/dist/web/assets/play-D_SuGDBM.js +1 -0
  331. package/dist/web/assets/plus-yw95Iaj8.js +1 -0
  332. package/dist/web/assets/{presentation-Bb8ecExR.js → presentation-I86G1Gd9.js} +1 -1
  333. package/dist/web/assets/{python-DXA1xp0A.js → python-CqFTPj8r.js} +1 -1
  334. package/dist/web/assets/{refresh-cw-B53QjxMO.js → refresh-cw-Dga35Eay.js} +1 -1
  335. package/dist/web/assets/requests-BCbaFiqV.js +1 -0
  336. package/dist/web/assets/{reward-checks-5AOStF27.js → reward-checks-Bcq9ETCA.js} +1 -1
  337. package/dist/web/assets/{save-V1Q4Fcqa.js → save-BLKjYtzR.js} +1 -1
  338. package/dist/web/assets/settings-D7C-Auyi.js +21 -0
  339. package/dist/web/assets/{settings-lists-CtH1A57b.js → settings-lists-DMKA1lCN.js} +5 -5
  340. package/dist/web/assets/square-BY5lG2Ol.js +1 -0
  341. package/dist/web/assets/{square-terminal-Dmgkm5zY.js → square-terminal-B-n7vUex.js} +1 -1
  342. package/dist/web/assets/submit-issue-command-B7Hrt2tU.js +3 -0
  343. package/dist/web/assets/{toggleHighContrast-B-BD2K2Q.js → toggleHighContrast-BhmBE5XE.js} +1 -1
  344. package/dist/web/assets/training-QrdkRQZQ.js +2 -0
  345. package/dist/web/assets/{training-model-data-14942K_Z.js → training-model-data-DB-jg6L_.js} +12 -12
  346. package/dist/web/assets/{tsMode-DdgIcxK3.js → tsMode-BSWEII2p.js} +1 -1
  347. package/dist/web/assets/{upload-82Y6RjLi.js → upload-C4MPhQn8.js} +1 -1
  348. package/dist/web/assets/{useAccountSettings-BgHXNpq_.js → useAccountSettings-9oqWdRLs.js} +1 -1
  349. package/dist/web/assets/useAgentInventory-isO79ui9.js +1 -0
  350. package/dist/web/assets/{useLocalAgentSchedules-CsKv22Hs.js → useLocalAgentSchedules-CZX6PxoK.js} +1 -1
  351. package/dist/web/assets/{useQuery-CPC2wsWm.js → useQuery-BD0Uexmh.js} +1 -1
  352. package/dist/web/assets/{wifi-off-DXOoDN9l.js → wifi-off-Cloe0WuQ.js} +1 -1
  353. package/dist/web/assets/{workers-Clf4hKt5.js → workers-BXagz5eg.js} +1 -1
  354. package/dist/web/assets/x-Dqpel42h.js +1 -0
  355. package/dist/web/assets/{yaml-I1tf8Uxx.js → yaml-sBdvVbCc.js} +1 -1
  356. package/dist/web/index.html +2 -2
  357. package/docs/command-reference.md +22 -4
  358. package/package.json +5 -2
  359. package/dist/chunks/actions-command-6LF4Z4WK.js +0 -2
  360. package/dist/chunks/app-server-connected-apps-3T546FE7.js +0 -2
  361. package/dist/chunks/app-server-evaluations-TXD747QA.js +0 -2
  362. package/dist/chunks/app-server-harness-services-BBCDV5P3.js +0 -2
  363. package/dist/chunks/app-server-runtime-VEJPDAFP.js +0 -2
  364. package/dist/chunks/apps-CTT2XYRR.js +0 -2
  365. package/dist/chunks/chunk-4M3YW3EQ.js +0 -13
  366. package/dist/chunks/chunk-4U2FNXQW.js +0 -2
  367. package/dist/chunks/chunk-547AUVKN.js +0 -2
  368. package/dist/chunks/chunk-557YG77L.js +0 -2
  369. package/dist/chunks/chunk-7KTARW23.js +0 -2
  370. package/dist/chunks/chunk-B42QQUZY.js +0 -2
  371. package/dist/chunks/chunk-EWOTDVDJ.js +0 -4
  372. package/dist/chunks/chunk-GAQLXFOT.js +0 -2
  373. package/dist/chunks/chunk-GLDYJM7O.js +0 -1
  374. package/dist/chunks/chunk-HKV7RX5E.js +0 -2
  375. package/dist/chunks/chunk-IWK3RTLR.js +0 -2
  376. package/dist/chunks/chunk-JX6OX6XE.js +0 -12
  377. package/dist/chunks/chunk-JY3YSI54.js +0 -2
  378. package/dist/chunks/chunk-LILXHGIA.js +0 -2
  379. package/dist/chunks/chunk-LJPO3TEL.js +0 -17
  380. package/dist/chunks/chunk-MNFW5WLD.js +0 -6
  381. package/dist/chunks/chunk-N5GPINVP.js +0 -2
  382. package/dist/chunks/chunk-N663LL27.js +0 -2
  383. package/dist/chunks/chunk-NOSBNHGC.js +0 -18
  384. package/dist/chunks/chunk-NR5VASQB.js +0 -2
  385. package/dist/chunks/chunk-O3MHHGC5.js +0 -151
  386. package/dist/chunks/chunk-OZ6LRNRE.js +0 -2
  387. package/dist/chunks/chunk-PGO4FRHU.js +0 -10
  388. package/dist/chunks/chunk-QAVQJZCM.js +0 -2
  389. package/dist/chunks/chunk-RBDUMASL.js +0 -2
  390. package/dist/chunks/chunk-TM4VEMNN.js +0 -2
  391. package/dist/chunks/chunk-TUCKED4T.js +0 -4
  392. package/dist/chunks/chunk-TVTFEGTU.js +0 -2
  393. package/dist/chunks/chunk-TW3SRBLU.js +0 -22
  394. package/dist/chunks/chunk-UT6F6AIB.js +0 -12
  395. package/dist/chunks/chunk-VE6ZIGUQ.js +0 -2
  396. package/dist/chunks/chunk-VI32G77S.js +0 -2
  397. package/dist/chunks/chunk-VWRTE64Y.js +0 -2
  398. package/dist/chunks/chunk-XSB3T4JZ.js +0 -5
  399. package/dist/chunks/chunk-XWDFXM3S.js +0 -2
  400. package/dist/chunks/chunk-ZQHPGEYT.js +0 -2
  401. package/dist/chunks/cli-GCSO2OAI.js +0 -2
  402. package/dist/chunks/connected-app-executor-UDE7U4KG.js +0 -2
  403. package/dist/chunks/connected-evidence-GXIY2L7C.js +0 -2
  404. package/dist/chunks/core-commands-NJ6TGND4.js +0 -2
  405. package/dist/chunks/dataset-preparation-authoring-IUXUQK3L.js +0 -4
  406. package/dist/chunks/datasets-AH56DKLZ.js +0 -2
  407. package/dist/chunks/desktop-test-PYUTEOWO.js +0 -3
  408. package/dist/chunks/dist-5267UT3V.js +0 -2
  409. package/dist/chunks/evaluation-coordination-3AUICOC5.js +0 -2
  410. package/dist/chunks/experiment-improvements-YS7GGPDW.js +0 -2
  411. package/dist/chunks/experiments-EJZK7FPT.js +0 -2
  412. package/dist/chunks/experiments-signal-NKUIJCIY.js +0 -2
  413. package/dist/chunks/host-profile-evaluation-tools-CTC5JQPD.js +0 -2
  414. package/dist/chunks/host-profile-external-dataset-GJWDY3YT.js +0 -2
  415. package/dist/chunks/hosted-app-server-composition-TLJSKMJT.js +0 -2
  416. package/dist/chunks/hosted-experiment-improvement-TIVXXRPG.js +0 -3
  417. package/dist/chunks/hosted-harness-runtime-SFLJEZFI.js +0 -2
  418. package/dist/chunks/hosted-profile-candidate-DKEMVIYG.js +0 -3
  419. package/dist/chunks/hosted-profile-compiler-V6YR6EHO.js +0 -2
  420. package/dist/chunks/hosted-profile-evaluation-control-ERCXAPZD.js +0 -2
  421. package/dist/chunks/hosted-profile-evaluation-inspection-Q3AIIIB6.js +0 -3
  422. package/dist/chunks/hosted-profile-evaluation-preparation-ELLGH44Z.js +0 -3
  423. package/dist/chunks/human-review-5WM6MSON.js +0 -2
  424. package/dist/chunks/learning-KVLTMRLD.js +0 -2
  425. package/dist/chunks/local-harness-improvement-runtime-IGIKM6GJ.js +0 -2
  426. package/dist/chunks/local-harness-taskset-review-DR2ZIDOH.js +0 -2
  427. package/dist/chunks/model-projects-H22KENI4.js +0 -2
  428. package/dist/chunks/opchat-3S6TSDZO.js +0 -3
  429. package/dist/chunks/opchat-bounded-chat-B7LPCD4U.js +0 -2
  430. package/dist/chunks/organizations-62YNTZTO.js +0 -2
  431. package/dist/chunks/project-action-payload-32F4X2BB.js +0 -2
  432. package/dist/chunks/project-agent-O4REKO6T.js +0 -2
  433. package/dist/chunks/published-experiment-source-DAOTJLIN.js +0 -2
  434. package/dist/chunks/refiner-profile-service-DYMZ7J3X.js +0 -2
  435. package/dist/chunks/sandbox-command-UQ26NDIX.js +0 -2
  436. package/dist/chunks/saved-work-PG52WCRQ.js +0 -2
  437. package/dist/chunks/src-AU6LG7E6.js +0 -421
  438. package/dist/chunks/standalone-experiment-turn-owner-SD3SUTKX.js +0 -2
  439. package/dist/chunks/store-chat-resources-T4LR7K25.js +0 -2
  440. package/dist/chunks/store-evaluation-results-WUVJWCFU.js +0 -7
  441. package/dist/chunks/store-harness-workspaces-IFEFY5CK.js +0 -2
  442. package/dist/chunks/store-human-review-ZQNLZRGG.js +0 -7
  443. package/dist/chunks/store-learned-preference-migration-validation-UH6MJQSH.js +0 -2
  444. package/dist/chunks/store-model-batch-review-QO4VVKWC.js +0 -2
  445. package/dist/chunks/store-model-configuration-C3HSOFD5.js +0 -3
  446. package/dist/chunks/store-model-project-preparation-RQ2YTC2Y.js +0 -2
  447. package/dist/chunks/store-task-inbox-DL5RYFPO.js +0 -33
  448. package/dist/chunks/store-taskset-drafts-UFGN4SGF.js +0 -9
  449. package/dist/chunks/taskset-packages-CBLJFWDQ.js +0 -2
  450. package/dist/chunks/training-error-L5V5IBX3.js +0 -2
  451. package/dist/chunks/training-hosted-I2NDBYGS.js +0 -2
  452. package/dist/chunks/training-hosted-report-4F25RZZ4.js +0 -2
  453. package/dist/chunks/training-hosted-workers-KI767T4Y.js +0 -2
  454. package/dist/skills/openpond-desktop-harness/SKILL.md +0 -113
  455. package/dist/skills/openpond-desktop-harness/agents/openai.yaml +0 -4
  456. package/dist/web/assets/App-DHJVXTI2.js +0 -54
  457. package/dist/web/assets/AppTerminalPanel-RjFlF-a4.js +0 -2
  458. package/dist/web/assets/AppsView-ttlr9ckQ.js +0 -1
  459. package/dist/web/assets/BrowserSidebar-Cp2l0kg0.js +0 -1
  460. package/dist/web/assets/ChatTimelineEntry-BITv20Ze.js +0 -1
  461. package/dist/web/assets/CommandMenu-6oj8FUr6.js +0 -1
  462. package/dist/web/assets/ComposerAttachments-6en7m_ov.js +0 -2
  463. package/dist/web/assets/FilePagePreview-CW4J_1u7.js +0 -2
  464. package/dist/web/assets/LabModelVersionDetailPage-f0tHT-Sn.js +0 -1
  465. package/dist/web/assets/LabsRoute-B61l1b8P.js +0 -101
  466. package/dist/web/assets/MainChatThread-egKi0gLk.js +0 -2
  467. package/dist/web/assets/MainPane-2dj6Dg4l.js +0 -95
  468. package/dist/web/assets/MainPane-BwHw3UYp.css +0 -1
  469. package/dist/web/assets/NativeSetupTerminal-CNHTByLo.js +0 -2
  470. package/dist/web/assets/NativeSkillSidebar-DCdMbSfe.js +0 -1
  471. package/dist/web/assets/RightChatPanelStack-B3mBViGC.js +0 -1
  472. package/dist/web/assets/RightSidebarHomePanel-CxDYSyyx.js +0 -1
  473. package/dist/web/assets/ScheduledWorkPage-Dh47iH11.js +0 -1
  474. package/dist/web/assets/SettingsView-D2bu3tK_.js +0 -5
  475. package/dist/web/assets/TeamChatView-CN17AsgA.js +0 -1
  476. package/dist/web/assets/TrainingCreationPanel-DJKzaNFj.js +0 -1
  477. package/dist/web/assets/TrainingMetricWorkbench-DBy8F1xp.js +0 -1
  478. package/dist/web/assets/WorkSidebarPanel-Ds-eTQLs.js +0 -1
  479. package/dist/web/assets/WorkspaceDiffPanel-D_iyg2D4.js +0 -11
  480. package/dist/web/assets/WorkspaceEnvironmentMenu-Fn-NlfMQ.js +0 -35
  481. package/dist/web/assets/app-models-BviS9b7U.js +0 -1
  482. package/dist/web/assets/browser-sidebar-links-ujSvTf5h.js +0 -1
  483. package/dist/web/assets/chat-resources-3SvnVeKv.js +0 -1
  484. package/dist/web/assets/chevron-right-sFx2xRvT.js +0 -1
  485. package/dist/web/assets/contracts-BHTOD1nd.js +0 -1
  486. package/dist/web/assets/icons-CK5-nxVC.js +0 -1
  487. package/dist/web/assets/index-Dezj4Z2p.css +0 -1
  488. package/dist/web/assets/loader-circle-cyf35w3i.js +0 -1
  489. package/dist/web/assets/play-wI_3FLr4.js +0 -1
  490. package/dist/web/assets/plus-DoJe4fLj.js +0 -1
  491. package/dist/web/assets/settings-BKmRueaw.js +0 -21
  492. package/dist/web/assets/square-BqSK-hv9.js +0 -1
  493. package/dist/web/assets/submit-issue-command-DRgUboVW.js +0 -3
  494. package/dist/web/assets/training-managed-adapter-BXNwgd3P.js +0 -1
  495. package/dist/web/assets/useAgentInventory-B-LNn3up.js +0 -1
  496. package/dist/web/assets/x-IPhrr4ju.js +0 -1
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b as a}from"./chunk-3R4MSE2S.js";import"./chunk-6PKXJEJM.js";import"./chunk-PAE3PQEC.js";import"./chunk-4NXEYPPX.js";import"./chunk-NWOK6NLE.js";import"./chunk-6SH4B7DV.js";import"./chunk-LRRBYIGH.js";import"./chunk-Y2KPHVZK.js";import"./chunk-IZ56L2ZK.js";import"./chunk-B4RKHHF7.js";import"./chunk-KCJVFLBB.js";import"./chunk-WBUK73ST.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-OZ6LRNRE.js";import"./chunk-MWXW2CA6.js";import"./chunk-L3KS6MOV.js";import"./chunk-XGY4OQLC.js";import"./chunk-IWK3RTLR.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-HFJUXKT5.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as createStandaloneExperimentTurnOwner};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as O,b as D}from"./chunk-RBDUMASL.js";import{b as _,c as R,d as l,e as d}from"./chunk-TGEGXTPR.js";import{a as L}from"./chunk-KCJVFLBB.js";import{wb as c,xb as w}from"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import{r as m,u as f}from"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n as y}from"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as g}from"./chunk-FTQLQJQV.js";import{randomUUID as H}from"node:crypto";var E=c.omit({workspace:!0}).extend({workspace:c.shape.workspace.omit({files:!0})}),k=class extends L{static{g(this,"SqliteChatResourceStore")}datasetListings=new Map;datasetListingDataVersion=null;async listChatHostedExperiments(){return await this.ready,await this.writeQueue,this.database.all("SELECT payload FROM chat_hosted_experiments ORDER BY id",[]).map(e=>JSON.parse(e.payload))}async readChatHostedExperiment(e){await this.ready,await this.writeQueue;let a=this.database.get("SELECT payload FROM chat_hosted_experiments WHERE id=?",[e]);return a?JSON.parse(a.payload):null}async retainChatHostedExperiment(e,a,s,t){await this.ready;let r=this.writeQueue.then(()=>{let i=this.database.get("SELECT owner_hash,configuration_hash FROM chat_hosted_experiments WHERE id=?",[e]);if(i&&(i.owner_hash!==a||i.configuration_hash!==s))throw new Error("The retained hosted Experiment changed owner or configuration.");this.database.run("INSERT INTO chat_hosted_experiments(id,owner_hash,configuration_hash,payload) VALUES(?,?,?,?) ON CONFLICT(id) DO UPDATE SET payload=excluded.payload",[e,a,s,JSON.stringify(t)])});return this.writeQueue=r.then(()=>{},()=>{}),r}async readChatExperimentGroup(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT request_hash,payload FROM chat_experiment_groups WHERE operation_id=?",[e]);if(!s)return null;if(a&&s.request_hash!==a)throw new Error("Experiment operation ID was reused with different inputs.");return JSON.parse(s.payload)}async prepareChatExperimentGroup(e,a,s){await this.ready;let t=this.writeQueue.then(()=>{this.database.run("INSERT OR IGNORE INTO chat_experiment_groups(operation_id,request_hash,payload) VALUES(?,?,?)",[e,a,JSON.stringify(s)]);let r=this.database.get("SELECT request_hash,payload FROM chat_experiment_groups WHERE operation_id=?",[e]);if(r.request_hash!==a)throw new Error("Experiment operation ID was reused with different inputs.");return JSON.parse(r.payload)});return this.writeQueue=t.then(()=>{},()=>{}),t}async localResourceOwnerId(){await this.ready;let e=this.writeQueue.then(()=>(this.database.run("INSERT OR IGNORE INTO local_resource_owner(singleton,id) VALUES(1,?)",[`local-owner-${H()}`]),this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]).id));return this.writeQueue=e.then(()=>{},()=>{}),e}async readLocalDataset(e,a){await this.ready,await this.writeQueue;let s=this.database.get(a===void 0?"SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?":"SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",a===void 0?[e]:[e,a]);return s?d(this.database,s.payload):null}async readLocalDatasetByWorkspaceHash(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND json_extract(r.payload,'$.workspace.contentHash')=?",[e,a]);return s?d(this.database,s.payload):null}async listLocalDatasets(e=!1){if(e){let a=(await this.listLocalDatasetListings()).filter(t=>t.sync);return(await Promise.all(a.map(t=>this.readLocalDataset(t.workspace.draft.id)))).filter(t=>t!==null)}return await this.ready,await this.writeQueue,this.database.all("SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash ORDER BY w.updated_at DESC",[]).map(a=>d(this.database,a.payload))}async listLocalDatasetListings(){await this.ready,await this.writeQueue;let e=this.database.get("PRAGMA data_version",[]).data_version;this.datasetListingDataVersion!==e&&this.datasetListings.clear(),this.datasetListingDataVersion=e;let a=this.database.all("SELECT id,revision,updated_at FROM local_dataset_workspaces ORDER BY updated_at DESC",[]),s=new Set(a.map(t=>t.id));for(let t of this.datasetListings.keys())s.has(t)||this.datasetListings.delete(t);return a.map(t=>{let r=`${t.revision}:${t.updated_at}`,i=this.datasetListings.get(t.id);if(i?.stamp===r)return structuredClone(i.value);let o=this.database.get("SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[t.id]).payload,n=E.parse(l(this.database,o));return this.datasetListings.set(t.id,{stamp:r,value:n}),structuredClone(n)})}async readLocalDatasetListing(e,a){await this.ready,await this.writeQueue;let s=a===void 0?"local_dataset_workspaces":"local_dataset_versions",t=this.database.get(`SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM ${s} w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?${a===void 0?"":" AND w.revision=?"}`,a===void 0?[e]:[e,a]);return t?E.parse(l(this.database,t.payload)):null}async readLocalDatasetProjection(e,a,s){await this.ready,await this.writeQueue;let t=s.workspaceHash?"w.id=? AND json_extract(r.payload,'$.workspace.contentHash')=?":s.revision===void 0?"w.id=?":"w.id=? AND w.revision=?",r=s.workspaceHash||s.revision!==void 0?"local_dataset_versions":"local_dataset_workspaces",i=s.workspaceHash?[e,s.workspaceHash]:s.revision===void 0?[e]:[e,s.revision],o=`${r} w JOIN local_dataset_records r ON r.record_hash=w.record_hash`,n=this.database.get(`SELECT json_remove(r.payload,'$.workspace.files') AS payload FROM ${o} WHERE ${t}`,i);if(!n)return null;let h=E.parse(l(this.database,n.payload)),{paths:I,policyPaths:N}=D(h.workspace.draft,a),p=[...N],u=[...I],S=p.length?`json_extract(file.value,'$.path') NOT IN (${p.map(()=>"?").join(",")})`:"1",b=u.length?` OR json_extract(file.value,'$.path') IN (${u.map(()=>"?").join(",")})`:"",v=this.database.all(`SELECT file.value AS payload FROM ${o},json_each(r.payload,'$.workspace.files') file WHERE ${t} AND (${S}${b})`,[...i,...p,...u]).map(x=>m.parse(R(this.database,JSON.parse(x.payload)))),T=h.workspace.contentHash,C=O({...h.workspace,files:v},a);return{record:c.parse({...h,workspace:C}),sourceWorkspaceHash:T}}async recoverLocalDatasetOperation(e,a){await this.ready,await this.writeQueue;let s=this.database.get("SELECT w.request_hash,r.payload FROM local_dataset_operations w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.operation_id=?",[e]);if(!s)return null;if(s.request_hash!==a)throw new Error("Dataset operation ID was reused with different input.");return d(this.database,s.payload)}async saveLocalDataset(e){let a=c.parse(e.record);if(f(a.workspace,Number.POSITIVE_INFINITY),a.workspace.draft.profileId!==a.ownerId||a.workspace.draft.modelScope!==null)throw new Error("Independent local Dataset ownership cannot change.");await this.ready;let s=this.writeQueue.then(()=>{this.database.exec("BEGIN IMMEDIATE");try{let t=this.database.get("SELECT w.request_hash,r.payload FROM local_dataset_operations w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.operation_id=?",[e.operationId]);if(t){if(t.request_hash!==e.requestHash)throw new Error("Dataset operation ID was reused with different input.");let n=d(this.database,t.payload);return this.database.exec("COMMIT"),n}let r=a.workspace.draft.id,i=this.database.get("SELECT w.revision,r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[r]);if((i?.revision??0)!==e.expectedRevision)throw new Error("Dataset changed. Reload its saved revision before editing.");if(a.workspace.draft.revision!==e.expectedRevision+1)throw new Error("Dataset revisions must advance once per saved edit.");if(i){let n=d(this.database,i.payload);if(n.ownerId!==a.ownerId||n.projectId!==a.projectId||n.workspace.draft.createdAt!==a.workspace.draft.createdAt)throw new Error("Dataset ownership and origin cannot change.");a.sync=n.sync}let o=_(this.database,a);return this.database.run("INSERT INTO local_dataset_workspaces(id,revision,record_hash,updated_at) VALUES(?,?,?,?) ON CONFLICT(id) DO UPDATE SET revision=excluded.revision,record_hash=excluded.record_hash,updated_at=excluded.updated_at",[r,a.workspace.draft.revision,o,a.workspace.draft.updatedAt]),this.database.run("INSERT INTO local_dataset_versions(id,revision,record_hash) VALUES(?,?,?)",[r,a.workspace.draft.revision,o]),this.database.run("INSERT INTO local_dataset_operations(operation_id,request_hash,record_hash) VALUES(?,?,?)",[e.operationId,e.requestHash,o]),this.database.exec("COMMIT"),this.datasetListings.delete(r),a}catch(t){throw this.database.exec("ROLLBACK"),t}});return this.writeQueue=s.then(()=>{},()=>{}),s}async updateLocalDatasetMetadata(e,a,s){await this.ready;let t=this.writeQueue.then(()=>{this.database.exec("BEGIN IMMEDIATE");try{let r=this.database.get("SELECT r.payload FROM local_dataset_workspaces w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=?",[e]);if(!r)throw new Error("Local Dataset was not found.");let i=d(this.database,r.payload);if(y(i)!==a)throw new Error("Dataset state changed. Retry against its latest saved state.");let o=c.parse(s(i));if(o.ownerId!==i.ownerId||o.projectId!==i.projectId||o.workspace.contentHash!==i.workspace.contentHash)throw new Error("Metadata updates cannot edit Dataset bytes or ownership.");let n=_(this.database,o);return this.database.run("UPDATE local_dataset_workspaces SET record_hash=? WHERE id=?",[n,e]),this.database.run("UPDATE local_dataset_versions SET record_hash=? WHERE id=? AND revision=?",[n,e,o.workspace.draft.revision]),this.database.exec("COMMIT"),this.datasetListings.delete(e),o}catch(r){throw this.database.exec("ROLLBACK"),r}});return this.writeQueue=t.then(()=>{},()=>{}),t}async linkChatResource(e,a,s){let t=w.parse(s);await this.upsertPayload("INSERT INTO chat_resource_links(session_id,turn_id,kind,resource_id,revision,payload) VALUES(?,?,?,?,?,?) ON CONFLICT(session_id,turn_id,kind,resource_id) DO UPDATE SET revision=excluded.revision,payload=excluded.payload WHERE excluded.revision>=chat_resource_links.revision",[e,a,t.kind,t.id,t.revision,JSON.stringify(t)])}async chatResourceLinks(e){await this.ready,await this.writeQueue;let a=[],s=[];return e.sessionId&&(a.push("session_id=?"),s.push(e.sessionId)),e.kind&&(a.push("kind=?"),s.push(e.kind)),e.id&&(a.push("resource_id=?"),s.push(e.id)),this.database.all(`SELECT session_id,turn_id,payload FROM chat_resource_links${a.length?` WHERE ${a.join(" AND ")}`:""}`,s).map(t=>({sessionId:t.session_id,turnId:t.turn_id,summary:w.parse(JSON.parse(t.payload))}))}};export{k as SqliteChatResourceStore};
@@ -1,7 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as m}from"./chunk-GSWBNJGZ.js";import{a as k}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import{p as f}from"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import{Hb as E,Ib as O,O as v,Ob as h,Pb as C,Q as y,f as R,h as p,m as H}from"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import{J as P,P as _}from"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n as s,o as c}from"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as g}from"./chunk-FTQLQJQV.js";var w=class extends k{static{g(this,"SqliteEvaluationResultStore")}async saveProfileEvaluationGrade(a){let e=P.parse(a);c(e,"Profile evaluation grade");let n=await this.getProfileEvaluationGrade(e.contentHash);return n||(await this.upsertPayload("INSERT INTO profile_evaluation_grades (content_hash, payload) VALUES (?, ?) ON CONFLICT(content_hash) DO NOTHING",[e.contentHash,JSON.stringify(e)]),e)}async getProfileEvaluationGrade(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_grades WHERE content_hash = ?",[a],P.parse)}async saveProfileEvaluationReceipt(a){let e=R.parse(a);H(e);let n=await this.getProfileEvaluationReceipt(e.id);if(n){if(n.contentHash!==e.contentHash)throw new Error(`Profile evaluation receipt ${e.id} is immutable.`);return n}return await this.upsertPayload("INSERT INTO profile_evaluation_receipts (id, run_id, payload) VALUES (?, ?, ?)",[e.id,e.runManifest.id,JSON.stringify(e)]),e}async getProfileEvaluationReceipt(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_receipts WHERE id = ?",[a],R.parse)}async saveProfileEvaluationRun(a){let e=m.parse(a);c(e,"Profile evaluation run"),c(e.manifest,"Profile evaluation run manifest"),_(e.metric);let n=e.manifest.profileEvaluation;if(!n||n.profileId!==e.profileRef.profileId||e.metric.runManifest.id!==e.manifest.id||e.metric.runManifest.contentHash!==e.manifest.contentHash||s(e.receiptRefs)!==s(e.metric.receiptRefs))throw new Error("Profile evaluation run differs from its manifest or metric receipts.");if(e.receiptRefs.length!==e.manifest.population.length||e.gradeRefs.length!==e.receiptRefs.length)throw new Error("Profile evaluation run has an incomplete receipt or grade population.");for(let[t,u]of e.manifest.population.entries()){let d=e.receiptRefs[t],r=await this.getProfileEvaluationReceipt(d.id);if(!r||r.contentHash!==d.contentHash||r.runManifest.id!==e.manifest.id||r.runManifest.contentHash!==e.manifest.contentHash||r.id!==u.receiptId||r.taskId!==u.taskId||r.seed!==u.seed)throw new Error("Profile evaluation run references a missing or mismatched receipt.");let l=e.gradeRefs[t],o=await this.getProfileEvaluationGrade(l.contentHash);if(!o||o.contentHash!==l.contentHash||!r.graderEvidenceRefs.some(S=>S.id===l.id&&S.contentHash===l.contentHash))throw new Error("Profile evaluation run references a missing or mismatched grade.")}let i=await this.getProfileEvaluationRun(e.manifest.id);if(i){if(i.contentHash!==e.contentHash)throw new Error(`Profile evaluation run ${e.manifest.id} is immutable.`);return i}return await this.upsertPayload("INSERT INTO profile_evaluation_runs (id, profile_key, taskset_id, payload, created_at) VALUES (?, ?, ?, ?, ?)",[e.manifest.id,s(e.profileRef),e.manifest.tasksetRelease.id,JSON.stringify(e),e.completedAt]),e}async getProfileEvaluationRun(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_runs WHERE id = ?",[a],m.parse)}async listProfileEvaluationRuns(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_runs WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],m.parse)}async saveProfileEvaluationComparison(a,e){let n=f.parse(a),i=E.parse(e);c(i,"Profile evaluation comparison");let t=[];for(let d of i.members){let r=await this.getProfileEvaluationRun(d.runManifest.id);if(!r||s(r.profileRef)!==s(n)||r.manifest.contentHash!==d.runManifest.contentHash||r.metric.contentHash!==d.metricResultHash)throw new Error("Profile evaluation comparison references a missing or mismatched run.");t.push({manifest:r.manifest,result:r.metric})}if(O({id:i.id,members:t,createdAt:i.createdAt}).contentHash!==i.contentHash)throw new Error("Profile evaluation comparison differs from retained run evidence.");let u=await this.getProfileEvaluationComparison(i.id);if(u){if(u.contentHash!==i.contentHash)throw new Error(`Profile evaluation comparison ${i.id} is immutable.`);return u}return await this.upsertPayload("INSERT INTO profile_evaluation_comparisons (id, profile_key, payload, created_at) VALUES (?, ?, ?, ?)",[i.id,s(n),JSON.stringify(i),i.createdAt]),i}async getProfileEvaluationComparison(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_comparisons WHERE id = ?",[a],E.parse)}async listProfileEvaluationComparisons(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_comparisons WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],E.parse)}async saveProfileEvaluationSuiteRun(a,e,n){let i=f.parse(a),t=h.parse(n);c(t,"Profile evaluation suite run");let u=[];for(let l of t.members){let o=await this.getProfileEvaluationRun(l.runManifest.id);if(!o||s(o.profileRef)!==s(i)||o.manifest.contentHash!==l.runManifest.contentHash||o.contentHash!==l.runHash||o.passed!==l.passed||o.metric.value!==l.score)throw new Error("Profile evaluation suite references a missing or mismatched run.");u.push({definitionId:l.definitionId,manifest:o.manifest,runHash:o.contentHash,passed:o.passed,score:o.metric.value})}if(C({id:t.id,suiteId:t.suiteId,catalog:e,members:u,createdAt:t.createdAt,completedAt:t.completedAt}).contentHash!==t.contentHash)throw new Error("Profile evaluation suite differs from retained run evidence.");let r=await this.getProfileEvaluationSuiteRun(t.id);if(r){if(r.contentHash!==t.contentHash)throw new Error(`Profile evaluation suite run ${t.id} is immutable.`);return r}return await this.upsertPayload("INSERT INTO profile_evaluation_suite_runs (id, profile_key, payload, created_at) VALUES (?, ?, ?, ?)",[t.id,s(i),JSON.stringify(t),t.createdAt]),t}async getProfileEvaluationSuiteRun(a){return this.getParsedPayload("SELECT payload FROM profile_evaluation_suite_runs WHERE id = ?",[a],h.parse)}async listProfileEvaluationSuiteRuns(a){return this.listParsedPayloads("SELECT payload FROM profile_evaluation_suite_runs WHERE profile_key = ? ORDER BY created_at DESC, id ASC",[s(f.parse(a))],h.parse)}async saveBenchmarkRun(a){let e=v.parse(a.run);return c(e,"Benchmark run"),await this.upsertPayload(`INSERT INTO benchmark_runs (id, taskset_id, phase, payload, created_at)
3
- VALUES (?, ?, ?, ?, ?)
4
- ON CONFLICT(id) DO NOTHING`,[e.id,a.tasksetId,e.phase,JSON.stringify(e),e.createdAt]),e}async listBenchmarkRuns(a){return this.listParsedPayloads("SELECT payload FROM benchmark_runs WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",[a],v.parse)}async saveBenchmarkComparison(a){let e=y.parse(a.comparison);return c(e,"Benchmark comparison"),await this.upsertPayload(`INSERT INTO benchmark_comparisons (id, taskset_id, payload, created_at)
5
- VALUES (?, ?, ?, ?)
6
- ON CONFLICT(id) DO NOTHING`,[e.id,a.tasksetId,JSON.stringify(e),e.createdAt]),e}async listBenchmarkComparisons(a){return this.listParsedPayloads("SELECT payload FROM benchmark_comparisons WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",[a],y.parse)}async saveEvaluationResult(a){let e=p.parse(a.result);if(c(e,"Evaluation result"),e.metadata.sourceTasksetId!==a.tasksetId)throw new Error("Evaluation result does not match the supplied Taskset identity.");let n=await this.getEvaluationResult(e.id);if(n){if(n.contentHash!==e.contentHash)throw new Error(`Evaluation result ${e.id} is immutable and already has another content hash.`);return n}return await this.upsertPayload(`INSERT INTO evaluation_results (id, taskset_id, kind, payload, created_at)
7
- VALUES (?, ?, ?, ?, ?)`,[e.id,a.tasksetId,a.kind,JSON.stringify(e),a.createdAt]),e}async getEvaluationResult(a){return this.getParsedPayload("SELECT payload FROM evaluation_results WHERE id = ?",[a],p.parse)}async listEvaluationResults(a,e){return this.listParsedPayloads(e?"SELECT payload FROM evaluation_results WHERE taskset_id = ? AND kind = ? ORDER BY created_at DESC, id ASC":"SELECT payload FROM evaluation_results WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",e?[a,e]:[a],p.parse)}};export{m as LocalProfileEvaluationRunSchema,w as SqliteEvaluationResultStore};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b}from"./chunk-Y2KPHVZK.js";import{a}from"./chunk-IZ56L2ZK.js";import"./chunk-KCJVFLBB.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-OZ6LRNRE.js";import"./chunk-UWHIU24L.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{a as LocalHarnessReleaseRecordSchema,b as SqliteHarnessWorkspaceStore};
@@ -1,7 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as h,b as d,c as p,h as N}from"./chunk-JIFUGA3U.js";import"./chunk-LJDBR3RN.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as T}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import{aa as u,t as I}from"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n as l}from"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as c}from"./chunk-FTQLQJQV.js";function L(o,e){let i=d(o,e.scope,e.executionId);if(i.ownerActorId!==e.actorId||!i.completedAt)throw new Error("human_local_publication_source_denied");return o.exec("CREATE TABLE IF NOT EXISTS human_local_publications(scope TEXT NOT NULL,actor_id TEXT NOT NULL,execution_id TEXT NOT NULL,operation_id TEXT NOT NULL,execution_hash TEXT NOT NULL,publication TEXT NOT NULL,PRIMARY KEY(scope,actor_id,execution_id,operation_id))"),i}c(L,"setup");function w(o,e){if(L(o,e).executionHash!==e.executionHash)throw new Error("human_local_publication_source_changed");let t=o.get("SELECT publication,execution_hash FROM human_local_publications WHERE scope=? AND actor_id=? AND execution_id=? AND operation_id=?",[e.scope,e.actorId,e.executionId,e.operationId]);if(t){if(t.execution_hash!==e.executionHash||l(JSON.parse(t.publication))!==l(e.publication))throw new Error("human_local_publication_operation_conflict");return}o.run("INSERT INTO human_local_publications VALUES(?,?,?,?,?,?)",[e.scope,e.actorId,e.executionId,e.operationId,e.executionHash,JSON.stringify(e.publication)])}c(w,"retainHumanLocalPublication");function O(o,e){let i=L(o,e);return o.all("SELECT publication,execution_hash FROM human_local_publications WHERE scope=? AND actor_id=? AND execution_id=? ORDER BY operation_id LIMIT 1001",[e.scope,e.actorId,e.executionId]).map(t=>{if(t.execution_hash!==i.executionHash)throw new Error("human_local_publication_source_changed");return JSON.parse(t.publication)})}c(O,"readHumanLocalPublications");function _(o,e){let i=d(o,e.teamId,e.executionId);if(i.ownerActorId!==e.actorId)throw new Error("live_agent_account_denied");let t=o.get("SELECT owner_id FROM local_experiment_executions WHERE team_id=? AND id=?",[e.teamId,e.executionId]),n=p(o,e.teamId,e.executionId).find(g=>g.receiptId===e.receiptId);if(!n||n.admission.request.model.providerId!=="claude-code")throw new Error("live_agent_case_denied");let a=o.get("SELECT payload FROM local_experiment_events WHERE team_id=? AND execution_id=? AND case_id=? AND type='external.start' ORDER BY sequence LIMIT 1",[e.teamId,e.executionId,e.receiptId]);if(!a||JSON.parse(a.payload).sessionId!==e.sessionId)throw new Error("live_agent_session_stale");o.exec("CREATE TABLE IF NOT EXISTS human_live_controls(team_id TEXT NOT NULL,actor_id TEXT NOT NULL,operation_id TEXT NOT NULL,request_hash TEXT NOT NULL,state TEXT NOT NULL,PRIMARY KEY(team_id,actor_id,operation_id))");let{phase:r,ownerId:R,...E}=e,m=l(E),s=o.get("SELECT request_hash,state FROM human_live_controls WHERE team_id=? AND actor_id=? AND operation_id=?",[e.teamId,e.actorId,e.operationId]);if(s&&s.request_hash!==m)throw new Error("live_agent_operation_conflict");if(e.phase==="inspect")return s?{replay:!0,state:s.state}:null;if(N(o,e.ownerId),t?.owner_id!==e.ownerId)throw new Error("live_agent_execution_lease_lost");if(e.phase==="acknowledge"){if(!s)throw new Error("live_agent_operation_missing");return s.state==="acknowledged"?{replay:!0,state:"acknowledged"}:(v(o,e,"external.control_receipt",{sessionId:e.sessionId,operationId:e.operationId,action:e.action,transport:"process_stdin",state:"acknowledged",occurredAt:new Date().toISOString()}),o.run("UPDATE human_live_controls SET state='acknowledged' WHERE team_id=? AND actor_id=? AND operation_id=?",[e.teamId,e.actorId,e.operationId]),{replay:!1,state:"acknowledged"})}if(s)return{replay:!0,state:s.state};if(o.get("SELECT c.operation_id FROM human_live_controls c JOIN local_experiment_events e ON e.team_id=c.team_id AND json_extract(e.payload,'$.actorId')=c.actor_id AND json_extract(e.payload,'$.operationId')=c.operation_id WHERE c.team_id=? AND c.actor_id=? AND c.state='prepared' AND e.execution_id=? AND e.case_id=? AND e.type='external.human_intervention' LIMIT 1",[e.teamId,e.actorId,e.executionId,e.receiptId]))throw new Error("live_agent_prior_delivery_unknown");if(n.status!=="running"||i.completedAt)throw new Error("live_agent_already_sealed");return o.run("INSERT INTO human_live_controls VALUES(?,?,?,?,'prepared')",[e.teamId,e.actorId,e.operationId,m]),v(o,e,"external.human_intervention",{...E,occurredAt:new Date().toISOString()}),{replay:!1,state:"prepared"}}c(_,"writeHumanLiveControl");function v(o,e,i,t){let n=JSON.stringify(t),a=Buffer.byteLength(n),r=o.get("SELECT event_count,byte_count FROM local_experiment_trace_budgets WHERE team_id=? AND execution_id=?",[e.teamId,e.executionId]);if(a>1048576||(r?.event_count??0)>=2e4||(r?.byte_count??0)+a>67108864)throw new Error("live_agent_control_too_large");o.run("INSERT INTO local_experiment_events(team_id,execution_id,case_id,type,payload) VALUES(?,?,?,?,?)",[e.teamId,e.executionId,e.receiptId,i,n]),o.run("INSERT INTO local_experiment_trace_budgets(team_id,execution_id,event_count,byte_count) VALUES(?,?,1,?) ON CONFLICT(team_id,execution_id) DO UPDATE SET event_count=event_count+1,byte_count=byte_count+excluded.byte_count",[e.teamId,e.executionId,a])}c(v,"appendControlEvent");var y=`
3
- CREATE TABLE IF NOT EXISTS human_review_revisions(scope TEXT NOT NULL,id TEXT NOT NULL,revision INTEGER NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id,revision));
4
- CREATE TABLE IF NOT EXISTS human_reviews(scope TEXT NOT NULL,id TEXT NOT NULL,revision INTEGER NOT NULL,project_id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id));
5
- CREATE INDEX IF NOT EXISTS human_reviews_project_idx ON human_reviews(scope,project_id,id);
6
- CREATE TABLE IF NOT EXISTS human_review_operations(scope TEXT NOT NULL,id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope,id));
7
- `,x=class extends T{static{c(this,"SqliteHumanReviewStore")}async humanLiveControl(e){await this.ready;let i=this.writeQueue.then(()=>{let t=this.database;t.exec("BEGIN IMMEDIATE");try{let n=_(t,e);return t.exec("COMMIT"),n}catch(n){throw t.exec("ROLLBACK"),n}});return this.writeQueue=i.then(()=>{},()=>{}),i}async humanLiveControlReceipt(e){return await this.ready,await this.writeQueue,_(this.database,{...e,phase:"inspect"})}async rememberHumanLocalPublication(e){await this.ready;let i=this.writeQueue.then(()=>{let t=this.database;t.exec("BEGIN IMMEDIATE");try{w(t,e),t.exec("COMMIT")}catch(n){throw t.exec("ROLLBACK"),n}});return this.writeQueue=i.then(()=>{},()=>{}),i}async forgetHumanLocalPublication(e){await this.ready;let i=this.writeQueue.then(()=>{if(this.database.get("SELECT name FROM sqlite_master WHERE type='table' AND name='human_local_publications'"))return this.database.run("DELETE FROM human_local_publications WHERE scope=? AND actor_id=? AND json_extract(publication,'$.id')=?",[e.scope,e.actorId,e.publicationId])});return this.writeQueue=i.then(()=>{},()=>{}),i}async humanLocalPublications(e){return await this.ready,await this.writeQueue,O(this.database,e)}humanReviewRepository(){return{transaction:c(async(e,i)=>{await this.ready;let t=this.writeQueue.then(async()=>{let n=this.database;n.exec(y),n.exec("BEGIN IMMEDIATE");let a=!0;try{let r=await i(S(n,e,()=>{if(!a)throw new Error("human_transaction_closed")}));return n.exec("COMMIT"),r}catch(r){throw n.exec("ROLLBACK"),r}finally{a=!1}});return this.writeQueue=t.then(()=>{},()=>{}),t},"transaction")}}humanReviewLocalEvidence(e,i){let t=d(this.database,e,i),n=h(this.database,e,t.definition.id,t.definition.revision);return{execution:t,released:n,cases:p(this.database,e,i)}}};function S(o,e,i){return{async get(t,n){i();let a=n===void 0?o.get("SELECT payload FROM human_reviews WHERE scope=? AND id=?",[e,t]):o.get("SELECT payload FROM human_review_revisions WHERE scope=? AND id=? AND revision=?",[e,t,n]);return a?u.parse(JSON.parse(a.payload)):null},async put(t,n){i();let a=u.parse(t),r=o.get("SELECT revision FROM human_reviews WHERE scope=? AND id=?",[e,a.id]);if(a.scope!==e||a.revision!==n+1||(r?.revision??0)!==n)throw new I("human_revision_conflict",409);o.run("INSERT INTO human_review_revisions(scope,id,revision,payload) VALUES(?,?,?,?)",[e,a.id,a.revision,JSON.stringify(a)]),o.run("INSERT INTO human_reviews(scope,id,revision,project_id,payload) VALUES(?,?,?,?,?) ON CONFLICT(scope,id) DO UPDATE SET revision=excluded.revision,payload=excluded.payload",[e,a.id,a.revision,a.projectId,JSON.stringify(a)])},async list(t){i();let n=o.all(`SELECT payload FROM human_reviews WHERE scope=? ${t.projectId?"AND project_id=?":""} ${t.afterId?"AND id>?":""} ORDER BY id LIMIT ?`,[e,...t.projectId?[t.projectId]:[],...t.afterId?[t.afterId]:[],t.limit+1]),a=n.slice(0,t.limit).map(r=>u.parse(JSON.parse(r.payload)));return{items:a,nextCursor:n.length>t.limit?a.at(-1).id:null}},async operation(t){i();let n=o.get("SELECT payload FROM human_review_operations WHERE scope=? AND id=?",[e,t]);return n?JSON.parse(n.payload):null},async saveOperation(t,n){i(),o.run("INSERT INTO human_review_operations(scope,id,payload) VALUES(?,?,?)",[e,t,JSON.stringify(n)])}}}c(S,"createHumanReviewTransaction");export{y as HUMAN_REVIEW_SQL,x as SqliteHumanReviewStore,S as createHumanReviewTransaction};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import{H as d}from"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as s}from"./chunk-FTQLQJQV.js";function f(e){if(Array.isArray(e)){let r=!1,n=e.map(c=>{let t=f(c);return r||=t.changed,t.value});return{value:r?n:e,changed:r}}if(!u(e))return{value:e,changed:!1};let o=!1,i={};for(let[r,n]of Object.entries(e)){if(r==="learnedPreference"&&n!==null){let t=u(n)?Object.fromEntries(Object.entries(n).filter(([l])=>l!=="qualificationKind")):n,a=d.safeParse(t);i[r]=a.success?a.data:null,o||=!a.success||t!==n;continue}let c=f(n);i[r]=c.value,o||=c.changed}return{value:o?i:e,changed:o}}s(f,"sanitizeUnverifiableLearnedPreferenceBindings");function u(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}s(u,"isRecord");export{f as sanitizeUnverifiableLearnedPreferenceBindings};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b as B}from"./chunk-NK4JKB7C.js";import{a as E}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import{b as k,m as v,n as y}from"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import{ta as M}from"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import{x as u}from"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import{O as R,ba as g}from"./chunk-4M3YW3EQ.js";import{t as s}from"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n as d}from"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as p}from"./chunk-FTQLQJQV.js";var T=class extends E{static{p(this,"SqliteModelBatchReviewStore")}async findModelBatchReview(t,r){return this.modelBatchReviewTransaction(t,r)}async beginModelBatchReview(t,r,o){let e=await this.modelBatchReviewTransaction(t,r,o);if(!e)throw new Error("Model batch review was not created.");return e}async modelBatchReviewTransaction(t,r,o){let e=k.parse(r);await this.ready;let l=this.writeQueue.then(async()=>{let a=this.db;if(!a)throw new Error("Model review store is closed.");a.exec("BEGIN IMMEDIATE");let w=!0,h=B(a,t,()=>{if(!w)throw new Error("Model review transaction is closed.")});try{let i=a.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[e.modelId,t]);if(!i)throw new s("model_not_found",404);let n=u.parse(JSON.parse(i.payload)),m=await v(h,e);if(m||!o)return a.exec("COMMIT"),m;if(n.revision!==e.expectedModelRevision||!n.trainingSetup.tasksetRef||!R(n.trainingSetup.tasksetRef,e.tasksetRef))throw new s("model_revision_conflict",409);let f=a.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND profile_id = ?",[e.tasksetRef.id,e.tasksetRef.revision,t]),c=f?M.parse(JSON.parse(f.payload)):null;if(!c||c.contentHash!==e.tasksetRef.contentHash||d(c.metadata.learning)!==d(g(o.taskset)))throw new s("model_review_package_mismatch",409);let _=await y(h,{scope:t,request:e,package:o,now:new Date().toISOString()});return a.exec("COMMIT"),_}catch(i){throw a.exec("ROLLBACK"),i}finally{w=!1}});return this.writeQueue=l.then(()=>{},()=>{}),l}};export{T as SqliteModelBatchReviewStore};
@@ -1,3 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as C,b as Te}from"./chunk-F4TJ7WQV.js";import{a as Q,d as ve}from"./chunk-X4ZT22SG.js";import{d as we,f as Ie,g as ye}from"./chunk-MEK7DLX3.js";import{a as he,c as F,d as J,e as ge,f as ke,g as Me}from"./chunk-XSB3T4JZ.js";import"./chunk-GLDYJM7O.js";import{a as fe,d as B,e as b,g as me}from"./chunk-LILXHGIA.js";import{b as Se,c as Pe,d as W}from"./chunk-ZQHPGEYT.js";import{b as ce}from"./chunk-GW5SE3FM.js";import{a as ue}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import{B as de,d as ie,e as ne}from"./chunk-TW3SRBLU.js";import{Jb as le,K as ee,M as L,Ob as pe,P as te,S as re,la as ae,ta as oe,wa as se,za as x}from"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import{E as Y,K as Z,i as k,n as N,t as X,x as v}from"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import{N as g,O as R,Q as V,d as G,ib as K}from"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import{A as I}from"./chunk-PF56N7ZY.js";import{a as f}from"./chunk-FTQLQJQV.js";import qe from"node:path";import{createHash as xe}from"node:crypto";function j(o){let{request:a,resolved:r}=b(o.request,o.package),{starter:t,...n}=r,e=a.rewardBindingRef&&!R(a.rewardBindingRef,g(r.rewardBinding));if(e&&(!o.rewardSelection||!R(a.rewardBindingRef,g(o.rewardSelection.rewardBinding))))throw new Error("The selected starter Reward is unavailable for package preparation.");let i=re({owner:{scopeId:a.profileId,modelId:a.modelId},source:n,...e?o.rewardSelection:{rewardBinding:n.rewardBinding,rewards:n.rewards,assets:n.assets}}),{taskset:s,taskDefinition:p,rewardBinding:l,rewards:d,assets:h}=i;if(o.source.profileId!==a.profileId||o.source.sourceHash!==t.contentHash)throw new Error("Starter source must belong to this Profile and pin the catalog package.");let u=i.execution!==void 0,y=s.environment.kind==="text"&&s.environment.entrypoint==="openpond.text.v1"&&!s.environment.stateful&&(!s.environmentRelease&&!s.verifierSetRelease||i.executionResources!==void 0)&&!s.capabilities.length&&!s.tools.length;if(!["sft","grpo"].includes(a.method)||p.harness||!y&&!u||s.tasks.some(c=>c.artifactRefs.length)||s.graders.some(c=>c.kind==="model_judge"&&(!c.model||c.calibrationStatus!=="passed")))throw new Error("This starter requires an additional training or environment adapter before preparation.");let w=new Set(o.approvedTrainingTaskIds);if(w.size!==o.approvedTrainingTaskIds.length)throw new Error("Starter training approvals must be unique.");for(let c of w){let P=s.tasks.find(H=>H.id===c);if(!P||P.split!=="train")throw new Error(`Starter approval must reference a training task: ${c}.`);if(a.method==="sft"&&P.expectedOutput===null)throw new Error(`SFT starter approval requires a reviewed target: ${c}.`)}if(a.method==="grpo"&&s.tasks.some(c=>c.split==="train"&&!w.has(c.id)))throw new Error("GRPO starter preparation requires approval of every training task.");for(let c of o.fixtures){if(!s.tasks.some(P=>P.id===c.taskId))throw new Error(`Starter fixture references an unknown task: ${c.taskId}.`);u&&!c.infrastructureError&&ee.parse(c.metadata.toolScript)}let E=s.id,m=se({profileId:a.profileId,id:`${E}-draft`,name:t.name,now:o.createdAt}),S=[];for(let c of s.graders){if(c.kind!=="custom_verifier")continue;let P=h.find(D=>D.id===c.verifierRef.id);if(!P)throw new Error(`Starter verifier asset is missing: ${c.id}.`);let H=c.verifierRef.path;S.some(D=>D.path===H)||S.push({path:H,role:"verifier",content:G(P,c.verifierRef)})}let _=ae.parse({...m,objective:p.instructions,metrics:s.metrics??m.metrics,sourceRefs:[o.source],policy:s.policy,environment:{...m.environment,kind:u?"agent":"chat",entrypoint:s.environment.entrypoint,stateful:s.environment.stateful,toolNames:s.tools.map(c=>c.name),deterministicSeeds:s.environment.deterministicSeeds,defaultTimeoutMs:s.environment.defaultTimeoutMs,networkPolicy:s.environment.networkPolicy,metadata:{portableEnvironment:s.environment,portableTools:s.tools,...i.executionResources?{portableExecutionResources:i.executionResources}:i.execution?{portableExecutionResources:{environment:i.execution.environment,verifierSet:i.execution.verifierSet}}:{}}},output:{mode:"structured_json",jsonSchema:p.outputSchema,renderer:null},capabilities:{...m.capabilities,taskKind:u?"single_agent":"chat",requiresTools:u,requiresState:u,supportedSignals:a.method==="grpo"?["reward"]:["demonstration"],compatibleMethods:[a.method],rewardKinds:[...new Set(s.graders.map(c=>c.kind==="human"?"human":c.kind==="model_judge"?"model_judge":"deterministic"))],requiresPrivilegedGrading:!0,environmentPlacements:["local","remote"]},tasks:s.tasks.map(({artifactRefs:c,...P})=>({...P,schemaVersion:"openpond.taskData.v1",sourceRefs:[o.source.id],metadata:{exampleOrigin:"curated_starter",starter:g(t),portableTaskRecord:{...P,artifactRefs:[]}}})),graders:pe(l,d,h),graderFixtures:o.fixtures,learningSignals:{...m.learningSignals,rewards:a.method==="grpo"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"reward",id:`starter-reward-${c.id}`,taskId:c.id,task:p.instructions,rules:[{id:l.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],otherwisePoints:0,executable:!0,approved:!0,confidence:1,sourceRefs:[o.source.id],artifactRef:l.id,metadata:{starter:g(t),rewardBinding:g(l),approvalOrigin:"catalog_publication"}})):[],demonstrations:a.method==="sft"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"demonstration",id:`starter-target-${c.id}`,taskId:c.id,sourceRefs:[o.source.id],artifactRef:s.id,approved:!0,confidence:1,prompt:null,response:JSON.stringify(c.expectedOutput),metadata:{starter:g(t),approvalOrigin:"catalog_publication"}})):[]},metadata:{starter:g(t),starterTasksetRelease:g(s),taskDefinition:g(p),rewardBinding:g(l),rewardExecution:{binding:l,rewards:d},portableCapabilities:s.capabilities,derivedPortableMetadata:s.metadata,modelTasksetDerivation:s.metadata.modelTasksetDerivation}}),M=de({draft:_,now:o.createdAt,tasksetId:E,sourcePackageHash:s.contentHash});return M.metrics=s.metrics,M.contentHash=x(M),{draft:_,taskset:M,generatedFiles:S,resources:i}}f(j,"prepareModelStarterTaskset");function O(o,a){let r=B(a),t=o.get("SELECT request_hash, payload FROM model_starter_creation_operations WHERE profile_id = ? AND operation_id = ?",[r.profileId,r.operationId]);if(!t)return null;if(t.request_hash!==Re(r))throw new Error("Starter creation operation was already used with different configuration.");return v.parse(JSON.parse(t.payload))}f(O,"findModelStarterCreation");async function Ee(o,a){let r=B(a.request);if(r.learning)throw new Error("Create this Model in a hosted workspace to enable continual learning.");let t=O(o,r);if(t)return t;let{taskset:n,resources:e}=j(a),i=me(a.package),s=await Y({id:r.modelId,profileId:r.profileId,name:r.name,objective:i.taskDefinition.instructions,defaultBaseModel:r.startingModel,defaultDestinationId:null,trainingSetup:fe({package:e,setup:X.parse({tasksetRef:g(n),rewardBindingRef:g(e.rewardBinding),baseModel:r.startingModel,method:r.method,managedRolloutPlacement:"remote"})})},0);o.exec("BEGIN IMMEDIATE");try{let p=O(o,r);if(p)return o.exec("COMMIT"),p;if(o.get("SELECT id FROM tasksets WHERE id = ?",[n.id])||o.get("SELECT id FROM model_projects WHERE id = ?",[r.modelId]))throw new Error("Starter creation requires a new Model and Taskset identity.");let l=[...e.executionResources??e.execution?[{kind:"asset",resource:te(e.executionResources??e.execution)}]:[],...i.execution?[{kind:"asset",resource:L(i.execution)}]:[],...i.assets.map(u=>({kind:"asset",resource:u})),...i.rewards.map(u=>({kind:"reward",resource:u})),{kind:"binding",resource:i.rewardBinding},{kind:"definition",resource:i.taskDefinition},{kind:"package",resource:i.taskset},...e.taskset.contentHash===i.taskset.contentHash?[]:[{kind:"definition",resource:e.taskDefinition},{kind:"package",resource:e.taskset},...e.execution?[{kind:"asset",resource:L(e.execution)}]:[]]];for(let{kind:u,resource:y}of l)he(o,r.profileId,u,y);let d=JSON.stringify(n);o.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[n.id,n.profileId,n.status,d,n.createdAt,n.updatedAt]),o.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[n.id,n.revision,n.contentHash,n.profileId,n.status,d,n.createdAt,n.updatedAt]);let h=ke(o,s);return o.run("INSERT INTO model_starter_creation_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[r.profileId,r.operationId,Re(r),JSON.stringify(h)]),o.exec("COMMIT"),h}catch(p){throw o.exec("ROLLBACK"),p}}f(Ee,"commitModelStarterCreation");function Re(o){return xe("sha256").update(k(o)).digest("hex")}f(Re,"requestHash");function q(o,a,r,t,n){let e=v.parse(r);o.exec("BEGIN IMMEDIATE");try{let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[e.id]),s=i?v.parse(JSON.parse(i.payload)):null;s&&s.profileId!==e.profileId&&T("Model ownership changed during hosted synchronization.");let p;if(t)k(s)!==k(a)&&T("Model changed while its hosted configuration was loading. Refresh before applying it."),p=e;else{(!s||!a||a.id!==e.id||a.profileId!==e.profileId)&&T("Model is no longer available for hosted synchronization."),s.hosted?.teamId!==a.hosted?.teamId&&s.hosted?.teamId!==e.hosted?.teamId&&T("Model hosting team changed during synchronization.");let l=e.hosted,d=s.hosted,h=d;if(l){d?.apiOrigin&&d.apiOrigin!==l.apiOrigin&&T("Model hosting API changed during synchronization.");let u=d?.apiOrigin===l.apiOrigin&&d?.teamId===l.teamId&&d.projectId===l.projectId;u&&d.revision===l.revision&&d.etag!==l.etag&&T("Hosted Model receipts disagree about the same revision."),h={...u&&d.revision>l.revision?d:l,tasksets:u?je(d.tasksets,l.tasksets,w=>`${w.localTasksetId}:${w.releaseHash}`,w=>w.syncedAt):l.tasksets}}p=v.parse({...s,hosted:h,tasksetSyncs:je(s.tasksetSyncs,e.tasksetSyncs,u=>u.localTasksetId,u=>u.lastAttemptAt)})}return n?.(),o.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
3
- ON CONFLICT(id) DO UPDATE SET payload = excluded.payload, updated_at = excluded.updated_at`,[p.id,p.profileId,JSON.stringify(p),p.createdAt,p.updatedAt]),o.exec("COMMIT"),p}catch(i){throw o.exec("ROLLBACK"),i}}f(q,"commitModelProjectHosting");function je(o,a,r,t){let n=new Map(o.map(e=>[r(e),e]));for(let e of a){let i=n.get(r(e));(!i||Date.parse(t(e))>=Date.parse(t(i)))&&n.set(r(e),e)}return[...n.values()]}f(je,"mergeLatest");function T(o){throw new Z(409,{schemaVersion:"openpond.modelProjectApiError.v2",code:"model_hosting_conflict",message:o,retryable:!1,requestId:null,details:{}})}f(T,"conflict");function z(o,a){let{request:r,resolved:t}=b(a.request,a.package),n=r.rewardBindingRef;if(!n||R(n,g(t.rewardBinding)))return a;function e(l,d){let h=o.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[r.profileId,l,d.id,d.revision]);if(!h)throw new Error(`The selected starter ${l} is unavailable in this Profile.`);let u=K[l].parse(JSON.parse(h.payload));if(V(u),d.contentHash&&d.contentHash!==u.contentHash)throw new Error("The selected starter Reward differs from its immutable reference.");return u}f(e,"read");let i=e("binding",n),s=[...new Map(i.sources.map(l=>[k(l.reward),e("reward",l.reward)])).values()],p=new Map(t.assets.map(l=>[l.id,l]));for(let l of s){let d=l.implementation;for(let h of[...l.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]])p.has(h.id)||p.set(h.id,e("asset",{id:h.id,revision:1}))}return{...a,rewardSelection:{rewardBinding:i,rewards:s,assets:[...p.values()]}}}f(z,"resolveModelStarterSelection");import be from"node:path";async function $(o,a,r){let t=r.project.trainingSetup.tasksetRef;if(!t)return;let n=o.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[t.id,t.revision]);if(!n)return;let e=oe.parse(JSON.parse(n.payload));if(e.profileId!==r.project.profileId||e.contentHash!==t.contentHash)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),s=i?v.parse(JSON.parse(i.payload)):null;if(s&&(s.profileId!==r.project.profileId||s.revision!==r.expectedRevision))return;let p=s?.hosted?.tasksets.find(m=>m.localTasksetId===e.id&&m.localTasksetHash===e.contentHash),l=typeof e.metadata.importedPackageHash=="string"?e.metadata.importedPackageHash:p?.packageHash;if(!l){if(e.metadata.learning!==void 0||e.metadata.taskDefinition!==void 0||e.metadata.rewardBinding!==void 0)return;let m=r.project.trainingSetup,S=m.baseModel??r.project.defaultBaseModel,_=m.method??(e.authoringProvenance.buildIntent==="verifiable_reward"?"grpo":null);if(!m.rewardBindingRef&&(_!=="grpo"||m.recipe||!S?.revision||!S.tokenizerRevision||!S.chatTemplateHash))return;if(x(e)!==t.contentHash)throw new Error("Selected Taskset differs from its immutable content hash.");let M=le({taskset:e,adapterId:we(e)});return Te({storeDir:a,taskset:e,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:M.tasksetRelease,environment:M.environmentRelease,verifierSet:M.verifierSetRelease}})}let d=await Pe(a,l);if(d.taskset.id!==(p?.releaseId??t.id)||d.taskset.revision!==(p?.releaseRevision??t.revision))throw new Error("Cached package differs from its selected Taskset revision.");let{files:h,contentHash:u,...y}=d,w=Ie(d,typeof e.metadata.importedPackageHash=="string"),E=await ye({root:be.join(a,"training","tasksets",C(e)),content:y,sources:h.filter(m=>!w.has(m.asset.id)).map(m=>({asset:m.asset,sourcePath:e.tasks.flatMap(S=>S.assets??[]).find(S=>S.id===m.asset.id)?.artifactRef??m.asset.path})),fileOrder:h.map(m=>m.asset.id)});if(E.contentHash!==d.contentHash)throw new Error("Imported package bytes changed before the Reward edit.");return E}f($,"loadModelTasksetPackage");var{package:It,evaluationPackage:yt,...Ce}=ie.shape,A=I.object({apiOrigin:I.string().url().refine(o=>new URL(o).origin===o),teamId:I.string().min(1),project:v,localTaskset:N,localEvaluation:N.optional(),evaluationPackageHash:I.string().regex(/^[a-f0-9]{64}$/).optional(),packageHash:I.string().regex(/^[a-f0-9]{64}$/),request:I.object(Ce).strict()}).strict().refine(o=>!!o.localEvaluation==!!o.evaluationPackageHash,"Evaluation bytes and local identity must be captured together.");function U(o,a){let r=o.get("SELECT payload FROM model_project_package_operations WHERE profile_id = ? AND model_id = ? AND state = 'pending'",[a.profileId,a.modelId]),t=r?A.parse(JSON.parse(r.payload)):null;if(t&&(t.apiOrigin!==a.apiOrigin||t.teamId!==a.teamId))throw new Error("Finish the pending package publication in its original API and workspace before changing hosting.");return t}f(U,"pendingModelPackageOperation");function Oe(o,a){let r=A.parse(a);o.exec("BEGIN IMMEDIATE");try{let t=U(o,{profileId:r.project.profileId,modelId:r.project.id,apiOrigin:r.apiOrigin,teamId:r.teamId});if(t)return o.exec("COMMIT"),t;let n=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),e=n?v.parse(JSON.parse(n.payload)):null;if(k(e)!==k(r.project))throw new Error("Model changed while its package was being prepared. Retry the push.");let i=o.get("SELECT payload, state FROM model_project_package_operations WHERE operation_id = ?",[r.request.operationId]);if(i){let s=A.parse(JSON.parse(i.payload));if(k({...s,project:r.project})!==k(r))throw new Error("Package operation identity was reused with different publication content.");if(i.state==="committed")return o.exec("COMMIT"),s;o.run("UPDATE model_project_package_operations SET state = 'pending', payload = ? WHERE operation_id = ? AND state = 'rejected'",[JSON.stringify(r),r.request.operationId])}else o.run("INSERT INTO model_project_package_operations (operation_id, profile_id, model_id, api_origin, team_id, state, payload, created_at) VALUES (?, ?, ?, ?, ?, 'pending', ?, ?)",[r.request.operationId,r.project.profileId,r.project.id,r.apiOrigin,r.teamId,JSON.stringify(r),new Date().toISOString()]);return o.exec("COMMIT"),r}catch(t){throw o.exec("ROLLBACK"),t}}f(Oe,"prepareModelPackageOperation");function _e(o,a,r){let t=ne.parse(r),n=o.get("SELECT payload, receipt FROM model_project_package_operations WHERE operation_id = ?",[a]);if(!n)throw new Error("Package push has no durable local intent.");let e=A.parse(JSON.parse(n.payload));if(n.receipt&&k(JSON.parse(n.receipt))!==k(t))throw new Error("Package push retry returned a different receipt.");if(t.operationId!==a||t.teamId!==e.teamId||t.packageHash!==e.packageHash||t.modelProjectId!==e.request.modelProjectId)throw new Error("Package push receipt differs from its local intent.");if(e.evaluationPackageHash&&(!t.evaluation||t.evaluation.packageHash!==e.evaluationPackageHash||k(t.evaluation.taskset)!==k(e.request.modelConfiguration?.trainingSetup.evaluationTasksetRef)))throw new Error("Evaluation package receipt differs from its local intent.");let i=e.project,s=t.project;if(e.request.selection==="select"&&!s)throw new Error("Selected package receipt is missing Model configuration.");if(!s&&!i.hosted)throw new Error("Historical package receipt has no existing hosted Model.");let p=new Date().toISOString(),l=v.parse({...i,hosted:{schemaVersion:"openpond.hostedModelProjectLink.v1",apiOrigin:e.apiOrigin,teamId:e.teamId,projectId:s?.id??i.hosted.projectId,portableProjectId:i.id,revision:s?.revision??i.hosted.revision,etag:t.projectEtag,syncedSourceRevision:e.request.selection==="select"?i.revision:i.hosted.syncedSourceRevision,syncedAt:p,tasksets:[...(i.hosted?.tasksets??[]).filter(d=>d.releaseHash!==t.taskset.contentHash&&d.releaseHash!==t.evaluation?.taskset.contentHash),{localTasksetId:e.localTaskset.id,localTasksetHash:e.localTaskset.contentHash,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,packageHash:t.packageHash,hostedTasksetId:t.hostedTasksetId,syncedAt:p},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,localTasksetHash:e.localEvaluation.contentHash,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,packageHash:t.evaluation.packageHash,hostedTasksetId:t.evaluation.hostedTasksetId,syncedAt:p}]:[]]},tasksetSyncs:[...i.tasksetSyncs.filter(d=>d.localTasksetId!==e.localTaskset.id&&d.localTasksetId!==e.localEvaluation?.id),{localTasksetId:e.localTaskset.id,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,state:"synced",hostedTasksetId:t.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,state:"synced",hostedTasksetId:t.evaluation.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null}]:[]]});return q(o,i,l,!1,()=>{o.run("UPDATE model_project_package_operations SET state = 'committed', receipt = ? WHERE operation_id = ?",[JSON.stringify(t),a])})}f(_e,"completeModelPackageOperation");var He=class extends ue{static{f(this,"SqliteModelConfigurationStore")}async pendingModelPackagePush(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Package push store is closed.");return U(this.db,a)}async prepareModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return Oe(this.db,a)});return this.writeQueue=r.then(()=>{},()=>{}),r}async completeModelPackagePush(a,r){await this.ready;let t=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return _e(this.db,a,r)});return this.writeQueue=t.then(()=>{},()=>{}),t}async rejectModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");this.db.run("UPDATE model_project_package_operations SET state = 'rejected' WHERE operation_id = ? AND state = 'pending'",[a])});return this.writeQueue=r.then(()=>{},()=>{}),r}async findModelProjectConfigurationSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return J(this.db,a)}async saveModelProjectConfiguration(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model save failed because the local store is closed.");let t=J(this.db,a);if(t)return t;let n=await $(this.db,this.home,a),e=F(this.db,a,!0,n);if(e?.imported)await W({home:this.home,...e.imported});else if(e){let i=qe.join(this.home,"training","tasksets",C(e.source));await Q(this.home,e,e.directoryId,{source:{directory:i,packageHash:await ce(i)},verify:f(s=>ve(s,e.taskset),"verify")}),this.db.run("UPDATE model_project_taskset_preparations SET state = 'materialized' WHERE profile_id = ? AND operation_id = ?",[a.project.profileId,a.operationId])}return ge(this.db,a,e,n?.modelResources?{...n.modelResources,taskset:n.taskset,executionResources:{environment:n.environment,verifierSet:n.verifierSet}}:n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async previewModelProjectTasksetSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return F(this.db,a,!1,await $(this.db,this.home,a))?.taskset??null}async findModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter lookup failed because the local store is closed.");return O(this.db,a)}async saveModelStarterCreation(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Starter creation failed because the local store is closed.");let t=O(this.db,a.request);if(t)return t;let n=z(this.db,a),e=j(n);return await Q(this.home,e,e.taskset.id),Ee(this.db,n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async prepareModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter check failed because the local store is closed.");return j(z(this.db,a))}async saveModelProjectHosting(a,r,t=!1,n=[]){await this.ready;let e=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model synchronization failed because the local store is closed.");if(n.length&&!t)throw new Error("Package import requires an atomic Model replacement.");for(let i of n){if(i.taskset.profileId!==r.profileId)throw new Error("Imported package belongs to another Profile.");i.reuseExisting?await Se(this.home,i.package):await W({home:this.home,...i})}return q(this.db,a,r,t,()=>{for(let i of n)Me(this.db,i)})});return this.writeQueue=e.then(()=>{},()=>{}),e}};export{He as SqliteModelConfigurationStore};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-VE6ZIGUQ.js";import{d as B,f as _,g as C}from"./chunk-XSB3T4JZ.js";import"./chunk-GLDYJM7O.js";import"./chunk-LILXHGIA.js";import{d as O}from"./chunk-ZQHPGEYT.js";import"./chunk-GW5SE3FM.js";import"./chunk-GOIKLFXK.js";import{e as z}from"./chunk-TGEGXTPR.js";import{a as A}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import{i as L,k as q}from"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import{Qb as u,ea as T,ha as H,ta as x}from"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import{E as b,y,z as I}from"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-YBNKGA5C.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import{N as m,b as E,d as S}from"./chunk-4M3YW3EQ.js";import{Ma as R,Ra as M}from"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n}from"./chunk-VVNV4NNW.js";import{A as s}from"./chunk-PF56N7ZY.js";import{a as h}from"./chunk-FTQLQJQV.js";var D=s.string().trim().min(1).max(500),P=s.string().regex(/^[a-f0-9]{64}$/),w=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparationInput.v1"),source:s.object({ownerId:D,datasetId:D,revision:s.number().int().positive(),workspaceHash:P,packageHash:P}).strict(),project:y,rewardBinding:M,rewards:s.array(R).min(1).max(100),assets:s.array(E).max(100)}).strict(),W=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparation.v1"),request:w,package:T,taskset:x,saveRequest:I,contentHash:P}).strict();async function F(c){let e=w.parse(c.request),r=H(c.source);if(r.contentHash!==e.source.packageHash)throw new Error("Dataset package changed since preparation was requested.");if(e.project.trainingSetup.tasksetRef||e.project.trainingSetup.tasksetRelease||e.project.trainingSetup.evaluationTasksetRef||e.project.trainingSetup.rewardBindingRef||e.project.trainingSetup.harnessRelease)throw new Error("Preparation selects its Taskset and Reward from the pinned source; omit preselected Taskset, Reward and Harness references.");if(!e.project.trainingSetup.recipe||!e.project.trainingSetup.baseModel)throw new Error("Preparation requires an explicit pinned base model and complete recipe.");let a=e.project.trainingSetup.baseModel,o=e.project.trainingSetup.recipe,i=o.baseModel;if(!a.revision||!a.tokenizerRevision||!a.chatTemplateHash||!i||i.id!==a.modelId||i.revision!==a.revision||i.tokenizerRevision!==a.tokenizerRevision||i.chatTemplateHash!==a.chatTemplateHash||o.method!==e.project.trainingSetup.method)throw new Error("Project and recipe must select the same pinned base model and training method.");if(!r.taskset.tasks.some(t=>t.split==="train")||!r.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval"))throw new Error("Preparation requires existing training and held-out validation tasks; it never changes splits.");let p=new Set(e.rewardBinding.sources.map(t=>n(t.reward)));if(new Set(e.rewards.map(t=>n(m(t)))).size!==e.rewards.length||e.rewards.some(t=>!p.has(n(m(t)))))throw new Error("Preparation Reward closure contains unexpected or duplicate releases.");let l=e.rewards.flatMap(t=>[...t.assets,..."verifierRef"in t.implementation?[t.implementation.verifierRef]:[],..."rubricRef"in t.implementation?[t.implementation.rubricRef]:[],..."inputContract"in t.implementation?[t.implementation.inputContract]:[]]),V=new Set(l.map(t=>t.id));if(new Set(e.assets.map(t=>t.id)).size!==e.assets.length||e.assets.some(t=>!V.has(t.id)))throw new Error("Preparation Reward closure contains unexpected or duplicate assets.");for(let t of l){let d=e.assets.find(G=>G.id===t.id);if(!d||t.visibility!=="verifier")throw new Error("Preparation requires its exact private verifier asset closure.");S(d,t)}for(let t of["training","evaluation"])if(!e.rewardBinding.sources.some(d=>d.role===t&&d.weight>0))throw new Error(`Preparation requires a positively weighted ${t} Reward source.`);let f=q({owner:{scopeId:e.project.profileId,modelId:e.project.id},source:r,rewardBinding:e.rewardBinding,rewards:e.rewards,assets:e.assets}),k=f.modelResources.assets.filter(t=>e.assets.some(d=>d.id===t.id));if(new Set(k.map(t=>t.asset.path)).size!==k.length||k.some(t=>t.asset.visibility!=="verifier"))throw new Error("Preparation requires distinct private verifier paths with verifier visibility.");let g=u({package:f,profileId:e.project.profileId,name:c.name,createdAt:c.createdAt}),j=m(g.taskset),$=await b({...e.project,trainingSetup:{...e.project.trainingSetup,tasksetRef:j,evaluationTasksetRef:g.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval")?j:null,rewardBindingRef:m(e.rewardBinding)}},0),v={schemaVersion:"openpond.localModelProjectPreparation.v1",request:e,package:f,taskset:g.taskset,saveRequest:$};return W.parse({...v,contentHash:n(v)})}h(F,"prepareLocalModelProject");function N(c){let e=W.parse(c),{contentHash:r,...a}=e;if(n(a)!==r)throw new Error("Project preparation receipt content hash changed.");return e}h(N,"parseLocalModelProjectPreparation");var Q=class extends A{static{h(this,"SqliteModelProjectPreparationStore")}async compile(e){let r=this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]),a=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",[e.source.datasetId,e.source.revision]);if(!a||!r||r.id!==e.source.ownerId)throw new Error("Dataset is unavailable on the selected local owner.");let o=z(this.database,a.payload);if(o.ownerId!==r.id||o.workspace.contentHash!==e.source.workspaceHash)throw new Error("Dataset owner or workspace changed since preparation was requested.");let i=L({workspace:o.workspace,preparation:null,adapterId:"openpond-desktop-taskset-authoring-v1",now:o.workspace.draft.updatedAt});return F({request:e,source:i,createdAt:o.workspace.draft.updatedAt,name:o.workspace.draft.name})}async prepareLocalModelProject(e){let r=w.parse(e);await this.ready;let a=this.writeQueue.then(async()=>{if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.project.id]))throw new Error("Model Project already exists; preparation only creates a distinct Model.");return this.compile(r)});return this.writeQueue=a.then(()=>{},()=>{}),a}async applyLocalModelProjectPreparation(e){let r=N(e);await this.ready;let a=this.writeQueue.then(async()=>{let o=await this.compile(r.request);if(n(o)!==n(r))throw new Error("Project preparation differs from the exact source, Reward closure or recipe. Prepare and review it again.");let i=B(this.database,r.saveRequest);if(i)return{project:i,taskset:r.taskset,packageHash:r.package.contentHash,preparationHash:r.contentHash};if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.request.project.id]))throw new Error("Model Project already exists with a different preparation.");let p=u({package:r.package,profileId:r.request.project.profileId,name:r.taskset.name,createdAt:r.taskset.createdAt});if(n(p.taskset)!==n(r.taskset))throw new Error("Project preparation projection changed.");await O({home:this.home,...p}),this.database.exec("BEGIN IMMEDIATE");try{C(this.database,p);let l=_(this.database,r.saveRequest,null,r.package);return this.database.exec("COMMIT"),{project:l,taskset:p.taskset,packageHash:p.package.contentHash,preparationHash:r.contentHash}}catch(l){throw this.database.exec("ROLLBACK"),l}});return this.writeQueue=a.then(()=>{},()=>{}),a}};export{Q as SqliteModelProjectPreparationStore};
@@ -1,33 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as Ee,b as ge,c as he,e as U,h as ye,i as me,l as Se,m as Te}from"./chunk-VI32G77S.js";import{A as m,B as ue,D as ce,E as f,F as le,h as W,l as se,t as oe,u as ae,w as de,x as pe}from"./chunk-LJPO3TEL.js";import{c as _e}from"./chunk-4ZBOYWQ3.js";import"./chunk-DMFUEUAZ.js";import{a as ie}from"./chunk-KCJVFLBB.js";import{a as re,c as N}from"./chunk-JHR3LF2F.js";import{Ea as A,Eb as F,Fa as g,G as q,Ga as b,H as G,Ua as ee,Va as te,Wa as L,Za as ne,_a as O,b as C,ta as Z}from"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import{q as E,r as z}from"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import"./chunk-N5GPINVP.js";import"./chunk-TW3SRBLU.js";import"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-2EPR4HLF.js";import{z as M}from"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import{A as D}from"./chunk-PF56N7ZY.js";import{a as u}from"./chunk-FTQLQJQV.js";import{createPublicKey as We,verify as He}from"node:crypto";var Re=`CREATE TABLE IF NOT EXISTS remote_device_authority (id INTEGER PRIMARY KEY CHECK(id=1), payload TEXT NOT NULL);
3
- CREATE TABLE IF NOT EXISTS remote_device_receipts (id TEXT PRIMARY KEY, payload_hash TEXT NOT NULL, command TEXT NOT NULL, receipt TEXT NOT NULL);
4
- CREATE TABLE IF NOT EXISTS remote_device_approval_claims (approval_id TEXT PRIMARY KEY, command_id TEXT NOT NULL UNIQUE);
5
- CREATE TABLE IF NOT EXISTS remote_device_cancellations (id TEXT PRIMARY KEY,payload_hash TEXT NOT NULL,device_id TEXT NOT NULL);`;function P(s,e,t){if(e.payload.resume===!0&&e.action!=="follow_up")throw new Error("remote_resume_action_invalid");let n=s.get("SELECT payload_hash FROM remote_device_cancellations WHERE id=?",[e.id]);if(n)throw new Error(n.payload_hash===e.payloadHash?"remote_command_cancelled":"remote_command_identity_changed");let i=s.get("SELECT payload FROM remote_device_authority WHERE id=1");if(!i)throw new Error("remote_authority_unavailable");let r=JSON.parse(i.payload),o=Date.now();if(e.actor!=="remote-human"||r.deviceId!==e.deviceId||r.fence!==e.fence||r.grantRevision!==e.grantRevision||!(Date.parse(r.leaseExpiresAt)>o)||!(Date.parse(e.deadline)>o)||!(Date.parse(e.permit.expiresAt)>o))throw new Error("remote_authority_expired_or_changed");let a=re.parse(r.owner);if(q(e.scope)!==q({installationId:a.installationId,profileId:a.profileId,ownerUserId:a.ownerUserId,teamId:a.teamId})||!N(t,a))throw new Error("remote_task_not_owned");let d=r.publicKeys.find(I=>I.keyId===e.permit.keyId),{permit:p,...c}=e;if(!d||!He(null,Buffer.from(G(c,p.expiresAt,p.keyId)),We(d.publicKey),Buffer.from(p.signature,"base64")))throw new Error("remote_permit_invalid");if(e.action==="start"){let I=t.metadata?.remoteStarterSourceSessionId,T=typeof I=="string"?s.get("SELECT payload FROM sessions WHERE id=?",[I]):null,_=T?JSON.parse(T.payload):null,x=W(t);if(!_||!N(_,a)||_.archived||_.status==="closed"||e.payload.projectId!==_.localProjectId||e.payload.starterRevision!==U(_)||e.expectedRevision!==U(_)||x?.operationId!==e.id||x.payloadHash!==e.payloadHash)throw new Error("remote_starter_changed");return}let l=s.get("SELECT id FROM turns WHERE session_id=? ORDER BY sort_index DESC LIMIT 1",[t.id]),w=Ee(t,l?.id??null,ge(s,t.id));if(e.localSessionId!==t.id||w!==e.expectedRevision)throw new Error("remote_target_changed")}u(P,"assertRemoteAdmission");import{isDeepStrictEqual as Me}from"node:util";function S(s){return L.parse({...JSON.parse(s.payload),sequence:s.sequence})}u(S,"inputFromRow");function R(s,e){let t=s.get("SELECT sequence, payload FROM task_inputs WHERE id = ?",[e]);return t?S(t):null}u(R,"readTaskInput");function h(s,e){let t=L.parse(e);return s.run("UPDATE task_inputs SET kind = ?, state = ?, turn_id = ?, payload = ? WHERE id = ?",[t.kind,t.state,t.turnId,JSON.stringify(t),t.id]),t}u(h,"writeTaskInput");function y(s,e){return s.get("SELECT * FROM task_inbox_turns WHERE session_id = ?",[e])}u(y,"readInboxOwner");function k(s,e,t,n){let i=y(s,e);if(!i||i.turn_id!==t||i.owner_id!==n||i.lease_until<=Date.now())throw new Error("Task execution ownership was lost. Stop before dispatching more work.");return i}u(k,"requireInboxOwner");function J(s,e,t){let n=y(s,e),i=t?s.get("SELECT status FROM turns WHERE id = ? AND session_id = ?",[t,e]):null;if(!t||!n||n.turn_id!==t||!n.accepting||n.paused||n.lease_until<=Date.now()||i?.status!=="in_progress")throw new Error("The expected turn is no longer accepting input. Your text was not sent to a different turn; send it as a follow-up instead.")}u(J,"assertSteerTarget");function j(s,e){let t=`${e.senderKind}:${e.senderSessionId??"user"}`,n=s.get("SELECT sequence, payload, admission FROM task_inputs WHERE session_id = ? AND sender_key = ? AND idempotency_key = ?",[e.sessionId,t,e.idempotencyKey]);if(n){let l=S(n),w=JSON.parse(n.admission);if(["kind","body","payload","replyTo","expectedTurnId"].some(T=>!Me(w[T],e[T])))throw new Error("This input identity was already used with different content.");return l}let i=s.get("SELECT payload FROM sessions WHERE id = ?",[e.sessionId]),r=i?JSON.parse(i.payload):null;if(!r||r.status==="closed"||r.archived)throw new Error("The recipient task is unavailable.");if(e.payload.remoteDevice!==void 0){if(e.senderKind!=="user"||e.senderSessionId!==null)throw new Error("remote_human_input_required");P(s,e.payload.remoteDevice,r)}if(e.senderKind==="ponder"||e.payload.ponderDesktop!==void 0){let l=s.get("SELECT id FROM turns WHERE session_id = ? ORDER BY sort_index DESC LIMIT 1",[e.sessionId]);le(s,e,r,l?.id??null)}let o=e.payload.localManagedMessage;if(o&&typeof o=="object"){let l=o.targetRevision,w=s.get("SELECT id FROM turns WHERE session_id = ? ORDER BY sort_index DESC LIMIT 1",[e.sessionId]);if(typeof l!="string"||l!==se(r,w?.id??null))throw new me("The managed target changed before message admission. Refresh and review the message before sending.")}let a=y(s,e.sessionId);if(e.kind==="steer"&&J(s,e.sessionId,e.expectedTurnId),e.kind==="steer"&&B(s,e.expectedTurnId,e.body),s.get("SELECT count(*) AS count FROM task_inputs WHERE session_id = ? AND state = 'pending'",[e.sessionId]).count>=ee)throw new Error("The task inbox is full. Wait for delivery before sending more input.");let p=new Date().toISOString(),c=L.parse({...e,sequence:0,revision:1,state:"pending",requestIds:[],error:null,payload:{...e.payload,...e.payload.remoteDevice?{remoteDeviceExecution:de(r)}:{}},turnId:e.kind!=="queued"&&e.kind!=="followup"&&a?.accepting&&!a.paused&&a.lease_until>Date.now()?a.turn_id:null,createdAt:p,updatedAt:p});if(e.payload.remoteDevice!==void 0){let l=e.payload.remoteDevice;if(l.payload.resume===!0&&(e.kind!=="queued"||e.expectedTurnId!==l.expectedTurnId))throw new Error("remote_resume_input_invalid");he(s,l)}return s.run("INSERT INTO task_inputs (id, session_id, sender_key, idempotency_key, kind, state, turn_id, payload, admission) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",[c.id,c.sessionId,t,c.idempotencyKey,c.kind,c.state,c.turnId,JSON.stringify(c),JSON.stringify(e)]),R(s,c.id)}u(j,"admitTaskInput");function v(s,e,t){return s.all(`SELECT sequence, payload FROM task_inputs WHERE session_id = ? AND state = 'pending'
6
- AND ((turn_id = ?) OR (turn_id IS NULL AND kind NOT IN ('queued', 'followup', 'steer')))
7
- ORDER BY sequence`,[e,t]).map(S)}u(v,"pendingTaskInputs");function B(s,e,t){if(s.get(`SELECT COALESCE(SUM(length(json_extract(payload, '$.body'))), 0) AS size
8
- FROM task_inputs WHERE turn_id = ? AND kind = 'steer' AND state NOT IN ('rejected', 'cancelled')`,[e]).size+t.length>64e3)throw new Error("This turn's correction history is full. Finish it or send the additional instructions in a new turn.")}u(B,"assertCorrectionBudget");function Ie(s,e){let t=s.all("SELECT session_id, turn_id FROM task_inbox_turns WHERE owner_id <> ? AND lease_until > 0",[e]),n=new Date().toISOString();for(let i of t){let r=s.get("SELECT status FROM turns WHERE id = ?",[i.turn_id]);s.run("UPDATE task_inbox_turns SET accepting = 0, paused = ?, lease_until = 0 WHERE session_id = ?",[r?1:0,i.session_id]);let o=s.all("SELECT sequence, payload FROM task_inputs WHERE turn_id = ? AND state IN ('pending', 'included')",[i.turn_id]);for(let a of o){let d=S(a);h(s,{...d,updatedAt:n,...d.state==="included"?{error:"Execution owner stopped after inclusion. The provider outcome is uncertain; review before retrying."}:d.kind==="steer"?{state:"rejected",error:"The interrupted execution did not include this correction. Send it as a follow-up."}:{turnId:null}})}s.run("UPDATE task_input_requests SET state = 'failed' WHERE turn_id = ? AND state = 'included'",[i.turn_id]);for(let a of s.all("SELECT id, payload FROM task_waits WHERE turn_id = ? AND state = 'waiting'",[i.turn_id])){let d=O.parse(JSON.parse(a.payload));s.run("UPDATE task_waits SET state = 'unavailable', payload = ? WHERE id = ?",[JSON.stringify({...d,state:"unavailable",updatedAt:n}),a.id])}}return t.map(i=>({sessionId:i.session_id,turnId:i.turn_id}))}u(Ie,"recoverTaskInboxOwners");function we(s,e,t){if(m(e),e.intent.action!=="create"||!e.claimId||e.receipt||!["dispatching","attention"].includes(e.state))return null;let n=ue(e.id),i=s.get("SELECT payload FROM sessions WHERE id = ?",[n]);if(!i||s.get("SELECT id FROM task_inputs WHERE session_id = ? LIMIT 1",[n])||s.get("SELECT id FROM turns WHERE session_id = ? LIMIT 1",[n]))return null;let r=E.parse(JSON.parse(i.payload)),o=W(r),a=s.get("SELECT payload FROM ponder_desktop_authority WHERE id = 1");if(!a||!o||!N(r,t)||r.archived||r.status!=="idle")return null;let d=A.parse(JSON.parse(a.payload));return d.state!=="attached"||Date.parse(d.leaseExpiresAt)<=Date.now()||d.authorizationRevision!==e.origin.authorizationRevision||!Object.entries(e.origin.scope).every(([p,c])=>d.scope[p]===c)||o.operationId!==e.id||o.payloadHash!==e.payloadHash||o.sessionRevision!==oe(r,null)||o.executionRevision!==ae(r)?null:Z.parse({sessionId:n,creationHash:o.creationHash,sessionRevision:o.sessionRevision,executionRevision:o.executionRevision})}u(we,"readPonderDesktopReservationResume");var Oe=D.object({operation:g,receipt:g.shape.receipt.unwrap()}).strict();function H(s,e){let t=s.get("SELECT payload FROM ponder_desktop_stops WHERE operation_id = ?",[e]);return t?Oe.parse(JSON.parse(t.payload)):null}u(H,"readPonderDesktopStop");function fe(s,e){if(e=g.parse(e),m(e),e.intent.action!=="stop")throw new Error("ponder_desktop_stop_intent_invalid");let t=H(s,e.id);if(t){if(t.operation.payloadHash!==e.payloadHash)throw new Error("ponder_desktop_stop_identity_reused");return t}let n=s.get("SELECT payload FROM sessions WHERE id = ?",[e.intent.targetId]);if(!n)throw new Error("ponder_desktop_stop_target_unavailable");let i=E.parse(JSON.parse(n.payload)),r=s.get("SELECT id FROM turns WHERE session_id = ? ORDER BY sort_index DESC LIMIT 1",[i.id]);f(s,e,i,r?.id??null,e.intent.targetRevision);let o=y(s,i.id),a=s.get("SELECT status FROM turns WHERE id = ? AND session_id = ?",[e.intent.expectedTurnId,i.id]);if(!o||o.turn_id!==e.intent.expectedTurnId||o.lease_until<=Date.now()||a?.status!=="in_progress")throw new Error("ponder_desktop_stop_target_changed");let d=Oe.parse({operation:e,receipt:{sessionId:i.id,sessionTitle:i.title,inputId:null,turnId:e.intent.expectedTurnId,state:"stop_requested"}});return s.run("INSERT INTO ponder_desktop_stops (operation_id, payload_hash, payload) VALUES (?, ?, ?)",[e.id,e.payloadHash,JSON.stringify(d)]),d}u(fe,"admitPonderDesktopStop");function ke(s,e,t){let n=H(s,e);if(!n)throw new Error("ponder_desktop_stop_not_found");if(n.receipt.state!=="stop_requested")return n;let i={...n,receipt:{...n.receipt,state:t}};return s.run("UPDATE ponder_desktop_stops SET payload = ? WHERE operation_id = ?",[JSON.stringify(i),e]),i}u(ke,"settlePonderDesktopStop");import{createHash as qe}from"node:crypto";function De(s){return qe("sha256").update(C("POST","/ponder/desktop/result",s)).digest("hex")}u(De,"hash");function K(s,e,t){let n=s.get("SELECT payload, payload_hash FROM ponder_desktop_results WHERE operation_id = ? AND turn_id = ?",[e,t]);if(!n)return null;let i=b.parse(JSON.parse(n.payload));if(i.operationId!==e||i.turnId!==t||De(i)!==n.payload_hash)throw new Error("ponder_desktop_committed_result_invalid");return i}u(K,"readPonderDesktopResult");function ve(s,e){let t=b.parse(e),n=K(s,t.operationId,t.turnId);return n||(s.run("INSERT INTO ponder_desktop_results (operation_id, turn_id, payload_hash, payload) VALUES (?, ?, ?, ?)",[t.operationId,t.turnId,De(t),JSON.stringify(t)]),t)}u(ve,"commitPonderDesktopResult");var xe=D.object({operation:g,receipt:g.shape.receipt.unwrap()}).strict();function Y(s,e){let t=s.get("SELECT payload, payload_hash FROM ponder_desktop_observations WHERE operation_id = ?",[e]);if(!t)return null;let n=xe.parse(JSON.parse(t.payload));if(m(n.operation),n.operation.id!==e||n.operation.payloadHash!==t.payload_hash||n.operation.intent.action!=="observe"||n.receipt.turnId!==n.operation.intent.expectedTurnId||n.receipt.sessionId!==n.operation.intent.targetId||n.receipt.inputId!==null)throw new Error("ponder_desktop_observation_record_invalid");return n}u(Y,"readPonderDesktopObservation");function Ne(s,e){let t=g.parse(e);if(m(t),t.intent.action!=="observe")throw new Error("ponder_desktop_observation_intent_invalid");let n=Y(s,t.id);if(n){if(n.operation.payloadHash!==t.payloadHash)throw new Error("ponder_desktop_observation_identity_reused");return n}let i=s.get("SELECT payload FROM sessions WHERE id = ?",[t.intent.targetId]);if(!i)throw new Error("ponder_desktop_observation_target_unavailable");let r=E.parse(JSON.parse(i.payload)),o=s.get("SELECT id FROM turns WHERE session_id = ? ORDER BY sort_index DESC LIMIT 1",[r.id]);f(s,t,r,o?.id??null,t.intent.targetRevision);let a=s.get("SELECT id FROM turns WHERE id = ? AND session_id = ?",[t.intent.expectedTurnId,r.id]);if(!a||o?.id!==a.id)throw new Error("ponder_desktop_observation_target_changed");let d=xe.parse({operation:t,receipt:{sessionId:r.id,sessionTitle:r.title,inputId:null,turnId:a.id,state:"observing"}});return s.run("INSERT INTO ponder_desktop_observations (operation_id, payload_hash, payload) VALUES (?, ?, ?)",[t.id,t.payloadHash,JSON.stringify(d)]),d}u(Ne,"admitPonderDesktopObservation");import{createHash as be}from"node:crypto";var Pe=D.object({operation:g,receipt:g.shape.receipt.unwrap(),inspection:F}).strict();function Ce(s){return be("sha256").update(C("POST","/ponder/desktop/inspection",s)).digest("hex")}u(Ce,"snapshotHash");function Q(s,e){let t=s.get("SELECT payload, payload_hash, snapshot_hash FROM ponder_desktop_inspections WHERE operation_id = ?",[e]);if(!t)return null;let n=Pe.parse(JSON.parse(t.payload));m(n.operation);let{operation:i,receipt:r,inspection:o}=n;if(i.intent.action!=="inspect"||i.id!==e||i.payloadHash!==t.payload_hash||Ce(n)!==t.snapshot_hash||o.operationId!==e||o.payloadHash!==i.payloadHash||o.sessionId!==i.intent.targetId||o.turnId!==i.intent.expectedTurnId||r.sessionId!==o.sessionId||r.turnId!==o.turnId||r.inputId!==null||r.state!=="inspected")throw new Error("ponder_desktop_inspection_record_invalid");return n}u(Q,"readPonderDesktopInspection");function Ae(s,e){let t=g.parse(e);if(m(t),t.intent.action!=="inspect")throw new Error("ponder_desktop_inspection_intent_invalid");let n=Q(s,t.id);if(n){if(n.operation.payloadHash!==t.payloadHash)throw new Error("ponder_desktop_inspection_identity_reused");return n}let i=s.get("SELECT payload FROM sessions WHERE id = ?",[t.intent.targetId]);if(!i)throw new Error("ponder_desktop_inspection_target_unavailable");let r=E.parse(JSON.parse(i.payload)),o=r.localProjectId??r.workspaceId??r.cwd;if(r.archived||r.systemKind||r.hiddenFromDefaultSidebar||r.status==="closed"||r.experience==="development"||["sandbox","sandbox_template","sandbox_app"].includes(r.workspaceKind??"")||t.target.kind!=="session"||t.target.id!==r.id||t.target.revision!==t.intent.targetRevision||t.target.workspaceId!==o||t.target.providerId!==r.provider||t.target.modelId!==(r.modelRef?.modelId??null))throw new Error("ponder_desktop_inspection_target_changed");let a=s.get("SELECT id, payload FROM turns WHERE session_id = ? ORDER BY sort_index DESC LIMIT 1",[r.id]);if(f(s,t,r,a?.id??null,t.intent.targetRevision),!a||a.id!==t.intent.expectedTurnId)throw new Error("ponder_desktop_inspection_target_changed");let d=z.parse(JSON.parse(a.payload));if(d.sessionId!==r.id||d.id!==a.id)throw new Error("ponder_desktop_inspection_turn_invalid");let p=s.all(`
9
- SELECT sequence, substr(json_extract(payload, '$.id'), 1, 201) AS id,
10
- substr(json_extract(payload, '$.timestamp'), 1, 101) AS timestamp, name AS kind,
11
- substr(json_extract(payload, '$.output'), 1, 4001) AS text,
12
- substr(json_extract(payload, '$.action'), 1, 300) AS action,
13
- json_extract(payload, '$.status') AS status,
14
- substr(coalesce(json_extract(payload, '$.data.nativeMessageId'), json_extract(payload, '$.data.itemId')), 1, 300) AS message_id,
15
- json_extract(payload, '$.data.nativeMessageSnapshot') AS message_snapshot
16
- FROM events WHERE turn_id = ? AND session_id = ?
17
- AND name IN ('assistant.delta', 'tool.started', 'tool.completed')
18
- AND coalesce(json_extract(payload, '$.data.retainedHistory'), 0) <> 1
19
- AND coalesce(json_extract(payload, '$.data.phase'), '') NOT IN ('reasoning', 'analysis')
20
- ORDER BY sequence DESC LIMIT 101`,[d.id,r.id]),c=16e3,l=!1,w=p.slice(0,100).map(_=>{let x=_.text??"",X=Math.min(4e3,c),$=x.slice(0,X);return c-=$.length,l||=x.length>X,{id:_.id,sequence:_.sequence,timestamp:_.timestamp,kind:_.kind,text:$,action:_.action,status:_.status,messageId:_.message_id,messageSnapshot:_.message_snapshot===1}}).reverse(),I=F.parse({operationId:t.id,payloadHash:t.payloadHash,sessionId:r.id,sessionTitle:r.title.slice(0,300),turnId:d.id,workspaceId:o,providerId:d.modelRef?.providerId??t.target.providerId,modelId:d.modelRef?.modelId??t.target.modelId,capturedAt:new Date().toISOString(),taskStatus:d.status,taskCompletedAt:d.completedAt?new Date(d.completedAt).toISOString():null,error:d.error?.slice(0,2e3)??null,events:w,coverage:{olderEventsOmitted:p.length>100,textTruncated:l,textLimit:16e3,eventLimit:100}}),T=Pe.parse({operation:t,inspection:I,receipt:{sessionId:r.id,sessionTitle:I.sessionTitle,inputId:null,turnId:d.id,state:"inspected"}});return f(s,t,r,a.id,t.intent.targetRevision),s.run("INSERT INTO ponder_desktop_inspections (operation_id, payload_hash, snapshot_hash, payload) VALUES (?, ?, ?, ?)",[t.id,t.payloadHash,Ce(T),JSON.stringify(T)]),T}u(Ae,"admitPonderDesktopInspection");var V=9e4,Le=class extends ie{static{u(this,"SqliteTaskInboxStore")}async initializeRemoteDeviceStore(){return this.inboxWrite(e=>{e.exec(Re),e.run("DELETE FROM remote_device_authority")})}async setRemoteDeviceAuthority(e){return this.inboxWrite(t=>{e?t.run("INSERT INTO remote_device_authority(id,payload) VALUES(1,?) ON CONFLICT(id) DO UPDATE SET payload=excluded.payload",[JSON.stringify(e)]):t.run("DELETE FROM remote_device_authority")})}async getRemoteDeviceReceipt(e){await this.ready,await this.writeQueue;let t=this.database.get("SELECT receipt FROM remote_device_receipts WHERE id=?",[e]);return t?JSON.parse(t.receipt):null}async getRemoteDeviceCancellation(e){return await this.ready,await this.writeQueue,this.database.get("SELECT payload_hash,device_id FROM remote_device_cancellations WHERE id=?",[e])}async cancelRemoteDeviceCommand(e,t){return this.inboxWrite(n=>{let i=n.get("SELECT payload_hash,receipt FROM remote_device_receipts WHERE id=?",[e]);if(i){if(i.payload_hash!==t)throw new Error("remote_command_identity_changed");return{receipt:JSON.parse(i.receipt),cancelled:!1}}let r=R(n,`remote-input:${e}`);if(r){let p=r.payload.remoteDevice;if(p.payloadHash!==t)throw new Error("remote_command_identity_changed");return{receipt:{id:e,deviceId:p.deviceId,payloadHash:t,action:p.action,targetId:p.targetId,localSessionId:r.sessionId,inputId:r.id,state:"admitted",revision:2,createdAt:r.createdAt,expiresAt:p.deadline},cancelled:!1}}let o=n.get("SELECT payload FROM remote_device_authority WHERE id=1");if(!o)throw new Error("remote_authority_unavailable");let a=JSON.parse(o.payload);if(!(Date.parse(a.leaseExpiresAt)>Date.now()))throw new Error("remote_authority_unavailable");let d=n.get("SELECT payload_hash FROM remote_device_cancellations WHERE id=?",[e]);if(d&&d.payload_hash!==t)throw new Error("remote_command_identity_changed");return n.run("INSERT INTO remote_device_cancellations(id,payload_hash,device_id) VALUES(?,?,?) ON CONFLICT(id) DO NOTHING",[e,t,a.deviceId]),{receipt:null,cancelled:!0}})}async saveRemoteDeviceReceipt(e,t){return this.inboxWrite(n=>{let i=n.get("SELECT payload_hash FROM remote_device_receipts WHERE id=?",[e.id]);if(i&&i.payload_hash!==e.payloadHash)throw new Error("remote_command_identity_changed");n.run("INSERT INTO remote_device_receipts(id,payload_hash,command,receipt) VALUES(?,?,?,?) ON CONFLICT(id) DO UPDATE SET receipt=excluded.receipt",[e.id,e.payloadHash,JSON.stringify(e),JSON.stringify(t)])})}async admitRemoteDeviceStop(e){return this.inboxWrite(t=>{let n=t.get("SELECT payload_hash,receipt FROM remote_device_receipts WHERE id=?",[e.id]);if(n){if(n.payload_hash!==e.payloadHash)throw new Error("remote_command_identity_changed");return JSON.parse(n.receipt)}let i=t.get("SELECT payload FROM sessions WHERE id=?",[e.localSessionId]);if(!i)throw new Error("remote_task_unavailable");let r=E.parse(JSON.parse(i.payload));P(t,e,r);let o=t.get("SELECT id,status FROM turns WHERE session_id=? ORDER BY sort_index DESC LIMIT 1",[e.localSessionId]);if(!e.expectedTurnId||o?.id!==e.expectedTurnId||o.status!=="in_progress")throw new Error("remote_turn_changed");let a={id:e.id,deviceId:e.deviceId,payloadHash:e.payloadHash,action:e.action,targetId:e.targetId,localSessionId:r.id,turnId:o.id,state:"admitted",revision:2,createdAt:new Date().toISOString(),expiresAt:e.deadline};return t.run("INSERT INTO remote_device_receipts(id,payload_hash,command,receipt) VALUES(?,?,?,?)",[e.id,e.payloadHash,JSON.stringify(e),JSON.stringify(a)]),a})}async admitRemoteDeviceApproval(e){return this.inboxWrite(t=>{let n=t.get("SELECT payload_hash,receipt FROM remote_device_receipts WHERE id=?",[e.id]);if(n){if(n.payload_hash!==e.payloadHash)throw new Error("remote_command_identity_changed");return JSON.parse(n.receipt)}let i=t.get("SELECT payload FROM sessions WHERE id=?",[e.localSessionId]);if(!i)throw new Error("remote_task_unavailable");let r=E.parse(JSON.parse(i.payload));P(t,e,r);let o=t.get("SELECT id,payload FROM turns WHERE session_id=? ORDER BY sort_index DESC LIMIT 1",[r.id]),a=o?JSON.parse(o.payload):null;if(!a||a.id!==e.expectedTurnId||a.status!=="in_progress")throw new Error("remote_turn_changed");let d=t.get("SELECT payload FROM approvals WHERE id=?",[e.expectedApprovalId]),p=d?JSON.parse(d.payload):null;if(!p||p.status!=="pending"||p.sessionId!==r.id||!p.turnId||p.turnId!==a.id&&p.turnId!==a.providerTurnId||!ye(p))throw new Error("remote_approval_changed_or_unsupported");if(t.get("SELECT command_id FROM remote_device_approval_claims WHERE approval_id=?",[p.id]))throw new Error("remote_approval_already_claimed");t.run("INSERT INTO remote_device_approval_claims(approval_id,command_id) VALUES(?,?)",[p.id,e.id]);let l={id:e.id,deviceId:e.deviceId,payloadHash:e.payloadHash,action:e.action,targetId:e.targetId,localSessionId:r.id,approvalId:p.id,turnId:a.id,state:"admitted",revision:2,createdAt:new Date().toISOString(),expiresAt:e.deadline};return t.run("INSERT INTO remote_device_receipts(id,payload_hash,command,receipt) VALUES(?,?,?,?)",[e.id,e.payloadHash,JSON.stringify(e),JSON.stringify(l)]),l})}async admitPonderDesktopInspection(e){return this.inboxWrite(t=>Ae(t,e))}async getPonderDesktopInspection(e){return await this.ready,await this.writeQueue,Q(this.database,e)}async setPonderProjectSharing(e){return this.inboxWrite(t=>Se(t,e))}async readPonderProjectSharing(e){return await this.ready,await this.writeQueue,Te(this.database,e)}async getPonderDesktopReservationResume(e,t){return this.inboxWrite(n=>we(n,e,t))}async admitPonderDesktopObservation(e){return this.inboxWrite(t=>Ne(t,e))}async getPonderDesktopObservation(e){return await this.ready,await this.writeQueue,Y(this.database,e)}async getPonderDesktopResult(e,t){return await this.ready,await this.writeQueue,K(this.database,e,t)}async commitPonderDesktopResult(e){return this.inboxWrite(t=>ve(t,e))}async inboxWrite(e){await this.ready;let t=this.writeQueue.then(()=>{let n=this.database;n.exec("BEGIN IMMEDIATE");try{let i=e(n);return n.exec("COMMIT"),i}catch(i){throw n.exec("ROLLBACK"),i}});return this.writeQueue=t.then(()=>{},()=>{}),t}async setPonderDesktopAuthority(e){let t=A.parse(e);if(t.state!=="attached"||Date.parse(t.leaseExpiresAt)<=Date.now())throw new Error("ponder_desktop_local_authority_invalid");return this.inboxWrite(n=>{n.run("INSERT INTO ponder_desktop_authority (id, runtime_id, payload) VALUES (1, ?, ?) ON CONFLICT(id) DO UPDATE SET runtime_id = excluded.runtime_id, payload = excluded.payload",[t.runtimeId,JSON.stringify(t)])})}async clearPonderDesktopAuthority(e){return this.inboxWrite(t=>{e?t.run("DELETE FROM ponder_desktop_authority WHERE runtime_id = ?",[e]):t.run("DELETE FROM ponder_desktop_authority")})}async admitPonderDesktopStop(e){return this.inboxWrite(t=>fe(t,e))}async getPonderDesktopStop(e){return await this.ready,await this.writeQueue,H(this.database,e)}async settlePonderDesktopStop(e,t){return this.inboxWrite(n=>ke(n,e,t))}async recoverTaskInboxOwners(e){return this.inboxWrite(t=>Ie(t,e))}async hasTaskCompletion(e){return await this.ready,await this.writeQueue,!!this.database.get("SELECT turn_id FROM task_completion_outbox WHERE turn_id = ?",[e])}async taskInboxSnapshot(e){await this.ready,await this.writeQueue;let t=y(this.database,e),n=t&&t.lease_until>Date.now()&&this.database.get("SELECT status FROM turns WHERE id = ?",[t.turn_id])?.status==="in_progress",i=this.database.all(`SELECT sequence, payload FROM task_inputs WHERE session_id = ? AND (state IN ('pending', 'included')
21
- OR sequence IN (SELECT sequence FROM task_inputs WHERE session_id = ? ORDER BY sequence DESC LIMIT 30)) ORDER BY sequence`,[e,e]);return{sessionId:e,activeTurnId:n?t.turn_id:null,acceptingInput:!!(n&&t.accepting&&!t.paused),paused:!!t?.paused,inputs:i.map(S),waits:await this.taskWaitsForSession(e)}}async declareTaskWork(e,t,n,i){return this.inboxWrite(r=>{k(r,e,t,n),r.run("INSERT INTO task_work_claims (session_id, turn_id, work_areas) VALUES (?, ?, ?) ON CONFLICT(session_id) DO UPDATE SET turn_id = excluded.turn_id, work_areas = excluded.work_areas",[e,t,JSON.stringify(i)])})}async taskWorkAreas(e){await this.ready,await this.writeQueue;let t=this.database.get("SELECT c.work_areas FROM task_work_claims c JOIN task_inbox_turns t ON c.session_id = t.session_id AND c.turn_id = t.turn_id WHERE c.session_id = ? AND t.lease_until > ?",[e,Date.now()]);return t?JSON.parse(t.work_areas):[]}async admitTaskInput(e){return this.inboxWrite(t=>j(t,e))}async admitTaskInputs(e){return this.inboxWrite(t=>e.map(n=>j(t,n)))}async rejectTaskInput(e,t,n){return this.inboxWrite(i=>{let r=R(i,e);if(r?.state==="pending"){let o=n&&r.senderKind==="ponder"?i.get("SELECT id FROM turns WHERE id = ? AND session_id = ? AND json_extract(payload, '$.metadata.taskInputId') = ?",[n,r.sessionId,r.id]):null;h(i,{...r,state:"rejected",error:t,...o?{turnId:o.id}:{},updatedAt:new Date().toISOString()})}})}async getTaskInput(e){return await this.ready,await this.writeQueue,R(this.database,e)}async taskInputsForSession(e,t={}){return await this.ready,await this.writeQueue,this.database.all(`SELECT sequence, payload FROM task_inputs WHERE session_id = ? AND sequence > ?
22
- ${t.pendingOnly?"AND state = 'pending'":""} ORDER BY sequence LIMIT ?`,[e,t.afterSequence??0,Math.max(1,Math.min(500,t.limit??128))]).map(S)}async mutateTaskInput(e,t,n){let i=ne.parse(n);return this.inboxWrite(r=>{let o=R(r,t);if(!o||o.sessionId!==e||o.senderKind!=="user")throw new Error("Queued user input not found.");if(o.state!=="pending"||o.revision!==i.expectedRevision||o.turnId)throw new Error("This input changed or has already been admitted. Refresh the queue before editing it.");if(i.action==="resume"){if(o.kind!=="queued")throw new Error("Only the user queue can be resumed here.");let a=y(r,e);if(a&&a.lease_until>Date.now())throw new Error("This task is already running.");r.run("UPDATE task_inbox_turns SET paused = 0 WHERE session_id = ?",[e])}return i.action==="steer"&&(J(r,e,i.expectedTurnId),B(r,i.expectedTurnId,o.body)),h(r,{...o,revision:o.revision+1,updatedAt:new Date().toISOString(),...i.action==="cancel"?{state:"cancelled"}:{},...i.action==="edit"?{body:i.body,payload:{...o.payload,prompt:i.body}}:{},...i.action==="steer"?{kind:"steer",expectedTurnId:i.expectedTurnId,turnId:i.expectedTurnId}:{}})})}async openTaskInboxTurn(e,t,n){return this.inboxWrite(i=>{let r=y(i,e);if(r&&r.lease_until>Date.now()&&(r.turn_id!==t||r.owner_id!==n))throw new Error("A turn is already running for this task.");i.run(`INSERT INTO task_inbox_turns (session_id, turn_id, owner_id, generation, accepting, paused, lease_until)
23
- VALUES (?, ?, ?, ?, 1, 0, ?) ON CONFLICT(session_id) DO UPDATE SET turn_id = excluded.turn_id,
24
- owner_id = excluded.owner_id, generation = excluded.generation, accepting = 1, paused = 0, lease_until = excluded.lease_until`,[e,t,n,(r?.generation??0)+1,Date.now()+V])})}async renewTaskInboxTurn(e,t,n){return this.inboxWrite(i=>{k(i,e,t,n),i.run("UPDATE task_inbox_turns SET lease_until = ? WHERE session_id = ?",[Date.now()+V,e])})}async pendingTaskInputs(e,t){return await this.ready,await this.writeQueue,v(this.database,e,t)}async taskAssignmentInputs(e){return await this.ready,await this.writeQueue,this.database.all("SELECT sequence, payload FROM task_inputs WHERE turn_id = ? AND kind = 'steer' AND state IN ('included', 'resolved') ORDER BY sequence",[e]).map(S)}async pauseTaskInboxTurn(e,t,n){return this.inboxWrite(i=>{k(i,e,t,n),i.run("UPDATE task_inbox_turns SET accepting = 0, paused = 1 WHERE session_id = ?",[e])})}async includeTaskInputs(e,t,n,i){return this.inboxWrite(r=>{k(r,e,t,n);let o=r.get("SELECT input_ids FROM task_input_requests WHERE request_id = ?",[i]);if(o)return JSON.parse(o.input_ids).map(p=>R(r,p));let a=te,d=[];for(let p of v(r,e,t)){if(p.body.length>a||d.length>=32)break;a-=p.body.length,d.push(h(r,{...p,state:"included",turnId:t,requestIds:[...p.requestIds,i],updatedAt:new Date().toISOString()}))}return r.run("INSERT INTO task_input_requests (request_id, session_id, turn_id, input_ids, state, created_at) VALUES (?, ?, ?, ?, 'included', ?)",[i,e,t,JSON.stringify(d.map(p=>p.id)),new Date().toISOString()]),d})}async settleTaskInputRequest(e,t){return this.inboxWrite(n=>{let i=n.get("SELECT input_ids FROM task_input_requests WHERE request_id = ?",[e]);if(i){n.run("UPDATE task_input_requests SET state = ? WHERE request_id = ?",[t,e]);for(let r of JSON.parse(i.input_ids)){let o=R(n,r);!o||o.state!=="included"||h(n,{...o,state:t==="resolved"?"resolved":t==="replaced"?"pending":"included",error:t==="failed"?"Provider request failed after input inclusion; receipt is not evidence of a reply.":null,updatedAt:new Date().toISOString()})}}})}async sealTaskInboxTurn(e,t,n){return this.inboxWrite(i=>(k(i,e,t,n),v(i,e,t).length?!1:(i.run("UPDATE task_inbox_turns SET accepting = 0 WHERE session_id = ?",[e]),!0)))}async sealNativeTaskInboxTurn(e,t,n){return this.inboxWrite(i=>(k(i,e,t,n),i.run("UPDATE task_inbox_turns SET accepting = 0 WHERE session_id = ?",[e]),v(i,e,t).map(r=>h(i,{...r,updatedAt:new Date().toISOString(),...r.kind==="steer"?{state:"rejected",error:"The agent finished before this correction could be dispatched. Send it as a follow-up."}:{turnId:null}}))))}async closeTaskInboxTurn(e,t,n,i){return this.inboxWrite(r=>{let o=y(r,e);if(!(!o||o.turn_id!==t||o.owner_id!==n)){r.run("UPDATE task_inbox_turns SET accepting = 0, paused = CASE WHEN ? = 1 THEN 1 ELSE paused END, lease_until = 0 WHERE session_id = ?",[i==="completed"?0:1,e]);for(let a of v(r,e,t))a.kind==="steer"?h(r,{...a,state:"rejected",error:`Turn ${i} before this correction was included. Send it as a follow-up.`,updatedAt:new Date().toISOString()}):a.turnId===t&&h(r,{...a,turnId:null,updatedAt:new Date().toISOString()})}})}async taskInboxPaused(e){return await this.ready,await this.writeQueue,!!y(this.database,e)?.paused}async reserveTaskFollowup(e,t,n){return this.inboxWrite(i=>{let r=y(i,e);if(r?.paused||r&&r.lease_until>Date.now())return null;let o=i.all("SELECT sequence, payload FROM task_inputs WHERE session_id = ? AND state = 'pending' AND turn_id IS NULL AND kind IN ('queued', 'followup') ORDER BY sequence",[e]),a=null;for(let d of o){let p=S(d);if(p.senderKind==="ponder"||p.payload.remoteDevice!==void 0){let c=i.get("SELECT payload FROM sessions WHERE id = ?",[e]);try{if(!c)throw new Error("The original local task no longer exists.");ce(p,E.parse(JSON.parse(c.payload))),pe(p,E.parse(JSON.parse(c.payload)))}catch(l){return h(i,{...p,state:"rejected",error:String(l),updatedAt:new Date().toISOString()})}}a=p;break}return a?(i.run(`INSERT INTO task_inbox_turns (session_id, turn_id, owner_id, generation, accepting, paused, lease_until)
25
- VALUES (?, ?, ?, ?, 1, 0, ?) ON CONFLICT(session_id) DO UPDATE SET turn_id = excluded.turn_id,
26
- owner_id = excluded.owner_id, generation = excluded.generation, accepting = 1, paused = 0, lease_until = excluded.lease_until`,[e,t,n,(r?.generation??0)+1,Date.now()+V]),h(i,{...a,turnId:t,updatedAt:new Date().toISOString()})):null})}async taskInboxWakeTargets(){return await this.ready,await this.writeQueue,this.database.all(`SELECT DISTINCT i.session_id FROM task_inputs i LEFT JOIN task_inbox_turns t ON t.session_id = i.session_id
27
- WHERE i.state = 'pending' AND i.turn_id IS NULL AND i.kind IN ('queued', 'followup')
28
- AND COALESCE(t.paused, 0) = 0 AND COALESCE(t.lease_until, 0) <= ?`,[Date.now()]).map(e=>e.session_id)}async createTaskWait(e){let t=O.parse(e);return this.inboxWrite(n=>{let i=n.get("SELECT payload FROM task_waits WHERE id = ?",[t.id]);if(i)return O.parse(JSON.parse(i.payload));if(t.targetSessionId===t.sessionId)throw new Error("A task cannot wait for itself.");if(t.targetSessionId&&n.get(`WITH RECURSIVE dependencies(session_id) AS (
29
- SELECT target_session_id FROM task_waits WHERE session_id = ? AND state = 'waiting'
30
- UNION SELECT w.target_session_id FROM task_waits w JOIN dependencies d ON w.session_id = d.session_id WHERE w.state = 'waiting'
31
- ) SELECT session_id FROM dependencies WHERE session_id = ? LIMIT 1`,[t.targetSessionId,t.sessionId]))throw new Error("This dependency would create a task wait cycle. Coordinate a different order.");return n.run("INSERT INTO task_waits (id, session_id, turn_id, target_session_id, target_turn_id, state, deadline, payload) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[t.id,t.sessionId,t.turnId,t.targetSessionId,t.targetTurnId,t.state,t.deadline,JSON.stringify(t)]),t})}async settleTaskWait(e,t){return this.inboxWrite(n=>{let i=n.get("SELECT payload FROM task_waits WHERE id = ?",[e]);if(!i)throw new Error("Task wait not found.");let r=O.parse(JSON.parse(i.payload));if(r.state!=="waiting")return r;let o={...r,state:t,updatedAt:new Date().toISOString()};return n.run("UPDATE task_waits SET state = ?, payload = ? WHERE id = ?",[t,JSON.stringify(o),e]),o})}async taskWaitsForSession(e){return await this.ready,await this.writeQueue,this.database.all("SELECT payload FROM task_waits WHERE session_id = ? AND state = 'waiting'",[e]).map(t=>O.parse(JSON.parse(t.payload)))}async commitSubagentCompletion(e,t){let n=M.parse(e);return this.inboxWrite(i=>{let r=new Date().toISOString();i.run(`INSERT INTO subagent_runs (id, parent_session_id, parent_turn_id, child_session_id, role_id, status, payload, created_at, updated_at)
32
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET status = excluded.status,
33
- payload = excluded.payload, updated_at = excluded.updated_at`,_e(n,r)),i.run("INSERT INTO task_completion_outbox (turn_id, run_id, payload, created_at) VALUES (?, ?, ?, ?) ON CONFLICT(turn_id) DO NOTHING",[t,n.id,JSON.stringify(n),r])})}async pendingTaskCompletions(e=""){return await this.ready,await this.writeQueue,this.database.all("SELECT turn_id, payload FROM task_completion_outbox WHERE input_id IS NULL AND turn_id > ? ORDER BY turn_id LIMIT 100",[e]).map(t=>({turnId:t.turn_id,run:M.parse(JSON.parse(t.payload))}))}async settleTaskCompletion(e,t){return this.inboxWrite(n=>{if(!R(n,t))throw new Error("Completion delivery has no durable input receipt.");n.run("UPDATE task_completion_outbox SET input_id = ? WHERE turn_id = ? AND input_id IS NULL",[t,e])})}};export{Le as SqliteTaskInboxStore};
@@ -1,9 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-W45RKGM6.js";import{a as ke}from"./chunk-F7D4BMTO.js";import{a as N,d as L}from"./chunk-X4ZT22SG.js";import{d as x,e as Te,g as ye}from"./chunk-MEK7DLX3.js";import{b as ue,f as we,g as Ee}from"./chunk-XSB3T4JZ.js";import"./chunk-GLDYJM7O.js";import"./chunk-LILXHGIA.js";import{b as C,c as D,d as ge}from"./chunk-ZQHPGEYT.js";import{a as M,b as g,c as q}from"./chunk-GW5SE3FM.js";import{a as me}from"./chunk-KCJVFLBB.js";import"./chunk-TUCKED4T.js";import"./chunk-OQPJ7FJF.js";import"./chunk-WBUK73ST.js";import"./chunk-P7HRF4FM.js";import"./chunk-INO67SEN.js";import"./chunk-2ITZW2CN.js";import"./chunk-BEI4YULC.js";import"./chunk-CN5OXQ7A.js";import"./chunk-NR5VASQB.js";import"./chunk-JY3YSI54.js";import"./chunk-W5W4IODW.js";import"./chunk-OZ6LRNRE.js";import"./chunk-PWK5Z5S3.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import"./chunk-RH43WLBX.js";import"./chunk-P74RR2GB.js";import"./chunk-KOKX7PBS.js";import"./chunk-NLQ2UPN2.js";import"./chunk-XGY4OQLC.js";import"./chunk-547AUVKN.js";import"./chunk-IWK3RTLR.js";import"./chunk-IDOGNIMV.js";import"./chunk-PCB65K4G.js";import{d as ce,e as fe,f as U,o as le,p as pe}from"./chunk-N5GPINVP.js";import{A as de,j as re,k as ie,m as oe,n as ne}from"./chunk-TW3SRBLU.js";import{Jb as F,Q as se,Qb as he,_ as A,b as X,c as Z,e as $,i as ee,la as y,ta as T,za as H}from"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import{n as te,x as S,y as ae}from"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-5ZBLCWEJ.js";import"./chunk-LAOLJDVB.js";import"./chunk-UWHIU24L.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import{e as J,f as Y}from"./chunk-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import{N as B,O as I}from"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import{n as m}from"./chunk-VVNV4NNW.js";import{A as u}from"./chunk-PF56N7ZY.js";import{a as h}from"./chunk-FTQLQJQV.js";import{randomUUID as et}from"node:crypto";import{cp as tt,mkdir as at,readdir as st,rename as G,rm as Ne,stat as rt}from"node:fs/promises";import O from"node:path";function ve(o,t,e,a){let s=t.modelScope;if(!s)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelId,t.profileId]);if(!i)throw new Error("Taskset draft Model was not found in this Profile.");let r=S.parse(JSON.parse(i.payload)),n={id:e.id,revision:e.revision,contentHash:e.contentHash},f=e.metadata.rewardBinding===void 0?null:te.parse(e.metadata.rewardBinding),p=s.source?.authoringGraph==="bound"&&f&&r.trainingSetup.rewardBindingRef&&I(f,r.trainingSetup.rewardBindingRef);return we(o,{schemaVersion:"openpond.modelProjectSave.v1",operationId:`draft-publication:${m({draftId:t.id,revision:t.revision,scope:s,tasksetRef:n})}`,expectedRevision:s.expectedModelRevision,project:ae.strip().parse({...r,trainingSetup:{...r.trainingSetup,tasksetRef:n,rewardBindingRef:f,tasksetRelease:null,recipe:p?r.trainingSetup.recipe:null,...r.trainingSetup.evaluationTasksetRef&&r.trainingSetup.tasksetRef&&I(r.trainingSetup.evaluationTasksetRef,r.trainingSetup.tasksetRef)?{evaluationTasksetRef:n}:{}}})},null,a?.modelResources?{...a.modelResources,taskset:a.taskset,executionResources:{environment:a.environment,verifierSet:a.verifierSet}}:a??void 0)}h(ve,"selectTasksetDraftModel");import{createHash as je,randomUUID as Je}from"node:crypto";import{lstat as Se,mkdir as Pe,readdir as Be,readFile as $e,rename as qe,rm as Ue,writeFile as Ve}from"node:fs/promises";import R from"node:path";var b=le.extend({workspaceHash:u.string().regex(/^[a-f0-9]{64}$/).nullable()}).strict();async function De(o){let{db:t,profileId:e}=o,a=Z.parse(o.request),s=h(()=>{let w=t.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[a.modelId,e]);if(!w)throw new Error("Taskset draft Model was not found in this Profile.");return S.parse(JSON.parse(w.payload))},"requireModel"),i=s(),r=m(a),n=t.get("SELECT request_hash, state, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(n){if(n.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(n.state==="deleted")throw new Error("This Taskset draft was deleted.");return b.parse(JSON.parse(n.payload))}if(!o.source)return null;if(i.revision!==a.expectedModelRevision)throw new Error("Model changed before draft initialization. Refresh before editing.");let f=i.trainingSetup.tasksetRef,p=f?t.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND profile_id = ?",[f.id,f.revision,e]):null,d=p?T.parse(JSON.parse(p.payload)):null;if(!d||!f||d.contentHash!==f.contentHash)throw new Error("The selected source Taskset is unavailable.");let l=o.source,c=i.hosted?.apiOrigin?i.hosted.tasksets.find(w=>w.localTasksetId===d.id&&w.localTasksetHash===d.contentHash&&w.packageHash===l.contentHash&&w.releaseId===l.taskset.id&&w.releaseRevision===l.taskset.revision&&w.releaseHash===l.taskset.contentHash):null,k=typeof d.metadata.importedPackageHash=="string"?d.metadata.importedPackageHash:c?.packageHash;if(k?k!==l.contentHash:!I(B(F({taskset:d,adapterId:x(d)}).tasksetRelease),B(l.taskset)))throw new Error("Taskset draft package differs from its selected source.");let P=l.modelResources?se.safeParse(l.taskset.metadata.modelTasksetDerivation):X.safeParse(l.taskset.metadata.modelTasksetAuthoring),_=c&&P.success&&P.data.owner.modelId===i.id?P.data.owner:{scopeId:e,modelId:i.id},Ce=ce({request:a,owner:_,source:l}),ze=pe({sourceDraft:de(d),source:l,preparation:Ce,expectedModelRevision:a.expectedModelRevision});await C(o.home,l);let K=b.parse({...ze,workspaceHash:null}),We=K.draft;t.exec("BEGIN IMMEDIATE");try{let w=t.get("SELECT request_hash FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(w&&w.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");if(!w&&s().revision!==a.expectedModelRevision)throw new Error("Model changed during draft initialization. Refresh before editing.");t.run("INSERT INTO model_taskset_draft_operations (profile_id, operation_id, request_hash, draft_id, state, payload) VALUES (?, ?, ?, ?, 'prepared', ?) ON CONFLICT(profile_id, operation_id) DO NOTHING",[e,a.operationId,r,We.id,JSON.stringify(K)]),t.exec("COMMIT")}catch(w){throw t.exec("ROLLBACK"),w}let j=t.get("SELECT request_hash, payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[e,a.operationId]);if(!j||j.request_hash!==r)throw new Error("Taskset draft operation was reused with different input.");return b.parse(JSON.parse(j.payload))}h(De,"prepareDraftInitialization");async function Re(o){let{initialized:t,workspacePath:e}=o;if(o.completed())return;if(t.workspaceHash)try{if(await Se(e),o.completed())return;if(await V(e),await g(e)!==t.workspaceHash)throw new Error("Prepared Taskset draft files changed before initialization completed.");return}catch(s){if(s.code!=="ENOENT")throw s}let a=`${e}.initializing-${Je()}`;await Pe(R.dirname(e),{recursive:!0});try{let s=t.draft.modelScope?.source;if(!s)throw new Error("Taskset draft lost its source preparation.");let i=await D(o.home,s.sourcePackageHash),r=new Map;for(let f of t.filePaths){let p=i.files.find(d=>d.asset.id===f.assetId);if(!p)throw new Error("Taskset draft source asset is missing.");for(let d of f.paths){if(d.includes("\\")||R.posix.isAbsolute(d)||d.split("/").some(k=>!k||k==="."||k===".."||k.startsWith(".env")))throw new Error("Taskset draft source path is invalid.");let l=r.get(d);if(l&&l!==p.asset.contentHash)throw new Error("Taskset draft source paths conflict.");if(l)continue;let c=R.join(a,d);await Pe(R.dirname(c),{recursive:!0}),await Ve(c,A(p),{flag:"wx"}),r.set(d,p.asset.contentHash)}}await M(t.draft,a);for(let[f,p]of r)if(je("sha256").update(await $e(R.join(a,f))).digest("hex")!==p)throw new Error(`Taskset draft source asset conflicts with authoring file ${f}.`);let n=await g(a);if(o.retainHash({...t,workspaceHash:n}),o.completed())return;try{await qe(a,e)}catch(f){if(!["EEXIST","ENOTEMPTY"].includes(f.code??""))throw f;if(o.completed())return;if(await V(e),await g(e)!==n)throw new Error("Prepared Taskset draft files changed before initialization completed.")}}finally{await Ue(a,{recursive:!0,force:!0})}}h(Re,"materializeDraftInitialization");async function V(o){let t=await Se(o);if(!t.isDirectory()||t.isSymbolicLink())throw new Error("Taskset draft source must be a regular directory.");for(let e of await Be(o,{withFileTypes:!0})){if(e.name.startsWith(".env")||e.isSymbolicLink())throw new Error("Taskset draft source contains a prohibited file.");if(e.isDirectory())await V(R.join(o,e.name));else if(!e.isFile())throw new Error("Taskset draft source must contain regular files.")}}h(V,"assertRegularTree");import Qe from"node:path";async function be(o){let t=F({taskset:o.taskset,adapterId:x(o.taskset)}),e=await ye({root:o.directory,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:t.tasksetRelease,environment:t.environmentRelease,verifierSet:t.verifierSetRelease},sources:U.parse(o.taskset.metadata.portableFileInventory??[])}),a=o.preparation.authoringGraph==="bound"?await D(o.home,o.preparation.sourcePackageHash):void 0,s=fe({preparation:o.preparation,edited:e,source:a});if(s.modelResources){let c=he({package:s,profileId:o.taskset.profileId,name:o.taskset.name,createdAt:o.taskset.createdAt}),k=ue(c.taskset,o.taskset),P=T.parse({...k,authoringProvenance:o.taskset.authoringProvenance,metadata:{...k.metadata,sourcePackageHash:o.taskset.metadata.sourcePackageHash}}),_=T.parse({...P,contentHash:H(P)});return await ge({home:o.home,...c,taskset:_}),{taskset:_,directory:Qe.join(o.home,"training","tasksets",String(_.environment.metadata.runtimeSourceTasksetId))}}let i=U.parse(o.taskset.metadata.portableFileInventory??[]),r=s.files.map(c=>({asset:c.asset,sourcePath:i.find(k=>k.asset.id===c.asset.id)?.sourcePath??c.asset.path})),n=s.taskset.environment.entrypoint==="openpond.javascript-environment.v1"?s.files.find(c=>c.asset.path==="environment/execution.json"):void 0,f=`model-draft-${m({packageHash:s.contentHash,taskset:o.taskset})}`,p=T.parse({...o.taskset,id:s.taskset.id,revision:s.taskset.revision,metadata:{...o.taskset.metadata,portableFileInventory:r,importedPackageHash:s.contentHash,derivedPortableMetadata:s.taskset.metadata},environment:{...o.taskset.environment,metadata:{...o.taskset.environment.metadata,runtimeSourceTasksetId:f,portableExecutionResources:{environment:s.environment,verifierSet:s.verifierSet}}}}),d=T.parse({...p,contentHash:H(p)}),l=await N(o.home,{taskset:d,generatedFiles:n?[{path:n.asset.path,role:"environment",content:new TextDecoder("utf-8",{fatal:!0}).decode(A(n))}]:[]},f,{source:{directory:o.directory,packageHash:await g(o.directory)},verify:h(c=>L(c,d),"verify")});return await C(o.home,s),{directory:l,taskset:d}}h(be,"materializeModelTasksetDraftPublication");import{constants as Q}from"node:fs";import{createHash as Ge}from"node:crypto";import{lstat as Ie,mkdir as Ke,open as Ye,readdir as Xe,rm as _e}from"node:fs/promises";import z from"node:path";var v=h((o,t)=>Y(z.join(o,"state","taskset-draft-writes"),t),"withTasksetDraftLock"),He=ie,Ze=h(o=>Ge("sha256").update(o).digest("hex"),"digest");async function W(o,t,e=!1){$.parse(t);let a=o;for(let s of["",...t.split("/").slice(0,-1)]){s&&(a=z.join(a,s)),e&&await Ke(a,{recursive:!1}).catch(r=>{if(r.code!=="EEXIST")throw r});let i=await Ie(a);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Taskset draft paths must use regular directories.")}return z.join(o,t)}h(W,"regularPath");async function Me(o,t){let e=await W(o,t),a=await Ye(e,Q.O_RDONLY|Q.O_NOFOLLOW|Q.O_NONBLOCK);try{let s=await a.stat();if(!s.isFile()||s.size>re)throw new Error("Taskset draft file must be a regular file within the 6 MB editing limit.");let i=Buffer.alloc(s.size),r=0;for(;r<i.length;){let n=await a.read(i,r,i.length-r,r);if(!n.bytesRead)throw new Error("Taskset draft file changed during reading.");r+=n.bytesRead}if((await a.read(Buffer.alloc(1),0,1,r)).bytesRead)throw new Error("Taskset draft file changed during reading.");return i}finally{await a.close()}}h(Me,"readBytes");async function Oe(o,t){let e=await Me(o,t);return oe(t,e)}h(Oe,"readTasksetDraftFile");async function Ae(o){let t=[];async function e(a=""){for(let s of await Xe(z.join(o,a),{withFileTypes:!0})){let i=a?`${a}/${s.name}`:s.name;if($.parse(i),s.isSymbolicLink())throw new Error("Taskset draft files cannot contain symbolic links.");if(s.isDirectory()){await e(i);continue}if(!s.isFile())throw new Error("Taskset draft files must be regular files.");if(t.length>=1e4)throw new Error("Taskset draft file inventory exceeds its limit.");let r=await Ie(await W(o,i));if(!r.isFile()||r.isSymbolicLink())throw new Error("Taskset draft files must be regular files.");t.push({path:i,sizeBytes:r.size,writable:He(i)})}}return h(e,"visit"),await W(o,"taskset.json"),await e(),t.sort((a,s)=>a.path.localeCompare(s.path))}h(Ae,"listTasksetDraftFiles");async function Fe(o,t,e){if(!He(t.path))throw new Error("This file is managed by the Taskset forms or retained source history.");let a=null;try{a=await Me(o,t.path)}catch(r){if(r.code!=="ENOENT")throw r}if((a?Ze(a):null)!==t.expectedFileHash)throw new Error("Taskset draft file changed. Reload it before saving.");if(!a&&t.content===null)throw new Error("Taskset draft file does not exist.");let s=t.content?ne(t.content):null,i=await W(o,t.path,!0);s?await J(i,s):await _e(i);try{return await e()}catch(r){throw a?await J(i,a):await _e(i,{force:!0}),r}}h(Fe,"mutateTasksetDraftFile");var E=u.object({schemaVersion:u.literal("openpond.tasksetDraftPointer.v1"),id:u.string().trim().min(1),profileId:u.string().trim().min(1),modelScope:y.shape.modelScope,status:u.enum(["draft","validating","needs_review","published"]),revision:u.number().int().positive(),workspacePath:u.string().trim().min(1),packageHash:u.string().regex(/^[a-f0-9]{64}$/),publishedTasksetRef:u.object({id:u.string().trim().min(1),revision:u.number().int().positive(),contentHash:u.string().trim().min(8)}).nullable(),createdAt:u.string().trim().min(1),updatedAt:u.string().trim().min(1)}),xe=class extends me{static{h(this,"SqliteTasksetDraftStore")}async initializeModelTasksetDraft(t,e,a){await this.ready;let s=this.writeQueue.then(()=>v(this.home,async()=>{let i=this.database,r=await De({db:i,home:this.home,profileId:t,request:e,source:a});if(!r)return null;let n=h(()=>{let d=i.get("SELECT state FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]);if(d?.state==="deleted")throw new Error("This Taskset draft was deleted.");let l=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);if(!l){if(d?.state==="ready")throw new Error("The initialized Taskset draft is unavailable.");return!1}let c=E.parse(JSON.parse(l.payload));if(c.profileId!==t||c.modelScope?.source?.requestHash!==r.draft.modelScope?.source?.requestHash)throw new Error("Taskset draft identity conflicts with its initialization.");return!0},"completed"),f=this.workspacePath(r.draft.id);await Re({home:this.home,initialized:r,workspacePath:f,completed:n,retainHash:h(d=>{let l=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),c=b.parse(JSON.parse(l.payload));if(c.workspaceHash&&c.workspaceHash!==d.workspaceHash)throw new Error("Taskset draft initialization produced different files on retry.");i.run("UPDATE model_taskset_draft_operations SET payload = ? WHERE profile_id = ? AND operation_id = ? AND state = 'prepared'",[JSON.stringify(d),t,e.operationId])},"retainHash")}),i.exec("BEGIN IMMEDIATE");try{if(!n()){let d=i.get("SELECT payload FROM model_taskset_draft_operations WHERE profile_id = ? AND operation_id = ?",[t,e.operationId]),l=b.parse(JSON.parse(d.payload)),c=l.draft,k=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:c.id,profileId:t,modelScope:c.modelScope,status:c.status,revision:c.revision,workspacePath:f,packageHash:l.workspaceHash,publishedTasksetRef:c.publishedTasksetRef,createdAt:c.createdAt,updatedAt:c.updatedAt});i.run("INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",[c.id,t,c.status,c.revision,JSON.stringify(k),c.createdAt,c.updatedAt]),i.run("UPDATE model_taskset_draft_operations SET state = 'ready' WHERE profile_id = ? AND operation_id = ?",[t,e.operationId])}i.exec("COMMIT")}catch(d){throw i.exec("ROLLBACK"),d}let p=i.get("SELECT payload FROM taskset_drafts WHERE id = ?",[r.draft.id]);return this.draftFromStoredPayload(JSON.parse(p.payload))}));return this.writeQueue=s.then(()=>{},()=>{}),s}async saveTasksetDraft(t,e,a={}){let s=y.parse(t);await this.ready;let i=this.writeQueue.then(()=>v(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[s.id]),n=r?E.safeParse(JSON.parse(r.payload)):null;if(n?.success){if(n.data.profileId!==s.profileId)throw new Error("Taskset draft profile cannot change.");if(m(n.data.modelScope?{...n.data.modelScope,expectedModelRevision:0}:null)!==m(s.modelScope?{...s.modelScope,expectedModelRevision:0}:null)||!a.refreshModelRevision&&m(n.data.modelScope)!==m(s.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.data.status==="published")throw new Error("Published Taskset drafts are immutable. Initialize a new draft to revise the Taskset.");if(s.revision<n.data.revision||e!==void 0&&n.data.revision!==e)throw new Error("Taskset draft changed before saving. Refresh before saving.")}else if(e!==void 0)throw new Error("Taskset draft is unavailable for saving.");if((!n?.success||a.refreshModelRevision)&&s.modelScope){let c=this.database.get("SELECT payload FROM model_projects WHERE id = ? AND profile_id = ?",[s.modelScope.modelId,s.profileId]);if(!c)throw new Error("Taskset draft Model was not found in this Profile.");if(S.parse(JSON.parse(c.payload)).revision!==s.modelScope.expectedModelRevision)throw new Error("Taskset draft Model changed. Refresh before editing.")}let f=this.workspacePath(s.id),d=(await M(s,f)).draft,l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:d.id,profileId:d.profileId,modelScope:d.modelScope,status:d.status,revision:d.revision,workspacePath:f,packageHash:await g(f),publishedTasksetRef:d.publishedTasksetRef,createdAt:d.createdAt,updatedAt:d.updatedAt});return await this.savePointer(l,!0),d}));return this.writeQueue=i.then(()=>{},()=>{}),i}async importTasksetDraftPackage(t){let e=O.resolve(t.packagePath),s=(await rt(e)).isDirectory()?e:O.dirname(e);await Le(s);let i=await g(s),r=await q(s),n=await this.getTasksetDraft(r.id);if(n){let c=n.metadata.importedTasksetPackage;if(c&&typeof c=="object"&&!Array.isArray(c)&&c.packageHash===i&&n.profileId===t.profileId)return n;throw new Error(`Taskset draft ${r.id} already exists. Import a package with a distinct Taskset id.`)}let f=y.parse({...r,profileId:t.profileId,modelScope:null,status:"draft",revision:1,publishedTasksetRef:null,metadata:{...r.metadata,importedTasksetPackage:{packageHash:i,importedAt:new Date().toISOString()}},updatedAt:new Date().toISOString()}),p=this.workspacePath(f.id),d=`${p}.import-${process.pid}-${Date.now()}`;await at(O.dirname(p),{recursive:!0});try{await tt(s,d,{recursive:!0,errorOnExist:!0,force:!1,preserveTimestamps:!0}),await M(f,d),await G(d,p)}catch(c){throw await Ne(d,{recursive:!0,force:!0}),c}let l=E.parse({schemaVersion:"openpond.tasksetDraftPointer.v1",id:f.id,profileId:f.profileId,status:f.status,revision:f.revision,workspacePath:p,packageHash:await g(p),publishedTasksetRef:f.publishedTasksetRef,createdAt:f.createdAt,updatedAt:f.updatedAt});return await this.savePointer(l),this.draftFromStoredPayload(l)}async materializePublishedTasksetPackage(t){let e=await this.getTasksetDraftWorkspace(t.draftId);if(!e)throw new Error(`Taskset draft ${t.draftId} workspace was not found.`);if(t.taskset.metadata.sourcePackageHash!==void 0&&t.taskset.metadata.sourcePackageHash!==e.packageHash)throw new Error("Taskset draft files changed before publication. Refresh before publishing.");let a=`draft-${m({taskset:t.taskset,packageHash:e.packageHash})}`,s=await Te(t.taskset,e.workspacePath),i=T.parse({...s.taskset,metadata:{...s.taskset.metadata,sourcePackageHash:e.packageHash},environment:{...s.taskset.environment,metadata:{...s.taskset.environment.metadata,runtimeSourceTasksetId:a}}}),r=T.parse({...i,contentHash:H(i)}),n=await N(this.home,{taskset:r,generatedFiles:s.generatedFiles},a,{source:{directory:e.workspacePath,packageHash:e.packageHash},verify:h(p=>L(p,r),"verify")}),f=await this.getTasksetDraft(t.draftId);return f?.modelScope?.source?be({home:this.home,directory:n,taskset:r,preparation:f.modelScope.source}):{directory:n,taskset:r}}async finalizeTasksetDraftPublication(t){await this.ready;let e=y.parse(t.draft),a=T.parse(t.taskset),s=e.modelScope?.source?.authoringGraph==="bound"&&typeof a.metadata.importedPackageHash=="string"?await D(this.home,a.metadata.importedPackageHash):null,i=this.writeQueue.then(()=>v(this.home,async()=>{let r=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ?",[e.id]);if(!r)throw new Error("Taskset draft was deleted before publication.");let n=E.parse(JSON.parse(r.payload));if(n.profileId!==e.profileId||a.profileId!==e.profileId)throw new Error("Taskset publication belongs to another Profile.");if(m(n.modelScope)!==m(e.modelScope))throw new Error("Taskset draft Model ownership cannot change.");if(n.status==="published"&&n.publishedTasksetRef){let c=n.publishedTasksetRef,k=this.database.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ? AND content_hash = ?",[c.id,c.revision,c.contentHash]);if(!k)throw new Error("Published draft lost its immutable Taskset revision.");return{draft:y.parse({...e,status:n.status,revision:n.revision,publishedTasksetRef:c,updatedAt:n.updatedAt}),taskset:T.parse(JSON.parse(k.payload))}}if(n.revision!==e.revision||a.metadata.sourcePackageHash!==t.packageHash)throw new Error("Taskset draft changed before publication. Refresh before publishing.");let f=n.modelScope?.source,p=f?.authoringGraph==="bound"&&a.metadata.modelTasksetDerivation&&typeof a.metadata.modelTasksetDerivation=="object"?{...a.metadata.modelTasksetDerivation,schemaVersion:f.lineage.schemaVersion}:a.metadata.modelTasksetAuthoring;if(f&&(a.id!==f.tasksetId||a.revision!==f.tasksetRevision||m(p)!==m(f.lineage)))throw new Error("Taskset publication differs from its retained source preparation.");let d=y.parse({...e,status:"published",revision:e.revision+1,publishedTasksetRef:{id:a.id,revision:a.revision,contentHash:a.contentHash},updatedAt:new Date().toISOString()}),l=E.parse({...n,status:d.status,revision:d.revision,publishedTasksetRef:d.publishedTasksetRef,updatedAt:d.updatedAt});return ke(this.database,a,()=>{if(s&&Ee(this.database,{package:s,taskset:a,generatedFiles:[]}),ve(this.database,e,a,s),this.database.get("SELECT revision FROM taskset_drafts WHERE id = ?",[e.id])?.revision!==e.revision)throw new Error("Taskset draft changed during publication.");this.database.run("UPDATE taskset_drafts SET status = ?, revision = ?, payload = ?, updated_at = ? WHERE id = ?",[l.status,l.revision,JSON.stringify(l),l.updatedAt,e.id])}),{draft:d,taskset:a}}));return this.writeQueue=i.then(()=>{},()=>{}),i}async getTasksetDraft(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],a=>a);return e===null?null:this.draftFromStoredPayload(e)}async listTasksetDrafts(t){await this.ready,await this.writeQueue;let e=await this.all(t?"SELECT payload FROM taskset_drafts WHERE profile_id = ? ORDER BY updated_at DESC":"SELECT payload FROM taskset_drafts ORDER BY updated_at DESC",t?[t]:[]);return Promise.all(e.map(a=>this.draftFromStoredPayload(JSON.parse(a.payload))))}async readHumanPublishedTasksetDraft(t,e){let a=(await this.listTasksetDrafts(t)).filter(r=>r.status==="published"&&r.modelScope===null&&m(r.publishedTasksetRef)===m(e));if(a.length!==1)return null;let s=a[0],i=await this.getTasksetDraftWorkspace(s.id);return i?{draft:s,workspace:i}:null}async getTasksetDraftWorkspace(t){let e=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[t],s=>s);if(e===null)return null;let a=await this.pointerFromStoredPayload(e);return{draftId:a.id,workspacePath:a.workspacePath,packageHash:await g(a.workspacePath)}}async deleteTasksetDraft(t){await this.ready;let e=this.writeQueue.then(()=>v(this.home,async()=>{let a=this.workspacePath(t),s=`${a}.delete-${et()}`,i=!1;try{await G(a,s),i=!0}catch(r){if(r.code!=="ENOENT")throw r}try{this.database.exec("BEGIN IMMEDIATE");try{this.database.run("DELETE FROM taskset_drafts WHERE id = ?",[t]),this.database.run("UPDATE model_taskset_draft_operations SET state = 'deleted' WHERE draft_id = ?",[t]),this.database.exec("COMMIT")}catch(r){throw this.database.exec("ROLLBACK"),r}}catch(r){throw i&&await G(s,a).catch(()=>{}),r}i&&await Ne(s,{recursive:!0,force:!0})}));this.writeQueue=e.catch(()=>{}),await e}async tasksetDraftFiles(t,e,a){return await this.ready,v(this.home,async()=>{let s=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[e,t]);if(!s)throw new Error("Taskset draft was not found in this Profile.");let i=E.parse(JSON.parse(s.payload));if(a!==void 0){let n=await Oe(i.workspacePath,a);return{draftRevision:i.revision,file:{...n,writable:n.writable&&i.status!=="published"}}}let r=await Ae(i.workspacePath);return{draftRevision:i.revision,files:r.map(n=>({...n,writable:n.writable&&i.status!=="published"}))}})}async saveTasksetDraftFile(t,e){let a=ee.parse(e);await this.ready;let s=this.writeQueue.then(()=>v(this.home,async()=>{let i=this.database.get("SELECT payload FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t]);if(!i)throw new Error("Taskset draft was not found in this Profile.");let r=E.parse(JSON.parse(i.payload));if(r.status==="published")throw new Error("Published Taskset drafts are immutable.");if(r.revision!==a.expectedDraftRevision)throw new Error("Taskset draft changed. Reload before saving a file.");return Fe(r.workspacePath,a,async()=>{let n=E.parse({...r,revision:r.revision+1,packageHash:await g(r.workspacePath),updatedAt:new Date().toISOString()}),f=await this.draftFromStoredPayload(n);this.database.exec("BEGIN IMMEDIATE");try{if(this.database.get("SELECT revision FROM taskset_drafts WHERE id = ? AND profile_id = ?",[a.draftId,t])?.revision!==r.revision)throw new Error("Taskset draft changed during file saving.");this.database.run("UPDATE taskset_drafts SET revision = ?, payload = ?, updated_at = ? WHERE id = ?",[n.revision,JSON.stringify(n),n.updatedAt,n.id]),this.database.exec("COMMIT")}catch(p){throw this.database.exec("ROLLBACK"),p}return f})}));return this.writeQueue=s.then(()=>{},()=>{}),s}workspacePath(t){let e=m(t).slice(0,24);return O.join(this.home,"workspaces","tasksets",`taskset-${e}`)}async draftFromStoredPayload(t){let e=await this.pointerFromStoredPayload(t),a=await q(e.workspacePath);return y.parse({...a,id:e.id,profileId:e.profileId,modelScope:e.modelScope,status:e.status,revision:e.revision,publishedTasksetRef:e.publishedTasksetRef,createdAt:e.createdAt,updatedAt:e.updatedAt})}async pointerFromStoredPayload(t){let e=E.safeParse(t);if(e.success)return e.data;let a=y.parse(t);await this.saveTasksetDraft(a);let s=await this.getParsedPayload("SELECT payload FROM taskset_drafts WHERE id = ?",[a.id],E.parse);if(!s)throw new Error(`Taskset draft ${a.id} migration failed.`);return s}async savePointer(t,e=!1){await(e?this.run.bind(this):this.upsertPayload.bind(this))(`INSERT INTO taskset_drafts (id, profile_id, status, revision, payload, created_at, updated_at)
3
- VALUES (?, ?, ?, ?, ?, ?, ?)
4
- ON CONFLICT(id) DO UPDATE SET
5
- profile_id = excluded.profile_id,
6
- status = excluded.status,
7
- revision = excluded.revision,
8
- payload = excluded.payload,
9
- updated_at = excluded.updated_at`,[t.id,t.profileId,t.status,t.revision,JSON.stringify(t),t.createdAt,t.updatedAt])}};async function Le(o){let t=await st(o,{withFileTypes:!0});for(let e of t){let a=O.join(o,e.name);if(e.isSymbolicLink())throw new Error(`Taskset packages cannot contain symbolic links: ${a}`);if(e.isDirectory()){await Le(a);continue}if(!e.isFile())throw new Error(`Taskset packages may contain only files and directories: ${a}`)}}h(Le,"assertRegularPackageTree");export{xe as SqliteTasksetDraftStore};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-PCB65K4G.js";import{a as G,b as H,c as I,d as P,e as Q,f as R,g as S,h as T,j as U,k as V,l as W,m as X,n as Y,o as Z,p as _,q as $}from"./chunk-N5GPINVP.js";import{c as z,d as A,e as B,f as C,g as D,h as E,i as F}from"./chunk-TW3SRBLU.js";import{$ as q,Ib as J,Jb as K,Kb as L,Lb as M,Mb as N,Nb as O,Ob as aa,Pb as ba,Qb as ca,Rb as da,V as k,W as l,X as m,Y as n,Z as o,_ as p,a as b,aa as r,b as c,c as d,d as e,da as s,e as f,ea as t,f as g,fa as u,g as h,ga as v,h as i,ha as w,i as j,ia as x,ja as y}from"./chunk-PGO4FRHU.js";import"./chunk-VNJAAYNQ.js";import"./chunk-TVTFEGTU.js";import"./chunk-NVHZRKXB.js";import"./chunk-MTP3B2SU.js";import"./chunk-LV3CQ72P.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import{t as a}from"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import"./chunk-FTQLQJQV.js";export{R as AuthoredTasksetFileInventorySchema,n as MAX_TASKSET_PACKAGE_BYTES,a as ModelBatchReviewError,G as ModelBatchReviewInspectionSchema,I as ModelBatchReviewReceiptSchema,H as ModelBatchReviewRequestSchema,b as ModelTasksetAuthoringOwnerSchema,c as ModelTasksetAuthoringSchema,e as ModelTasksetDraftPreparationSchema,d as ModelTasksetDraftRequestSchema,F as OpenPondTasksetPackageClient,E as OpenPondTasksetPackageError,h as TasksetDraftFileContentSchema,g as TasksetDraftFileInfoSchema,j as TasksetDraftFileMutationSchema,f as TasksetDraftFilePathSchema,i as TasksetDraftFileSchema,Z as TasksetDraftSourceInitializationSchema,s as TasksetPackageContentSchema,o as TasksetPackageFileSchema,k as TasksetPackageLearningResourcesSchema,z as TasksetPackageModelConfigurationSchema,A as TasksetPackagePublicationSchema,C as TasksetPackageReadbackSchema,B as TasksetPackageReceiptSchema,t as TasksetPackageSchema,D as TasksetReleasePackageReadbackSchema,Y as beginModelBatchReview,V as bindOrdinaryModelTasksetReward,U as compileModelTasksetDraftWorkspace,x as createTasksetPackage,r as createTasksetPackageExecutionFile,p as decodeTasksetPackageFile,X as findModelBatchReview,W as inspectModelBatchPackage,S as isGeneratedTasksetPublicationFilePath,l as learningPackageContextFiles,ba as learningVerifierModule,K as materializePortableTasksetRelease,$ as materializeTasksetDraftWorkspace,M as portableTasksetEnvironment,N as portableTasksetTools,T as prepareAuthoredTasksetSource,ca as prepareImportedTasksetPackage,P as prepareModelTasksetDraft,_ as prepareTasksetDraftSource,aa as projectLearningBatchGraders,O as projectPortableTaskRecord,L as projectPreferenceComparisonRelease,Q as publishModelTasksetDraftPackage,J as resolvePortableTasksetRewardExecution,q as resolveTasksetPackageExecution,v as resolveTasksetPackageInstructions,y as resolveTasksetWorkOutputs,u as tasksetPackageRewardBinding,da as tasksetPackageSourceId,m as validateTasksetLearningResources,w as validateTasksetPackage};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{p as e}from"./chunk-B42QQUZY.js";import"./chunk-7KTARW23.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-OE22TAXP.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as t}from"./chunk-FTQLQJQV.js";function i(n){return n instanceof e?{code:n.code,message:n.message,status:n.status,retryable:n.retryable,requestId:n.requestId}:null}t(i,"trainingCliError");export{i as trainingCliError};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as J}from"./chunk-NWQL6FNF.js";import{c as x}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as E,f as v,h as A}from"./chunk-3M53YXEI.js";import"./chunk-4N4EH3RJ.js";import"./chunk-HFJUXKT5.js";import"./chunk-5ZBLCWEJ.js";import{a as S}from"./chunk-QCSLEMZF.js";import{l as _,m as M,n as P,o as C,p as H,q as R}from"./chunk-B42QQUZY.js";import{m as j,o as T}from"./chunk-7KTARW23.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-ABF3W2MO.js";import"./chunk-RV7PUSI2.js";import"./chunk-KCV5VN4X.js";import"./chunk-6FA3GG5B.js";import"./chunk-2EPR4HLF.js";import"./chunk-BKEDG3A4.js";import"./chunk-OE22TAXP.js";import"./chunk-UGOK7VTC.js";import"./chunk-4M3YW3EQ.js";import"./chunk-PBZCXPPC.js";import"./chunk-NJLULBTM.js";import"./chunk-VVNV4NNW.js";import"./chunk-PF56N7ZY.js";import{a as h}from"./chunk-FTQLQJQV.js";async function U(n,s={}){let t=process.env.OPENPOND_CHAT_INVOCATION;if(t)try{let e=process.env.OPENPOND_LOCAL_API_URL;if(!e)throw new Error("The chat executor did not supply its local API URL.");let i=new URL(e);if(i.protocol!=="http:"||!["127.0.0.1","localhost","[::1]"].includes(i.hostname)||i.username||i.password)throw new Error("Chat attachment requires the app's loopback API origin.");let u=await(s.request??await(await import("./training-DF5UEPY3.js")).createLocalAuthenticatedRequest(e,{timeoutMs:15e3}))(new URL("/v1/chat-experiments",i),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"attach_training",invocationToken:t,payload:{location:"cloud",...n}}),signal:AbortSignal.timeout(15e3),redirect:"error"});if(!u.ok)throw new Error(`Chat attachment returned HTTP ${u.status}.`)}catch(e){(s.warn??console.error)(`Hosted operation succeeded, but chat attachment failed: ${e instanceof Error?e.message:String(e)}. Inspect the saved job to retry attachment; do not submit it again.`)}}h(U,"attachHostedTrainingToChat");import{readFile as W}from"node:fs/promises";var O=new Set(["succeeded","failed","cancelled"]);function $(n){let s=A(n.intervalMs,"interval-ms")??1e4,t=A(n.cleanupTimeoutMs,"cleanup-timeout-ms")??18e4,e=A(n.cleanupReserveMs,"cleanup-reserve-ms")??18e4;if([s,t,e].some(u=>!Number.isSafeInteger(u)||u>2147483647))throw new Error("Watch intervals and cleanup bounds must fit a positive 32-bit millisecond timer.");if(s<250)throw new Error("--interval-ms must be at least 250.");if(t<1e3||e<1e3)throw new Error("Cleanup timeout and reserve must be at least 1000 ms.");let i=E(n,"deadlineAt");if(!i&&n.cleanupReserveMs!==void 0)throw new Error("--cleanup-reserve-ms requires --deadline-at.");let c=i?Date.parse(i):null;if(i&&(!/T.*(?:Z|[+-]\d{2}:\d{2})$/.test(i)||!Number.isFinite(c)))throw new Error("--deadline-at requires an ISO timestamp with an explicit timezone.");if(c!==null&&c-e<=Date.now())throw new Error("--deadline-at must leave time for execution and the cleanup reserve.");return{intervalMs:s,deadlineAt:c,cancelAt:c===null?null:c-e,waitForCleanup:c!==null||v(n.waitForCleanup)||v(n.cancelOnInfrastructureError),cleanupTimeoutMs:t,cancelOnInfrastructureError:v(n.cancelOnInfrastructureError)}}h($,"parseHostedWatchOptions");async function q(n,s,t){for(let e=0;e<4;e++){let i=await n.getJob(s);if(k(i,s,t),O.has(i.state)||i.state==="cancelling")return i;try{let c=await n.cancelJob(s,i.version);return k(c,s,t,i.submissionHash),c}catch(c){if(!(c instanceof H)||c.status!==409||c.code!=="stale_version"||e===3)throw c}}throw new Error("Hosted cancellation could not reconcile the current Job version.")}h(q,"cancelHostedTrainingJob");async function B(n){let{client:s,options:t,jobId:e,teamId:i}=n,c=null,u,p=!1;for(;;){let w=Math.min(t.deadlineAt??1/0,c??1/0);if(n.requestBound.deadlineAt=Number.isFinite(w)?w:null,Date.now()>=w)throw D(e);try{let o=t.cancelAt!==null&&Date.now()>=t.cancelAt&&!p?await q(s,e,i):await s.getJob(e);if(k(o,e,i,u),u=o.submissionHash,t.cancelOnInfrastructureError&&!p&&!O.has(o.state)&&o.state!=="cancelling"){let d=await s.events(e);if(d.some(m=>m.jobId!==e))throw new Error("Hosted event does not match the watched Job.");let f=d.find(m=>m.type==="rollout_metric"&&m.data.terminalClass==="infrastructure"&&m.data.rewardEligible===!1);f&&(n.print({jobId:e,event:"hosted_watch_infrastructure_failure",trajectoryEventId:f.id,data:f.data}),o=await q(s,e,i),k(o,e,i,u),c??=Date.now()+t.cleanupTimeoutMs)}if(p||=o.state==="cancelling"||O.has(o.state),n.print(o),O.has(o.state)){let d=o.executionMode==="qualification"&&o.state==="succeeded";if(!t.waitForCleanup&&!d)return;c??=Date.now()+t.cleanupTimeoutMs,n.requestBound.deadlineAt=Math.min(t.deadlineAt??1/0,c);let{receipt:f,outputs:m}=await s.outputs(e);if(f){if(f.jobId!==e||f.teamId!==i||f.submissionHash!==u)throw new Error("Hosted cleanup receipt does not match the watched Job and submission.");if(f.cleanupComplete){d&&await C(f,{submissionHash:u,outputs:m}),n.print({jobId:e,cleanup:{scope:"job",complete:!0,receipt:f}});return}}}}catch(o){if(n.requestBound.deadlineAt!==null&&Date.now()>=n.requestBound.deadlineAt)throw D(e);if(t.deadlineAt===null&&c===null||!N(o))throw o;console.error(JSON.stringify({jobId:e,event:"hosted_watch_retry",code:o instanceof H?o.code:"transport_unavailable"}))}let g=Math.min(n.requestBound.deadlineAt??1/0,!p&&t.cancelAt!==null&&Date.now()<t.cancelAt?t.cancelAt:1/0);await new Promise(o=>setTimeout(o,Math.max(0,Math.min(t.intervalMs,g-Date.now()))))}}h(B,"watchHostedTrainingJob");function k(n,s,t,e){if(n.id!==s||n.teamId!==t||e!==void 0&&n.submissionHash!==e)throw new Error("Hosted response does not match the requested Job, workspace, and submission.")}h(k,"assertJobIdentity");function N(n){return n instanceof H?n.status===429||n.status>=500:n instanceof TypeError||n instanceof Error&&["TimeoutError","AbortError"].includes(n.name)}h(N,"isTransient");function D(n){return new Error(`Hosted watch deadline reached for ${n}; completed job cleanup is unverified. Inspect hosted-status, hosted-artifacts, and provider retirement before treating resources as released.`)}h(D,"cleanupDeadlineError");var l=h(n=>console.log(JSON.stringify(n,null,2)),"print");async function st(n,s){let t=s[0],e=s[1],i=t==="hosted-watch"?$(n):null,c={deadlineAt:i?.deadlineAt??null},u=await z(n);if(!u.token)throw new Error("Sign in to an OpenPond account before using hosted training.");let p=x(n)??u.apiBaseUrl;if(new URL(p).origin!==new URL(u.apiBaseUrl).origin)throw new Error("The hosted API URL must match the signed-in account\u2019s API origin.");let w=E(n,"teamId");if(!w)throw new Error("Hosted training requires --team-id <workspace-id>.");let g=new Headers({"x-openpond-team-id":w});u.token.startsWith("opk_")?(g.set("Authorization",`ApiKey ${u.token}`),g.set("openpond-api-key",u.token)):g.set("Authorization",`Bearer ${u.token}`);let o=h((r,a)=>{let b=c.deadlineAt===null?1/0:c.deadlineAt-Date.now();if(b<=0)throw new DOMException("Hosted watch deadline reached","TimeoutError");let y=AbortSignal.timeout(Math.max(1,Math.min(i?1e4:18e4,b)));return fetch(r,{...a,redirect:"error",signal:a?.signal?AbortSignal.any([a.signal,y]):y})},"request"),d=R({baseUrl:p,headers:g,fetch:o}),f=h(r=>U({jobId:r,teamId:w,apiOrigin:new URL(p).origin}),"attach"),m=h(async(r,a)=>{l(r),await f(a)},"printAttached"),I=h(async()=>{if(!e)throw new Error(`${t} requires an input JSON file.`);let r=await W(e);if(r.byteLength>64*1024*1024)throw new Error("Hosted training input exceeds 64 MiB.");return JSON.parse(r.toString("utf8"))},"readInput");if(s.length>2)throw new Error(`${t} accepts at most one identifier or input file.`);if(["hosted-serving-pools","hosted-base-serving-prepare","hosted-serving-pool-retire"].includes(t??"")){l(await(await import("./training-hosted-serving-QAV7ZGGV.js")).runHostedServingCommand({action:t,target:e,baseUrl:p,headers:g,request:o,readInput:I,confirmed:v(n.yes)}));return}if(t==="hosted-provider"||t==="hosted-quotes"){if(e)throw new Error(`${t} does not accept an identifier.`);let r=t==="hosted-provider"?"/v1/managed-rl/provider-inventory":"/v1/managed-rl/quotes",a=await o(new URL(r,p),{headers:g}),b=await a.json();if(!a.ok)throw new Error(`Hosted capacity read failed (${a.status}).`);l(b);return}if(t==="hosted-workers"||t==="hosted-worker"||t?.startsWith("hosted-worker-")){l(await(await import("./training-hosted-workers-KI767T4Y.js")).runHostedWorkerCommand({action:t,target:e,baseUrl:p,headers:g,request:o,readInput:I,confirmed:v(n.yes)}));return}if(t==="hosted-models"){l(await T({baseUrl:p,headers:g,fetch:o}).list());return}if(t==="hosted-model"){if(!e)throw new Error("hosted-model requires a Model Project ID.");l(await T({baseUrl:p,headers:g,fetch:o}).get(e));return}if(t==="hosted-sync-model"){let r=j.parse(await I());l(await T({baseUrl:p,headers:g,fetch:o}).upsert(r));return}if(t==="hosted-capabilities"){l(await d.capabilities());return}if(t==="hosted-batches"){let r=new S({baseUrl:p,apiKey:u.token,scope:w,fetch:o});l(await r.list("batch",{limit:100}));return}if(t==="hosted-preparations"){l(await d.listPreparations(w));return}if(t==="hosted-jobs"){l(await d.listJobs({limit:100}));return}if(t==="hosted-prepare"){let r=_.parse(await I());if(r.teamId!==w)throw new Error("Preparation input belongs to a different workspace.");l(await d.prepareRun(r));return}if(t==="hosted-start"){let r=await M(await I());if(r.plan.request.teamId!==w)throw new Error("Preparation belongs to a different workspace.");if(!v(n.yes))throw new Error("Starting paid hosted training requires --yes.");let a=await d.startPreparation(r.plan.id,{teamId:w,planHash:r.plan.contentHash,expectedRevision:r.revision});l(a),a.jobId&&await f(a.jobId);return}if(t==="hosted-stage"){l(await d.stageArtifact(await I()));return}if(t==="hosted-submit"||t==="hosted-qualify"){let r=await P(await I());if(t==="hosted-qualify"&&(r.job.kind!=="policy_optimize"||r.job.executionMode!=="qualification"))throw new Error("hosted-qualify requires an immutable policy_optimize submission with executionMode=qualification.");if(!v(n.yes))throw new Error("Submitting paid hosted training requires --yes.");if(r.job.kind==="policy_optimize"&&r.job.executionMode==="qualification"&&!(await d.capabilities()).executionModes?.includes("qualification"))throw new Error("This hosted runtime does not advertise original-learner qualification support.");let a=await d.createJob(r);if(a.teamId!==w||a.submissionHash!==r.contentHash||a.kind!==r.job.kind||r.job.kind==="policy_optimize"&&a.executionMode!==r.job.executionMode)throw new Error(`Hosted submission response identity or execution mode mismatch; inspect hosted-status ${a.id} before attempting another submission.`);await m(a,a.id);return}if(!e)throw new Error(`${t} requires a hosted job ID.`);if(t==="hosted-status"){await m(await d.getJob(e),e);return}if(t==="hosted-report"){let r=await d.getJob(e),[a,b]=await Promise.all([d.events(e),d.outputs(e)]),y=await d.getJob(e);if(y.id!==e||y.teamId!==w||r.id!==e||r.teamId!==w)throw new Error("Hosted report status identity mismatch.");let{buildHostedTrainingReport:L}=await import("./training-hosted-report-4F25RZZ4.js");await m(L({job:y,events:a,outputs:b,versionBeforeRead:r.version,generatedAt:new Date().toISOString()}),e);return}if(t==="hosted-evaluation-tasks"){let r=E(n,"evaluationId");if(!r)throw new Error("hosted-evaluation-tasks requires --evaluation-id from hosted-artifacts.");let b=(await d.outputs(e)).outputs.find(y=>y.kind==="evaluation"&&y.id===r);if(!b)throw new Error("Evaluation does not belong to this job's retained outputs.");l(await d.evaluationTasks(e,{id:b.id,contentHash:b.contentHash},{cursor:E(n,"cursor")||void 0}));return}if(t==="hosted-trajectory"){let r=E(n,"trajectoryId");if(!r)throw new Error("hosted-trajectory requires --trajectory-id <receipt-id> from hosted-inspect.");let a=await o(new URL(`/v1/managed-rl/jobs/${encodeURIComponent(e)}/trajectories/${encodeURIComponent(r)}`,p),{headers:g});if(!a.ok)throw new Error(`Hosted trajectory read failed (${a.status}).`);l(await a.json());return}if(t==="hosted-inspect"){let r=await o(new URL(`/v1/managed-rl/jobs/${encodeURIComponent(e)}`,p),{headers:g});if(!r.ok)throw new Error(`Hosted job inspection failed (${r.status}).`);l(await r.json());return}if(t==="hosted-cancel"){await m(await q(d,e,w),e);return}if(t==="hosted-artifacts"){await m(await d.outputs(e),e);return}if(t==="hosted-logs"){await m(await d.logs(e),e);return}if(t==="hosted-events"){await m(await d.events(e),e);return}if(t==="hosted-watch"&&i){await f(e),await B({client:d,jobId:e,teamId:w,options:i,print:l,requestBound:c});return}throw new Error(`Unknown hosted training command: ${t}`)}h(st,"runHostedTrainingCommand");async function z(n){for(let s=0;;s++)try{return await J(E(n,"account"))}catch(t){if(t.issue?.code!=="STORAGE_BUSY"||s>=29)throw t;await new Promise(i=>setTimeout(i,1e3))}}h(z,"accountContext");export{st as runHostedTrainingCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as c}from"./chunk-FTQLQJQV.js";function h(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{}}c(h,"record");function b(n){return typeof n=="number"&&Number.isFinite(n)?n:null}c(b,"finite");function l(n){let t=b(n);return t!==null&&t>=0?t:null}c(l,"nonnegative");function s(n){let t=n.filter(i=>i!==null).sort((i,a)=>i-a),o=t.length?t.reduce((i,a)=>i+a,0):null,d=c(i=>t.length?t[Math.max(0,Math.ceil(t.length*i)-1)]:null,"quantile");return{observations:t.length,missing:n.length-t.length,total:o,mean:o===null?null:o/t.length,min:t[0]??null,max:t.at(-1)??null,p50:d(.5),p95:d(.95)}}c(s,"statistics");function R(n,t){return Object.fromEntries(t.map(o=>[o,s(n.map(d=>l(d[o])))]))}c(R,"timingStatistics");function x(n,t){return Object.fromEntries(t.map(o=>{let{total:d,...i}=s(n.map(a=>l(a[o])));return[o,i]}))}c(x,"distributionStatistics");function B(n){if(!n.length)return null;let t=n.reduce((o,d)=>o+d,0)/n.length;return Math.sqrt(n.reduce((o,d)=>o+(d-t)**2,0)/n.length)}c(B,"populationStd");function g(n){return typeof n=="string"&&/^[a-zA-Z0-9_.:-]{1,200}$/.test(n)?n:null}c(g,"code");function w(n){let t=new Map;for(let o of n)o!==null&&t.set(o,(t.get(o)??0)+1);return Object.fromEntries([...t].sort(([o],[d])=>o.localeCompare(d)))}c(w,"counts");var D=["commandTotalSeconds","requestPreparationSeconds","vllmRequestSeconds","vllmQueueSeconds","vllmPrefillSeconds","vllmDecodeSeconds","vllmTimeToFirstTokenSeconds","vllmInferenceSeconds","tokenizationSeconds","workerQueueSeconds","workerBatchWaitSeconds"],L=["inputPreparationSeconds","parameterHashSeconds","residentLoadSeconds","oldAndReferenceForwardSeconds","optimizerForwardBackwardSeconds","postUpdateForwardSeconds","checkpointSaveSeconds","adapterSerializationSeconds","adapterCompositionSeconds","serializedAdapterVerificationSeconds","optimizerStateSerializationSeconds","deferredDiagnosticsSerializationSeconds","totalTrainStepSeconds"];function $(n){let{job:t,outputs:o}=n;if(n.events.length>1e5)throw new Error("Hosted report exceeds 100,000 events.");if(n.events.some(e=>e.jobId!==t.id)||o.outputs.some(e=>e.jobId!==t.id)||o.receipt&&(o.receipt.jobId!==t.id||o.receipt.teamId!==t.teamId))throw new Error("Hosted report evidence belongs to a different job or workspace.");let d=new Map;for(let e of n.events){let r=d.get(e.id);if(r&&r.sequence===e.sequence&&JSON.stringify(r)!==JSON.stringify(e))throw new Error("Hosted report contains conflicting event snapshots.");(!r||e.sequence>=r.sequence)&&d.set(e.id,e)}let i=[...d.values()],a=i.filter(e=>e.data.metricKind==="rollout_trajectory"),m=a.filter(e=>e.data.rewardEligible===!0),y=a.filter(e=>e.data.rewardEligible===!1),v=m.filter(e=>b(e.data.reward)!==null),T=i.filter(e=>e.data.metricKind==="inference_command"),f=i.filter(e=>e.data.metricKind==="policy_optimization"),k=i.filter(e=>e.type==="optimizer_skipped_no_signal"),F=i.filter(e=>e.data.metricKind==="gpu_allocation"),J=i.filter(e=>e.data.metricKind==="physical_gpu_worker"),U=[],p=c((e,r)=>U.push({code:e,message:r}),"add"),M=n.versionBeforeRead===t.version;M||p("job_changed_during_read","The job changed during these reads; rerun for a stable snapshot."),a.length||p("no_recorded_trajectories","No trajectory evidence is present; this report cannot assess model quality or learning."),y.length&&p("ineligible_trajectories","Infrastructure-ineligible trajectories are excluded from reward statistics."),m.length!==v.length&&p("eligible_rewards_pending","Some eligible trajectories have no finite grade yet."),k.length&&p("no_signal_groups","Recorded groups produced zero standardized advantage and skipped optimization; inspect reward/task quality before increasing the budget.");let I=t.executionMode==="qualification";I&&p("qualification_only","This run collects original-model evidence; optimizer updates were not requested."),t.terminalReason&&p("terminal_reason_present","The job has a terminal reason; inspect official status/logs for its details."),o.receipt||p("execution_receipt_unavailable","No final execution receipt is available; cleanup and reconciled execution evidence remain unverified here."),o.receipt&&!o.receipt.cleanupComplete&&p("cleanup_incomplete","The execution receipt does not attest completed cleanup.");let A=new Map;for(let e of m){let r=g(e.data.rolloutGroupId);if(!r)continue;let u=A.get(r)??[];u.push(e),A.set(r,u)}let G=[...A].map(([e,r])=>{let u=r.map(_=>b(_.data.reward)).filter(_=>_!==null),O=B(u);return{groupId:e,recordedEligible:r.length,recordedScored:u.length,rewardMean:s(u).mean,rewardStd:O,allRecordedRewardsEqual:u.length>=2&&O===0,optimizerSkippedNoSignal:k.some(_=>_.data.rolloutGroupId===e)}}),E=new Set(v.flatMap(e=>Object.entries(h(e.data.rewardComponents)).filter(([r,u])=>g(r)&&b(u)!==null).map(([r])=>r))),H=Object.fromEntries([...E].sort().map(e=>[e,s(v.map(r=>b(h(r.data.rewardComponents)[e])))]));v.length&&![...E].some(e=>e!=="reward")?p("per_grader_reward_breakdown_unavailable","Eligible aggregate rewards are recorded, but no separate finite numeric component fields are present. Per-grader coverage and scores are unavailable; missing breakdowns are not zero grades."):E.size&&p("reward_component_binding_unverified","Reward components summarize finite numeric event fields only. The reward field is aggregate; other fields are not established as individual grader scores without matching the frozen grader binding.");let z=T.map(e=>h(e.data.timings)),W=f.map(e=>h(e.data.timings));T.length&&z.some(e=>l(e.vllmRequestSeconds)===null)&&p("inference_timing_incomplete","Some inference commands lack request timing; missing measurements are not zero durations."),f.length<t.rolloutProgress.optimizerUpdatesApplied&&p("optimizer_event_coverage_incomplete","Fewer optimizer events were returned than applied updates; report evidence may be incomplete."),k.length<t.rolloutProgress.optimizerUpdatesSkipped&&p("no_signal_event_coverage_incomplete","Fewer no-signal events were returned than skipped updates; group details may be incomplete.");let C=Date.parse(t.completedAt??n.generatedAt);if(!Number.isFinite(C)||!Number.isFinite(Date.parse(n.generatedAt)))throw new Error("Hosted report timestamp is invalid.");let S=Math.max(0,(C-Date.parse(t.createdAt))/1e3),j=c(e=>S>0?e*3600/S:null,"hourlyRate"),P=s(a.map(e=>l(e.data.outputTokens))),q=new Map;for(let e of F.sort((r,u)=>r.sequence-u.sequence)){let r=g(e.data.allocationId);r&&q.set(r,e)}let N=new Map;for(let e of J.sort((r,u)=>r.sequence-u.sequence)){let r=g(e.data.physicalWorkerId);r&&N.set(r,e)}let K=t.completedAt!==null;return{schemaVersion:"openpond.trainingRunReport.v1",generatedAt:n.generatedAt,job:{id:t.id,teamId:t.teamId,submissionHash:t.submissionHash,kind:t.kind,executionMode:I?"qualification":"training",state:t.state,phase:t.phase,version:t.version,terminalReasonPresent:t.terminalReason!==null,createdAt:t.createdAt,completedAt:t.completedAt},evidence:{jobRevisionStableDuringRead:M,versionBeforeRead:n.versionBeforeRead,versionAfterRead:t.version,readModel:"independent_authenticated_reads_not_an_atomic_snapshot",returnedEvents:n.events.length,uniqueEvents:i.length,scope:"returned_public_event_snapshot",terminal:K,completeness:"Only recorded events are summarized; absent instrumentation is not proof of no work."},progress:t.rolloutProgress,wall:{elapsedSeconds:S,inferenceCommands:T.length,optimizerEvents:f.length},throughput:{recordedTrajectoriesPerWallHour:j(a.length),recordedEligibleTrajectoriesPerWallHour:j(m.length),appliedUpdatesPerWallHour:j(t.rolloutProgress.optimizerUpdatesApplied),recordedOutputTokensPerWallSecond:S>0&&P.total!==null?P.total/S:null,note:"Whole-job throughput includes startup, waits and cleanup; this is not engine decode tokens/second."},trajectories:{recorded:a.length,eligible:m.length,ineligible:y.length,eligibilityUnknown:a.length-m.length-y.length,scoredEligible:v.length,pendingEligibleGrades:m.length-v.length,inputTokens:s(a.map(e=>l(e.data.inputTokens))),outputTokens:P,eligibleRewards:s(m.map(e=>b(e.data.reward))),rewardComponents:H,terminalClasses:w(a.map(e=>g(e.data.terminalClass))),ineligibleTerminalClasses:w(y.map(e=>g(e.data.terminalClass))),groups:G,groupCoverageNote:"Within-group statistics cover recorded eligible scores only; equal partial scores do not establish a completed no-signal group."},failures:{commandErrorCodes:w(i.map(e=>g(e.data.errorCode))),outboxErrorCodes:w(i.map(e=>g(e.data.lastErrorCode))),providerFailureCodes:w([...N.values()].map(e=>g(e.data.failureCode)))},learning:{noSignalGroupsRecorded:k.length,samplingLogprobMae:s(f.map(e=>l(e.data.samplingLogprobMae))),entropy:s(f.map(e=>l(e.data.entropy))),gradientNorm:s(f.map(e=>l(e.data.gradientNorm))),behaviorPolicyKlPreUpdate:s(f.map(e=>l(e.data.behaviorPolicyKlPreUpdate))),baseOrReferenceKl:s(f.map(e=>l(e.data.kl)))},timings:{environmentSeconds:R(a.map(e=>h(e.data.executionTiming)),["initializationSeconds","policySeconds","environmentSeconds","cleanupSeconds","totalRolloutSeconds"]),toolCalls:s(a.map(e=>l(h(e.data.executionTiming).toolCalls))),toolFailures:s(a.map(e=>l(h(e.data.executionTiming).toolFailures))),inferenceSeconds:R(z,D),optimizerSeconds:R(W,L),cachedPromptTokens:s(z.map(e=>l(e.vllmCachedPromptTokens))),note:"Totals are sums of recorded work. Nested timings and concurrent requests overlap; do not sum these into wall time or infer idle time from them."},gpuActivity:{inference:x(z,["gpuActivitySampleCount","gpuUtilizationMeanPercent","gpuUtilizationMaxPercent","gpuMemoryBusUtilizationMeanPercent","gpuActivityWindowSeconds","gpuActivityObservedSpanSeconds","gpuInterRequestGapSeconds","gpuInterRequestSampleCount","gpuInterRequestUtilizationMeanPercent"]),optimizer:x(f.map(e=>h(e.data.hardware)),["gpuActivitySampleCount","gpuUtilizationMeanPercent","gpuUtilizationMaxPercent","gpuMemoryBusUtilizationMeanPercent","gpuActivityWindowSeconds","gpuActivityObservedSpanSeconds"]),note:"Device-wide one-second samples can include other co-resident work. Between-request activity is worker-wide, not attributed tool or idle time. Per-window statistics are not time-weighted whole-job utilization; short windows may have no samples."},costs:{accountingBasis:"job_accrued_meter_not_final_provider_invoice",jobAccruedSpendUsd:t.accruedSpendUsd,executionReceiptSpendUsd:o.receipt?.spendUsd??null,perRecordedEligibleTrajectoryUsd:m.length?t.accruedSpendUsd/m.length:null,perAppliedUpdateUsd:t.rolloutProgress.optimizerUpdatesApplied?t.accruedSpendUsd/t.rolloutProgress.optimizerUpdatesApplied:null,allocationGpuUsd:s([...q.values()].map(e=>l(e.data.accruedGpuUsd))),allocationGpuSeconds:s([...q.values()].map(e=>l(e.data.accruedGpuSeconds))),physicalInvoiceTotalUsd:null,note:"Job, receipt and allocation amounts are overlapping accounting views, not additive charges. Physical startup/idle/storage and provider settlement are not established by this report."},cleanup:{executionReceiptAvailable:o.receipt!==null,complete:o.receipt?.cleanupComplete??null},findings:U}}c($,"buildHostedTrainingReport");export{$ as buildHostedTrainingReport};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{A as r}from"./chunk-PF56N7ZY.js";import{a as m}from"./chunk-FTQLQJQV.js";var w=r.object({workerId:r.string().min(1).max(191),expectedControlRevision:r.string().regex(/^[a-f0-9]{64}$/),idempotencyKey:r.string().min(1).max(191),jobId:r.string().min(1).max(191).optional(),maximumStorageUsd:r.number().positive().max(10).optional(),warmIdleDeadlineAt:r.iso.datetime({offset:!0}).optional(),maximumIdleUsd:r.number().positive().max(10).optional()}).strict();async function f(e){let a="/v1/managed-rl/physical-workers",i;if(e.action==="hosted-workers"){if(e.target)throw new Error("hosted-workers does not accept an identifier.")}else if(e.action==="hosted-worker"){if(!e.target)throw new Error("hosted-worker requires a physical worker ID.");a+=`/${encodeURIComponent(e.target)}`}else{let o=e.action.replace("hosted-worker-","");if(!["stop","resume","retire","warm-idle"].includes(o))throw new Error(`Unknown physical worker action: ${o}`);if(!e.confirmed)throw new Error("Worker lifecycle changes require --yes.");let{workerId:c,...n}=w.parse(await e.readInput());if(o==="stop"&&!n.maximumStorageUsd)throw new Error("Stopping requires maximumStorageUsd for bounded retained storage.");if(o==="resume"&&!n.jobId)throw new Error("Resuming requires an admitted queued jobId with its own compute budget.");if(o==="warm-idle"&&(!n.warmIdleDeadlineAt||!n.maximumIdleUsd))throw new Error("Warm idle requires warmIdleDeadlineAt and maximumIdleUsd; the server caps retention at ten minutes.");a+=`/${encodeURIComponent(c)}/control`,i=JSON.stringify({...n,action:o})}let s=new Headers(e.headers);s.set("accept","application/json"),i&&s.set("content-type","application/json");let d=await e.request(new URL(a,e.baseUrl),{method:i?"POST":"GET",headers:s,body:i}),t=await d.json();if(!d.ok){let o=t&&typeof t=="object"&&"error"in t&&typeof t.error=="string"?t.error:"worker_request_failed";throw new Error(`Physical worker request failed (${d.status}): ${o}. Read hosted-worker before retrying a lifecycle mutation.`)}return t}m(f,"runHostedWorkerCommand");export{f as runHostedWorkerCommand};