openpond 0.2.68 → 0.2.70

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 (247) hide show
  1. package/dist/api/client-context.d.ts +4 -0
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/account-context-LEZDNYMR.js +12 -0
  4. package/dist/chunks/{acp-2OIXATRY.js → acp-QTA6IU6W.js} +1 -1
  5. package/dist/chunks/{acp-agent-PAGX2B47.js → acp-agent-N77HPAYQ.js} +1 -1
  6. package/dist/chunks/{actions-command-2VE6YI4W.js → actions-command-BZQCUDMD.js} +1 -1
  7. package/dist/chunks/{app-layer-YNEUEOEP.js → app-layer-YQQNLIXA.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-TZOAUOYR.js → app-server-connected-apps-NH4667QJ.js} +1 -1
  9. package/dist/chunks/{app-server-runtime-GBX65JJ7.js → app-server-runtime-B7AMBGQZ.js} +1 -1
  10. package/dist/chunks/apps-WG7WY5CB.js +2 -0
  11. package/dist/chunks/{chunk-RY46UPBO.js → chunk-2ACX7IW5.js} +1 -1
  12. package/dist/chunks/{chunk-FKUWCJ73.js → chunk-54755JYM.js} +2 -2
  13. package/dist/chunks/{chunk-HKVFU3B3.js → chunk-5FSPDSAO.js} +1 -1
  14. package/dist/chunks/{chunk-R4EEGWXB.js → chunk-67U7PAMU.js} +1 -1
  15. package/dist/chunks/{chunk-2TGHZXJE.js → chunk-6C6ZCYTL.js} +1 -1
  16. package/dist/chunks/{chunk-7RSQOC5M.js → chunk-7TM25J6S.js} +1 -1
  17. package/dist/chunks/chunk-BGMAWETL.js +12 -0
  18. package/dist/chunks/chunk-BLNEHU62.js +12 -0
  19. package/dist/chunks/{chunk-RBTDSI4L.js → chunk-CUB6PWAJ.js} +6 -6
  20. package/dist/chunks/chunk-DFZTRMTL.js +2 -0
  21. package/dist/chunks/{chunk-4N4EH3RJ.js → chunk-EJOV6Z6F.js} +1 -1
  22. package/dist/chunks/{chunk-MEJLWNRS.js → chunk-EWH64WRR.js} +1 -1
  23. package/dist/chunks/{chunk-WNXUSELC.js → chunk-EXAJ2B4I.js} +1 -1
  24. package/dist/chunks/{chunk-BHKXPWFB.js → chunk-FHDH4OUA.js} +1 -1
  25. package/dist/chunks/chunk-HES4VP3D.js +2 -0
  26. package/dist/chunks/{chunk-AYOMVI7J.js → chunk-HIMG7S5E.js} +1 -1
  27. package/dist/chunks/{chunk-2LJCJOJ7.js → chunk-HLJJAOI2.js} +1 -1
  28. package/dist/chunks/{chunk-JPUSTFZC.js → chunk-HYUTDZ3N.js} +1 -1
  29. package/dist/chunks/chunk-J7X72QUY.js +2 -0
  30. package/dist/chunks/chunk-JF7WWLNW.js +2 -0
  31. package/dist/chunks/{chunk-4KNPCJR4.js → chunk-JVNKSU27.js} +1 -1
  32. package/dist/chunks/{chunk-XT4CSKHM.js → chunk-JZKTBYNB.js} +1 -1
  33. package/dist/chunks/{chunk-JEMECEQH.js → chunk-KHDCMVEJ.js} +1 -1
  34. package/dist/chunks/chunk-KURL76NW.js +6 -0
  35. package/dist/chunks/chunk-MZKCW6CB.js +2 -0
  36. package/dist/chunks/{chunk-UMAVVMXL.js → chunk-OL3L3U36.js} +1 -1
  37. package/dist/chunks/{chunk-IIT66347.js → chunk-OXQ2WFIH.js} +1 -1
  38. package/dist/chunks/{chunk-73TW6BKK.js → chunk-PPF6EBTQ.js} +1 -1
  39. package/dist/chunks/{chunk-V24VHT76.js → chunk-REGKOCDO.js} +1 -1
  40. package/dist/chunks/{chunk-PSY6IRJE.js → chunk-TAXCMCYZ.js} +1 -1
  41. package/dist/chunks/{chunk-OIH2LPIT.js → chunk-TCTBCAI6.js} +1 -1
  42. package/dist/chunks/{chunk-GEYZVOGD.js → chunk-UZNRH6I3.js} +1 -1
  43. package/dist/chunks/{chunk-DWM5G7BU.js → chunk-Y4E5AAI7.js} +1 -1
  44. package/dist/chunks/chunk-YAA7F5LI.js +2 -0
  45. package/dist/chunks/{chunk-XQAUHXL4.js → chunk-ZK3ET5EP.js} +2 -2
  46. package/dist/chunks/{cli-R7TAP6Z2.js → cli-ALEEFAJ7.js} +1 -1
  47. package/dist/chunks/{command-LNOVZQSK.js → command-5AXJMFYC.js} +11 -11
  48. package/dist/chunks/{configuration-command-CNITTZRP.js → configuration-command-5LUNWPOL.js} +1 -1
  49. package/dist/chunks/{connected-app-executor-FGWCLOJO.js → connected-app-executor-DHXZE4X3.js} +1 -1
  50. package/dist/chunks/connected-evidence-NWMPICKJ.js +2 -0
  51. package/dist/chunks/{connected-starting-assets-KWOFEIE4.js → connected-starting-assets-NRVXIKQ2.js} +1 -1
  52. package/dist/chunks/{continual-FVOLGGOE.js → continual-UCKQ2QLH.js} +1 -1
  53. package/dist/chunks/core-commands-ZPBX35M2.js +2 -0
  54. package/dist/chunks/datasets-6K3ZANIV.js +2 -0
  55. package/dist/chunks/desktop-test-57INNJ76.js +3 -0
  56. package/dist/chunks/evaluation-coordination-B7CN4R2D.js +2 -0
  57. package/dist/chunks/experiment-improvements-G357VLDB.js +2 -0
  58. package/dist/chunks/experiments-BHQO26LJ.js +2 -0
  59. package/dist/chunks/experiments-signal-BI6NKETB.js +2 -0
  60. package/dist/chunks/{help-K6YLZ3KL.js → help-UQN5RUPA.js} +1 -1
  61. package/dist/chunks/{hosted-app-server-composition-LA3BZ4SE.js → hosted-app-server-composition-WDDO6F23.js} +1 -1
  62. package/dist/chunks/{hosted-experiment-improvement-VG2WE7XZ.js → hosted-experiment-improvement-VVYXQ65K.js} +1 -1
  63. package/dist/chunks/{hosted-tasksets-NXVF4AQA.js → hosted-tasksets-KCLNMPG5.js} +1 -1
  64. package/dist/chunks/human-review-PX6DBIFT.js +2 -0
  65. package/dist/chunks/{import-YHYKZ6JN.js → import-2HEYPHPW.js} +1 -1
  66. package/dist/chunks/learning-LSXBL5DB.js +2 -0
  67. package/dist/chunks/{local-harness-taskset-review-XQHQ6JCR.js → local-harness-taskset-review-E5GN5LTR.js} +1 -1
  68. package/dist/chunks/opchat-66BCRKEZ.js +3 -0
  69. package/dist/chunks/opchat-bounded-chat-KQWXZVFN.js +2 -0
  70. package/dist/chunks/organizations-IOYWDOCC.js +2 -0
  71. package/dist/chunks/{profile-P2SJPBOJ.js → profile-YH6G3ZTD.js} +1 -1
  72. package/dist/chunks/{project-action-payload-LTIQBX77.js → project-action-payload-53OH6WDH.js} +1 -1
  73. package/dist/chunks/project-agent-RYVMKW2F.js +2 -0
  74. package/dist/chunks/{runtime-Q7JUJO4D.js → runtime-ISLJIGWC.js} +1 -1
  75. package/dist/chunks/sandbox-command-DI45NRTV.js +2 -0
  76. package/dist/chunks/{sandbox-template-U536EEWY.js → sandbox-template-T42MDUSR.js} +1 -1
  77. package/dist/chunks/{saved-work-KSIQPXC2.js → saved-work-54I5ZJTC.js} +1 -1
  78. package/dist/chunks/setup-D6TY2GWV.js +2 -0
  79. package/dist/chunks/{src-SGQYVBNQ.js → src-7RN7BF4W.js} +1 -1
  80. package/dist/chunks/{src-C3ZUESMK.js → src-LF5X4RNQ.js} +1 -1
  81. package/dist/chunks/{store-model-configuration-6L3OYXF4.js → store-model-configuration-AYFGMC5D.js} +1 -1
  82. package/dist/chunks/{store-model-project-preparation-AAEKCF6V.js → store-model-project-preparation-5DEIS7TB.js} +1 -1
  83. package/dist/chunks/{store-taskset-drafts-FRFL6ITK.js → store-taskset-drafts-EAOOY6CR.js} +1 -1
  84. package/dist/chunks/{taskset-UDDLFYKV.js → taskset-HNDIGYQG.js} +1 -1
  85. package/dist/chunks/{teams-bot-MPWL2PP4.js → teams-bot-Z5CZLWE4.js} +1 -1
  86. package/dist/chunks/{training-5UMT45UL.js → training-JTYQA7GA.js} +1 -1
  87. package/dist/chunks/training-hardware-MR4FUC4U.js +3 -0
  88. package/dist/chunks/training-hosted-36SZFS4U.js +2 -0
  89. package/dist/chunks/{web-search-ZEKJHZW4.js → web-search-FTVNZ7PH.js} +1 -1
  90. package/dist/cli.js +2 -2
  91. package/dist/index.js +1 -1
  92. package/dist/sandbox/runtime-handle.d.ts +3 -5
  93. package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
  94. package/dist/sandbox/types/billing.d.ts +53 -0
  95. package/dist/sandbox/types/responses.d.ts +11 -1
  96. package/dist/sandbox/types/snapshots.d.ts +52 -3
  97. package/dist/skills/manifest.json +1 -1
  98. package/dist/web/assets/{App-CCuh99JW.js → App-CXhxya9x.js} +4 -4
  99. package/dist/web/assets/{AppDialog-CxjDHVk9.js → AppDialog-x1HU1uLv.js} +1 -1
  100. package/dist/web/assets/{AppTerminalPanel-CKJIVpKa.js → AppTerminalPanel-CNIKmqKc.js} +2 -2
  101. package/dist/web/assets/{AppToastContext-EpiT1dHs.js → AppToastContext-DNWd43HS.js} +1 -1
  102. package/dist/web/assets/{AppsView-BsMyPX_3.js → AppsView-BvOD83Z1.js} +1 -1
  103. package/dist/web/assets/{AttachmentTypeIcon-BXvZy5gB.js → AttachmentTypeIcon-BLdDr3JZ.js} +1 -1
  104. package/dist/web/assets/{BrowserSidebar-BIIV4aq4.js → BrowserSidebar-Ar0FlFKg.js} +1 -1
  105. package/dist/web/assets/{CartesianChart-brqLBqnF.js → CartesianChart-tS7f1HZv.js} +1 -1
  106. package/dist/web/assets/{ChatTimelineEntry-CwZbn16X.js → ChatTimelineEntry-z7_kur3h.js} +1 -1
  107. package/dist/web/assets/{CollaborationTabs-BU4uc4tZ.js → CollaborationTabs-CaiFEKrv.js} +1 -1
  108. package/dist/web/assets/{CommandMenu-DkWpXR55.js → CommandMenu-BpubEqaA.js} +1 -1
  109. package/dist/web/assets/{CommunityView-CsSxJZGn.js → CommunityView-TGR4s99l.js} +1 -1
  110. package/dist/web/assets/{ComposerAttachments-BdJGCYzI.js → ComposerAttachments-DPWCjKXz.js} +1 -1
  111. package/dist/web/assets/{ComposerCreateImproveStrip-CWy0j1vv.js → ComposerCreateImproveStrip-Drji01_6.js} +1 -1
  112. package/dist/web/assets/{ConversationImportsSettings-DCmiakbZ.js → ConversationImportsSettings-B_oW0cz7.js} +1 -1
  113. package/dist/web/assets/{DatasetReviewImport-DEnF_pGu.js → DatasetReviewImport-Dr3unJSY.js} +1 -1
  114. package/dist/web/assets/{ExperimentTrainingDataWorkspace-WhwQ0QBi.js → ExperimentTrainingDataWorkspace-DObvpJAw.js} +2 -2
  115. package/dist/web/assets/{FilePagePreview-BRhhz99q.js → FilePagePreview-9kkXbARN.js} +2 -2
  116. package/dist/web/assets/{GetStartedView-CLVD-qEi.js → GetStartedView-Dv2b_SlH.js} +1 -1
  117. package/dist/web/assets/{GettingStartedDialog-CMxaAMg-.js → GettingStartedDialog-sPaPMc61.js} +1 -1
  118. package/dist/web/assets/{HostedModelLearningReview-Cn-j-rDo.js → HostedModelLearningReview-BlwhGxS6.js} +1 -1
  119. package/dist/web/assets/HostedModelLearningSettings-B5ahk3je.js +1 -0
  120. package/dist/web/assets/{HtmlVisual-D5y2WG9L.js → HtmlVisual-rGsClq0p.js} +1 -1
  121. package/dist/web/assets/{LabModelVersionDetailPage-BxRmYD6h.js → LabModelVersionDetailPage-Da7AwZWV.js} +1 -1
  122. package/dist/web/assets/{LabModelWorkspace-u2Ulm_z4.js → LabModelWorkspace-DTeYViWH.js} +1 -1
  123. package/dist/web/assets/{LabSkillSidebar-C7IceJTJ.js → LabSkillSidebar-BieHbNl6.js} +1 -1
  124. package/dist/web/assets/{LabsRoute-CbztQaEf.js → LabsRoute-D3XqPB0-.js} +4 -4
  125. package/dist/web/assets/{LearningBatchesPage-CJqgZNvM.js → LearningBatchesPage-CCBuf2u4.js} +1 -1
  126. package/dist/web/assets/{MainChatThread-DNMfrrRq.js → MainChatThread-B6BQJfcq.js} +2 -2
  127. package/dist/web/assets/{MainPane-CQQxSDPS.js → MainPane-D3fQou29.js} +6 -6
  128. package/dist/web/assets/{ModelProjectPageHeader-Dge19aE1.js → ModelProjectPageHeader-BZn9Lu_J.js} +1 -1
  129. package/dist/web/assets/{NativeSetupTerminal-D4JnbpyD.js → NativeSetupTerminal-Bglqab_g.js} +2 -2
  130. package/dist/web/assets/{NativeSkillSidebar-Jzx1BeKV.js → NativeSkillSidebar-pUGRdnV_.js} +1 -1
  131. package/dist/web/assets/{NewProjectDialog-DcnGzEd9.js → NewProjectDialog-BpHN38MA.js} +1 -1
  132. package/dist/web/assets/{OutputsPage-Cmk15Vt_.js → OutputsPage-LunDCQ6w.js} +1 -1
  133. package/dist/web/assets/{PageChrome-Cz_fCqtn.js → PageChrome-DThEcWAx.js} +1 -1
  134. package/dist/web/assets/{ProjectsPage-BZ3Eo3Mz.js → ProjectsPage-vct_TQgL.js} +1 -1
  135. package/dist/web/assets/{RightChatPanelStack-C6H2vU9N.js → RightChatPanelStack-CgFK7DY0.js} +1 -1
  136. package/dist/web/assets/RightSidebarHomePanel-BJmzUcmy.js +1 -0
  137. package/dist/web/assets/{ScheduledWorkPage-CAkSwM0T.js → ScheduledWorkPage-mmaZfybl.js} +1 -1
  138. package/dist/web/assets/{SettingsView-DvQXGw3_.js → SettingsView-CJfeRsWR.js} +3 -3
  139. package/dist/web/assets/{TasksetDraftEditorPrimitives-JuU1k8vr.js → TasksetDraftEditorPrimitives-CuimAfkv.js} +1 -1
  140. package/dist/web/assets/{TeamChatView-DmHjr8W9.js → TeamChatView-BcK0lF1b.js} +1 -1
  141. package/dist/web/assets/{TerminalOverlay-DlaM9d8F.js → TerminalOverlay-0pzEvy-C.js} +1 -1
  142. package/dist/web/assets/{TrainingCreationPanel-ClpylNsr.js → TrainingCreationPanel-CcyzFz7l.js} +1 -1
  143. package/dist/web/assets/{TrainingDraftPanel-6tH2xSDj.js → TrainingDraftPanel-DSLZXdLz.js} +1 -1
  144. package/dist/web/assets/{UsageSettingsSection-CzDqxOYM.js → UsageSettingsSection-BT9pcnCn.js} +1 -1
  145. package/dist/web/assets/WorkSidebarPanel-CP-nHAsJ.js +1 -0
  146. package/dist/web/assets/{WorkspaceDiffPanel-B4e0lyF7.js → WorkspaceDiffPanel-Bbz5qrVA.js} +3 -3
  147. package/dist/web/assets/{WorkspaceEnvironmentMenu-D01ZkZZF.js → WorkspaceEnvironmentMenu-6hXpvMTl.js} +1 -1
  148. package/dist/web/assets/{WorkspaceFileLocation-C5s_njZb.js → WorkspaceFileLocation-BijVemBl.js} +1 -1
  149. package/dist/web/assets/{WorkspaceGitDialogs-DjPZ6KIh.js → WorkspaceGitDialogs-BOO0E5i9.js} +1 -1
  150. package/dist/web/assets/{WorkspaceMonacoEditor-CC4sfOiU.js → WorkspaceMonacoEditor-B_YzK7Do.js} +3 -3
  151. package/dist/web/assets/{WorkspacePdfPreview-vszQqFa4.js → WorkspacePdfPreview-CFti1fvu.js} +2 -2
  152. package/dist/web/assets/{WorkspacePresentationPreview-DQTvhaRD.js → WorkspacePresentationPreview-DPAhNaV6.js} +1 -1
  153. package/dist/web/assets/{bot-Doyx3T4j.js → bot-BE2rL_qv.js} +1 -1
  154. package/dist/web/assets/chevron-down-Bn8yph2O.js +1 -0
  155. package/dist/web/assets/chevron-right-BU-jUmb2.js +1 -0
  156. package/dist/web/assets/chevron-up-DacwuDJZ.js +1 -0
  157. package/dist/web/assets/{chunk-C3TS766N-ppRhs95p.js → chunk-C3TS766N-j1MK0e3c.js} +1 -1
  158. package/dist/web/assets/{client-DwZ92xtu.js → client-BnJhN-14.js} +1 -1
  159. package/dist/web/assets/{client-choice-storage-DitqKiIT.js → client-choice-storage-CQ0CNkzG.js} +1 -1
  160. package/dist/web/assets/{cloud-upload-HdzNTgr2.js → cloud-upload-DFjZE4O4.js} +1 -1
  161. package/dist/web/assets/{copy-DTQhoBNg.js → copy-CGrLUtw5.js} +1 -1
  162. package/dist/web/assets/{cssMode-BRTtfXxU.js → cssMode-DvRw2fUx.js} +1 -1
  163. package/dist/web/assets/{external-link-H1629UU6.js → external-link-3ZnEFUXd.js} +1 -1
  164. package/dist/web/assets/{folder-open-CAGdWOrr.js → folder-open-i9n8450i.js} +1 -1
  165. package/dist/web/assets/{folder-plus-C14cs2mE.js → folder-plus-cu8Md_ej.js} +1 -1
  166. package/dist/web/assets/{git-commit-horizontal-DFUfuVvF.js → git-commit-horizontal-CwckmC09.js} +1 -1
  167. package/dist/web/assets/{htmlMode-BVaCcL76.js → htmlMode-8VF4Ovtw.js} +1 -1
  168. package/dist/web/assets/{icons-Bk2b68aC.js → icons-4yRSxBZj.js} +1 -1
  169. package/dist/web/assets/{image-0DPVY6Ev.js → image-D-umhyyK.js} +1 -1
  170. package/dist/web/assets/{index-B6XX_0h3.js → index-DiVhx1GM.js} +2 -2
  171. package/dist/web/assets/{info-C8b_tafZ.js → info-Dq2RsPDJ.js} +1 -1
  172. package/dist/web/assets/{jsonMode-BCKKQmmV.js → jsonMode-CvCYQHkB.js} +1 -1
  173. package/dist/web/assets/loader-circle-DBl6qqtR.js +1 -0
  174. package/dist/web/assets/{lspLanguageFeatures-DozmNUOx.js → lspLanguageFeatures-CjufNNFF.js} +1 -1
  175. package/dist/web/assets/{maximize-2-CByk9-zN.js → maximize-2-CKY8dua6.js} +1 -1
  176. package/dist/web/assets/{message-square-C889vRqm.js → message-square-CVDgKlKX.js} +1 -1
  177. package/dist/web/assets/{monaco.contribution-BITdsRbn.js → monaco.contribution-BYAgjZbj.js} +2 -2
  178. package/dist/web/assets/{monaco.contribution-DxAV1oS5.js → monaco.contribution-BYY3-y9l.js} +2 -2
  179. package/dist/web/assets/{monaco.contribution-BqA-XZ44.js → monaco.contribution-Bh0CKj9i.js} +2 -2
  180. package/dist/web/assets/{monaco.contribution-B9q6qbbo.js → monaco.contribution-PjJ1258q.js} +2 -2
  181. package/dist/web/assets/{monitor-BtxlcLuI.js → monitor-UYe42gew.js} +1 -1
  182. package/dist/web/assets/{paperclip-BeIdaspf.js → paperclip-DrlSVUoz.js} +1 -1
  183. package/dist/web/assets/{pdf-perlzwEB.js → pdf-BMhday2W.js} +1 -1
  184. package/dist/web/assets/play-DIqZnaNf.js +1 -0
  185. package/dist/web/assets/plus-CFNxAPMK.js +1 -0
  186. package/dist/web/assets/{presentation-0bzvu6_u.js → presentation-DcZKqH7w.js} +1 -1
  187. package/dist/web/assets/{python-B9hOnkOI.js → python-CiA01i07.js} +1 -1
  188. package/dist/web/assets/{refresh-cw-D61-Ozk3.js → refresh-cw-00D-GDnF.js} +1 -1
  189. package/dist/web/assets/{save-iEMNZoPe.js → save-CXe7bqR7.js} +1 -1
  190. package/dist/web/assets/{settings-lists-C84qxFmP.js → settings-lists-B5J40WM6.js} +1 -1
  191. package/dist/web/assets/square-DJEaBefe.js +1 -0
  192. package/dist/web/assets/{square-terminal-Djpzo2Qs.js → square-terminal-DxC7TTds.js} +1 -1
  193. package/dist/web/assets/{submit-issue-command-HfKzyxg5.js → submit-issue-command-Dq3TqJLV.js} +1 -1
  194. package/dist/web/assets/{toggleHighContrast-ClsXu39R.js → toggleHighContrast-BH3Jckfo.js} +1 -1
  195. package/dist/web/assets/{training-model-data-CIysl8wH.js → training-model-data-B6IZ3x-t.js} +1 -1
  196. package/dist/web/assets/{tsMode-nbmaMc-D.js → tsMode-DXkj4bqC.js} +1 -1
  197. package/dist/web/assets/{upload-C6ug8RD-.js → upload-B3KRHVHl.js} +1 -1
  198. package/dist/web/assets/{useAccountSettings-Dr9h4Qz_.js → useAccountSettings-BGRkTRrp.js} +1 -1
  199. package/dist/web/assets/{useAgentInventory-ByCk2JAv.js → useAgentInventory-D_1AlAZJ.js} +1 -1
  200. package/dist/web/assets/{useChatContextSelection-C0eMm2g6.js → useChatContextSelection-hoMSuUSE.js} +1 -1
  201. package/dist/web/assets/{useLocalAgentSchedules-Do0y_leJ.js → useLocalAgentSchedules-DxTER7Ow.js} +1 -1
  202. package/dist/web/assets/{useQuery-D2MQ7e5U.js → useQuery-DkPec_9x.js} +1 -1
  203. package/dist/web/assets/{wifi-off-Dr-CapyW.js → wifi-off-CMzpvbWl.js} +1 -1
  204. package/dist/web/assets/{workers-DKvM2NdM.js → workers-ziY_bTv2.js} +1 -1
  205. package/dist/web/assets/x-omjwMPbJ.js +1 -0
  206. package/dist/web/assets/{yaml-C02vq4ar.js → yaml-mSvqVSko.js} +1 -1
  207. package/dist/web/index.html +1 -1
  208. package/docs/command-reference.md +11 -0
  209. package/package.json +1 -1
  210. package/dist/chunks/account-context-MWB6HN6I.js +0 -12
  211. package/dist/chunks/apps-RSFEJOQN.js +0 -2
  212. package/dist/chunks/chunk-27JGS3KB.js +0 -12
  213. package/dist/chunks/chunk-APKXXAUF.js +0 -2
  214. package/dist/chunks/chunk-DRTHKWHK.js +0 -6
  215. package/dist/chunks/chunk-JCLTFDVW.js +0 -2
  216. package/dist/chunks/chunk-KOC3YJEU.js +0 -12
  217. package/dist/chunks/chunk-KTIBXRWQ.js +0 -2
  218. package/dist/chunks/chunk-YDZBX4XQ.js +0 -2
  219. package/dist/chunks/connected-evidence-5VZBYNWN.js +0 -2
  220. package/dist/chunks/core-commands-BPYXVT7O.js +0 -2
  221. package/dist/chunks/datasets-E5TXSVIY.js +0 -2
  222. package/dist/chunks/desktop-test-FX7DTY4N.js +0 -3
  223. package/dist/chunks/evaluation-coordination-KUTZEEPB.js +0 -2
  224. package/dist/chunks/experiment-improvements-PQNR5YHN.js +0 -2
  225. package/dist/chunks/experiments-Z4BJWT3Y.js +0 -2
  226. package/dist/chunks/experiments-signal-3GCLKUWZ.js +0 -2
  227. package/dist/chunks/human-review-2ZOB7CJZ.js +0 -2
  228. package/dist/chunks/learning-LAXMGWSQ.js +0 -2
  229. package/dist/chunks/opchat-XXI2ZM53.js +0 -3
  230. package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +0 -2
  231. package/dist/chunks/organizations-W7HI2JA4.js +0 -2
  232. package/dist/chunks/project-agent-XRIXMXQK.js +0 -2
  233. package/dist/chunks/sandbox-command-HVA5FJU4.js +0 -2
  234. package/dist/chunks/setup-RMZ2BHLM.js +0 -2
  235. package/dist/chunks/training-hardware-UWQCRDMV.js +0 -3
  236. package/dist/chunks/training-hosted-CKSDRVL6.js +0 -2
  237. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +0 -1
  238. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +0 -1
  239. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +0 -1
  240. package/dist/web/assets/chevron-down-DX1hzujj.js +0 -1
  241. package/dist/web/assets/chevron-right-DHN0y3KC.js +0 -1
  242. package/dist/web/assets/chevron-up-_QrW88NF.js +0 -1
  243. package/dist/web/assets/loader-circle-y-SSPwpk.js +0 -1
  244. package/dist/web/assets/play-CHXXdkuO.js +0 -1
  245. package/dist/web/assets/plus-DFFWjhPw.js +0 -1
  246. package/dist/web/assets/square-BE_4JMR3.js +0 -1
  247. package/dist/web/assets/x-Jx2jlP9u.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n,s as r}from"./index-B6XX_0h3.js";import{n as i}from"./api-client-DJRVOFzS.js";import"./icons-Bk2b68aC.js";import{t as a}from"./external-link-H1629UU6.js";import{t as o}from"./loader-circle-y-SSPwpk.js";import{t as s}from"./plus-DFFWjhPw.js";import{t as c}from"./x-Jx2jlP9u.js";import{t as l}from"./NativeSetupTerminal-D4JnbpyD.js";import{t as u}from"./AppDialog-CxjDHVk9.js";import{Gt as d,Tn as f,gn as p,t as m}from"./App-CCuh99JW.js";/* empty css */import{t as h}from"./useAccountSettings-Dr9h4Qz_.js";var g=e(t(),1),_=n(),v={codex:{name:`Codex`,installUrl:`https://developers.openai.com/codex/cli`},"claude-code":{name:`Claude`,installUrl:`https://code.claude.com/docs/en/setup`}};function y({providerId:e,connection:t,config:n,onProviders:r}){let c=v[e],u=m(),d=(0,g.useRef)(u.active);d.current=u.active;let[h,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!0),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(null),E=(0,g.useRef)(null),D=(0,g.useRef)(!1),O=(0,g.useRef)(r);O.current=r,(0,g.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let k=(0,g.useCallback)(async()=>{E.current?.abort();let n=new AbortController;E.current=n;let r=setTimeout(()=>n.abort(Error(`Connection check timed out. Try again.`)),45e3);x(!0),C(null),y(null);try{let r=await i(t,`/v1/providers/${e}/native-setup`,{method:`POST`,body:JSON.stringify({action:`check`}),signal:n.signal});if(E.current!==n||n.signal.aborted)return;y(r),C(r.error),O.current(r.settings)}catch(e){E.current===n&&C(e instanceof Error?e.message:String(e))}finally{clearTimeout(r),E.current===n&&(E.current=null,x(!1))}},[t.serverUrl,t.token,e]);(0,g.useEffect)(()=>{!w&&!(e===`claude-code`&&d.current)&&k();function t(){!E.current&&!w&&!(e===`claude-code`&&d.current)&&k()}return window.addEventListener(`focus`,t),()=>{window.removeEventListener(`focus`,t);let e=E.current;E.current=null,e?.abort()}},[k,n?.binaryPath,n?.sourceHome,w,e]);async function A(){if(!b){x(!0),C(null);try{let n=await f.saveProviderSettings(t,{providers:{[e]:{enabled:!0}}});if(!D.current)return;O.current(n),await k()}catch(e){C(e instanceof Error?e.message:String(e)),x(!1)}}}async function j(){if(b)return;let r=new AbortController;E.current=r;let a=setTimeout(()=>r.abort(),1e4);x(!0),C(null);try{let a=await i(t,`/v1/providers/${e}/native-setup`,{method:`POST`,body:JSON.stringify({action:`login`}),signal:r.signal});if(E.current!==r||r.signal.aborted)return;if(!n?.enabled){let n=await f.saveProviderSettings(t,{providers:{[e]:{enabled:!0}}});if(E.current!==r||r.signal.aborted)return;O.current(n)}E.current===r&&!r.signal.aborted&&(e===`claude-code`?u.start(a):T(a))}catch(e){E.current===r&&C(e instanceof Error?e.message:String(e))}finally{clearTimeout(a),E.current===r&&(E.current=null,x(!1))}}(0,g.useEffect)(()=>{if(e!==`claude-code`||!u.result)return;let t=u.result.settings.providers[e];(t?.binaryPath||null)===(n?.binaryPath||null)&&(t?.sourceHome||null)===(n?.sourceHome||null)&&(x(!1),y(u.result),C(u.result.status===`unavailable`?u.result.error:null))},[u.result,e,n?.binaryPath,n?.sourceHome]);let M=!S&&h?.status===`ready`;return(0,_.jsxs)(`li`,{className:`getting-started-card`,children:[(0,_.jsx)(`img`,{className:`getting-started-provider-icon`,src:`/agent-sources/${e}.svg`,alt:``}),(0,_.jsx)(`h3`,{children:c.name}),(0,_.jsx)(`div`,{className:`getting-started-card-status`,role:`status`,"aria-live":`polite`,children:e===`claude-code`&&u.active?(0,_.jsx)(`button`,{type:`button`,onClick:u.resume,children:`Continue sign-in`}):b?(0,_.jsx)(o,{className:`settings-spin`,size:20,"aria-label":`Checking ${c.name}`}):M&&n?.enabled?(0,_.jsxs)(`span`,{children:[(0,_.jsx)(p,{size:16}),` Connected`]}):M?(0,_.jsxs)(`button`,{type:`button`,"aria-label":`Connect ${c.name}`,onClick:()=>void A(),children:[(0,_.jsx)(s,{size:14}),` Connect`]}):h?.status===`missing`?(0,_.jsxs)(`a`,{href:c.installUrl,target:`_blank`,rel:`noreferrer`,children:[`Install `,c.name,` `,(0,_.jsx)(a,{size:12})]}):h?.status===`needs_login`?(0,_.jsx)(`button`,{type:`button`,className:`getting-started-login`,"aria-label":`Log in to ${c.name}`,title:S??void 0,onClick:()=>void j(),children:`Log in`}):(0,_.jsx)(`button`,{type:`button`,"aria-label":`Retry ${c.name} connection`,title:S??`Check connection again`,onClick:()=>void k(),children:`Retry`})}),w?(0,_.jsx)(l,{modal:!0,connection:t,command:w.command,displayCommand:w.displayCommand,onComplete:()=>T(null),onClose:()=>T(null)}):null]})}var b=`https://www.openpond.ai/api-keys`;function x({connection:e,payload:t,onPayload:n,onClose:i}){let[o,s]=(0,g.useState)(!1),[l,f]=(0,g.useState)(``),[m,v]=(0,g.useState)(null),x=(0,g.useRef)(t);x.current=t;let S=h({connection:e,onPayload:n,onError:v});function C(e){n({...x.current,providers:e})}let w=t.account.state===`signed_in`;async function T(e){if(e.preventDefault(),l.trim()&&!S.saving)try{await S.saveAccount({apiKey:l,baseUrl:`https://www.openpond.ai`,apiBaseUrl:`https://api.openpond.ai`,environment:`production`}),f(``),s(!1)}catch{}}async function E(){v(null);try{let e=window.openpond?.browser;if(e?.openExternal){let t=await e.openExternal({conversationId:`openpond-get-started`,url:b});if(!t.ok)throw Error(t.error??`Could not open API keys in your browser.`)}else window.open(b,`_blank`,`noopener,noreferrer`)}catch(e){v(e instanceof Error?e.message:String(e))}}return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(u,{inertExclusionSelector:`.native-login-session`,ariaLabel:`Get started with OpenPond`,backdropClassName:`git-dialog-backdrop`,className:`git-dialog getting-started-dialog`,onClose:i,children:[(0,_.jsx)(`button`,{type:`button`,className:`git-dialog-close`,"aria-label":`Close get started`,title:`Close`,onClick:i,children:(0,_.jsx)(c,{size:16})}),(0,_.jsx)(`header`,{className:`getting-started-header`,children:(0,_.jsx)(`h2`,{children:`Get started with OpenPond`})}),(0,_.jsxs)(`ol`,{className:`getting-started-cards`,children:[(0,_.jsxs)(`li`,{className:`getting-started-card`,children:[(0,_.jsx)(`img`,{className:`getting-started-provider-icon`,src:r,alt:``}),(0,_.jsx)(`h3`,{children:`OpenPond account`}),(0,_.jsx)(`div`,{className:`getting-started-card-status`,role:`status`,children:w?(0,_.jsxs)(`span`,{children:[(0,_.jsx)(p,{size:16}),` Connected`]}):(0,_.jsx)(`a`,{href:b,onClick:e=>{e.preventDefault(),v(null),s(!0)},children:`Connect account`})})]}),(0,_.jsx)(y,{providerId:`codex`,connection:e,config:t.providers.providers.codex,onProviders:C}),(0,_.jsx)(y,{providerId:`claude-code`,connection:e,config:t.providers.providers[`claude-code`],onProviders:C})]})]}),o?(0,_.jsxs)(u,{ariaLabel:`Connect OpenPond account`,backdropClassName:`git-dialog-backdrop getting-started-account-backdrop`,className:`git-dialog getting-started-account-dialog`,onClose:()=>s(!1),dismissDisabled:S.saving,children:[(0,_.jsx)(`button`,{type:`button`,className:`git-dialog-close`,"aria-label":`Close account connection`,disabled:S.saving,onClick:()=>s(!1),children:(0,_.jsx)(c,{size:16})}),(0,_.jsx)(`h2`,{children:`Connect OpenPond`}),(0,_.jsxs)(`a`,{href:b,target:`_blank`,rel:`noreferrer`,className:`getting-started-key-link`,onClick:e=>{e.preventDefault(),E()},children:[`Create an API key `,(0,_.jsx)(a,{size:12})]}),(0,_.jsxs)(`form`,{onSubmit:e=>void T(e),children:[(0,_.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,_.jsx)(`span`,{children:`OpenPond API key`}),(0,_.jsx)(`input`,{"data-autofocus":!0,type:`password`,autoComplete:`off`,spellCheck:!1,placeholder:`opk_…`,value:l,disabled:S.saving,onChange:e=>{f(e.target.value),v(null)}})]}),m?(0,_.jsx)(d,{error:m}):null,(0,_.jsx)(`button`,{className:`git-dialog-primary`,type:`submit`,disabled:S.saving||!l.trim(),children:S.saving?`Connecting…`:`Connect account`})]})]}):null]})}export{x as GettingStartedDialog};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n,s as r}from"./index-DiVhx1GM.js";import{n as i}from"./api-client-DJRVOFzS.js";import"./icons-4yRSxBZj.js";import{t as a}from"./external-link-3ZnEFUXd.js";import{t as o}from"./loader-circle-DBl6qqtR.js";import{t as s}from"./plus-CFNxAPMK.js";import{t as c}from"./x-omjwMPbJ.js";import{t as l}from"./NativeSetupTerminal-Bglqab_g.js";import{t as u}from"./AppDialog-x1HU1uLv.js";import{Gt as d,Tn as f,gn as p,t as m}from"./App-CXhxya9x.js";/* empty css */import{t as h}from"./useAccountSettings-BGRkTRrp.js";var g=e(t(),1),_=n(),v={codex:{name:`Codex`,installUrl:`https://developers.openai.com/codex/cli`},"claude-code":{name:`Claude`,installUrl:`https://code.claude.com/docs/en/setup`}};function y({providerId:e,connection:t,config:n,onProviders:r}){let c=v[e],u=m(),d=(0,g.useRef)(u.active);d.current=u.active;let[h,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!0),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(null),E=(0,g.useRef)(null),D=(0,g.useRef)(!1),O=(0,g.useRef)(r);O.current=r,(0,g.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let k=(0,g.useCallback)(async()=>{E.current?.abort();let n=new AbortController;E.current=n;let r=setTimeout(()=>n.abort(Error(`Connection check timed out. Try again.`)),45e3);x(!0),C(null),y(null);try{let r=await i(t,`/v1/providers/${e}/native-setup`,{method:`POST`,body:JSON.stringify({action:`check`}),signal:n.signal});if(E.current!==n||n.signal.aborted)return;y(r),C(r.error),O.current(r.settings)}catch(e){E.current===n&&C(e instanceof Error?e.message:String(e))}finally{clearTimeout(r),E.current===n&&(E.current=null,x(!1))}},[t.serverUrl,t.token,e]);(0,g.useEffect)(()=>{!w&&!(e===`claude-code`&&d.current)&&k();function t(){!E.current&&!w&&!(e===`claude-code`&&d.current)&&k()}return window.addEventListener(`focus`,t),()=>{window.removeEventListener(`focus`,t);let e=E.current;E.current=null,e?.abort()}},[k,n?.binaryPath,n?.sourceHome,w,e]);async function A(){if(!b){x(!0),C(null);try{let n=await f.saveProviderSettings(t,{providers:{[e]:{enabled:!0}}});if(!D.current)return;O.current(n),await k()}catch(e){C(e instanceof Error?e.message:String(e)),x(!1)}}}async function j(){if(b)return;let r=new AbortController;E.current=r;let a=setTimeout(()=>r.abort(),1e4);x(!0),C(null);try{let a=await i(t,`/v1/providers/${e}/native-setup`,{method:`POST`,body:JSON.stringify({action:`login`}),signal:r.signal});if(E.current!==r||r.signal.aborted)return;if(!n?.enabled){let n=await f.saveProviderSettings(t,{providers:{[e]:{enabled:!0}}});if(E.current!==r||r.signal.aborted)return;O.current(n)}E.current===r&&!r.signal.aborted&&(e===`claude-code`?u.start(a):T(a))}catch(e){E.current===r&&C(e instanceof Error?e.message:String(e))}finally{clearTimeout(a),E.current===r&&(E.current=null,x(!1))}}(0,g.useEffect)(()=>{if(e!==`claude-code`||!u.result)return;let t=u.result.settings.providers[e];(t?.binaryPath||null)===(n?.binaryPath||null)&&(t?.sourceHome||null)===(n?.sourceHome||null)&&(x(!1),y(u.result),C(u.result.status===`unavailable`?u.result.error:null))},[u.result,e,n?.binaryPath,n?.sourceHome]);let M=!S&&h?.status===`ready`;return(0,_.jsxs)(`li`,{className:`getting-started-card`,children:[(0,_.jsx)(`img`,{className:`getting-started-provider-icon`,src:`/agent-sources/${e}.svg`,alt:``}),(0,_.jsx)(`h3`,{children:c.name}),(0,_.jsx)(`div`,{className:`getting-started-card-status`,role:`status`,"aria-live":`polite`,children:e===`claude-code`&&u.active?(0,_.jsx)(`button`,{type:`button`,onClick:u.resume,children:`Continue sign-in`}):b?(0,_.jsx)(o,{className:`settings-spin`,size:20,"aria-label":`Checking ${c.name}`}):M&&n?.enabled?(0,_.jsxs)(`span`,{children:[(0,_.jsx)(p,{size:16}),` Connected`]}):M?(0,_.jsxs)(`button`,{type:`button`,"aria-label":`Connect ${c.name}`,onClick:()=>void A(),children:[(0,_.jsx)(s,{size:14}),` Connect`]}):h?.status===`missing`?(0,_.jsxs)(`a`,{href:c.installUrl,target:`_blank`,rel:`noreferrer`,children:[`Install `,c.name,` `,(0,_.jsx)(a,{size:12})]}):h?.status===`needs_login`?(0,_.jsx)(`button`,{type:`button`,className:`getting-started-login`,"aria-label":`Log in to ${c.name}`,title:S??void 0,onClick:()=>void j(),children:`Log in`}):(0,_.jsx)(`button`,{type:`button`,"aria-label":`Retry ${c.name} connection`,title:S??`Check connection again`,onClick:()=>void k(),children:`Retry`})}),w?(0,_.jsx)(l,{modal:!0,connection:t,command:w.command,displayCommand:w.displayCommand,onComplete:()=>T(null),onClose:()=>T(null)}):null]})}var b=`https://www.openpond.ai/api-keys`;function x({connection:e,payload:t,onPayload:n,onClose:i}){let[o,s]=(0,g.useState)(!1),[l,f]=(0,g.useState)(``),[m,v]=(0,g.useState)(null),x=(0,g.useRef)(t);x.current=t;let S=h({connection:e,onPayload:n,onError:v});function C(e){n({...x.current,providers:e})}let w=t.account.state===`signed_in`;async function T(e){if(e.preventDefault(),l.trim()&&!S.saving)try{await S.saveAccount({apiKey:l,baseUrl:`https://www.openpond.ai`,apiBaseUrl:`https://api.openpond.ai`,environment:`production`}),f(``),s(!1)}catch{}}async function E(){v(null);try{let e=window.openpond?.browser;if(e?.openExternal){let t=await e.openExternal({conversationId:`openpond-get-started`,url:b});if(!t.ok)throw Error(t.error??`Could not open API keys in your browser.`)}else window.open(b,`_blank`,`noopener,noreferrer`)}catch(e){v(e instanceof Error?e.message:String(e))}}return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(u,{inertExclusionSelector:`.native-login-session`,ariaLabel:`Get started with OpenPond`,backdropClassName:`git-dialog-backdrop`,className:`git-dialog getting-started-dialog`,onClose:i,children:[(0,_.jsx)(`button`,{type:`button`,className:`git-dialog-close`,"aria-label":`Close get started`,title:`Close`,onClick:i,children:(0,_.jsx)(c,{size:16})}),(0,_.jsx)(`header`,{className:`getting-started-header`,children:(0,_.jsx)(`h2`,{children:`Get started with OpenPond`})}),(0,_.jsxs)(`ol`,{className:`getting-started-cards`,children:[(0,_.jsxs)(`li`,{className:`getting-started-card`,children:[(0,_.jsx)(`img`,{className:`getting-started-provider-icon`,src:r,alt:``}),(0,_.jsx)(`h3`,{children:`OpenPond account`}),(0,_.jsx)(`div`,{className:`getting-started-card-status`,role:`status`,children:w?(0,_.jsxs)(`span`,{children:[(0,_.jsx)(p,{size:16}),` Connected`]}):(0,_.jsx)(`a`,{href:b,onClick:e=>{e.preventDefault(),v(null),s(!0)},children:`Connect account`})})]}),(0,_.jsx)(y,{providerId:`codex`,connection:e,config:t.providers.providers.codex,onProviders:C}),(0,_.jsx)(y,{providerId:`claude-code`,connection:e,config:t.providers.providers[`claude-code`],onProviders:C})]})]}),o?(0,_.jsxs)(u,{ariaLabel:`Connect OpenPond account`,backdropClassName:`git-dialog-backdrop getting-started-account-backdrop`,className:`git-dialog getting-started-account-dialog`,onClose:()=>s(!1),dismissDisabled:S.saving,children:[(0,_.jsx)(`button`,{type:`button`,className:`git-dialog-close`,"aria-label":`Close account connection`,disabled:S.saving,onClick:()=>s(!1),children:(0,_.jsx)(c,{size:16})}),(0,_.jsx)(`h2`,{children:`Connect OpenPond`}),(0,_.jsxs)(`a`,{href:b,target:`_blank`,rel:`noreferrer`,className:`getting-started-key-link`,onClick:e=>{e.preventDefault(),E()},children:[`Create an API key `,(0,_.jsx)(a,{size:12})]}),(0,_.jsxs)(`form`,{onSubmit:e=>void T(e),children:[(0,_.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,_.jsx)(`span`,{children:`OpenPond API key`}),(0,_.jsx)(`input`,{"data-autofocus":!0,type:`password`,autoComplete:`off`,spellCheck:!1,placeholder:`opk_…`,value:l,disabled:S.saving,onChange:e=>{f(e.target.value),v(null)}})]}),m?(0,_.jsx)(d,{error:m}):null,(0,_.jsx)(`button`,{className:`git-dialog-primary`,type:`submit`,disabled:S.saving||!l.trim(),children:S.saving?`Connecting…`:`Connect account`})]})]}):null]})}export{x as GettingStartedDialog};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-B6XX_0h3.js";import{n as r}from"./LearningBatchesPage-CJqgZNvM.js";import{It as i}from"./App-CCuh99JW.js";var a=e(t(),1),o=n();function s({api:e,policyId:t,sourceId:n,onBack:s}){let c=(0,a.useMemo)(()=>e.reviewClient(t,n),[e,t,n]),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(null);return(0,o.jsxs)(`section`,{"aria-label":`Hosted example review`,children:[(0,o.jsx)(`button`,{type:`button`,className:`training-button secondary`,onClick:()=>{i(s)},children:`Back to continual learning`}),(0,o.jsx)(`p`,{children:`Reviewing hosted examples. Approved tasks become eligible for this policy's next training check.`}),(0,o.jsx)(r,{client:c,selectedId:l,after:d,sourceId:n,onSelect:e=>{i(()=>u(e))},onPage:f})]})}export{s as HostedModelLearningReview};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-DiVhx1GM.js";import{n as r}from"./LearningBatchesPage-CCBuf2u4.js";import{It as i}from"./App-CXhxya9x.js";var a=e(t(),1),o=n();function s({api:e,policyId:t,sourceId:n,onBack:s}){let c=(0,a.useMemo)(()=>e.reviewClient(t,n),[e,t,n]),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(null);return(0,o.jsxs)(`section`,{"aria-label":`Hosted example review`,children:[(0,o.jsx)(`button`,{type:`button`,className:`training-button secondary`,onClick:()=>{i(s)},children:`Back to continual learning`}),(0,o.jsx)(`p`,{children:`Reviewing hosted examples. Approved tasks become eligible for this policy's next training check.`}),(0,o.jsx)(r,{client:c,selectedId:l,after:d,sourceId:n,onSelect:e=>{i(()=>u(e))},onPage:f})]})}export{s as HostedModelLearningReview};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-DiVhx1GM.js";import{M as r,N as i}from"./chunk-H3JZ3P5T-DolwEJXo.js";import{T as a,f as o,m as s,w as c}from"./LearningBatchesPage-CCBuf2u4.js";import{t as l}from"./api-client-DJRVOFzS.js";import{t as u}from"./AppDialog-x1HU1uLv.js";import{Ut as d}from"./App-CXhxya9x.js";import{W as f}from"./MainPane-D3fQou29.js";var p=e(t(),1),m=n();function h({client:e,project:t,policy:n,onClose:h}){let[g]=(0,p.useState)(()=>n?.id??`policy-${crypto.randomUUID()}`),[_]=(0,p.useState)(()=>a(t,n)),[v,y]=(0,p.useState)(_.enabled),[b,x]=(0,p.useState)(n?.trigger.kind??`nightly`),[S,C]=(0,p.useState)(n?.trigger.kind===`nightly`?n.trigger.localTime:`20:00`),[w,T]=(0,p.useState)(n?.trigger.kind===`nightly`?n.trigger.timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone),[E]=(0,p.useState)(()=>[...new Set([w,`UTC`,...Intl.supportedValuesOf(`timeZone`)])].sort().map(e=>({value:e,label:e}))),[D,O]=(0,p.useState)(!n),[k,ee]=(0,p.useState)(_.humanReviewRequired),[A,j]=(0,p.useState)(n?.sources??[]),[M,N]=(0,p.useState)(n?.taskDefinition??null),[P,F]=(0,p.useState)({interval:String(_.intervalSeconds/60),minimum:String(_.minimumApprovedExamples),batch:String(_.maxBatchExamples),spend:String(_.maxIterationSpendUsd),daily:String(_.maxDailySpendUsd),cooldown:String(_.cooldownSeconds/60),retries:String(_.maxRetries),backlog:String(_.maxBacklogExamples)}),[I,L]=(0,p.useState)(!1),[R,z]=(0,p.useState)(!1),[B,V]=(0,p.useState)(null),[H,U]=(0,p.useState)(),[W,G]=(0,p.useState)(null),[K,q]=(0,p.useState)(null),J=(0,p.useRef)(null),Y=(0,p.useRef)(!1);(0,p.useEffect)(()=>{let t=!1;return e.sources(H).then(e=>{t||(G({after:H,data:e}),q(null))},e=>{t||q(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,H]);let X=W&&W.after===H?W.data:null,Z=D?t.trainingSetup.rewardBindingRef:n?.rewardBinding;function te(e){let t=A.some(t=>t.id===e.id);j(t?A.filter(t=>t.id!==e.id):[...A,r(e)]),N(t&&A.length===1?null:M??e.taskDefinition),L(!0)}async function Q(){if(Y.current)return!1;Y.current=!0,z(!0),V(null);try{if(!J.current){if(!M||!A.length||!Z)throw Error(`Select task sources and a Model Reward before saving.`);let e=c({project:t,previous:n,policyId:g,applyModelConfiguration:D,sources:A,taskDefinition:M,settings:{enabled:v,scheduled:b!==`manual`,humanReviewRequired:k,intervalSeconds:Number(P.interval)*60,trigger:b===`nightly`?{kind:`nightly`,localTime:S,timeZone:w}:b===`schedule`?{kind:`schedule`,intervalSeconds:Number(P.interval)*60}:b===`approved_count`?{kind:`approved_count`}:b===`manual`?{kind:`manual`}:void 0,minimumApprovedExamples:Number(P.minimum),maxBatchExamples:Number(P.batch),maxIterationSpendUsd:Number(P.spend),maxDailySpendUsd:Number(P.daily),cooldownSeconds:Number(P.cooldown)*60,maxRetries:Number(P.retries),maxBacklogExamples:Number(P.backlog)}});b===`upstream_accepted`&&n?.trigger.kind===`upstream_accepted`&&(e.trigger=n.trigger,e.automation.train=n.automation.train),J.current={action:`publish`,kind:`policy`,operationId:crypto.randomUUID(),expectedRevision:n?.revision??0,content:e}}return await e.command(J.current),J.current=null,L(!1),!0}catch(e){return e instanceof l&&e.status>=400&&e.status<500&&![408,429].includes(e.status)&&(J.current=null),V(e instanceof Error?e.message:`Unable to save learning settings.`),!1}finally{Y.current=!1,z(!1)}}let $=f({name:`learning settings`,dirty:I,busy:R,save:Q});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u,{ariaLabel:`Continual learning settings`,className:`labs-rename-dialog learning-workspace hosted-learning-settings`,backdropClassName:`labs-rename-backdrop`,dismissDisabled:R,onClose:()=>{$.requestLeave(h)},children:[(0,m.jsx)(`h2`,{children:`Continual learning settings`}),(0,m.jsxs)(`p`,{children:[`Train `,t.name,` from admitted, unused evidence. Saving settings does not start an extra run.`]}),(0,m.jsx)(o,{error:B??K}),(0,m.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await Q()&&($.allowNextNavigation(),h())},children:[(0,m.jsxs)(`fieldset`,{disabled:R||!!J.current,onChange:()=>L(!0),children:[(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),` `,`Enable learning`]}),(0,m.jsxs)(`fieldset`,{children:[(0,m.jsx)(`legend`,{children:`Example review and admission`}),(0,m.jsx)(d,{label:`Example admission`,value:k?`human`:`qualified_automatic`,options:[{value:`human`,label:`Human approval before training`},{value:`qualified_automatic`,label:`Qualified automatic admission`,disabled:k,description:`Requires an existing qualified policy; cannot be enabled here.`}],onChange:e=>{ee(e===`human`),L(!0)}}),(0,m.jsx)(`p`,{children:`Grader scores measure quality; human admission gives ordinary evidence permission to train. Newly authored Dataset rows must first be submitted as evidence. Qualified conversation policies handle independently verified admissions and send exceptions to Inbox.`})]}),(0,m.jsxs)(`fieldset`,{children:[(0,m.jsx)(`legend`,{children:`Candidate decision`}),(0,m.jsx)(`p`,{children:`Owner approval follows training and independent comparison. This form does not authorize automatic acceptance or serving activation. Conversation exception and activation controls belong to that conversation policy.`})]}),n?(0,m.jsxs)(`label`,{children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),` `,`Use the Model’s current training configuration`]}):null,(0,m.jsxs)(`fieldset`,{children:[(0,m.jsx)(`legend`,{children:`Task sources`}),!X&&!K?(0,m.jsx)(`p`,{children:`Loading sources…`}):null,X?(0,m.jsx)(d,{label:`Task source`,searchable:!0,floating:!0,value:`__choose__`,triggerContent:A.length?A.map(e=>X.sources.items.find(t=>t.id===e.id)?.name??e.id).join(`, `):`Choose task sources`,options:[{value:`__choose__`,label:`Choose a task source`,disabled:!0},...X.sources.items.map(e=>{let t=X.definitions.find(t=>i(r(t),e.taskDefinition)),n=A.find(t=>t.id===e.id),a=!!(Z&&t&&i(Z,t.rewardBinding)&&(!M||i(M,e.taskDefinition)));return{value:e.id,label:`${n?`Remove`:`Add`} ${e.name}`,disabled:!n&&(!e.enabled||!a),description:n&&n.revision!==e.revision?`Using saved revision ${n.revision}; remove and add again to update.`:a?void 0:`Different task format or Reward.`}})],onChange:e=>{let t=X.sources.items.find(t=>t.id===e);t&&te(t)}}):null,A.length?(0,m.jsx)(`p`,{children:A.map(e=>X?.sources.items.find(t=>t.id===e.id)?.name??e.id).join(`, `)}):null,(0,m.jsxs)(`p`,{children:[A.length,` sources selected.`,` `,(0,m.jsx)(`button`,{type:`button`,onClick:()=>{j([]),N(null),L(!0)},children:`Clear selection`})]}),K?(0,m.jsx)(`button`,{type:`button`,className:`training-button secondary`,onClick:()=>{e.sources(H).then(e=>{G({after:H,data:e}),q(null)},e=>q(e instanceof Error?e.message:`Unable to refresh sources.`))},children:`Retry sources`}):null,(0,m.jsx)(s,{after:H,next:X?.sources.nextCursor,onPage:e=>U(e??void 0)})]}),(0,m.jsxs)(`fieldset`,{children:[(0,m.jsx)(`legend`,{children:`Training schedule`}),(0,m.jsx)(d,{label:`Training schedule`,value:b,options:[{value:`nightly`,label:`Every night`},{value:`approved_count`,label:`When enough approved tasks are ready`},{value:`schedule`,label:`Check at an interval`},{value:`manual`,label:`Manual updates`},...n?.trigger.kind===`upstream_accepted`?[{value:`upstream_accepted`,label:`After the configured upstream Model is accepted`}]:[]],onChange:e=>{x(e),L(!0)}}),b===`nightly`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`label`,{children:[`Local check time`,(0,m.jsx)(`input`,{type:`time`,value:S,onChange:e=>C(e.target.value)})]}),(0,m.jsxs)(`label`,{children:[`Timezone`,(0,m.jsx)(d,{label:`Learning timezone`,searchable:!0,floating:!0,value:w,options:E,onChange:e=>{T(e),L(!0)}})]}),(0,m.jsxs)(`p`,{children:[`Checks daily at `,S,` · `,w,`. Training waits for at least`,` `,P.minimum,` approved, unused examples and available budget and capacity.`]})]}):b===`approved_count`?(0,m.jsxs)(`p`,{children:[`Checks when at least `,P.minimum,` admitted, unused examples are ready.`]}):b===`manual`?(0,m.jsx)(`p`,{children:`Training starts only through an explicit Run now action.`}):null]}),Object.keys(P).filter(e=>e!==`interval`||b===`schedule`).map(e=>(0,m.jsxs)(`label`,{children:[{interval:`Check interval (minutes)`,minimum:`Minimum approved examples`,batch:`Maximum examples per batch`,spend:`Maximum spend per iteration ($)`,daily:`Maximum daily spend ($)`,cooldown:`Cooldown (minutes)`,retries:`Automatic retries`,backlog:`Maximum backlog`}[e],(0,m.jsx)(`input`,{type:`number`,value:P[e],min:`0`,step:e===`spend`||e===`daily`?`0.01`:`1`,onChange:t=>F(n=>({...n,[e]:t.target.value}))})]},e))]}),(0,m.jsxs)(`div`,{className:`model-build-actions`,children:[(0,m.jsx)(`button`,{type:`submit`,className:`training-button`,disabled:R,children:R?`Saving…`:J.current?`Retry save`:`Save settings`}),(0,m.jsx)(`button`,{type:`button`,className:`training-button secondary`,disabled:R,onClick:()=>{$.requestLeave(h)},children:`Cancel`})]})]})]}),$.dialog]})}export{h as HostedModelLearningSettings};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-B6XX_0h3.js";import{m as r,p as i,r as a,v as o}from"./schemas-Brv9Vmnk.js";import{i as s,n as c}from"./api-client-DJRVOFzS.js";import"./icons-Bk2b68aC.js";import{t as l}from"./maximize-2-CByk9-zN.js";import{F as u,Gt as d,M as f,N as p,Wt as m,dn as h,j as g}from"./App-CCuh99JW.js";import{Ft as _,Pt as v}from"./MainPane-CQQxSDPS.js";var y=e(t(),1);a([`page`,`node`]);var b=r({x:i().finite().nonnegative(),y:i().finite().nonnegative(),width:i().finite().positive().max(16e3),height:i().finite().positive().max(16e3)}).refine(e=>e.width*e.height<=4e7,`The snapshot is too large.`),x=r({rect:b,selector:o().max(500),html:o().max(6291456).optional(),source:o().max(64e3).optional()});function S(e,t){let n=!1,r=null,i=null;function a(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${[...e.classList].slice(0,3).map(e=>`.${e}`).join(``)}`.slice(0,500)}function o(e,t,n){let r=e instanceof SVGElement&&e.tagName.toLowerCase()!==`svg`?e.ownerSVGElement:null;for(;r?.ownerSVGElement;)r=r.ownerSVGElement;let i=r??e,a=i.cloneNode(!0),o=[i,...i.querySelectorAll(`*`)],s=[a,...a.querySelectorAll(`*`)];for(let e=0;e<o.length;e++){let t=o[e],n=s[e];if([`SCRIPT`,`IFRAME`,`OBJECT`,`EMBED`,`LINK`,`META`].includes(n.tagName)){n.remove();continue}let r=[...n.attributes];for(let e of r)/^on/i.test(e.name)&&n.removeAttribute(e.name);if(n instanceof HTMLElement||n instanceof SVGElement){let e=getComputedStyle(t);n.style.cssText=[...e].map(t=>`${t}:${e.getPropertyValue(t).replace(/url\((["']?)(.*?)\1\)/g,(e,t,n)=>{let r=n.indexOf(`#`);return r>0&&[document.baseURI.split(`#`)[0],document.URL.split(`#`)[0]].includes(n.slice(0,r))?`url("#${n.slice(r+1)}")`:e})};`).join(``),n.style.setProperty(`animation`,`none`),n.style.setProperty(`transition`,`none`)}if(t instanceof HTMLInputElement&&(n.setAttribute(`value`,t.value),t.checked?n.setAttribute(`checked`,``):n.removeAttribute(`checked`)),t instanceof HTMLTextAreaElement&&(n.textContent=t.value),t instanceof HTMLOptionElement&&(t.selected?n.setAttribute(`selected`,``):n.removeAttribute(`selected`)),t instanceof HTMLCanvasElement){let e=document.createElement(`img`);e.src=t.toDataURL(`image/png`),e.style.cssText=n.style.cssText,t===i?a=e:n.replaceWith(e)}if(t.shadowRoot)throw Error(`This element has a shadow root. Capture it from a native browser tab.`)}a.style.setProperty(`margin`,`0`),a.style.setProperty(`position`,`relative`),a.style.setProperty(`inset`,`auto`),a.style.setProperty(`width`,`${t}px`),a.style.setProperty(`max-width`,`none`);let c=document.createElement(`div`);c.style.width=`${t}px`,c.style.height=`${n}px`;for(let t=e;t;t=t.parentElement){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`rgba(0, 0, 0, 0)`&&e!==`transparent`){c.style.backgroundColor=e;break}}if(r){let n=r.getBoundingClientRect(),i=e.getBoundingClientRect();Object.assign(c.style,{position:`relative`,overflow:`hidden`,width:`${t}px`,height:`${Math.ceil(i.height)}px`}),Object.assign(a.style,{position:`absolute`,left:`${n.left-i.left}px`,top:`${n.top-i.top}px`,width:`${n.width}px`,height:`${n.height}px`})}return c.append(a),c.outerHTML}function s(n,r){try{let i=n.getBoundingClientRect(),s=r?Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth):Math.ceil(i.width),c=r?Math.max(document.documentElement.scrollHeight,document.body.scrollHeight):Math.ceil(i.height);if(!s||!c)throw Error(`The selected element has no visible area.`);e({capture:{rect:{x:r?0:Math.max(0,i.left+scrollX),y:r?0:Math.max(0,i.top+scrollY),width:s,height:c},selector:r?`Full page`:a(n),source:n.outerHTML.slice(0,64e3),...t?{html:o(n,s,c)}:{}}})}catch(t){e({error:t instanceof Error?t.message:String(t)})}}function c(){n=!1,r=null,i?.remove(),i=null,document.removeEventListener(`pointermove`,l,!0),document.removeEventListener(`click`,u,!0),document.removeEventListener(`keydown`,f,!0),window.removeEventListener(`click`,u,!0);for(let e of[`pointerdown`,`pointerup`,`mousedown`,`mouseup`])window.removeEventListener(e,d,!0)}function l(e){if(!n||(r=e.composedPath().find(e=>e instanceof Element&&e!==i)??null,!r||!i))return;let t=r.getBoundingClientRect();Object.assign(i.style,{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}),i.textContent=`${a(r)} · ${Math.ceil(t.width)} × ${Math.ceil(t.height)}`}function u(e){if(!n||!e.isTrusted)return;e.preventDefault(),e.stopImmediatePropagation();let t=e.composedPath().find(e=>e instanceof Element&&e!==i);c(),t&&s(t,!1)}function d(e){n&&(e.preventDefault(),e.stopImmediatePropagation())}function f(t){t.key===`Escape`&&t.isTrusted&&(t.preventDefault(),t.stopImmediatePropagation(),c(),e({canceled:!0}))}return{page(){c(),s(document.body,!0)},start(){c(),n=!0,i=document.createElement(`div`),i.setAttribute(`data-openpond-snapshot-overlay`,``),i.style.cssText=`position:fixed;pointer-events:none;z-index:2147483647;box-sizing:border-box;border:2px solid var(--blue,Highlight);background:transparent;color:var(--text,CanvasText);font:12px/1.3 monospace;text-shadow:0 0 3px var(--bg,Canvas);overflow:visible;`,document.documentElement.append(i),document.addEventListener(`pointermove`,l,!0),window.addEventListener(`click`,u,!0);for(let e of[`pointerdown`,`pointerup`,`mousedown`,`mouseup`])window.addEventListener(e,d,!0);document.addEventListener(`keydown`,f,!0)},cancel(){c(),e({canceled:!0})},dispose:c}}function C(){return`(${S.toString()})`}var w=`default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'`,T=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`),E=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);function ee(e,t,n=f){let r=`(() => {
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-DiVhx1GM.js";import{m as r,p as i,r as a,v as o}from"./schemas-Brv9Vmnk.js";import{i as s,n as c}from"./api-client-DJRVOFzS.js";import"./icons-4yRSxBZj.js";import{t as l}from"./maximize-2-CKY8dua6.js";import{F as u,Gt as d,M as f,N as p,Wt as m,dn as h,j as g}from"./App-CXhxya9x.js";import{Ft as _,Pt as v}from"./MainPane-D3fQou29.js";var y=e(t(),1);a([`page`,`node`]);var b=r({x:i().finite().nonnegative(),y:i().finite().nonnegative(),width:i().finite().positive().max(16e3),height:i().finite().positive().max(16e3)}).refine(e=>e.width*e.height<=4e7,`The snapshot is too large.`),x=r({rect:b,selector:o().max(500),html:o().max(6291456).optional(),source:o().max(64e3).optional()});function S(e,t){let n=!1,r=null,i=null;function a(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${[...e.classList].slice(0,3).map(e=>`.${e}`).join(``)}`.slice(0,500)}function o(e,t,n){let r=e instanceof SVGElement&&e.tagName.toLowerCase()!==`svg`?e.ownerSVGElement:null;for(;r?.ownerSVGElement;)r=r.ownerSVGElement;let i=r??e,a=i.cloneNode(!0),o=[i,...i.querySelectorAll(`*`)],s=[a,...a.querySelectorAll(`*`)];for(let e=0;e<o.length;e++){let t=o[e],n=s[e];if([`SCRIPT`,`IFRAME`,`OBJECT`,`EMBED`,`LINK`,`META`].includes(n.tagName)){n.remove();continue}let r=[...n.attributes];for(let e of r)/^on/i.test(e.name)&&n.removeAttribute(e.name);if(n instanceof HTMLElement||n instanceof SVGElement){let e=getComputedStyle(t);n.style.cssText=[...e].map(t=>`${t}:${e.getPropertyValue(t).replace(/url\((["']?)(.*?)\1\)/g,(e,t,n)=>{let r=n.indexOf(`#`);return r>0&&[document.baseURI.split(`#`)[0],document.URL.split(`#`)[0]].includes(n.slice(0,r))?`url("#${n.slice(r+1)}")`:e})};`).join(``),n.style.setProperty(`animation`,`none`),n.style.setProperty(`transition`,`none`)}if(t instanceof HTMLInputElement&&(n.setAttribute(`value`,t.value),t.checked?n.setAttribute(`checked`,``):n.removeAttribute(`checked`)),t instanceof HTMLTextAreaElement&&(n.textContent=t.value),t instanceof HTMLOptionElement&&(t.selected?n.setAttribute(`selected`,``):n.removeAttribute(`selected`)),t instanceof HTMLCanvasElement){let e=document.createElement(`img`);e.src=t.toDataURL(`image/png`),e.style.cssText=n.style.cssText,t===i?a=e:n.replaceWith(e)}if(t.shadowRoot)throw Error(`This element has a shadow root. Capture it from a native browser tab.`)}a.style.setProperty(`margin`,`0`),a.style.setProperty(`position`,`relative`),a.style.setProperty(`inset`,`auto`),a.style.setProperty(`width`,`${t}px`),a.style.setProperty(`max-width`,`none`);let c=document.createElement(`div`);c.style.width=`${t}px`,c.style.height=`${n}px`;for(let t=e;t;t=t.parentElement){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`rgba(0, 0, 0, 0)`&&e!==`transparent`){c.style.backgroundColor=e;break}}if(r){let n=r.getBoundingClientRect(),i=e.getBoundingClientRect();Object.assign(c.style,{position:`relative`,overflow:`hidden`,width:`${t}px`,height:`${Math.ceil(i.height)}px`}),Object.assign(a.style,{position:`absolute`,left:`${n.left-i.left}px`,top:`${n.top-i.top}px`,width:`${n.width}px`,height:`${n.height}px`})}return c.append(a),c.outerHTML}function s(n,r){try{let i=n.getBoundingClientRect(),s=r?Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth):Math.ceil(i.width),c=r?Math.max(document.documentElement.scrollHeight,document.body.scrollHeight):Math.ceil(i.height);if(!s||!c)throw Error(`The selected element has no visible area.`);e({capture:{rect:{x:r?0:Math.max(0,i.left+scrollX),y:r?0:Math.max(0,i.top+scrollY),width:s,height:c},selector:r?`Full page`:a(n),source:n.outerHTML.slice(0,64e3),...t?{html:o(n,s,c)}:{}}})}catch(t){e({error:t instanceof Error?t.message:String(t)})}}function c(){n=!1,r=null,i?.remove(),i=null,document.removeEventListener(`pointermove`,l,!0),document.removeEventListener(`click`,u,!0),document.removeEventListener(`keydown`,f,!0),window.removeEventListener(`click`,u,!0);for(let e of[`pointerdown`,`pointerup`,`mousedown`,`mouseup`])window.removeEventListener(e,d,!0)}function l(e){if(!n||(r=e.composedPath().find(e=>e instanceof Element&&e!==i)??null,!r||!i))return;let t=r.getBoundingClientRect();Object.assign(i.style,{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}),i.textContent=`${a(r)} · ${Math.ceil(t.width)} × ${Math.ceil(t.height)}`}function u(e){if(!n||!e.isTrusted)return;e.preventDefault(),e.stopImmediatePropagation();let t=e.composedPath().find(e=>e instanceof Element&&e!==i);c(),t&&s(t,!1)}function d(e){n&&(e.preventDefault(),e.stopImmediatePropagation())}function f(t){t.key===`Escape`&&t.isTrusted&&(t.preventDefault(),t.stopImmediatePropagation(),c(),e({canceled:!0}))}return{page(){c(),s(document.body,!0)},start(){c(),n=!0,i=document.createElement(`div`),i.setAttribute(`data-openpond-snapshot-overlay`,``),i.style.cssText=`position:fixed;pointer-events:none;z-index:2147483647;box-sizing:border-box;border:2px solid var(--blue,Highlight);background:transparent;color:var(--text,CanvasText);font:12px/1.3 monospace;text-shadow:0 0 3px var(--bg,Canvas);overflow:visible;`,document.documentElement.append(i),document.addEventListener(`pointermove`,l,!0),window.addEventListener(`click`,u,!0);for(let e of[`pointerdown`,`pointerup`,`mousedown`,`mouseup`])window.addEventListener(e,d,!0);document.addEventListener(`keydown`,f,!0)},cancel(){c(),e({canceled:!0})},dispose:c}}function C(){return`(${S.toString()})`}var w=`default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'`,T=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`),E=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);function ee(e,t,n=f){let r=`(() => {
2
2
  const style = document.getElementById('openpond-theme');
3
3
  const keys = ${T(Object.keys(f))};
4
4
  function theme(values) { if (!values || typeof values !== 'object') return;
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-B6XX_0h3.js";import{t as r}from"./useQuery-D2MQ7e5U.js";import{C as i,O as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,o as g,p as _,r as v,s as y,v as b,w as ee}from"./LabModelWorkspace-u2Ulm_z4.js";import{t as x}from"./query-scope-BRpcgljO.js";import"./icons-Bk2b68aC.js";import{c as S,l as te,n as C,o as w,r as T,t as ne}from"./training-model-data-CIysl8wH.js";import{t as E}from"./chevron-down-DX1hzujj.js";import{t as D}from"./chevron-right-DHN0y3KC.js";import{t as re}from"./loader-circle-y-SSPwpk.js";import{Fn as O,Gt as k,Tn as A,gn as j,rn as ie}from"./App-CCuh99JW.js";import{t as ae}from"./ModelProjectPageHeader-Dge19aE1.js";import{lt as oe}from"./MainPane-CQQxSDPS.js";import{t as se}from"./LabsRoute-CbztQaEf.js";function ce(e){if(!e)return[];let t=e.recipe;return t.method===`grpo`?[{label:`LoRA rank`,value:String(t.lora.rank)},{label:`Learning rate`,value:M(t.optimizer.learningRate)},{label:`Optimizer steps`,value:String(t.optimizer.maxSteps)},{label:`Rollouts per update`,value:String(t.rollout.groupSize)},{label:`Rollout concurrency`,value:String(t.rollout.concurrency)},{label:`Max output tokens`,value:t.rollout.maxOutputTokens.toLocaleString()},{label:`Temperature`,value:String(t.rollout.temperature)},{label:`Top P`,value:String(t.rollout.topP)}]:t.method===`sft`||t.method===`dpo`?[{label:`LoRA rank`,value:String(t.lora.rank)},{label:`Learning rate`,value:M(t.optimizer.learningRate)},{label:`Optimizer steps`,value:String(t.optimizer.maxSteps)}]:[]}function le(e,t){if(!e||!t)return[];if(t.parent.kind===`base_model`)return[{label:`Starting checkpoint`,value:`Frozen base · ${t.parent.revision}`},{label:`Optimizer`,value:`Fresh`}];let n=e.modelVersions.find(e=>e.id===t.parent.id);return[{label:`Starting checkpoint`,value:[e.comparisonSeriesEntries.find(e=>e.seriesId===t.seriesId&&e.modelVersionId===t.parent.id)?.label??null,n?`Version ${n.version}`:t.parent.id].filter(e=>!!e).join(` · `)},{label:`Optimizer`,value:`Fresh`}]}function ue(e,t){if(!e||!t||t.parent.kind===`base_model`)return`Frozen base`;let n=e.comparisonSeriesEntries.find(e=>e.seriesId===t.seriesId&&e.modelVersionId===t.parent.id),r=e.modelVersions.find(e=>e.id===t.parent.id);return[n?.label??`Prior checkpoint`,r?`Version ${r.version}`:null].filter(e=>!!e).join(` · `)}function M(e){return e===0?`0`:e.toExponential(2)}var N=e(t(),1),P=n();function de({events:e}){let t=e.filter(e=>e.type===`metric`&&e.payload.metricKind===`rollout_trajectory`);return t.length?(0,P.jsx)(`div`,{className:`training-rollout-receipts`,children:t.map((e,t)=>{let n=e.payload.rewardEligible===!0,r=I(e.payload.reward),i=typeof e.payload.failureClass==`string`?e.payload.failureClass:null,a=typeof e.payload.failureCode==`string`?e.payload.failureCode:null;return(0,P.jsxs)(`details`,{children:[(0,P.jsxs)(`summary`,{children:[(0,P.jsxs)(`span`,{children:[`Attempt `,t+1]}),(0,P.jsx)(`strong`,{children:n?`eligible`:`ineligible`}),(0,P.jsx)(`em`,{children:n&&r!=null?r.toFixed(3):a??i??`not reward eligible`})]}),(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)(F,{label:`Rollout`,value:L(e.payload.rolloutId)}),(0,P.jsx)(F,{label:`Group`,value:L(e.payload.rolloutGroupId)}),(0,P.jsx)(F,{label:`Policy`,value:`v${I(e.payload.policyVersion)??0}`}),(0,P.jsx)(F,{label:`Worker`,value:String((I(e.payload.workerSlot)??0)+1)}),(0,P.jsx)(F,{label:`Reward`,value:r==null?`Not eligible`:String(r)}),(0,P.jsx)(F,{label:`Failure class`,value:i??`None`}),(0,P.jsx)(F,{label:`Failure code`,value:a??`None`}),(0,P.jsx)(F,{label:`Components`,value:JSON.stringify(e.payload.rewardComponents??{})}),(0,P.jsx)(F,{label:`Tokens`,value:`${I(e.payload.inputTokens)??0} input · ${I(e.payload.outputTokens)??0} output`})]})]},e.id)})}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No managed attempts were recorded for this run.`})}function fe({receipts:e}){let[t,n]=(0,N.useState)(!1);if(!e.length)return(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No on-policy rollout receipts were recorded for this run.`});let r=[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)),i=t?r:r.slice(0,24);return(0,P.jsxs)(`div`,{className:`training-rollout-receipts`,children:[e.length>24?(0,P.jsxs)(`div`,{className:`training-rollout-receipt-controls`,children:[(0,P.jsx)(`span`,{children:t?`Showing all ${e.length} receipts`:`Showing latest ${i.length} of ${e.length} receipts`}),(0,P.jsx)(`button`,{className:`training-text-button`,type:`button`,onClick:()=>n(e=>!e),children:t?`Show latest 24`:`Show all ${e.length}`})]}):null,i.map(e=>(0,P.jsxs)(`details`,{children:[(0,P.jsxs)(`summary`,{children:[(0,P.jsx)(`span`,{children:pe(e.providerTrace.rolloutId)}),(0,P.jsx)(`strong`,{children:e.status}),(0,P.jsx)(`em`,{children:e.reward.eligible&&e.reward.raw!=null?e.reward.raw.toFixed(3):e.failureClass??`not reward eligible`})]}),(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)(F,{label:`Correlation`,value:e.correlationId}),(0,P.jsx)(F,{label:`Task`,value:e.taskId}),(0,P.jsx)(F,{label:`Policy`,value:e.policy.modelId}),(0,P.jsx)(F,{label:`Checkpoint`,value:e.policy.checkpointId??`Provider initial policy`}),(0,P.jsx)(F,{label:`Environment`,value:`${e.environment.id}@${e.environment.version}`}),(0,P.jsx)(F,{label:`World`,value:`${e.environment.worldId} · ${e.environment.worldHash}`}),(0,P.jsx)(F,{label:`Raw reward`,value:e.reward.raw==null?`Not eligible`:String(e.reward.raw)}),(0,P.jsx)(F,{label:`Components`,value:JSON.stringify(e.reward.components)}),(0,P.jsx)(F,{label:`Outcome`,value:e.verifier?.outcome??e.failureClass??`Pending`}),(0,P.jsx)(F,{label:`Trace`,value:`${e.providerTrace.experimentId}/${e.providerTrace.rolloutId}`})]})]},e.id))]})}function F({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function I(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function L(e){return typeof e==`string`&&e?e:`Not recorded`}function pe(e){return e.replace(/^lineage_/,``).slice(0,18)}function me({detail:e,loading:t,pending:n=!1}){if(t&&!e)return(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`Loading evaluation results…`});let r=e?.evaluation;return r?(0,P.jsxs)(`div`,{className:`training-run-evaluation`,children:[(0,P.jsxs)(`div`,{className:`training-metric-summary`,children:[(0,P.jsx)(R,{label:`Base score`,value:ge(r.base.meanScore)}),(0,P.jsx)(R,{label:`Trained score`,value:ge(r.trained.meanScore)}),(0,P.jsx)(R,{label:`Score change`,value:_e(r.meanScoreDelta)}),(0,P.jsx)(R,{label:`Trained pass rate`,value:z(r.trained.passRate)})]}),r.base.count===0?(0,P.jsx)(`p`,{className:`training-muted`,children:`Base-model scoring was not imported for this earlier run. New runs retain both base and trained evaluations.`}):null,r.trained.count>0&&r.trained.scoredCount===0?(0,P.jsx)(`p`,{className:`training-muted`,children:`Outputs were captured, but the grader was unavailable, so this run has no evaluation score.`}):null,(0,P.jsx)(`div`,{className:`training-table-wrap`,children:(0,P.jsxs)(`table`,{className:`training-data-table training-evaluation-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Test example`}),(0,P.jsx)(`th`,{children:`Base`}),(0,P.jsx)(`th`,{children:`Trained`}),(0,P.jsx)(`th`,{children:`Result`})]})}),(0,P.jsx)(`tbody`,{children:r.examples.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:(0,P.jsxs)(`details`,{children:[(0,P.jsx)(`summary`,{children:e.taskId}),(0,P.jsx)(he,{input:e.input,baseOutput:e.baseOutput,trainedOutput:e.trainedOutput,baseGrade:e.baseGrade,trainedGrade:e.trainedGrade})]})}),(0,P.jsx)(`td`,{children:ve(e.baseGrade)}),(0,P.jsx)(`td`,{children:ve(e.trainedGrade)}),(0,P.jsx)(`td`,{children:ye(e.baseGrade,e.trainedGrade)})]},e.taskId))})]})})]}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:n?`Evaluation will appear here after the first eligible checkpoint is scored.`:`No scored evaluation results are available for this run.`})}function he({input:e,baseOutput:t,trainedOutput:n,baseGrade:r,trainedGrade:i}){let a=[...new Set([...r?.feedback??[],...i?.feedback??[]])];return(0,P.jsxs)(`div`,{className:`training-evaluation-output`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Input`}),(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]}),t?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Base output`}),(0,P.jsx)(`pre`,{children:JSON.stringify(t,null,2)})]}):null,n?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Trained output`}),(0,P.jsx)(`pre`,{children:JSON.stringify(n,null,2)})]}):null,a.length?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Grader feedback`}),(0,P.jsx)(`p`,{children:a.join(` `)})]}):null]})}function R({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]})}function ge(e){return e==null?`Not recorded`:e.toFixed(3)}function z(e){return e==null?`Not recorded`:`${Math.round(e*100)}%`}function _e(e){return e==null?`Not comparable`:`${e>=0?`+`:``}${e.toFixed(3)}`}function ve(e){return e?.status===`unavailable`?`Unavailable`:e?.score==null?`Not scored`:e.score.toFixed(3)}function ye(e,t){if(!t)return`Not evaluated`;if(t.status===`unavailable`)return`Unavailable`;if(!e||e.score==null||t.score==null)return t.passed?`Passed`:`Failed`;let n=t.score-e.score;return Math.abs(n)<5e-4?`No change`:n>0?`Improved ${n.toFixed(3)}`:`Regressed ${Math.abs(n).toFixed(3)}`}function be({connection:e,lineageId:t,jobId:n,onSaved:r}){let i=n??t,a=n?`jobs`:`models`,[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(0),[u,d]=(0,N.useState)(!0),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(null),[b,ee]=(0,N.useState)(``),[x,S]=(0,N.useState)(null),[te,C]=(0,N.useState)([]),[w,T]=(0,N.useState)(!1);(0,N.useEffect)(()=>{if(!e){d(!1),p(!1),_(`Connect to OpenPond to review this candidate.`);return}let t=!0;return d(!0),p(!1),_(null),C([]),(async()=>{try{if(a===`models`){let n=await A.candidateReview(e,i);t&&n&&s(n)}let n=await A.candidateReview(e,i,!0,a);t&&(s(n),p(!!n))}catch(e){t&&_(xe(e))}finally{t&&d(!1)}})(),()=>{t=!1}},[e,i,a,c]);function ne(e){y(e),ee(``),S(null)}async function E(){if(!e||!o||!v||!b.trim())return;let t=x&&x.reason===b.trim()&&x.decision===v?x:{schemaVersion:`openpond.trainingCandidateDecisionRequest.v1`,...o.target,decision:v,reason:b.trim(),idempotencyKey:crypto.randomUUID(),expectedDecision:o.decision?{id:o.decision.id,contentHash:o.decision.contentHash}:null};S(t),h(!0),_(null);try{s(await A.recordCandidateReview(e,i,t,a)),y(null),S(null),C([]),await r()}catch(e){_(xe(e))}finally{h(!1)}}let D=(te.at(-1)??o?.decision)?.request.expectedDecision;async function re(){if(e&&D){T(!0),_(null);try{let t=await A.candidateReviewHistory(e,i,D,a);C(e=>[...e,t])}catch(e){_(xe(e))}finally{T(!1)}}}let O=o?.decision;return(0,P.jsxs)(`section`,{className:`training-run-evaluation`,"aria-label":`Candidate review`,children:[(0,P.jsx)(`h3`,{children:`Candidate review`}),O?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`strong`,{children:O.request.decision===`accepted`?`Accepted`:`Rejected`}),(0,P.jsx)(`p`,{children:O.request.reason}),(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Review `,O.revision,` · `,new Date(O.decidedAt).toLocaleString()]})]}):(0,P.jsx)(`p`,{className:`training-muted`,children:u?`Loading candidate review…`:o?`No candidate decision recorded.`:`Candidate review unavailable.`}),o?(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Last synced `,new Date(o.syncedAt).toLocaleString(),`. Acceptance keeps this candidate for later use; serving is activated separately.`]}):null,g?(0,P.jsx)(k,{error:g}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:u||m,onClick:()=>l(e=>e+1),children:`Refresh review`}),(0,P.jsx)(`button`,{className:`training-button`,type:`button`,disabled:!f||u||m||O?.request.decision===`accepted`,onClick:()=>ne(`accepted`),children:`Accept candidate`}),(0,P.jsx)(`button`,{className:`training-button danger`,type:`button`,disabled:!f||u||m||O?.request.decision===`rejected`,onClick:()=>ne(`rejected`),children:`Reject candidate`})]}),te.map(e=>(0,P.jsxs)(`details`,{className:`training-evidence`,children:[(0,P.jsxs)(`summary`,{children:[`Review `,e.revision,` · `,e.request.decision]}),(0,P.jsx)(`p`,{children:e.request.reason}),(0,P.jsx)(`p`,{children:new Date(e.decidedAt).toLocaleString()})]},e.id)),D?(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:w||m,onClick:()=>void re(),children:w?`Loading…`:`Earlier review`}):null,v?(0,P.jsx)(`div`,{className:`training-dialog-backdrop`,role:`presentation`,onMouseDown:()=>!m&&y(null),children:(0,P.jsxs)(`section`,{className:`training-dialog training-promotion-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Review candidate`,onMouseDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`div`,{className:`training-dialog-header`,children:(0,P.jsx)(`h2`,{children:v===`accepted`?`Accept this candidate?`:`Reject this candidate?`})}),(0,P.jsx)(`p`,{children:`The adapter and its recorded evaluation remain in the candidate’s history.`}),(0,P.jsxs)(`label`,{className:`training-promotion-reason`,children:[(0,P.jsx)(`span`,{children:`Reason`}),(0,P.jsx)(`textarea`,{autoFocus:!0,maxLength:5e3,value:b,onChange:e=>ee(e.target.value)})]}),g?(0,P.jsx)(k,{error:g}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:m,onClick:()=>y(null),children:`Cancel`}),(0,P.jsx)(`button`,{className:`training-button ${v===`rejected`?`danger`:``}`,type:`button`,disabled:m||!b.trim(),onClick:()=>void E(),children:m?`Saving…`:x?`Retry save`:`Save decision`})]})]})}):null]})}function xe(e){return e instanceof Error?e.message:`Candidate review could not be loaded.`}function Se({connection:e,jobId:t,evaluations:n}){let[r,i]=(0,N.useState)(null),a=n.filter(e=>e.reference),o=a.find(e=>e.reference?.id===r)??a.filter(e=>e.kind===`candidate`).at(-1)??a[0];return!e||!o?.reference?null:(0,P.jsxs)(`section`,{className:`training-run-evaluation`,"aria-label":`Retained evaluation answers`,children:[(0,P.jsxs)(`label`,{className:`training-taskset-selector`,children:[(0,P.jsx)(`span`,{children:`Evaluation answers`}),(0,P.jsx)(`select`,{value:o.reference.id,onChange:e=>i(e.target.value),children:a.map(e=>(0,P.jsxs)(`option`,{value:e.reference.id,children:[e.kind===`baseline`?`Baseline`:`Candidate`,` · policy `,e.policyVersion]},e.reference.id))})]}),(0,P.jsx)(B,{connection:e,jobId:t,evaluation:o.reference},`${t}:${o.reference.id}:${o.reference.contentHash}`)]})}function B({connection:e,jobId:t,evaluation:n}){let[r,i]=(0,N.useState)(),[a,o]=(0,N.useState)([]),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(!0),[p,m]=(0,N.useState)(0),{id:h,contentHash:g}=n;return(0,N.useEffect)(()=>{let n=!0;return f(!0),u(null),c(null),A.trainingEvaluationTasks(e,t,{id:h,contentHash:g},r).then(e=>{n&&c(e)}).catch(e=>{n&&u(e instanceof Error?e.message:String(e))}).finally(()=>{n&&f(!1)}),()=>{n=!1}},[e,t,h,g,r,p]),(0,P.jsxs)(`div`,{className:`training-run-evaluation`,"aria-busy":d,children:[d?(0,P.jsx)(`p`,{className:`training-muted`,children:`Loading recorded answers…`}):null,l?(0,P.jsx)(k,{error:l,children:(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,onClick:()=>m(e=>e+1),children:`Retry answers`})}):null,s?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Tasks `,s.offset+1,`–`,s.offset+s.tasks.length,` of`,` `,s.total,`. Recorded outputs and scores are retained for this run.`]}),s.tasks.map((e,t)=>(0,P.jsxs)(`details`,{className:`training-evidence`,children:[(0,P.jsxs)(`summary`,{children:[`Example `,s.offset+t+1,` · score `,e.score.toFixed(3)]}),(0,P.jsxs)(`div`,{className:`training-evaluation-output`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Instruction`}),(0,P.jsx)(`pre`,{children:e.input.instruction})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Context`}),(0,P.jsx)(`pre`,{children:JSON.stringify(e.input.context,null,2)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Recorded output`}),(0,P.jsx)(`pre`,{children:e.output})]})]})]},e.taskId))]}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:d||!a.length,onClick:()=>{i(a.at(-1)),o(e=>e.slice(0,-1))},children:`Previous tasks`}),(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:d||!s?.nextCursor,onClick:()=>{s?.nextCursor&&(o(e=>[...e,r]),i(s.nextCursor))},children:`Next tasks`})]})]})}var V=new Set([`queued`,`starting`,`running`,`cancelling`,`reconciling`]);function Ce(e,t,n,i=!1){let a=[`training-run-detail`,x(e),t,i],o=!!(e&&t),s=r({queryKey:[...a,`retained`],queryFn:({signal:n})=>A.trainingRunDetail(e,t,{includeEvaluation:i,refresh:!1,signal:n}),enabled:o,staleTime:3e4,gcTime:6e4}),c=r({queryKey:[...a,`hosted`],queryFn:({signal:n})=>A.trainingRunDetail(e,t,{includeEvaluation:i,signal:n}),enabled:o,staleTime:3e4,gcTime:6e4,refetchInterval:n&&V.has(n)?3e3:!1,refetchIntervalInBackground:!1}),l=c.data??s.data??null;return{detail:l,loading:o&&!l&&(s.isPending||c.isPending),error:c.error?.message??s.error?.message??null,refresh:async()=>(await c.refetch()).data??null}}function we({title:e,status:t,statusValue:n,versionStatus:r,method:i,baseModel:a,taskset:o,compute:s,duration:c,output:l,reward:u,telemetry:d,evidence:f,configuration:p,children:m,failure:h,onOpenTaskset:g,showHeader:_=!0}){let v=d?.cost.providerReportedUsd??d?.cost.estimatedUsd??f?.cost.totalUsd??null;return(0,P.jsxs)(`div`,{className:`labs-model-run-summary`,children:[_?(0,P.jsx)(`section`,{className:`labs-run-outcome-card`,children:(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`labs-run-title-row`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsx)(b,{label:t,value:n})]}),(0,P.jsxs)(`p`,{children:[Te(i),` on `,a]})]})})}):null,m,(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Run setup`})}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(H,{label:`Training method`,value:i}),(0,P.jsx)(H,{label:`Base model`,value:a}),(0,P.jsx)(H,{label:`Compute`,value:s}),(0,P.jsx)(H,{label:`Output`,value:l}),r?(0,P.jsx)(H,{label:`Version status`,value:r}):null,(0,P.jsx)(H,{label:`Duration`,value:c}),(0,P.jsx)(H,{label:`Run cost`,value:v===null?`Not reported`:`$${v.toFixed(4)}`}),(0,P.jsx)(H,{label:y(n)?`Latest reward`:`Final reward`,value:u===null?`Not reported`:u.toFixed(4)}),p.map(e=>(0,P.jsx)(H,{label:e.label,value:e.value},e.label)),d||f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(U,{label:`GPU`,value:W(d,f)}),(0,P.jsx)(U,{label:`Tokens`,value:`${G(d?.usage.promptTokens??f?.usage.inputTokens??null)} prompt · ${G(d?.usage.generatedTokens??f?.usage.outputTokens??null)} generated`}),(0,P.jsx)(U,{label:`Trajectories`,value:`${G(d?.usage.successfulTrajectories??f?.reward.eligibleTrajectoryCount??null)} succeeded · ${G(d?.usage.failedTrajectories??(f?f.reward.trajectoryCount-f.reward.eligibleTrajectoryCount:null))} failed`}),(0,P.jsx)(U,{label:`Optimizer updates`,value:G(d?.usage.optimizerSteps??f?.progress.committedOptimizerSteps??null)}),(0,P.jsx)(U,{label:`GPU time`,value:d?.usage.gpuSeconds==null?`Not reported`:`${d.usage.gpuSeconds.toFixed(1)} seconds`})]}):(0,P.jsx)(H,{label:`Resource usage`,value:`Not retained for this run`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:`Taskset`}),(0,P.jsx)(`dd`,{children:g?(0,P.jsxs)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:g,children:[(0,P.jsx)(`span`,{children:o}),(0,P.jsx)(D,{"aria-hidden":`true`,size:14})]}):o})]})]})]}),h?(0,P.jsx)(`p`,{className:`labs-training-error`,children:h}):null]})}function H({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function U({label:e,value:t}){return(0,P.jsx)(H,{label:e,value:t})}function W(e,t){let n=e?.resource.gpuCount??t?.resource.gpuCount??null,r=e?.resource.gpuType??t?.resource.gpuType??null;return n===null&&r===null?`Not reported`:`${n??`Unknown`} × ${r?Ee(r):`Unreported`}`}function G(e){return e===null?`Not reported`:e.toLocaleString()}function Te(e){return e===`RFT`?`Reinforcement fine-tuning`:`${e} training`}function Ee(e){return e.split(` · `).map(e=>e.replaceAll(`_`,` `).replace(/\b[a-z]/g,e=>e.toUpperCase())).join(` · `)}function K({receipt:e,onOpenConversation:t}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Inconclusive benchmark`})}),(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:e.reason}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(X,{label:`Held-out baseline tokens`,value:e.usage.baseline.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Adaptation baseline tokens`,value:e.usage.adaptation.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Refiner tokens`,value:e.usage.refiner.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Grader tokens`,value:e.usage.grader.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Observed / maximum spend`,value:`$${e.budget.observedSpendUsd.toFixed(4)} / $${e.budget.maximumSpendUsd.toFixed(2)}`}),(0,P.jsx)(X,{label:`Harness candidate`,value:e.stopReason===`candidate_harness_unchanged`?`Unchanged`:`Lineage invalid`}),(0,P.jsx)(X,{label:`Completed attempts`,value:e.attempts.length.toLocaleString()}),(0,P.jsx)(X,{label:`Candidate attempts`,value:`Skipped`})]})]}),e.attempts.length?(0,P.jsx)(Y,{receipt:e,onOpenConversation:t}):null]})}function De({run:e}){let t=[`baseline`,`adaptation`,`refiner`,`candidate_adaptation`,`candidate`,`comparison`],n={baseline:`Baseline`,adaptation:`Adaptation`,refiner:`Refiner`,candidate_adaptation:`Sequential adaptation`,candidate:`Candidate`,comparison:`Comparison`},r=Math.max(0,t.indexOf(e.evaluationProgress?.stage??`baseline`)),i=e.evaluationProgress?.completedAttempts??0,a=e.evaluationProgress?.totalAttempts??1;return(0,P.jsxs)(`div`,{className:`labs-benchmark-progress`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`h3`,{children:`Benchmark progress`}),(0,P.jsxs)(`strong`,{children:[i,` of `,a,` attempts`]})]}),(0,P.jsx)(`div`,{className:`labs-benchmark-progress-track`,"aria-hidden":`true`,children:(0,P.jsx)(`span`,{style:{width:`${Math.min(100,i/a*100)}%`}})}),(0,P.jsx)(`ol`,{children:t.map((e,t)=>(0,P.jsxs)(`li`,{className:t<r?`complete`:t===r?`active`:void 0,children:[(0,P.jsx)(`span`,{}),n[e]]},e))})]})}function q({receipt:e}){let t=o(e),n=t.pairs.filter(e=>e.cohort===`held_out`),r=t.pairs.filter(e=>e.cohort===`adaptation`),i=e=>e.length?e.reduce((e,t)=>e+t,0)/e.length:0;return(0,P.jsxs)(`div`,{className:`labs-benchmark-attempt-charts`,children:[(0,P.jsx)(J,{title:`Held-out tokens by task`,baseline:n.map(e=>e.baseline.totalTokens),candidate:n.map(e=>e.refined.totalTokens),format:e=>Math.round(e).toLocaleString()}),(0,P.jsx)(J,{title:`Adaptation tokens by task`,baseline:r.map(e=>e.baseline.totalTokens),candidate:r.map(e=>e.refined.totalTokens),format:e=>Math.round(e).toLocaleString()}),(0,P.jsx)(J,{title:`Held-out quality by task`,baseline:n.map(e=>e.baseline.score),candidate:n.map(e=>e.refined.score),format:e=>e.toFixed(2),summarize:i}),(0,P.jsx)(J,{title:`Adaptation quality by task`,baseline:r.map(e=>e.baseline.score),candidate:r.map(e=>e.refined.score),format:e=>e.toFixed(2),summarize:i})]})}function Oe({receipt:e,run:t,tasksetName:n,onOpenTaskset:r}){let i=o(e),a=i.comparedTaskCount>0,s=i.passed,c=i.tokenDeltaPercent===null?`—`:`${i.tokenDeltaPercent>0?`+`:``}${i.tokenDeltaPercent.toFixed(2)}%`,l=e=>{let t=i.cohorts[e];return`${t.passedTaskCount}/${t.comparedTaskCount} passed`};return(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Token efficiency`})}),a?(0,P.jsxs)(`div`,{className:`labs-benchmark-efficiency-summary`,children:[(0,P.jsxs)(`strong`,{children:[i.passedTaskCount,` of `,i.comparedTaskCount,` tasks passed`]}),(0,P.jsxs)(`p`,{children:[`A task passes only when its refined token count is strictly lower than its own baseline. `,i.failedTaskCount,` failed this token-efficiency test; aggregate usage changed by `,c,`.`]})]}):(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:`Paired task-level token evidence is unavailable for this run.`}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(X,{label:`Execution`,value:w(t.status)}),(0,P.jsx)(X,{label:`Token-efficiency result`,value:s?`Passed`:`Failed`}),(0,P.jsx)(X,{label:`Efficiency passes`,value:`${i.passedTaskCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`Efficiency failures`,value:`${i.failedTaskCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`All-task foreground tokens`,value:`${i.baselineTokens.toLocaleString()} → ${i.refinedTokens.toLocaleString()}`}),(0,P.jsx)(X,{label:`Aggregate token change`,value:c}),(0,P.jsx)(X,{label:`Adaptation replay`,value:l(`adaptation`)}),(0,P.jsx)(X,{label:`Held-out replay`,value:l(`held_out`)}),(0,P.jsx)(X,{label:`Task quality`,value:`${i.baselinePassedCount}/${i.comparedTaskCount} → ${i.refinedPassedCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`Result lineage`,value:e.lineage.valid?`Valid`:`Invalid`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:`Taskset`}),(0,P.jsx)(`dd`,{children:r?(0,P.jsx)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:r,children:n}):n})]})]})]})}function J({title:e,baseline:t,candidate:n,format:r,summarize:i=e=>e.reduce((e,t)=>e+t,0)}){let a=t.filter(e=>e!==null),o=n.filter(e=>e!==null),s=Math.max(1,...a,...o),c=Math.max(2,t.length,n.length),l=e=>{let t=[],n=[];return e.forEach((e,r)=>{if(e===null){n.length&&t.push(n.join(` `)),n=[];return}let i=6+r/(c-1)*88,a=44-e/s*36;n.push(`${i},${a}`)}),n.length&&t.push(n.join(` `)),t},u=e=>e.flatMap((e,t)=>e===null?[]:[{x:6+t/(c-1)*88,y:44-e/s*36}]);return(0,P.jsxs)(`section`,{className:`labs-benchmark-line-chart`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`h4`,{children:e}),(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`span`,{children:[`Baseline `,r(i(a))]}),(0,P.jsxs)(`span`,{children:[`Refined `,r(i(o))]})]})]}),(0,P.jsxs)(`svg`,{"aria-label":e,role:`img`,viewBox:`0 0 100 50`,preserveAspectRatio:`none`,children:[(0,P.jsx)(`line`,{x1:`6`,x2:`94`,y1:`44`,y2:`44`}),l(t).map((e,t)=>(0,P.jsx)(`polyline`,{className:`baseline`,points:e},`baseline-${t}`)),l(n).map((e,t)=>(0,P.jsx)(`polyline`,{className:`candidate`,points:e},`candidate-${t}`)),u(t).map((e,t)=>(0,P.jsx)(`circle`,{className:`baseline`,cx:e.x,cy:e.y,r:`1`},`baseline-point-${t}`)),u(n).map((e,t)=>(0,P.jsx)(`circle`,{className:`candidate`,cx:e.x,cy:e.y,r:`1`},`candidate-point-${t}`))]})]})}function Y({receipt:e,onOpenConversation:t}){let n=e.schemaVersion===`openpond.modelEvaluationReceipt.v1`?d(e.attempts??[]):e.attempts??[];return(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:e.schemaVersion===`openpond.modelEvaluationReceipt.v1`?`Selected task results`:`Completed attempts`})}),(0,P.jsx)(`div`,{className:`training-table-wrap`,children:(0,P.jsxs)(`table`,{className:`training-data-table labs-benchmark-attempt-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Task`}),(0,P.jsx)(`th`,{children:`Phase`}),(0,P.jsx)(`th`,{children:`Result`}),(0,P.jsx)(`th`,{children:`Score`}),(0,P.jsx)(`th`,{children:`Tokens`}),(0,P.jsx)(`th`,{children:`Work chat`})]})}),(0,P.jsx)(`tbody`,{children:n.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:ke(e.taskId)}),(0,P.jsx)(`td`,{children:e.phase}),(0,P.jsx)(`td`,{children:(0,P.jsx)(b,{label:e.passed?`Passed`:`Failed`,value:e.passed?`succeeded`:`failed`})}),(0,P.jsx)(`td`,{children:e.score===null?`—`:e.score.toFixed(2)}),(0,P.jsx)(`td`,{children:e.totalTokens.toLocaleString()}),(0,P.jsx)(`td`,{children:e.sessionId?(0,P.jsx)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:()=>t(e.sessionId),children:`Open chat`}):`Not retained`})]},`${e.phase}:${e.attemptId}`))})]})})]})}function ke(e){return e.replace(/^(?:adaptation|frozen)-/,``).replaceAll(`-`,` `).replace(/^./,e=>e.toUpperCase())}function X({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function Ae(e){let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:2)} ${t[r]}`}function je({error:e,events:t,loading:n,pending:r}){let[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)({}),[c,l]=(0,N.useState)(!0),u=(0,N.useRef)(null),d=(0,N.useRef)(null),f=(0,N.useRef)(null),p=(0,N.useMemo)(()=>Me(t),[t]),m=(0,N.useMemo)(()=>t.filter(e=>o[Z(e)]??Ne(Z(e))),[t,o]),h=p.filter(e=>o[e.id]??Ne(e.id)).length,g=p.length>0&&h===p.length,_=h>0&&!g;return(0,N.useEffect)(()=>{f.current&&(f.current.indeterminate=_)},[_]),(0,N.useEffect)(()=>{if(!i)return;let e=e=>{d.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,N.useLayoutEffect)(()=>{let e=u.current;e&&c&&(e.scrollTop=e.scrollHeight)},[e,c,r,m]),n&&!t.length?(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`Loading run events…`}):t.length?(0,P.jsxs)(`div`,{className:`training-event-log-shell`,children:[(0,P.jsxs)(`div`,{className:`training-event-log-toolbar`,children:[(0,P.jsx)(`div`,{children:(0,P.jsx)(`strong`,{children:`Activity log`})}),(0,P.jsxs)(`div`,{className:`training-event-filter`,ref:d,children:[(0,P.jsxs)(`button`,{"aria-expanded":i,"aria-haspopup":`menu`,className:`training-event-filter-trigger`,type:`button`,onClick:()=>a(e=>!e),children:[(0,P.jsx)(ie,{"aria-hidden":`true`,size:14}),`Event types`,(0,P.jsxs)(`span`,{children:[h,`/`,p.length]}),(0,P.jsx)(E,{"aria-hidden":`true`,size:13})]}),i?(0,P.jsxs)(`div`,{"aria-label":`Filter training activity by event type`,className:`training-event-filter-menu`,role:`menu`,children:[(0,P.jsxs)(`label`,{className:`training-event-filter-option select-all`,children:[(0,P.jsx)(`input`,{checked:g,ref:f,type:`checkbox`,onChange:e=>{let t=e.currentTarget.checked;s(Object.fromEntries(p.map(e=>[e.id,t])))}}),(0,P.jsx)(`span`,{className:`training-event-filter-check`,children:(0,P.jsx)(j,{"aria-hidden":`true`,size:12})}),`Select all`]}),(0,P.jsx)(`div`,{className:`training-event-filter-options`,children:p.map(e=>{let t=o[e.id]??Ne(e.id);return(0,P.jsxs)(`label`,{className:`training-event-filter-option`,children:[(0,P.jsx)(`input`,{checked:t,type:`checkbox`,onChange:t=>s(n=>({...n,[e.id]:t.currentTarget.checked}))}),(0,P.jsx)(`span`,{className:`training-event-filter-check`,children:(0,P.jsx)(j,{"aria-hidden":`true`,size:12})}),(0,P.jsx)(`span`,{children:e.label}),(0,P.jsx)(`small`,{children:e.count.toLocaleString()})]},e.id)})})]}):null]})]}),(0,P.jsxs)(`div`,{"aria-label":`Training activity log`,"aria-live":`polite`,className:`training-event-log`,ref:u,role:`log`,onScroll:e=>{let t=e.currentTarget,n=t.scrollHeight-t.scrollTop-t.clientHeight;l(n<=6)},children:[(0,P.jsxs)(`div`,{"aria-hidden":`true`,className:`training-event-log-header`,children:[(0,P.jsx)(`span`,{children:`Time`}),(0,P.jsx)(`span`,{children:`Event type`}),(0,P.jsx)(`span`,{children:`Details`})]}),m.map(e=>(0,P.jsxs)(`div`,{className:`training-event-log-line ${e.type}`,children:[(0,P.jsx)(`time`,{dateTime:e.timestamp,children:C(e.timestamp)}),(0,P.jsx)(`span`,{children:Pe(Z(e))}),(0,P.jsx)(`code`,{children:Fe(e)})]},e.id)),r&&!e?(0,P.jsxs)(`div`,{className:`training-event-log-loading`,role:`status`,children:[(0,P.jsx)(re,{"aria-hidden":`true`,className:`spin`,size:14}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Waiting for new activity`})]}):null,m.length?null:(0,P.jsx)(`div`,{className:`training-event-log-empty`,children:`No events match the selected event types.`}),e?(0,P.jsxs)(`div`,{className:`training-event-log-line failure`,children:[(0,P.jsx)(`time`,{children:`—`}),(0,P.jsx)(`span`,{children:`Failure`}),(0,P.jsx)(`code`,{children:e})]}):null]})]}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:e??`No normalized run events were recorded.`})}function Z(e){return typeof e.payload.remoteEventType==`string`&&e.payload.remoteEventType.trim()?e.payload.remoteEventType:typeof e.payload.telemetryType==`string`&&e.payload.telemetryType.trim()?e.payload.telemetryType:e.type}function Me(e){let t=new Map;for(let n of e){let e=Z(n);t.set(e,(t.get(e)??0)+1)}return[...t.entries()].map(([e,t])=>({id:e,count:t,label:Pe(e)})).sort((e,t)=>e.label.localeCompare(t.label))}function Ne(e){return e!==`metric`&&!e.endsWith(`_metric`)}function Pe(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Fe(e){let t=e.payload,n=ze(t.step),r=ze(t.maxSteps);if(typeof t.telemetryType==`string`){let e=typeof t.message==`string`?t.message:null,r=typeof t.errorCode==`string`?t.errorCode:null,i=typeof t.telemetrySource==`string`?` · ${t.telemetrySource}`:``;return`${e??t.telemetryType.replaceAll(`_`,` `)}${n==null?``:` · step ${n}`}${i}${r?` · ${r}`:``}`}if(typeof t.remoteEventType==`string`){let e=Ie(t.remoteEventType),r=typeof t.remotePhase==`string`?Le(t.remotePhase):null,i=typeof t.errorCode==`string`&&t.errorCode.trim()?t.errorCode.trim():null;return[e,r,n==null?null:`step ${n}`,i?`error ${i}`:null].filter(e=>!!e).join(` · `)}if(e.type===`start`)return typeof t.device==`string`?`Worker started on ${t.device}.`:`Worker started.`;if(e.type===`progress`&&n!=null)return r==null?`Step ${n}.`:`Step ${n} of ${r}.`;if(e.type===`metric`){let e=typeof t.metricKind==`string`?t.metricKind.replaceAll(`_`,` `):`metric`,r=[Q(`loss`,t.loss),Q(`reward`,t.meanReward??t.reward),Q(`policy loss`,t.policyLoss),Q(`value loss`,t.valueLoss),Q(`preference accuracy`,t.preferenceAccuracy,Be)].filter(e=>!!e),i=typeof t.failureClass==`string`?t.failureClass:null,a=typeof t.failureCode==`string`?t.failureCode:null,o=typeof t.metricId==`string`&&typeof t.value==`number`?` · ${t.metricId}: ${t.value.toPrecision(4)}`:``;return`${e}${n==null?``:` · step ${n}`}${o}${i?` · ${i}`:``}${a?` · ${a}`:``}${r.length?` · ${r.join(` · `)}`:``}`}if(e.type===`checkpoint`){let e=ze(t.policyVersion),n=ze(t.sizeBytes),r=[e==null?null:`policy ${e}`,n==null?null:Ae(n),t.final===!0?`final`:null].filter(e=>!!e);return r.length?`Checkpoint committed · ${r.join(` · `)}.`:`Checkpoint committed.`}if(e.type===`complete`){let e=ze(t.artifactCount);return e==null?`Worker completed.`:`Worker completed with ${e} artifacts.`}return e.type===`failure`&&typeof t.message==`string`?t.message:Object.keys(t).length?JSON.stringify(t):`Recorded.`}function Ie(e){return{drain:`Rollout drain`,infer:`Model inference`,materialize_checkpoint:`Checkpoint materialization`,optimizer_metric:`Optimizer metric`,provision_gpu:`GPU provisioning`,rollout_metric:`Rollout trajectory`,score_reward_model:`Reward scoring`,start_inference:`Policy server`,train_step:`Optimizer update`,upload_checkpoint:`Checkpoint upload`}[e]??Re(e)}function Le(e){return{committed:`committed`,completed:`completed`,eligible:`recorded`,failed:`failed`,running:`running`,succeeded:`succeeded`}[e]??Re(e).toLocaleLowerCase()}function Re(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Q(e,t,n=e=>new Intl.NumberFormat(void 0,{maximumFractionDigits:4}).format(e)){let r=ze(t);return r==null?null:`${e} ${n(r)}`}function ze(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Be(e){return`${(e*100).toFixed(1)}%`}function Ve({connection:e,detailTab:t,onDetailTabChange:n,selectedEntryKey:r,workproduct:o,runs:d,training:f,onOpenDataset:b,onOpenConversation:x,detailKind:C}){let E=f.payload,[D,re]=(0,N.useState)(null),k=(0,N.useMemo)(()=>l(o,d,E),[d,E,o]),A=(0,N.useMemo)(()=>h(o,d,E),[d,E,o]),j=(0,N.useMemo)(()=>m(o,E),[E,o]),ie=(0,N.useMemo)(()=>u(o,d,E),[d,E,o]),se=(0,N.useMemo)(()=>new Map(ie.map(e=>[e.id,e])),[ie]),M=(0,N.useMemo)(()=>s(k,A),[k,A]).find(e=>e.key===r)??null,F=r.startsWith(`model-run:`)?r.slice(10):null,I=F?j.find(e=>e.id===F)??null:M?.job?j.find(e=>e.id===M.job?.metadata.modelRunId)??null:null,L=M?.job??(I?E?.jobs.find(e=>e.id===I.id||e.metadata.modelRunId===I.id)??null:null),pe=E?.comparisonSeriesEntries.find(e=>e.modelRunId===I?.id||e.modelRunId===L?.metadata.modelRunId)??null,he=a.shape.recovery.safeParse(L?.metadata.hostedRecovery),R=he.success?he.data:void 0,ge=O.shape.continuation.safeParse(L?.metadata.hostedContinuation),z=ge.success?ge.data:void 0,_e=z?A.find(e=>e.lineage.jobId===z.sourceArtifact.jobId):void 0,ve=R?`Recovered checkpoint`:_e?`Version ${_e.number}`:z?`Checkpoint ${z.sourceArtifact.checkpointId}`:typeof L?.metadata.parentHostedArtifactId==`string`?`Prior hosted run`:ue(E,pe),ye=(0,N.useMemo)(()=>{let e=v(k,A,j);return p(e,I?.kind===`evaluation`?`evals`:`training`)},[k,j,I?.kind,A]),xe=ye.findIndex(e=>e.key===r||L!==null&&e.job?.id===L.id||I!==null&&e.lifecycleRun?.id===I.id),B=xe<0?null:ye.length-xe,V=M?.version??(I?.adapterArtifactLineageId?A.find(e=>e.lineage.id===I.adapterArtifactLineageId)??null:null),H=(I?E?.modelVersions.find(e=>e.id===I.modelVersionId)?.baseModel.modelId:null)??E?.modelVersions.filter(e=>e.modelId===o.id&&e.kind===`base_reference`).sort((e,t)=>t.version-e.version)[0]?.baseModel.modelId??(typeof L?.metadata.baseModelId==`string`?L.metadata.baseModelId:null),U=V?.lineage.frozenEvaluationArtifactId??null,W=V?.plan??(L?se.get(L.planId)??null:null),G=V?.taskset??_(E).find(e=>e.id===(I?.taskset.id??W?.tasksetId??L?.metadata.tasksetId))??null,Te=G?.name??(typeof L?.metadata.tasksetId==`string`?L.metadata.tasksetId:`Unavailable`),Ee=I?.method??W?.recipe.method??Ke(L?.metadata),K=Ce(e,L?.id??null,L?.status??null,t===`evaluation`),De=L?E?.rolloutReceipts.filter(e=>e.jobId===L.id)??[]:[],q=K.detail?.managedEvidence??null,Oe=K.detail?.events.some(e=>e.type===`metric`&&e.payload.metricKind===`rollout_trajectory`)??!1,J=c({lifecycleRun:I,job:K.detail?.job??L}),Y=y(J),ke=I?.status===`failed`&&L?.metadata.phase===`artifact_collection_failed`,X=Ee===`grpo`,Z=Ue(L?.metadata),Me=(W&&(W.recipe.method===`sft`||W.recipe.method===`dpo`||W.recipe.method===`grpo`)?W.recipe.optimizer.maxSteps:null)??q?.progress.targetOptimizerSteps??null,Ne=Me!==null&&typeof L?.metadata.progress==`number`&&Number.isFinite(L.metadata.progress)?Math.floor(Math.max(0,L.metadata.progress)*Me):0,Pe=Math.max(0,Z?.optimizerUpdatesApplied??0,Ne,K.detail?.policyMetrics.reduce((e,t)=>Math.max(e,t.step),0)??0,K.detail?.stepMetrics.reduce((e,t)=>Math.max(e,t.step),0)??0,q?.progress.committedOptimizerSteps??0),Fe=He(X&&Z?Z.groupsCompleted:Pe,X&&Z?Z.groupsTarget:Me),Ie=C===`run`?{id:`details`,label:`Details`}:{id:`overview`,label:`Overview`},Le=[...C===`run`&&L?[{id:`metrics`,label:`Metrics`}]:[],Ie,...C===`version`&&L?[{id:`metrics`,label:`Metrics`}]:[],{id:`evaluation`,label:`Evaluation`},...De.length||Oe?[{id:`rollouts`,label:`Rollouts`}]:[],{id:`artifacts`,label:`Artifacts`},...L?[{id:`activity`,label:`Activity`}]:[]],Re=t,Q=Le.some(e=>e.id===Re)?Re:Le[0].id;return!M&&!I&&f.loading?(0,P.jsxs)(`div`,{className:`labs-model-version-detail`,children:[(0,P.jsx)(ae,{title:`Run details`}),(0,P.jsx)(`p`,{role:`status`,children:`Loading training run…`})]}):!M&&!I?(0,P.jsx)(`div`,{className:`labs-model-version-detail`,children:(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`This training attempt is no longer available.`})}):I?.kind===`evaluation`?(0,P.jsx)(We,{run:I,runNumber:B,tasksetName:G?.name??`Unavailable`,onOpenTaskset:G?()=>b(G.id):void 0,onOpenConversation:x}):(0,P.jsxs)(`div`,{className:`labs-model-version-detail`,children:[(0,P.jsx)(ae,{title:I||L?B?`Run ${B}`:`Run details`:V?`Version ${V.number}`:`Run details`,description:`${te(Ee)} on ${Ge(W,H)}`,status:(0,P.jsx)(g,{status:J}),actions:Y&&(I||L)?(0,P.jsx)(`button`,{type:`button`,className:`training-button secondary`,disabled:f.busyAction!==null||J===`cancelling`,onClick:async()=>{let e=I?.id??L.id,t=I?await f.actions.cancelModelRun(I.id):await f.actions.cancelJob(L.id);re({runId:e,message:t?`Cancellation requested. Waiting for the training service to confirm.`:`Cancellation could not be requested. Try again.`})},children:J===`cancelling`?`Cancelling…`:f.busyAction===`cancel-model-run`||f.busyAction===`cancel-job`?`Requesting cancellation…`:`Cancel run`}):ke&&I?(0,P.jsx)(`button`,{type:`button`,className:`training-button secondary`,disabled:f.busyAction!==null,onClick:async()=>{let e=await f.actions.retryModelRunCollection(I.id);re({runId:I.id,message:e?.state===`succeeded`?`Outputs collected from the completed training job.`:`Collection failed. The training job and its outputs are retained.`})},children:f.busyAction===`retry-model-run-collection`?`Collecting…`:`Retry collection`}):void 0,metrics:[{label:X&&Z?`Training groups`:`Training steps`,value:Fe.value},...R&&Z?[{label:`Optimizer updates`,value:`${Math.max(0,Z.optimizerUpdatesApplied-R.policyVersion)} new · ${R.policyVersion} reused`}]:[],{label:Y?`Latest reward`:`Final reward`,value:Je(I?.reward?.raw??q?.reward.finalMean??null)},{label:`Duration`,value:I?T(I.startedAt,S(I.status,I.completedAt,I.updatedAt)):L?T(L.startedAt,S(L.status,L.completedAt,L.updatedAt)):`Not recorded`},{label:`Output`,value:V?`Version ${V.number}`:`No version`},{label:`Based on`,value:ve},{label:`Taskset`,value:Te,onSelect:G?()=>b(G.id):void 0,ariaLabel:G?`Open Taskset ${G.name}`:void 0}]}),(0,P.jsx)(ee,{recovery:R}),z?(0,P.jsx)(i,{continuation:{sourceJobId:z.sourceArtifact.jobId,checkpointId:z.sourceArtifact.checkpointId}}):null,D&&D.runId===(I?.id??L?.id)?(0,P.jsx)(`p`,{role:`status`,children:D.message}):null,(0,P.jsxs)(`section`,{className:`labs-run-detail-tabs`,children:[(0,P.jsx)(`div`,{className:`training-detail-tabs`,role:`tablist`,"aria-label":`Run details`,children:Le.map(e=>(0,P.jsx)(`button`,{"aria-controls":`run-detail-panel-${e.id}`,"aria-selected":Q===e.id,className:Q===e.id?`active`:void 0,id:`run-detail-tab-${e.id}`,role:`tab`,type:`button`,onClick:()=>n(e.id),children:e.label},e.id))}),(0,P.jsxs)(`div`,{"aria-labelledby":`run-detail-tab-${Q}`,className:`labs-run-detail-tab-panel`,id:`run-detail-panel-${Q}`,role:`tabpanel`,children:[Q===Ie.id?(0,P.jsx)(we,{baseModel:Ge(W,H),compute:I?ne(I.destinationId??``):W?ne(W.destinationId):L?ne(L.destinationId):`Not recorded`,duration:I?T(I.startedAt,S(I.status,I.completedAt,I.updatedAt)):L?T(L.startedAt,S(L.status,L.completedAt,L.updatedAt)):`Not recorded`,failure:L?.error??I?.failure??null,configuration:[...z?[{label:`Starting checkpoint`,value:[_e?`Version ${_e.number}`:null,z.sourceArtifact.checkpointId].filter(Boolean).join(` · `)},{label:`Parent run`,value:z.sourceArtifact.jobId},{label:`Parent artifact`,value:z.sourceArtifact.artifactId},{label:`Optimizer`,value:z.optimizerMode===`reset`?`Reset`:`Continue`}]:le(E,pe),...ce(W)],evidence:q,method:te(Ee),output:V?`Version ${V.number}`:`No version created`,reward:I?.reward?.raw??q?.reward.finalMean??null,status:I?w(I.status):L?w(L.status):`Imported`,statusValue:I?.status??L?.status??`imported`,taskset:Te,telemetry:I?.receipt?.schemaVersion===`openpond.modelRunReceipt.v1`?I.receipt.telemetry:null,title:I||L?B?`Run ${B}`:`Run details`:V?`Version ${V.number}`:`Run details`,versionStatus:V?V.current?`Active`:`Available`:null,onOpenTaskset:G?()=>b(G.id):void 0,showHeader:!1}):null,Q===`metrics`&&L?(0,P.jsx)(oe,{detail:K.detail,error:K.error,loading:K.loading,taskset:G}):null,Q===`artifacts`?(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)($,{label:`Training attempt`,value:L?.id??`Provider import`}),(0,P.jsx)($,{label:`Taskset`,value:Te}),(0,P.jsx)($,{label:`Prepared data`,value:L?.bundleHash??`Provider managed`}),(0,P.jsx)($,{label:`Version ID`,value:V?.lineage.id??`No version created`}),q?.checkpoint?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($,{label:`Checkpoint`,value:q.checkpoint.id}),(0,P.jsx)($,{label:`Checkpoint size`,value:q.checkpoint.sizeBytes==null?`Not reported`:Ae(q.checkpoint.sizeBytes)}),(0,P.jsx)($,{label:`Checkpoint hash`,value:q.checkpoint.sha256??`Not reported`})]}):null,q?.canonicalPublication.state?(0,P.jsx)($,{label:`Registry publication`,value:Ye(q.canonicalPublication.state)}):null]}):null,Q===`evaluation`?(0,P.jsxs)(`div`,{className:`training-run-evaluation`,children:[!q?.evaluations.length||K.detail?.evaluation?(0,P.jsx)(me,{detail:K.detail,loading:K.loading,pending:Y}):null,!K.detail?.evaluation&&q?.evaluations.length?(0,P.jsx)(`dl`,{className:`labs-inline-facts`,children:q.evaluations.map(e=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsx)($,{label:e.kind===`baseline`?`Baseline score`:`Candidate score`,value:e.score==null?`Not reported`:e.score.toFixed(6)}),(0,P.jsx)($,{label:e.kind===`baseline`?`Baseline coverage`:`Candidate coverage`,value:e.taskCount==null?`Not reported`:e.targetTaskCount==null?`${e.taskCount} ${e.taskCount===1?`task`:`tasks`} scored`:`${e.taskCount} of ${e.targetTaskCount} ${e.targetTaskCount===1?`task`:`tasks`} scored`})]},`${e.kind}:${e.policyVersion}`))}):null,V&&L?.destinationId===`openpond_managed`?(0,P.jsx)(be,{connection:e,lineageId:V.lineage.id,onSaved:f.refresh},V.lineage.id):null,!V&&L?.metadata.source===`hosted_model_project_import`&&L.status===`succeeded`?(0,P.jsx)(be,{connection:e,jobId:L.id,onSaved:f.refresh},`candidate:${L.id}`):null,L&&q?.evaluations.length?(0,P.jsx)(Se,{connection:e,jobId:L.id,evaluations:q.evaluations},L.id):null,U?(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,onClick:()=>void f.actions.downloadArtifact(U),children:`Download evaluation receipt`}):null]}):null,Q===`rollouts`?De.length?(0,P.jsx)(fe,{receipts:De}):(0,P.jsx)(de,{events:K.detail?.events??[]}):null,Q===`activity`&&L?(0,P.jsx)(je,{error:L.error??K.error,events:K.detail?.events??[],loading:K.loading,pending:Y}):null]})]})]})}function He(e,t){let n=Math.max(0,Math.floor(e));if(t===null||!Number.isFinite(t)||t<=0)return{value:n.toLocaleString(),hint:n===1?`completed update`:`completed updates`};let r=Math.max(1,Math.floor(t));return{value:`${n.toLocaleString()} / ${r.toLocaleString()}`,hint:`completed / planned`}}function Ue(e){let t=e?.rolloutProgress;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return[`groupsCompleted`,`groupsTarget`,`optimizerUpdatesApplied`,`optimizerUpdatesSkipped`].some(e=>typeof n[e]!=`number`||!Number.isInteger(n[e])||n[e]<0)?null:{groupsCompleted:n.groupsCompleted,groupsTarget:n.groupsTarget,optimizerUpdatesApplied:n.optimizerUpdatesApplied,optimizerUpdatesSkipped:n.optimizerUpdatesSkipped}}function We({run:e,runNumber:t,tasksetName:n,onOpenTaskset:r,onOpenConversation:i}){let[a,s]=(0,N.useState)(`results`),c=e.receipt?.schemaVersion===`openpond.modelEvaluationReceipt.v1`?e.receipt:null,l=e.receipt?.schemaVersion===`openpond.modelEvaluationStopReceipt.v1`?e.receipt:null,u=c?f(c):null,d=c?o(c):null;return(0,P.jsxs)(`div`,{className:`labs-model-version-detail labs-model-evaluation-detail`,children:[(0,P.jsx)(ae,{title:t?`Eval ${t}`:`Evaluation run`,description:`Harness Refiner benchmark · ${n}`,status:(0,P.jsx)(b,{label:c?d?.comparedTaskCount?`${d.passedTaskCount}/${d.comparedTaskCount} passed`:`No paired result`:l?`Inconclusive`:w(e.status),value:c?d?.comparedTaskCount&&d.passed?`succeeded`:`neutral`:l?.terminalClassification??e.status}),metrics:[{label:`Baseline pass rate`,value:c?`${(c.quality.baselinePassRate*100).toFixed(1)}%`:`—`},{label:`Candidate pass rate`,value:c?`${(c.quality.candidatePassRate*100).toFixed(1)}%`:`—`},{label:`Scenarios`,value:c?.attempts?.length??0},{label:`Execution`,value:w(e.status)}]}),(0,P.jsx)(`div`,{className:`training-detail-tabs`,role:`tablist`,"aria-label":`Evaluation details`,children:[`results`,`scenarios`,`activity`].map(e=>(0,P.jsx)(`button`,{className:a===e?`active`:void 0,"aria-selected":a===e,role:`tab`,type:`button`,onClick:()=>s(e),children:e===`results`?`Results`:e===`scenarios`?`Scenarios`:`Activity`},e))}),a===`results`&&c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(se,{series:[{id:`baseline`,label:`Held-out baseline`,inputTokens:u.baseline.inputTokens,outputTokens:u.baseline.outputTokens,tokens:u.baseline.totalTokens,passRate:c.quality.baselinePassRate,costUsd:u.baseline.costUsd},{id:`candidate`,label:`Held-out refined`,inputTokens:u.candidate.inputTokens,outputTokens:u.candidate.outputTokens,tokens:u.candidate.totalTokens,passRate:c.quality.candidatePassRate,costUsd:u.candidate.costUsd}]}),(0,P.jsx)(se,{series:[{id:`adaptation-baseline`,label:`Adaptation baseline`,inputTokens:u.adaptation.inputTokens,outputTokens:u.adaptation.outputTokens,tokens:u.adaptation.totalTokens,passRate:c.quality.adaptationBaselinePassRate,costUsd:u.adaptation.costUsd},{id:`adaptation-candidate`,label:`Adaptation replay`,inputTokens:u.candidate_adaptation.inputTokens,outputTokens:u.candidate_adaptation.outputTokens,tokens:u.candidate_adaptation.totalTokens,passRate:c.quality.adaptationCandidatePassRate,costUsd:u.candidate_adaptation.costUsd}]}),(0,P.jsx)(Oe,{receipt:c,run:e,tasksetName:n,onOpenTaskset:r})]}):a===`results`&&l?(0,P.jsx)(K,{receipt:l,onOpenConversation:i}):a===`results`?(0,P.jsx)(`section`,{className:`labs-run-summary-card`,children:e.failure?(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:e.failure}):(0,P.jsx)(De,{run:e})}):null,a===`scenarios`&&c?(0,P.jsxs)(P.Fragment,{children:[(c.attempts??[]).length?(0,P.jsx)(q,{receipt:c}):null,(c.attempts??[]).length?(0,P.jsx)(Y,{receipt:c,onOpenConversation:i}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No per-scenario attempts were retained.`})]}):null,a===`activity`?(0,P.jsxs)(`dl`,{className:`labs-inline-facts`,children:[(0,P.jsx)($,{label:`Run ID`,value:e.id}),(0,P.jsx)($,{label:`Status`,value:w(e.status)}),(0,P.jsx)($,{label:`Started`,value:e.startedAt?C(e.startedAt):`Not started`}),(0,P.jsx)($,{label:`Completed`,value:e.completedAt?C(e.completedAt):`In progress`})]}):null]})}function Ge(e,t=null){if(!e)return t?qe(t):`Not recorded`;let n=e.recipe.method===`sft`||e.recipe.method===`grpo`?e.recipe.baseModel:e.recipe.method===`dpo`?e.recipe.policyModel:e.recipe.method===`ppo`?e.recipe.policyOptimization.policyModel:null;return n?qe(n.id):`Not recorded`}function Ke(e){let t=e?.trainingMethod;return t===`sft`||t===`dpo`||t===`grpo`||t===`ppo`||t===`sdft`||t===`opd`||t===`opsd`||t===`sdpo`?t:null}function qe(e){return e.split(`/`).at(-1)??e}function Je(e){return e===null?`Not reported`:e.toFixed(4)}function $({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function Ye(e){return e?e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()):`Pending`}export{Ve as LabModelVersionDetailPage,Fe as eventSummary,He as formatTrainingProgress,Ue as managedRolloutProgress};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-DiVhx1GM.js";import{t as r}from"./useQuery-DkPec_9x.js";import{C as i,O as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,o as g,p as _,r as v,s as y,v as b,w as ee}from"./LabModelWorkspace-DTeYViWH.js";import{t as x}from"./query-scope-BRpcgljO.js";import"./icons-4yRSxBZj.js";import{c as S,l as te,n as C,o as w,r as T,t as ne}from"./training-model-data-B6IZ3x-t.js";import{t as E}from"./chevron-down-Bn8yph2O.js";import{t as D}from"./chevron-right-BU-jUmb2.js";import{t as re}from"./loader-circle-DBl6qqtR.js";import{Fn as O,Gt as k,Tn as A,gn as j,rn as ie}from"./App-CXhxya9x.js";import{t as ae}from"./ModelProjectPageHeader-BZn9Lu_J.js";import{lt as oe}from"./MainPane-D3fQou29.js";import{t as se}from"./LabsRoute-D3XqPB0-.js";function ce(e){if(!e)return[];let t=e.recipe;return t.method===`grpo`?[{label:`LoRA rank`,value:String(t.lora.rank)},{label:`Learning rate`,value:M(t.optimizer.learningRate)},{label:`Optimizer steps`,value:String(t.optimizer.maxSteps)},{label:`Rollouts per update`,value:String(t.rollout.groupSize)},{label:`Rollout concurrency`,value:String(t.rollout.concurrency)},{label:`Max output tokens`,value:t.rollout.maxOutputTokens.toLocaleString()},{label:`Temperature`,value:String(t.rollout.temperature)},{label:`Top P`,value:String(t.rollout.topP)}]:t.method===`sft`||t.method===`dpo`?[{label:`LoRA rank`,value:String(t.lora.rank)},{label:`Learning rate`,value:M(t.optimizer.learningRate)},{label:`Optimizer steps`,value:String(t.optimizer.maxSteps)}]:[]}function le(e,t){if(!e||!t)return[];if(t.parent.kind===`base_model`)return[{label:`Starting checkpoint`,value:`Frozen base · ${t.parent.revision}`},{label:`Optimizer`,value:`Fresh`}];let n=e.modelVersions.find(e=>e.id===t.parent.id);return[{label:`Starting checkpoint`,value:[e.comparisonSeriesEntries.find(e=>e.seriesId===t.seriesId&&e.modelVersionId===t.parent.id)?.label??null,n?`Version ${n.version}`:t.parent.id].filter(e=>!!e).join(` · `)},{label:`Optimizer`,value:`Fresh`}]}function ue(e,t){if(!e||!t||t.parent.kind===`base_model`)return`Frozen base`;let n=e.comparisonSeriesEntries.find(e=>e.seriesId===t.seriesId&&e.modelVersionId===t.parent.id),r=e.modelVersions.find(e=>e.id===t.parent.id);return[n?.label??`Prior checkpoint`,r?`Version ${r.version}`:null].filter(e=>!!e).join(` · `)}function M(e){return e===0?`0`:e.toExponential(2)}var N=e(t(),1),P=n();function de({events:e}){let t=e.filter(e=>e.type===`metric`&&e.payload.metricKind===`rollout_trajectory`);return t.length?(0,P.jsx)(`div`,{className:`training-rollout-receipts`,children:t.map((e,t)=>{let n=e.payload.rewardEligible===!0,r=I(e.payload.reward),i=typeof e.payload.failureClass==`string`?e.payload.failureClass:null,a=typeof e.payload.failureCode==`string`?e.payload.failureCode:null;return(0,P.jsxs)(`details`,{children:[(0,P.jsxs)(`summary`,{children:[(0,P.jsxs)(`span`,{children:[`Attempt `,t+1]}),(0,P.jsx)(`strong`,{children:n?`eligible`:`ineligible`}),(0,P.jsx)(`em`,{children:n&&r!=null?r.toFixed(3):a??i??`not reward eligible`})]}),(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)(F,{label:`Rollout`,value:L(e.payload.rolloutId)}),(0,P.jsx)(F,{label:`Group`,value:L(e.payload.rolloutGroupId)}),(0,P.jsx)(F,{label:`Policy`,value:`v${I(e.payload.policyVersion)??0}`}),(0,P.jsx)(F,{label:`Worker`,value:String((I(e.payload.workerSlot)??0)+1)}),(0,P.jsx)(F,{label:`Reward`,value:r==null?`Not eligible`:String(r)}),(0,P.jsx)(F,{label:`Failure class`,value:i??`None`}),(0,P.jsx)(F,{label:`Failure code`,value:a??`None`}),(0,P.jsx)(F,{label:`Components`,value:JSON.stringify(e.payload.rewardComponents??{})}),(0,P.jsx)(F,{label:`Tokens`,value:`${I(e.payload.inputTokens)??0} input · ${I(e.payload.outputTokens)??0} output`})]})]},e.id)})}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No managed attempts were recorded for this run.`})}function fe({receipts:e}){let[t,n]=(0,N.useState)(!1);if(!e.length)return(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No on-policy rollout receipts were recorded for this run.`});let r=[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)),i=t?r:r.slice(0,24);return(0,P.jsxs)(`div`,{className:`training-rollout-receipts`,children:[e.length>24?(0,P.jsxs)(`div`,{className:`training-rollout-receipt-controls`,children:[(0,P.jsx)(`span`,{children:t?`Showing all ${e.length} receipts`:`Showing latest ${i.length} of ${e.length} receipts`}),(0,P.jsx)(`button`,{className:`training-text-button`,type:`button`,onClick:()=>n(e=>!e),children:t?`Show latest 24`:`Show all ${e.length}`})]}):null,i.map(e=>(0,P.jsxs)(`details`,{children:[(0,P.jsxs)(`summary`,{children:[(0,P.jsx)(`span`,{children:pe(e.providerTrace.rolloutId)}),(0,P.jsx)(`strong`,{children:e.status}),(0,P.jsx)(`em`,{children:e.reward.eligible&&e.reward.raw!=null?e.reward.raw.toFixed(3):e.failureClass??`not reward eligible`})]}),(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)(F,{label:`Correlation`,value:e.correlationId}),(0,P.jsx)(F,{label:`Task`,value:e.taskId}),(0,P.jsx)(F,{label:`Policy`,value:e.policy.modelId}),(0,P.jsx)(F,{label:`Checkpoint`,value:e.policy.checkpointId??`Provider initial policy`}),(0,P.jsx)(F,{label:`Environment`,value:`${e.environment.id}@${e.environment.version}`}),(0,P.jsx)(F,{label:`World`,value:`${e.environment.worldId} · ${e.environment.worldHash}`}),(0,P.jsx)(F,{label:`Raw reward`,value:e.reward.raw==null?`Not eligible`:String(e.reward.raw)}),(0,P.jsx)(F,{label:`Components`,value:JSON.stringify(e.reward.components)}),(0,P.jsx)(F,{label:`Outcome`,value:e.verifier?.outcome??e.failureClass??`Pending`}),(0,P.jsx)(F,{label:`Trace`,value:`${e.providerTrace.experimentId}/${e.providerTrace.rolloutId}`})]})]},e.id))]})}function F({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function I(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function L(e){return typeof e==`string`&&e?e:`Not recorded`}function pe(e){return e.replace(/^lineage_/,``).slice(0,18)}function me({detail:e,loading:t,pending:n=!1}){if(t&&!e)return(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`Loading evaluation results…`});let r=e?.evaluation;return r?(0,P.jsxs)(`div`,{className:`training-run-evaluation`,children:[(0,P.jsxs)(`div`,{className:`training-metric-summary`,children:[(0,P.jsx)(R,{label:`Base score`,value:ge(r.base.meanScore)}),(0,P.jsx)(R,{label:`Trained score`,value:ge(r.trained.meanScore)}),(0,P.jsx)(R,{label:`Score change`,value:_e(r.meanScoreDelta)}),(0,P.jsx)(R,{label:`Trained pass rate`,value:z(r.trained.passRate)})]}),r.base.count===0?(0,P.jsx)(`p`,{className:`training-muted`,children:`Base-model scoring was not imported for this earlier run. New runs retain both base and trained evaluations.`}):null,r.trained.count>0&&r.trained.scoredCount===0?(0,P.jsx)(`p`,{className:`training-muted`,children:`Outputs were captured, but the grader was unavailable, so this run has no evaluation score.`}):null,(0,P.jsx)(`div`,{className:`training-table-wrap`,children:(0,P.jsxs)(`table`,{className:`training-data-table training-evaluation-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Test example`}),(0,P.jsx)(`th`,{children:`Base`}),(0,P.jsx)(`th`,{children:`Trained`}),(0,P.jsx)(`th`,{children:`Result`})]})}),(0,P.jsx)(`tbody`,{children:r.examples.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:(0,P.jsxs)(`details`,{children:[(0,P.jsx)(`summary`,{children:e.taskId}),(0,P.jsx)(he,{input:e.input,baseOutput:e.baseOutput,trainedOutput:e.trainedOutput,baseGrade:e.baseGrade,trainedGrade:e.trainedGrade})]})}),(0,P.jsx)(`td`,{children:ve(e.baseGrade)}),(0,P.jsx)(`td`,{children:ve(e.trainedGrade)}),(0,P.jsx)(`td`,{children:ye(e.baseGrade,e.trainedGrade)})]},e.taskId))})]})})]}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:n?`Evaluation will appear here after the first eligible checkpoint is scored.`:`No scored evaluation results are available for this run.`})}function he({input:e,baseOutput:t,trainedOutput:n,baseGrade:r,trainedGrade:i}){let a=[...new Set([...r?.feedback??[],...i?.feedback??[]])];return(0,P.jsxs)(`div`,{className:`training-evaluation-output`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Input`}),(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]}),t?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Base output`}),(0,P.jsx)(`pre`,{children:JSON.stringify(t,null,2)})]}):null,n?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Trained output`}),(0,P.jsx)(`pre`,{children:JSON.stringify(n,null,2)})]}):null,a.length?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Grader feedback`}),(0,P.jsx)(`p`,{children:a.join(` `)})]}):null]})}function R({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]})}function ge(e){return e==null?`Not recorded`:e.toFixed(3)}function z(e){return e==null?`Not recorded`:`${Math.round(e*100)}%`}function _e(e){return e==null?`Not comparable`:`${e>=0?`+`:``}${e.toFixed(3)}`}function ve(e){return e?.status===`unavailable`?`Unavailable`:e?.score==null?`Not scored`:e.score.toFixed(3)}function ye(e,t){if(!t)return`Not evaluated`;if(t.status===`unavailable`)return`Unavailable`;if(!e||e.score==null||t.score==null)return t.passed?`Passed`:`Failed`;let n=t.score-e.score;return Math.abs(n)<5e-4?`No change`:n>0?`Improved ${n.toFixed(3)}`:`Regressed ${Math.abs(n).toFixed(3)}`}function be({connection:e,lineageId:t,jobId:n,onSaved:r}){let i=n??t,a=n?`jobs`:`models`,[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(0),[u,d]=(0,N.useState)(!0),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(null),[b,ee]=(0,N.useState)(``),[x,S]=(0,N.useState)(null),[te,C]=(0,N.useState)([]),[w,T]=(0,N.useState)(!1);(0,N.useEffect)(()=>{if(!e){d(!1),p(!1),_(`Connect to OpenPond to review this candidate.`);return}let t=!0;return d(!0),p(!1),_(null),C([]),(async()=>{try{if(a===`models`){let n=await A.candidateReview(e,i);t&&n&&s(n)}let n=await A.candidateReview(e,i,!0,a);t&&(s(n),p(!!n))}catch(e){t&&_(xe(e))}finally{t&&d(!1)}})(),()=>{t=!1}},[e,i,a,c]);function ne(e){y(e),ee(``),S(null)}async function E(){if(!e||!o||!v||!b.trim())return;let t=x&&x.reason===b.trim()&&x.decision===v?x:{schemaVersion:`openpond.trainingCandidateDecisionRequest.v1`,...o.target,decision:v,reason:b.trim(),idempotencyKey:crypto.randomUUID(),expectedDecision:o.decision?{id:o.decision.id,contentHash:o.decision.contentHash}:null};S(t),h(!0),_(null);try{s(await A.recordCandidateReview(e,i,t,a)),y(null),S(null),C([]),await r()}catch(e){_(xe(e))}finally{h(!1)}}let D=(te.at(-1)??o?.decision)?.request.expectedDecision;async function re(){if(e&&D){T(!0),_(null);try{let t=await A.candidateReviewHistory(e,i,D,a);C(e=>[...e,t])}catch(e){_(xe(e))}finally{T(!1)}}}let O=o?.decision;return(0,P.jsxs)(`section`,{className:`training-run-evaluation`,"aria-label":`Candidate review`,children:[(0,P.jsx)(`h3`,{children:`Candidate review`}),O?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`strong`,{children:O.request.decision===`accepted`?`Accepted`:`Rejected`}),(0,P.jsx)(`p`,{children:O.request.reason}),(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Review `,O.revision,` · `,new Date(O.decidedAt).toLocaleString()]})]}):(0,P.jsx)(`p`,{className:`training-muted`,children:u?`Loading candidate review…`:o?`No candidate decision recorded.`:`Candidate review unavailable.`}),o?(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Last synced `,new Date(o.syncedAt).toLocaleString(),`. Acceptance keeps this candidate for later use; serving is activated separately.`]}):null,g?(0,P.jsx)(k,{error:g}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:u||m,onClick:()=>l(e=>e+1),children:`Refresh review`}),(0,P.jsx)(`button`,{className:`training-button`,type:`button`,disabled:!f||u||m||O?.request.decision===`accepted`,onClick:()=>ne(`accepted`),children:`Accept candidate`}),(0,P.jsx)(`button`,{className:`training-button danger`,type:`button`,disabled:!f||u||m||O?.request.decision===`rejected`,onClick:()=>ne(`rejected`),children:`Reject candidate`})]}),te.map(e=>(0,P.jsxs)(`details`,{className:`training-evidence`,children:[(0,P.jsxs)(`summary`,{children:[`Review `,e.revision,` · `,e.request.decision]}),(0,P.jsx)(`p`,{children:e.request.reason}),(0,P.jsx)(`p`,{children:new Date(e.decidedAt).toLocaleString()})]},e.id)),D?(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:w||m,onClick:()=>void re(),children:w?`Loading…`:`Earlier review`}):null,v?(0,P.jsx)(`div`,{className:`training-dialog-backdrop`,role:`presentation`,onMouseDown:()=>!m&&y(null),children:(0,P.jsxs)(`section`,{className:`training-dialog training-promotion-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Review candidate`,onMouseDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`div`,{className:`training-dialog-header`,children:(0,P.jsx)(`h2`,{children:v===`accepted`?`Accept this candidate?`:`Reject this candidate?`})}),(0,P.jsx)(`p`,{children:`The adapter and its recorded evaluation remain in the candidate’s history.`}),(0,P.jsxs)(`label`,{className:`training-promotion-reason`,children:[(0,P.jsx)(`span`,{children:`Reason`}),(0,P.jsx)(`textarea`,{autoFocus:!0,maxLength:5e3,value:b,onChange:e=>ee(e.target.value)})]}),g?(0,P.jsx)(k,{error:g}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:m,onClick:()=>y(null),children:`Cancel`}),(0,P.jsx)(`button`,{className:`training-button ${v===`rejected`?`danger`:``}`,type:`button`,disabled:m||!b.trim(),onClick:()=>void E(),children:m?`Saving…`:x?`Retry save`:`Save decision`})]})]})}):null]})}function xe(e){return e instanceof Error?e.message:`Candidate review could not be loaded.`}function Se({connection:e,jobId:t,evaluations:n}){let[r,i]=(0,N.useState)(null),a=n.filter(e=>e.reference),o=a.find(e=>e.reference?.id===r)??a.filter(e=>e.kind===`candidate`).at(-1)??a[0];return!e||!o?.reference?null:(0,P.jsxs)(`section`,{className:`training-run-evaluation`,"aria-label":`Retained evaluation answers`,children:[(0,P.jsxs)(`label`,{className:`training-taskset-selector`,children:[(0,P.jsx)(`span`,{children:`Evaluation answers`}),(0,P.jsx)(`select`,{value:o.reference.id,onChange:e=>i(e.target.value),children:a.map(e=>(0,P.jsxs)(`option`,{value:e.reference.id,children:[e.kind===`baseline`?`Baseline`:`Candidate`,` · policy `,e.policyVersion]},e.reference.id))})]}),(0,P.jsx)(B,{connection:e,jobId:t,evaluation:o.reference},`${t}:${o.reference.id}:${o.reference.contentHash}`)]})}function B({connection:e,jobId:t,evaluation:n}){let[r,i]=(0,N.useState)(),[a,o]=(0,N.useState)([]),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(!0),[p,m]=(0,N.useState)(0),{id:h,contentHash:g}=n;return(0,N.useEffect)(()=>{let n=!0;return f(!0),u(null),c(null),A.trainingEvaluationTasks(e,t,{id:h,contentHash:g},r).then(e=>{n&&c(e)}).catch(e=>{n&&u(e instanceof Error?e.message:String(e))}).finally(()=>{n&&f(!1)}),()=>{n=!1}},[e,t,h,g,r,p]),(0,P.jsxs)(`div`,{className:`training-run-evaluation`,"aria-busy":d,children:[d?(0,P.jsx)(`p`,{className:`training-muted`,children:`Loading recorded answers…`}):null,l?(0,P.jsx)(k,{error:l,children:(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,onClick:()=>m(e=>e+1),children:`Retry answers`})}):null,s?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`p`,{className:`training-muted`,children:[`Tasks `,s.offset+1,`–`,s.offset+s.tasks.length,` of`,` `,s.total,`. Recorded outputs and scores are retained for this run.`]}),s.tasks.map((e,t)=>(0,P.jsxs)(`details`,{className:`training-evidence`,children:[(0,P.jsxs)(`summary`,{children:[`Example `,s.offset+t+1,` · score `,e.score.toFixed(3)]}),(0,P.jsxs)(`div`,{className:`training-evaluation-output`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Instruction`}),(0,P.jsx)(`pre`,{children:e.input.instruction})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Context`}),(0,P.jsx)(`pre`,{children:JSON.stringify(e.input.context,null,2)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:`Recorded output`}),(0,P.jsx)(`pre`,{children:e.output})]})]})]},e.taskId))]}):null,(0,P.jsxs)(`div`,{className:`training-dialog-actions`,children:[(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:d||!a.length,onClick:()=>{i(a.at(-1)),o(e=>e.slice(0,-1))},children:`Previous tasks`}),(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,disabled:d||!s?.nextCursor,onClick:()=>{s?.nextCursor&&(o(e=>[...e,r]),i(s.nextCursor))},children:`Next tasks`})]})]})}var V=new Set([`queued`,`starting`,`running`,`cancelling`,`reconciling`]);function Ce(e,t,n,i=!1){let a=[`training-run-detail`,x(e),t,i],o=!!(e&&t),s=r({queryKey:[...a,`retained`],queryFn:({signal:n})=>A.trainingRunDetail(e,t,{includeEvaluation:i,refresh:!1,signal:n}),enabled:o,staleTime:3e4,gcTime:6e4}),c=r({queryKey:[...a,`hosted`],queryFn:({signal:n})=>A.trainingRunDetail(e,t,{includeEvaluation:i,signal:n}),enabled:o,staleTime:3e4,gcTime:6e4,refetchInterval:n&&V.has(n)?3e3:!1,refetchIntervalInBackground:!1}),l=c.data??s.data??null;return{detail:l,loading:o&&!l&&(s.isPending||c.isPending),error:c.error?.message??s.error?.message??null,refresh:async()=>(await c.refetch()).data??null}}function we({title:e,status:t,statusValue:n,versionStatus:r,method:i,baseModel:a,taskset:o,compute:s,duration:c,output:l,reward:u,telemetry:d,evidence:f,configuration:p,children:m,failure:h,onOpenTaskset:g,showHeader:_=!0}){let v=d?.cost.providerReportedUsd??d?.cost.estimatedUsd??f?.cost.totalUsd??null;return(0,P.jsxs)(`div`,{className:`labs-model-run-summary`,children:[_?(0,P.jsx)(`section`,{className:`labs-run-outcome-card`,children:(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`labs-run-title-row`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsx)(b,{label:t,value:n})]}),(0,P.jsxs)(`p`,{children:[Te(i),` on `,a]})]})})}):null,m,(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Run setup`})}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(H,{label:`Training method`,value:i}),(0,P.jsx)(H,{label:`Base model`,value:a}),(0,P.jsx)(H,{label:`Compute`,value:s}),(0,P.jsx)(H,{label:`Output`,value:l}),r?(0,P.jsx)(H,{label:`Version status`,value:r}):null,(0,P.jsx)(H,{label:`Duration`,value:c}),(0,P.jsx)(H,{label:`Run cost`,value:v===null?`Not reported`:`$${v.toFixed(4)}`}),(0,P.jsx)(H,{label:y(n)?`Latest reward`:`Final reward`,value:u===null?`Not reported`:u.toFixed(4)}),p.map(e=>(0,P.jsx)(H,{label:e.label,value:e.value},e.label)),d||f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(U,{label:`GPU`,value:W(d,f)}),(0,P.jsx)(U,{label:`Tokens`,value:`${G(d?.usage.promptTokens??f?.usage.inputTokens??null)} prompt · ${G(d?.usage.generatedTokens??f?.usage.outputTokens??null)} generated`}),(0,P.jsx)(U,{label:`Trajectories`,value:`${G(d?.usage.successfulTrajectories??f?.reward.eligibleTrajectoryCount??null)} succeeded · ${G(d?.usage.failedTrajectories??(f?f.reward.trajectoryCount-f.reward.eligibleTrajectoryCount:null))} failed`}),(0,P.jsx)(U,{label:`Optimizer updates`,value:G(d?.usage.optimizerSteps??f?.progress.committedOptimizerSteps??null)}),(0,P.jsx)(U,{label:`GPU time`,value:d?.usage.gpuSeconds==null?`Not reported`:`${d.usage.gpuSeconds.toFixed(1)} seconds`})]}):(0,P.jsx)(H,{label:`Resource usage`,value:`Not retained for this run`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:`Taskset`}),(0,P.jsx)(`dd`,{children:g?(0,P.jsxs)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:g,children:[(0,P.jsx)(`span`,{children:o}),(0,P.jsx)(D,{"aria-hidden":`true`,size:14})]}):o})]})]})]}),h?(0,P.jsx)(`p`,{className:`labs-training-error`,children:h}):null]})}function H({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function U({label:e,value:t}){return(0,P.jsx)(H,{label:e,value:t})}function W(e,t){let n=e?.resource.gpuCount??t?.resource.gpuCount??null,r=e?.resource.gpuType??t?.resource.gpuType??null;return n===null&&r===null?`Not reported`:`${n??`Unknown`} × ${r?Ee(r):`Unreported`}`}function G(e){return e===null?`Not reported`:e.toLocaleString()}function Te(e){return e===`RFT`?`Reinforcement fine-tuning`:`${e} training`}function Ee(e){return e.split(` · `).map(e=>e.replaceAll(`_`,` `).replace(/\b[a-z]/g,e=>e.toUpperCase())).join(` · `)}function K({receipt:e,onOpenConversation:t}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Inconclusive benchmark`})}),(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:e.reason}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(X,{label:`Held-out baseline tokens`,value:e.usage.baseline.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Adaptation baseline tokens`,value:e.usage.adaptation.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Refiner tokens`,value:e.usage.refiner.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Grader tokens`,value:e.usage.grader.totalTokens.toLocaleString()}),(0,P.jsx)(X,{label:`Observed / maximum spend`,value:`$${e.budget.observedSpendUsd.toFixed(4)} / $${e.budget.maximumSpendUsd.toFixed(2)}`}),(0,P.jsx)(X,{label:`Harness candidate`,value:e.stopReason===`candidate_harness_unchanged`?`Unchanged`:`Lineage invalid`}),(0,P.jsx)(X,{label:`Completed attempts`,value:e.attempts.length.toLocaleString()}),(0,P.jsx)(X,{label:`Candidate attempts`,value:`Skipped`})]})]}),e.attempts.length?(0,P.jsx)(Y,{receipt:e,onOpenConversation:t}):null]})}function De({run:e}){let t=[`baseline`,`adaptation`,`refiner`,`candidate_adaptation`,`candidate`,`comparison`],n={baseline:`Baseline`,adaptation:`Adaptation`,refiner:`Refiner`,candidate_adaptation:`Sequential adaptation`,candidate:`Candidate`,comparison:`Comparison`},r=Math.max(0,t.indexOf(e.evaluationProgress?.stage??`baseline`)),i=e.evaluationProgress?.completedAttempts??0,a=e.evaluationProgress?.totalAttempts??1;return(0,P.jsxs)(`div`,{className:`labs-benchmark-progress`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`h3`,{children:`Benchmark progress`}),(0,P.jsxs)(`strong`,{children:[i,` of `,a,` attempts`]})]}),(0,P.jsx)(`div`,{className:`labs-benchmark-progress-track`,"aria-hidden":`true`,children:(0,P.jsx)(`span`,{style:{width:`${Math.min(100,i/a*100)}%`}})}),(0,P.jsx)(`ol`,{children:t.map((e,t)=>(0,P.jsxs)(`li`,{className:t<r?`complete`:t===r?`active`:void 0,children:[(0,P.jsx)(`span`,{}),n[e]]},e))})]})}function q({receipt:e}){let t=o(e),n=t.pairs.filter(e=>e.cohort===`held_out`),r=t.pairs.filter(e=>e.cohort===`adaptation`),i=e=>e.length?e.reduce((e,t)=>e+t,0)/e.length:0;return(0,P.jsxs)(`div`,{className:`labs-benchmark-attempt-charts`,children:[(0,P.jsx)(J,{title:`Held-out tokens by task`,baseline:n.map(e=>e.baseline.totalTokens),candidate:n.map(e=>e.refined.totalTokens),format:e=>Math.round(e).toLocaleString()}),(0,P.jsx)(J,{title:`Adaptation tokens by task`,baseline:r.map(e=>e.baseline.totalTokens),candidate:r.map(e=>e.refined.totalTokens),format:e=>Math.round(e).toLocaleString()}),(0,P.jsx)(J,{title:`Held-out quality by task`,baseline:n.map(e=>e.baseline.score),candidate:n.map(e=>e.refined.score),format:e=>e.toFixed(2),summarize:i}),(0,P.jsx)(J,{title:`Adaptation quality by task`,baseline:r.map(e=>e.baseline.score),candidate:r.map(e=>e.refined.score),format:e=>e.toFixed(2),summarize:i})]})}function Oe({receipt:e,run:t,tasksetName:n,onOpenTaskset:r}){let i=o(e),a=i.comparedTaskCount>0,s=i.passed,c=i.tokenDeltaPercent===null?`—`:`${i.tokenDeltaPercent>0?`+`:``}${i.tokenDeltaPercent.toFixed(2)}%`,l=e=>{let t=i.cohorts[e];return`${t.passedTaskCount}/${t.comparedTaskCount} passed`};return(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:`Token efficiency`})}),a?(0,P.jsxs)(`div`,{className:`labs-benchmark-efficiency-summary`,children:[(0,P.jsxs)(`strong`,{children:[i.passedTaskCount,` of `,i.comparedTaskCount,` tasks passed`]}),(0,P.jsxs)(`p`,{children:[`A task passes only when its refined token count is strictly lower than its own baseline. `,i.failedTaskCount,` failed this token-efficiency test; aggregate usage changed by `,c,`.`]})]}):(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:`Paired task-level token evidence is unavailable for this run.`}),(0,P.jsxs)(`dl`,{className:`labs-run-detail-list`,children:[(0,P.jsx)(X,{label:`Execution`,value:w(t.status)}),(0,P.jsx)(X,{label:`Token-efficiency result`,value:s?`Passed`:`Failed`}),(0,P.jsx)(X,{label:`Efficiency passes`,value:`${i.passedTaskCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`Efficiency failures`,value:`${i.failedTaskCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`All-task foreground tokens`,value:`${i.baselineTokens.toLocaleString()} → ${i.refinedTokens.toLocaleString()}`}),(0,P.jsx)(X,{label:`Aggregate token change`,value:c}),(0,P.jsx)(X,{label:`Adaptation replay`,value:l(`adaptation`)}),(0,P.jsx)(X,{label:`Held-out replay`,value:l(`held_out`)}),(0,P.jsx)(X,{label:`Task quality`,value:`${i.baselinePassedCount}/${i.comparedTaskCount} → ${i.refinedPassedCount}/${i.comparedTaskCount}`}),(0,P.jsx)(X,{label:`Result lineage`,value:e.lineage.valid?`Valid`:`Invalid`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:`Taskset`}),(0,P.jsx)(`dd`,{children:r?(0,P.jsx)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:r,children:n}):n})]})]})]})}function J({title:e,baseline:t,candidate:n,format:r,summarize:i=e=>e.reduce((e,t)=>e+t,0)}){let a=t.filter(e=>e!==null),o=n.filter(e=>e!==null),s=Math.max(1,...a,...o),c=Math.max(2,t.length,n.length),l=e=>{let t=[],n=[];return e.forEach((e,r)=>{if(e===null){n.length&&t.push(n.join(` `)),n=[];return}let i=6+r/(c-1)*88,a=44-e/s*36;n.push(`${i},${a}`)}),n.length&&t.push(n.join(` `)),t},u=e=>e.flatMap((e,t)=>e===null?[]:[{x:6+t/(c-1)*88,y:44-e/s*36}]);return(0,P.jsxs)(`section`,{className:`labs-benchmark-line-chart`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`h4`,{children:e}),(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`span`,{children:[`Baseline `,r(i(a))]}),(0,P.jsxs)(`span`,{children:[`Refined `,r(i(o))]})]})]}),(0,P.jsxs)(`svg`,{"aria-label":e,role:`img`,viewBox:`0 0 100 50`,preserveAspectRatio:`none`,children:[(0,P.jsx)(`line`,{x1:`6`,x2:`94`,y1:`44`,y2:`44`}),l(t).map((e,t)=>(0,P.jsx)(`polyline`,{className:`baseline`,points:e},`baseline-${t}`)),l(n).map((e,t)=>(0,P.jsx)(`polyline`,{className:`candidate`,points:e},`candidate-${t}`)),u(t).map((e,t)=>(0,P.jsx)(`circle`,{className:`baseline`,cx:e.x,cy:e.y,r:`1`},`baseline-point-${t}`)),u(n).map((e,t)=>(0,P.jsx)(`circle`,{className:`candidate`,cx:e.x,cy:e.y,r:`1`},`candidate-point-${t}`))]})]})}function Y({receipt:e,onOpenConversation:t}){let n=e.schemaVersion===`openpond.modelEvaluationReceipt.v1`?d(e.attempts??[]):e.attempts??[];return(0,P.jsxs)(`section`,{className:`labs-run-summary-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsx)(`h3`,{children:e.schemaVersion===`openpond.modelEvaluationReceipt.v1`?`Selected task results`:`Completed attempts`})}),(0,P.jsx)(`div`,{className:`training-table-wrap`,children:(0,P.jsxs)(`table`,{className:`training-data-table labs-benchmark-attempt-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Task`}),(0,P.jsx)(`th`,{children:`Phase`}),(0,P.jsx)(`th`,{children:`Result`}),(0,P.jsx)(`th`,{children:`Score`}),(0,P.jsx)(`th`,{children:`Tokens`}),(0,P.jsx)(`th`,{children:`Work chat`})]})}),(0,P.jsx)(`tbody`,{children:n.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:ke(e.taskId)}),(0,P.jsx)(`td`,{children:e.phase}),(0,P.jsx)(`td`,{children:(0,P.jsx)(b,{label:e.passed?`Passed`:`Failed`,value:e.passed?`succeeded`:`failed`})}),(0,P.jsx)(`td`,{children:e.score===null?`—`:e.score.toFixed(2)}),(0,P.jsx)(`td`,{children:e.totalTokens.toLocaleString()}),(0,P.jsx)(`td`,{children:e.sessionId?(0,P.jsx)(`button`,{className:`labs-run-taskset-link`,type:`button`,onClick:()=>t(e.sessionId),children:`Open chat`}):`Not retained`})]},`${e.phase}:${e.attemptId}`))})]})})]})}function ke(e){return e.replace(/^(?:adaptation|frozen)-/,``).replaceAll(`-`,` `).replace(/^./,e=>e.toUpperCase())}function X({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function Ae(e){let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:2)} ${t[r]}`}function je({error:e,events:t,loading:n,pending:r}){let[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)({}),[c,l]=(0,N.useState)(!0),u=(0,N.useRef)(null),d=(0,N.useRef)(null),f=(0,N.useRef)(null),p=(0,N.useMemo)(()=>Me(t),[t]),m=(0,N.useMemo)(()=>t.filter(e=>o[Z(e)]??Ne(Z(e))),[t,o]),h=p.filter(e=>o[e.id]??Ne(e.id)).length,g=p.length>0&&h===p.length,_=h>0&&!g;return(0,N.useEffect)(()=>{f.current&&(f.current.indeterminate=_)},[_]),(0,N.useEffect)(()=>{if(!i)return;let e=e=>{d.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,N.useLayoutEffect)(()=>{let e=u.current;e&&c&&(e.scrollTop=e.scrollHeight)},[e,c,r,m]),n&&!t.length?(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`Loading run events…`}):t.length?(0,P.jsxs)(`div`,{className:`training-event-log-shell`,children:[(0,P.jsxs)(`div`,{className:`training-event-log-toolbar`,children:[(0,P.jsx)(`div`,{children:(0,P.jsx)(`strong`,{children:`Activity log`})}),(0,P.jsxs)(`div`,{className:`training-event-filter`,ref:d,children:[(0,P.jsxs)(`button`,{"aria-expanded":i,"aria-haspopup":`menu`,className:`training-event-filter-trigger`,type:`button`,onClick:()=>a(e=>!e),children:[(0,P.jsx)(ie,{"aria-hidden":`true`,size:14}),`Event types`,(0,P.jsxs)(`span`,{children:[h,`/`,p.length]}),(0,P.jsx)(E,{"aria-hidden":`true`,size:13})]}),i?(0,P.jsxs)(`div`,{"aria-label":`Filter training activity by event type`,className:`training-event-filter-menu`,role:`menu`,children:[(0,P.jsxs)(`label`,{className:`training-event-filter-option select-all`,children:[(0,P.jsx)(`input`,{checked:g,ref:f,type:`checkbox`,onChange:e=>{let t=e.currentTarget.checked;s(Object.fromEntries(p.map(e=>[e.id,t])))}}),(0,P.jsx)(`span`,{className:`training-event-filter-check`,children:(0,P.jsx)(j,{"aria-hidden":`true`,size:12})}),`Select all`]}),(0,P.jsx)(`div`,{className:`training-event-filter-options`,children:p.map(e=>{let t=o[e.id]??Ne(e.id);return(0,P.jsxs)(`label`,{className:`training-event-filter-option`,children:[(0,P.jsx)(`input`,{checked:t,type:`checkbox`,onChange:t=>s(n=>({...n,[e.id]:t.currentTarget.checked}))}),(0,P.jsx)(`span`,{className:`training-event-filter-check`,children:(0,P.jsx)(j,{"aria-hidden":`true`,size:12})}),(0,P.jsx)(`span`,{children:e.label}),(0,P.jsx)(`small`,{children:e.count.toLocaleString()})]},e.id)})})]}):null]})]}),(0,P.jsxs)(`div`,{"aria-label":`Training activity log`,"aria-live":`polite`,className:`training-event-log`,ref:u,role:`log`,onScroll:e=>{let t=e.currentTarget,n=t.scrollHeight-t.scrollTop-t.clientHeight;l(n<=6)},children:[(0,P.jsxs)(`div`,{"aria-hidden":`true`,className:`training-event-log-header`,children:[(0,P.jsx)(`span`,{children:`Time`}),(0,P.jsx)(`span`,{children:`Event type`}),(0,P.jsx)(`span`,{children:`Details`})]}),m.map(e=>(0,P.jsxs)(`div`,{className:`training-event-log-line ${e.type}`,children:[(0,P.jsx)(`time`,{dateTime:e.timestamp,children:C(e.timestamp)}),(0,P.jsx)(`span`,{children:Pe(Z(e))}),(0,P.jsx)(`code`,{children:Fe(e)})]},e.id)),r&&!e?(0,P.jsxs)(`div`,{className:`training-event-log-loading`,role:`status`,children:[(0,P.jsx)(re,{"aria-hidden":`true`,className:`spin`,size:14}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Waiting for new activity`})]}):null,m.length?null:(0,P.jsx)(`div`,{className:`training-event-log-empty`,children:`No events match the selected event types.`}),e?(0,P.jsxs)(`div`,{className:`training-event-log-line failure`,children:[(0,P.jsx)(`time`,{children:`—`}),(0,P.jsx)(`span`,{children:`Failure`}),(0,P.jsx)(`code`,{children:e})]}):null]})]}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:e??`No normalized run events were recorded.`})}function Z(e){return typeof e.payload.remoteEventType==`string`&&e.payload.remoteEventType.trim()?e.payload.remoteEventType:typeof e.payload.telemetryType==`string`&&e.payload.telemetryType.trim()?e.payload.telemetryType:e.type}function Me(e){let t=new Map;for(let n of e){let e=Z(n);t.set(e,(t.get(e)??0)+1)}return[...t.entries()].map(([e,t])=>({id:e,count:t,label:Pe(e)})).sort((e,t)=>e.label.localeCompare(t.label))}function Ne(e){return e!==`metric`&&!e.endsWith(`_metric`)}function Pe(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Fe(e){let t=e.payload,n=ze(t.step),r=ze(t.maxSteps);if(typeof t.telemetryType==`string`){let e=typeof t.message==`string`?t.message:null,r=typeof t.errorCode==`string`?t.errorCode:null,i=typeof t.telemetrySource==`string`?` · ${t.telemetrySource}`:``;return`${e??t.telemetryType.replaceAll(`_`,` `)}${n==null?``:` · step ${n}`}${i}${r?` · ${r}`:``}`}if(typeof t.remoteEventType==`string`){let e=Ie(t.remoteEventType),r=typeof t.remotePhase==`string`?Le(t.remotePhase):null,i=typeof t.errorCode==`string`&&t.errorCode.trim()?t.errorCode.trim():null;return[e,r,n==null?null:`step ${n}`,i?`error ${i}`:null].filter(e=>!!e).join(` · `)}if(e.type===`start`)return typeof t.device==`string`?`Worker started on ${t.device}.`:`Worker started.`;if(e.type===`progress`&&n!=null)return r==null?`Step ${n}.`:`Step ${n} of ${r}.`;if(e.type===`metric`){let e=typeof t.metricKind==`string`?t.metricKind.replaceAll(`_`,` `):`metric`,r=[Q(`loss`,t.loss),Q(`reward`,t.meanReward??t.reward),Q(`policy loss`,t.policyLoss),Q(`value loss`,t.valueLoss),Q(`preference accuracy`,t.preferenceAccuracy,Be)].filter(e=>!!e),i=typeof t.failureClass==`string`?t.failureClass:null,a=typeof t.failureCode==`string`?t.failureCode:null,o=typeof t.metricId==`string`&&typeof t.value==`number`?` · ${t.metricId}: ${t.value.toPrecision(4)}`:``;return`${e}${n==null?``:` · step ${n}`}${o}${i?` · ${i}`:``}${a?` · ${a}`:``}${r.length?` · ${r.join(` · `)}`:``}`}if(e.type===`checkpoint`){let e=ze(t.policyVersion),n=ze(t.sizeBytes),r=[e==null?null:`policy ${e}`,n==null?null:Ae(n),t.final===!0?`final`:null].filter(e=>!!e);return r.length?`Checkpoint committed · ${r.join(` · `)}.`:`Checkpoint committed.`}if(e.type===`complete`){let e=ze(t.artifactCount);return e==null?`Worker completed.`:`Worker completed with ${e} artifacts.`}return e.type===`failure`&&typeof t.message==`string`?t.message:Object.keys(t).length?JSON.stringify(t):`Recorded.`}function Ie(e){return{drain:`Rollout drain`,infer:`Model inference`,materialize_checkpoint:`Checkpoint materialization`,optimizer_metric:`Optimizer metric`,provision_gpu:`GPU provisioning`,rollout_metric:`Rollout trajectory`,score_reward_model:`Reward scoring`,start_inference:`Policy server`,train_step:`Optimizer update`,upload_checkpoint:`Checkpoint upload`}[e]??Re(e)}function Le(e){return{committed:`committed`,completed:`completed`,eligible:`recorded`,failed:`failed`,running:`running`,succeeded:`succeeded`}[e]??Re(e).toLocaleLowerCase()}function Re(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Q(e,t,n=e=>new Intl.NumberFormat(void 0,{maximumFractionDigits:4}).format(e)){let r=ze(t);return r==null?null:`${e} ${n(r)}`}function ze(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Be(e){return`${(e*100).toFixed(1)}%`}function Ve({connection:e,detailTab:t,onDetailTabChange:n,selectedEntryKey:r,workproduct:o,runs:d,training:f,onOpenDataset:b,onOpenConversation:x,detailKind:C}){let E=f.payload,[D,re]=(0,N.useState)(null),k=(0,N.useMemo)(()=>l(o,d,E),[d,E,o]),A=(0,N.useMemo)(()=>h(o,d,E),[d,E,o]),j=(0,N.useMemo)(()=>m(o,E),[E,o]),ie=(0,N.useMemo)(()=>u(o,d,E),[d,E,o]),se=(0,N.useMemo)(()=>new Map(ie.map(e=>[e.id,e])),[ie]),M=(0,N.useMemo)(()=>s(k,A),[k,A]).find(e=>e.key===r)??null,F=r.startsWith(`model-run:`)?r.slice(10):null,I=F?j.find(e=>e.id===F)??null:M?.job?j.find(e=>e.id===M.job?.metadata.modelRunId)??null:null,L=M?.job??(I?E?.jobs.find(e=>e.id===I.id||e.metadata.modelRunId===I.id)??null:null),pe=E?.comparisonSeriesEntries.find(e=>e.modelRunId===I?.id||e.modelRunId===L?.metadata.modelRunId)??null,he=a.shape.recovery.safeParse(L?.metadata.hostedRecovery),R=he.success?he.data:void 0,ge=O.shape.continuation.safeParse(L?.metadata.hostedContinuation),z=ge.success?ge.data:void 0,_e=z?A.find(e=>e.lineage.jobId===z.sourceArtifact.jobId):void 0,ve=R?`Recovered checkpoint`:_e?`Version ${_e.number}`:z?`Checkpoint ${z.sourceArtifact.checkpointId}`:typeof L?.metadata.parentHostedArtifactId==`string`?`Prior hosted run`:ue(E,pe),ye=(0,N.useMemo)(()=>{let e=v(k,A,j);return p(e,I?.kind===`evaluation`?`evals`:`training`)},[k,j,I?.kind,A]),xe=ye.findIndex(e=>e.key===r||L!==null&&e.job?.id===L.id||I!==null&&e.lifecycleRun?.id===I.id),B=xe<0?null:ye.length-xe,V=M?.version??(I?.adapterArtifactLineageId?A.find(e=>e.lineage.id===I.adapterArtifactLineageId)??null:null),H=(I?E?.modelVersions.find(e=>e.id===I.modelVersionId)?.baseModel.modelId:null)??E?.modelVersions.filter(e=>e.modelId===o.id&&e.kind===`base_reference`).sort((e,t)=>t.version-e.version)[0]?.baseModel.modelId??(typeof L?.metadata.baseModelId==`string`?L.metadata.baseModelId:null),U=V?.lineage.frozenEvaluationArtifactId??null,W=V?.plan??(L?se.get(L.planId)??null:null),G=V?.taskset??_(E).find(e=>e.id===(I?.taskset.id??W?.tasksetId??L?.metadata.tasksetId))??null,Te=G?.name??(typeof L?.metadata.tasksetId==`string`?L.metadata.tasksetId:`Unavailable`),Ee=I?.method??W?.recipe.method??Ke(L?.metadata),K=Ce(e,L?.id??null,L?.status??null,t===`evaluation`),De=L?E?.rolloutReceipts.filter(e=>e.jobId===L.id)??[]:[],q=K.detail?.managedEvidence??null,Oe=K.detail?.events.some(e=>e.type===`metric`&&e.payload.metricKind===`rollout_trajectory`)??!1,J=c({lifecycleRun:I,job:K.detail?.job??L}),Y=y(J),ke=I?.status===`failed`&&L?.metadata.phase===`artifact_collection_failed`,X=Ee===`grpo`,Z=Ue(L?.metadata),Me=(W&&(W.recipe.method===`sft`||W.recipe.method===`dpo`||W.recipe.method===`grpo`)?W.recipe.optimizer.maxSteps:null)??q?.progress.targetOptimizerSteps??null,Ne=Me!==null&&typeof L?.metadata.progress==`number`&&Number.isFinite(L.metadata.progress)?Math.floor(Math.max(0,L.metadata.progress)*Me):0,Pe=Math.max(0,Z?.optimizerUpdatesApplied??0,Ne,K.detail?.policyMetrics.reduce((e,t)=>Math.max(e,t.step),0)??0,K.detail?.stepMetrics.reduce((e,t)=>Math.max(e,t.step),0)??0,q?.progress.committedOptimizerSteps??0),Fe=He(X&&Z?Z.groupsCompleted:Pe,X&&Z?Z.groupsTarget:Me),Ie=C===`run`?{id:`details`,label:`Details`}:{id:`overview`,label:`Overview`},Le=[...C===`run`&&L?[{id:`metrics`,label:`Metrics`}]:[],Ie,...C===`version`&&L?[{id:`metrics`,label:`Metrics`}]:[],{id:`evaluation`,label:`Evaluation`},...De.length||Oe?[{id:`rollouts`,label:`Rollouts`}]:[],{id:`artifacts`,label:`Artifacts`},...L?[{id:`activity`,label:`Activity`}]:[]],Re=t,Q=Le.some(e=>e.id===Re)?Re:Le[0].id;return!M&&!I&&f.loading?(0,P.jsxs)(`div`,{className:`labs-model-version-detail`,children:[(0,P.jsx)(ae,{title:`Run details`}),(0,P.jsx)(`p`,{role:`status`,children:`Loading training run…`})]}):!M&&!I?(0,P.jsx)(`div`,{className:`labs-model-version-detail`,children:(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`This training attempt is no longer available.`})}):I?.kind===`evaluation`?(0,P.jsx)(We,{run:I,runNumber:B,tasksetName:G?.name??`Unavailable`,onOpenTaskset:G?()=>b(G.id):void 0,onOpenConversation:x}):(0,P.jsxs)(`div`,{className:`labs-model-version-detail`,children:[(0,P.jsx)(ae,{title:I||L?B?`Run ${B}`:`Run details`:V?`Version ${V.number}`:`Run details`,description:`${te(Ee)} on ${Ge(W,H)}`,status:(0,P.jsx)(g,{status:J}),actions:Y&&(I||L)?(0,P.jsx)(`button`,{type:`button`,className:`training-button secondary`,disabled:f.busyAction!==null||J===`cancelling`,onClick:async()=>{let e=I?.id??L.id,t=I?await f.actions.cancelModelRun(I.id):await f.actions.cancelJob(L.id);re({runId:e,message:t?`Cancellation requested. Waiting for the training service to confirm.`:`Cancellation could not be requested. Try again.`})},children:J===`cancelling`?`Cancelling…`:f.busyAction===`cancel-model-run`||f.busyAction===`cancel-job`?`Requesting cancellation…`:`Cancel run`}):ke&&I?(0,P.jsx)(`button`,{type:`button`,className:`training-button secondary`,disabled:f.busyAction!==null,onClick:async()=>{let e=await f.actions.retryModelRunCollection(I.id);re({runId:I.id,message:e?.state===`succeeded`?`Outputs collected from the completed training job.`:`Collection failed. The training job and its outputs are retained.`})},children:f.busyAction===`retry-model-run-collection`?`Collecting…`:`Retry collection`}):void 0,metrics:[{label:X&&Z?`Training groups`:`Training steps`,value:Fe.value},...R&&Z?[{label:`Optimizer updates`,value:`${Math.max(0,Z.optimizerUpdatesApplied-R.policyVersion)} new · ${R.policyVersion} reused`}]:[],{label:Y?`Latest reward`:`Final reward`,value:Je(I?.reward?.raw??q?.reward.finalMean??null)},{label:`Duration`,value:I?T(I.startedAt,S(I.status,I.completedAt,I.updatedAt)):L?T(L.startedAt,S(L.status,L.completedAt,L.updatedAt)):`Not recorded`},{label:`Output`,value:V?`Version ${V.number}`:`No version`},{label:`Based on`,value:ve},{label:`Taskset`,value:Te,onSelect:G?()=>b(G.id):void 0,ariaLabel:G?`Open Taskset ${G.name}`:void 0}]}),(0,P.jsx)(ee,{recovery:R}),z?(0,P.jsx)(i,{continuation:{sourceJobId:z.sourceArtifact.jobId,checkpointId:z.sourceArtifact.checkpointId}}):null,D&&D.runId===(I?.id??L?.id)?(0,P.jsx)(`p`,{role:`status`,children:D.message}):null,(0,P.jsxs)(`section`,{className:`labs-run-detail-tabs`,children:[(0,P.jsx)(`div`,{className:`training-detail-tabs`,role:`tablist`,"aria-label":`Run details`,children:Le.map(e=>(0,P.jsx)(`button`,{"aria-controls":`run-detail-panel-${e.id}`,"aria-selected":Q===e.id,className:Q===e.id?`active`:void 0,id:`run-detail-tab-${e.id}`,role:`tab`,type:`button`,onClick:()=>n(e.id),children:e.label},e.id))}),(0,P.jsxs)(`div`,{"aria-labelledby":`run-detail-tab-${Q}`,className:`labs-run-detail-tab-panel`,id:`run-detail-panel-${Q}`,role:`tabpanel`,children:[Q===Ie.id?(0,P.jsx)(we,{baseModel:Ge(W,H),compute:I?ne(I.destinationId??``):W?ne(W.destinationId):L?ne(L.destinationId):`Not recorded`,duration:I?T(I.startedAt,S(I.status,I.completedAt,I.updatedAt)):L?T(L.startedAt,S(L.status,L.completedAt,L.updatedAt)):`Not recorded`,failure:L?.error??I?.failure??null,configuration:[...z?[{label:`Starting checkpoint`,value:[_e?`Version ${_e.number}`:null,z.sourceArtifact.checkpointId].filter(Boolean).join(` · `)},{label:`Parent run`,value:z.sourceArtifact.jobId},{label:`Parent artifact`,value:z.sourceArtifact.artifactId},{label:`Optimizer`,value:z.optimizerMode===`reset`?`Reset`:`Continue`}]:le(E,pe),...ce(W)],evidence:q,method:te(Ee),output:V?`Version ${V.number}`:`No version created`,reward:I?.reward?.raw??q?.reward.finalMean??null,status:I?w(I.status):L?w(L.status):`Imported`,statusValue:I?.status??L?.status??`imported`,taskset:Te,telemetry:I?.receipt?.schemaVersion===`openpond.modelRunReceipt.v1`?I.receipt.telemetry:null,title:I||L?B?`Run ${B}`:`Run details`:V?`Version ${V.number}`:`Run details`,versionStatus:V?V.current?`Active`:`Available`:null,onOpenTaskset:G?()=>b(G.id):void 0,showHeader:!1}):null,Q===`metrics`&&L?(0,P.jsx)(oe,{detail:K.detail,error:K.error,loading:K.loading,taskset:G}):null,Q===`artifacts`?(0,P.jsxs)(`dl`,{className:`training-configuration-list`,children:[(0,P.jsx)($,{label:`Training attempt`,value:L?.id??`Provider import`}),(0,P.jsx)($,{label:`Taskset`,value:Te}),(0,P.jsx)($,{label:`Prepared data`,value:L?.bundleHash??`Provider managed`}),(0,P.jsx)($,{label:`Version ID`,value:V?.lineage.id??`No version created`}),q?.checkpoint?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($,{label:`Checkpoint`,value:q.checkpoint.id}),(0,P.jsx)($,{label:`Checkpoint size`,value:q.checkpoint.sizeBytes==null?`Not reported`:Ae(q.checkpoint.sizeBytes)}),(0,P.jsx)($,{label:`Checkpoint hash`,value:q.checkpoint.sha256??`Not reported`})]}):null,q?.canonicalPublication.state?(0,P.jsx)($,{label:`Registry publication`,value:Ye(q.canonicalPublication.state)}):null]}):null,Q===`evaluation`?(0,P.jsxs)(`div`,{className:`training-run-evaluation`,children:[!q?.evaluations.length||K.detail?.evaluation?(0,P.jsx)(me,{detail:K.detail,loading:K.loading,pending:Y}):null,!K.detail?.evaluation&&q?.evaluations.length?(0,P.jsx)(`dl`,{className:`labs-inline-facts`,children:q.evaluations.map(e=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsx)($,{label:e.kind===`baseline`?`Baseline score`:`Candidate score`,value:e.score==null?`Not reported`:e.score.toFixed(6)}),(0,P.jsx)($,{label:e.kind===`baseline`?`Baseline coverage`:`Candidate coverage`,value:e.taskCount==null?`Not reported`:e.targetTaskCount==null?`${e.taskCount} ${e.taskCount===1?`task`:`tasks`} scored`:`${e.taskCount} of ${e.targetTaskCount} ${e.targetTaskCount===1?`task`:`tasks`} scored`})]},`${e.kind}:${e.policyVersion}`))}):null,V&&L?.destinationId===`openpond_managed`?(0,P.jsx)(be,{connection:e,lineageId:V.lineage.id,onSaved:f.refresh},V.lineage.id):null,!V&&L?.metadata.source===`hosted_model_project_import`&&L.status===`succeeded`?(0,P.jsx)(be,{connection:e,jobId:L.id,onSaved:f.refresh},`candidate:${L.id}`):null,L&&q?.evaluations.length?(0,P.jsx)(Se,{connection:e,jobId:L.id,evaluations:q.evaluations},L.id):null,U?(0,P.jsx)(`button`,{className:`training-button secondary`,type:`button`,onClick:()=>void f.actions.downloadArtifact(U),children:`Download evaluation receipt`}):null]}):null,Q===`rollouts`?De.length?(0,P.jsx)(fe,{receipts:De}):(0,P.jsx)(de,{events:K.detail?.events??[]}):null,Q===`activity`&&L?(0,P.jsx)(je,{error:L.error??K.error,events:K.detail?.events??[],loading:K.loading,pending:Y}):null]})]})]})}function He(e,t){let n=Math.max(0,Math.floor(e));if(t===null||!Number.isFinite(t)||t<=0)return{value:n.toLocaleString(),hint:n===1?`completed update`:`completed updates`};let r=Math.max(1,Math.floor(t));return{value:`${n.toLocaleString()} / ${r.toLocaleString()}`,hint:`completed / planned`}}function Ue(e){let t=e?.rolloutProgress;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return[`groupsCompleted`,`groupsTarget`,`optimizerUpdatesApplied`,`optimizerUpdatesSkipped`].some(e=>typeof n[e]!=`number`||!Number.isInteger(n[e])||n[e]<0)?null:{groupsCompleted:n.groupsCompleted,groupsTarget:n.groupsTarget,optimizerUpdatesApplied:n.optimizerUpdatesApplied,optimizerUpdatesSkipped:n.optimizerUpdatesSkipped}}function We({run:e,runNumber:t,tasksetName:n,onOpenTaskset:r,onOpenConversation:i}){let[a,s]=(0,N.useState)(`results`),c=e.receipt?.schemaVersion===`openpond.modelEvaluationReceipt.v1`?e.receipt:null,l=e.receipt?.schemaVersion===`openpond.modelEvaluationStopReceipt.v1`?e.receipt:null,u=c?f(c):null,d=c?o(c):null;return(0,P.jsxs)(`div`,{className:`labs-model-version-detail labs-model-evaluation-detail`,children:[(0,P.jsx)(ae,{title:t?`Eval ${t}`:`Evaluation run`,description:`Harness Refiner benchmark · ${n}`,status:(0,P.jsx)(b,{label:c?d?.comparedTaskCount?`${d.passedTaskCount}/${d.comparedTaskCount} passed`:`No paired result`:l?`Inconclusive`:w(e.status),value:c?d?.comparedTaskCount&&d.passed?`succeeded`:`neutral`:l?.terminalClassification??e.status}),metrics:[{label:`Baseline pass rate`,value:c?`${(c.quality.baselinePassRate*100).toFixed(1)}%`:`—`},{label:`Candidate pass rate`,value:c?`${(c.quality.candidatePassRate*100).toFixed(1)}%`:`—`},{label:`Scenarios`,value:c?.attempts?.length??0},{label:`Execution`,value:w(e.status)}]}),(0,P.jsx)(`div`,{className:`training-detail-tabs`,role:`tablist`,"aria-label":`Evaluation details`,children:[`results`,`scenarios`,`activity`].map(e=>(0,P.jsx)(`button`,{className:a===e?`active`:void 0,"aria-selected":a===e,role:`tab`,type:`button`,onClick:()=>s(e),children:e===`results`?`Results`:e===`scenarios`?`Scenarios`:`Activity`},e))}),a===`results`&&c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(se,{series:[{id:`baseline`,label:`Held-out baseline`,inputTokens:u.baseline.inputTokens,outputTokens:u.baseline.outputTokens,tokens:u.baseline.totalTokens,passRate:c.quality.baselinePassRate,costUsd:u.baseline.costUsd},{id:`candidate`,label:`Held-out refined`,inputTokens:u.candidate.inputTokens,outputTokens:u.candidate.outputTokens,tokens:u.candidate.totalTokens,passRate:c.quality.candidatePassRate,costUsd:u.candidate.costUsd}]}),(0,P.jsx)(se,{series:[{id:`adaptation-baseline`,label:`Adaptation baseline`,inputTokens:u.adaptation.inputTokens,outputTokens:u.adaptation.outputTokens,tokens:u.adaptation.totalTokens,passRate:c.quality.adaptationBaselinePassRate,costUsd:u.adaptation.costUsd},{id:`adaptation-candidate`,label:`Adaptation replay`,inputTokens:u.candidate_adaptation.inputTokens,outputTokens:u.candidate_adaptation.outputTokens,tokens:u.candidate_adaptation.totalTokens,passRate:c.quality.adaptationCandidatePassRate,costUsd:u.candidate_adaptation.costUsd}]}),(0,P.jsx)(Oe,{receipt:c,run:e,tasksetName:n,onOpenTaskset:r})]}):a===`results`&&l?(0,P.jsx)(K,{receipt:l,onOpenConversation:i}):a===`results`?(0,P.jsx)(`section`,{className:`labs-run-summary-card`,children:e.failure?(0,P.jsx)(`p`,{className:`training-run-placeholder`,children:e.failure}):(0,P.jsx)(De,{run:e})}):null,a===`scenarios`&&c?(0,P.jsxs)(P.Fragment,{children:[(c.attempts??[]).length?(0,P.jsx)(q,{receipt:c}):null,(c.attempts??[]).length?(0,P.jsx)(Y,{receipt:c,onOpenConversation:i}):(0,P.jsx)(`div`,{className:`training-run-placeholder`,children:`No per-scenario attempts were retained.`})]}):null,a===`activity`?(0,P.jsxs)(`dl`,{className:`labs-inline-facts`,children:[(0,P.jsx)($,{label:`Run ID`,value:e.id}),(0,P.jsx)($,{label:`Status`,value:w(e.status)}),(0,P.jsx)($,{label:`Started`,value:e.startedAt?C(e.startedAt):`Not started`}),(0,P.jsx)($,{label:`Completed`,value:e.completedAt?C(e.completedAt):`In progress`})]}):null]})}function Ge(e,t=null){if(!e)return t?qe(t):`Not recorded`;let n=e.recipe.method===`sft`||e.recipe.method===`grpo`?e.recipe.baseModel:e.recipe.method===`dpo`?e.recipe.policyModel:e.recipe.method===`ppo`?e.recipe.policyOptimization.policyModel:null;return n?qe(n.id):`Not recorded`}function Ke(e){let t=e?.trainingMethod;return t===`sft`||t===`dpo`||t===`grpo`||t===`ppo`||t===`sdft`||t===`opd`||t===`opsd`||t===`sdpo`?t:null}function qe(e){return e.split(`/`).at(-1)??e}function Je(e){return e===null?`Not reported`:e.toFixed(4)}function $({label:e,value:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{children:e}),(0,P.jsx)(`dd`,{children:t})]})}function Ye(e){return e?e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()):`Pending`}export{Ve as LabModelVersionDetailPage,Fe as eventSummary,He as formatTrainingProgress,Ue as managedRolloutProgress};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r}from"./index-B6XX_0h3.js";import{a as i,m as a,o,p as s,r as c,v as l}from"./schemas-Brv9Vmnk.js";import{t as u}from"./icons-Bk2b68aC.js";import{c as d,l as f,n as p,o as m,r as h}from"./training-model-data-CIysl8wH.js";import{At as g,Bt as _,C as v,D as y,Dt as b,F as x,Ht as S,It as C,K as ee,Mt as w,Ot as T,P as te,Q as ne,R as E,Rt as re,S as ie,St as ae,T as D,Tt as O,Vt as oe,W as se,X as ce,_ as le,_t as k,a as ue,at as de,b as fe,c as pe,ct as me,d as he,dt as ge,f as _e,ft as ve,g as ye,h as be,i as xe,j as Se,l as Ce,n as we,nt as Te,o as Ee,p as De,q as Oe,r as ke,s as Ae,t as je,tt as Me,u as Ne,ut as Pe,v as Fe,w as Ie,x as Le,xt as Re,yt as ze,zt as Be}from"./CartesianChart-brqLBqnF.js";import{Bn as Ve,Bt as A,Hn as He,Pt as Ue,Ut as We,Vn as Ge,Wn as Ke,dn as qe,en as Je,gn as Ye,sn as Xe,zt as j}from"./App-CCuh99JW.js";import{t as Ze}from"./ModelProjectPageHeader-Dge19aE1.js";var M=a({label:l().max(200),value:l().max(12e3),severity:c([`info`,`warning`,`error`]).default(`info`)}).strict(),Qe=a({kind:c([`trajectory`,`evaluation`]),id:l().min(1).max(240),taskId:l().min(1).max(512).optional()}).strict().refine(e=>e.kind===`evaluation`?!!e.taskId:e.taskId===void 0,{message:`Evaluation feedback requires a task ID; trajectory feedback uses its receipt ID only.`}),$e=a({status:l(),score:s().nullable(),passed:o().nullable()}).strict(),et=a({jobId:l(),kind:c([`trajectory`,`evaluation`]),id:l(),taskId:l().optional(),compositionSha256:l(),training:$e,evaluation:$e,graders:i(a({graderId:l(),role:c([`training`,`evaluation`]),status:l(),rawScore:s().nullable(),normalizedScore:s().nullable(),passed:o().nullable(),message:l().nullable(),failureClass:l().nullable(),feedback:i(l().max(32768)).max(8)}).strict()).max(32)}).strict(),tt=a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l(),groupId:l(),groupIndex:s().int().nonnegative(),optimizerDisposition:c([`applied`,`skipped_no_signal`]),inputPolicyVersion:s().int().nonnegative(),outputPolicyVersion:s().int().nonnegative().optional()}).strict(),N=a({label:l(),state:c([`done`,`active`,`pending`,`missing`,`failed`]),status:l(),detail:l().optional(),diagnostics:i(M).max(100).optional(),feedback:i(Qe).max(100).optional(),error:l().optional(),progress:s().min(0).max(1).optional(),inLoop:o().optional()}).strict(),nt=a({jobId:l(),teamId:l(),modelProjectId:l(),state:l(),policyVersion:s().int().nonnegative(),groupsCompleted:s().int().nonnegative(),groupsTarget:s().int().nonnegative(),live:o(),continuation:a({sourceJobId:l(),artifactId:l(),checkpointId:l(),optimizerMode:c([`continue`,`reset`]),materialized:o(),parentRank:s().int().positive().optional(),trainableRank:s().int().positive().optional()}).strict().optional(),recovery:a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l().optional(),policyVersion:s().int().positive(),completedGroups:s().int().positive(),optimizerStateRestored:o(),optimizerUpdatesApplied:s().int().nonnegative().optional(),replayGroups:i(tt).max(128).optional(),replayCompleted:o().optional(),undurablePolicyVersion:s().int().positive().optional()}).strict().optional(),nodes:i(N).max(10),inference:N.nullable(),groups:i(a({index:s().int().nonnegative(),optimizerDisposition:c([`applied`,`skipped_no_signal`]).optional(),replay:tt.optional(),inherited:a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l(),optimizerDisposition:c([`applied`,`skipped_no_signal`]),inputPolicyVersion:s().int().nonnegative(),outputPolicyVersion:s().int().nonnegative().optional()}).strict().optional(),nodes:i(N).max(5).optional(),state:l(),meanReward:s().nullable(),plannedSlots:s().int().nonnegative(),diagnostics:i(M).max(100).optional(),attempts:i(a({id:l(),slot:s().int().nonnegative(),attempt:s().int().positive(),state:l(),reward:s().nullable(),diagnostics:i(M).max(100).optional(),feedback:i(Qe).max(100).optional()}).strict()).max(1e3)}).strict()).max(50),groupCount:s().int().nonnegative(),logs:i(a({id:l(),at:l(),source:l(),message:l(),level:l()}).strict()).max(200)}).strict(),rt=u(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),P=e(t());function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F.apply(null,arguments)}var it=e=>{var t=e.cx,n=e.cy,r=e.r,i=e.className,a=S(`recharts-dot`,i);return T(t)&&T(n)&&T(r)?P.createElement(`circle`,F({},_(e),ae(e),{className:a,cx:t,cy:n,r})):null},at=[`points`];function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ot(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=ct(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e){var t=lt(e,`string`);return typeof t==`symbol`?t:t+``}function lt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(null,arguments)}function ut(e,t){if(e==null)return{};var n,r,i=dt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ft(e){var t=e.option,n=e.dotProps,r=e.className;if((0,P.isValidElement)(t))return(0,P.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=S(r,typeof t==`boolean`?``:t.className),a=n??{};a.points;var o=ut(a,at);return P.createElement(it,L({},o,{className:i}))}function pt(e,t){return e==null?!1:t?!0:e.length===1}function mt(e){var t=e.points,n=e.dot,r=e.className,i=e.dotClassName,a=e.dataKey,o=e.baseProps,s=e.needClip,c=e.clipPathId,l=e.zIndex,u=l===void 0?E.scatter:l;if(!pt(t,n))return null;var d=fe(n),f=Be(n),p=t.map((e,r)=>{var s=I(I(I({r:3},o),f),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return P.createElement(ft,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&c!=null&&(m.clipPath=`url(#clipPath-${d?``:`dots-`}${c})`),P.createElement(D,{zIndex:u},P.createElement(C,L({className:r},m),p))}function ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ht(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gt(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _t(e){var t=vt(e,`string`);return typeof t==`symbol`?t:t+``}function vt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var yt=e=>{var t=e.point,n=e.childIndex,r=e.mainColor,i=e.activeDot,a=e.dataKey,o=e.clipPath;if(i===!1||t.x==null||t.y==null)return null;var s=R(R(R({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),oe(i)),ae(i)),c=(0,P.isValidElement)(i)?(0,P.cloneElement)(i,s):typeof i==`function`?i(s):P.createElement(it,s);return P.createElement(C,{className:`recharts-active-dot`,clipPath:o},c)};function bt(e){var t=e.points,n=e.mainColor,r=e.activeDot,i=e.itemDataKey,a=e.clipPath,o=e.zIndex,s=o===void 0?E.activeDot:o,c=ze(y),l=pe();if(t==null||l==null)return null;var u=t.find(e=>l.includes(e.payload));return b(u)?null:P.createElement(D,{zIndex:s},P.createElement(yt,{point:u,childIndex:Number(c),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var xt=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function St(e,t){if(e==null)return{};var n,r,i=Ct(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ct(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function wt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Tt(e,t){return`${t}px ${e}px`}function Et(e){return e.length%2==0?e:[...e,...e]}function Dt(e,t){for(var n=[],r=0;r<t;++r)n.push(...e);return n}function Ot(e,t,n){var r=Et(n),i=r.reduce((e,t)=>e+t,0);if(!i)return Tt(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;c<r.length;l+=(u=r[c])??0,++c){var u,d=r[c];if(d!=null&&l+d>o){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Dt(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function kt(e,t,n){return e?Ot(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):Tt(t,n)}function At(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=St(e,xt),a=r??!1,o;if(t!=null){var s=i.pathRef;o=kt(n,wt(s?.current??null),t)}else n!=null&&(o=String(n));return P.createElement(ee,z({},i,{connectNulls:a,strokeDasharray:o}))}function jt(e){var t=(0,P.useRef)(0),n=(0,P.useRef)(0),r=(0,P.useRef)(!1),i=(0,P.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,P.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(w(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Mt=(e,t,n,r)=>Se(e,`xAxis`,t,r),Nt=(e,t,n,r)=>te(e,`xAxis`,t,r),Pt=(e,t,n,r)=>Se(e,`yAxis`,n,r),Ft=(e,t,n,r)=>te(e,`yAxis`,n,r),It=k([ce,Mt,Pt,Nt,Ft],(e,t,n,r,i)=>ve(e,`xAxis`)?de(t,r,!1):de(n,i,!1)),Lt=(e,t,n,r,i)=>i;function Rt(e){return e.type===`line`}var zt=k([x,Lt],(e,t)=>e.filter(Rt).find(e=>e.id===t)),Bt=k([ce,Mt,Pt,Nt,Ft,zt,It,se],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return ln({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function Vt(e){var t=oe(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var Ht=[`id`],Ut=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],Wt=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n,r,i=Gt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Gt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Kt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e){var t=Yt(e,`string`);return typeof t==`symbol`?t:t+``}function Yt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Xt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Zt(e){var t=0,n=0;for(var r of e)r.status===`matched`&&r.prev.x!=null&&r.next.x!=null&&(t+=r.next.x-r.prev.x,n++);return n>0?t/n:0}var U={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Zt(e),r=[];for(var i of e)if(i.status===`matched`)r.push(H(H({},i.next),{},{x:O(i.prev.x,i.next.x,t),y:O(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(H(H({},i.next),{},{x:O(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(H(H({},i.prev),{},{x:O(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:be,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:At,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:E.line,type:`linear`},Qt=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Pe(n,t),payload:e}]},$t=P.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:g,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Pe(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return P.createElement(le,{tooltipEntrySettings:f})});function en(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=V(r,Ht),c=_(s);return P.createElement(mt,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function tn(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,P.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return H(H({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return P.createElement(Le,{value:t?i:void 0},n)}function nn(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=V(i,Ut),g=H(H({},re(h)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return P.createElement(P.Fragment,null,r?.length>1&&P.createElement(Fe,{option:p,DefaultShape:U.shape,shapeProps:g}),P.createElement(en,{points:r,clipPathId:t,props:i}))}function rn(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=Xt(r.current),m=De(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,v=!h,y=jt(a),b=(0,P.useCallback)(e=>e>0&&p>0,[p]);return P.createElement(tn,{points:a,showLabels:v},n.children,P.createElement(_e,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:b,layout:f},(e,i,a)=>{var o=h||i<1,s=o?y(i,p):null;return P.createElement(nn,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),P.createElement(ie,{label:n.label}))}function an(e){var t=e.clipPathId,n=e.props,r=(0,P.useRef)(null),i=(0,P.useRef)(null);return P.createElement(rn,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var on=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:ge(e.payload,t)}),sn=class extends P.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,c=e.left,l=e.width,u=e.height,d=e.id,f=e.needClip,p=e.zIndex;if(t)return null;var m=S(`recharts-line`,i),h=d,g=Vt(n),_=g.r,v=g.strokeWidth,y=fe(n),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${h})`:void 0;return P.createElement(D,{zIndex:p},P.createElement(C,{className:m},f&&P.createElement(`defs`,null,P.createElement(xe,{clipPathId:h,xAxisId:a,yAxisId:o}),!y&&P.createElement(`clipPath`,{id:`clipPath-dots-${h}`},P.createElement(`rect`,{x:c-b/2,y:s-b/2,width:l+b,height:u+b}))),P.createElement(Ee,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:on,errorBarOffset:0},P.createElement(an,{props:this.props,clipPathId:h}))),P.createElement(bt,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}};function cn(e){var t=Re(e,U),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=V(t,Wt),_=ue(p,m).needClip,v=Ce(),y=ne(),b=Te(),x=ze(e=>Bt(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var S=v.height,C=v.width,ee=v.x,w=v.y;return P.createElement(sn,B({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:ee,top:w,needClip:_}))}function ln(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=ge(e,o);if(t===`horizontal`)return{x:me({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(b(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=b(l)?null:n.scale.map(l),d=me({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function un(e){var t=Re(e,U),n=Te();return P.createElement(he,{id:t.id,type:`line`},e=>P.createElement(P.Fragment,null,P.createElement(ye,{legendPayload:Qt(t)}),P.createElement($t,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),P.createElement(Ne,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),P.createElement(cn,B({},t,{id:e}))))}var dn=P.memo(un,Oe);dn.displayName=`Line`;var fn=[`axis`],pn=(0,P.forwardRef)((e,t)=>P.createElement(je,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:fn,tooltipPayloadSearcher:Ie,categoricalChartProps:e,ref:t})),W=r(),mn=[{id:`optimizer.reward`,label:`Mean reward`,points:[]},{id:`reward.variance`,label:`Reward variance`,points:[]},{id:`optimizer.kl`,label:`Policy update KL`,points:[]},{id:`optimizer.policy_loss`,label:`Policy loss`,points:[]},{id:`optimizer.learning_rate`,label:`Learning rate`,points:[],format:`scientific`}];function hn({series:e,loading:t=!1,live:n=!1}){let[r,i]=(0,P.useState)(`raw`),a=(0,P.useMemo)(()=>{let r=e.filter(e=>e.points.length);if(!t&&!n)return r;let i=new Map(r.map(e=>[e.id,e]));for(let e of mn)i.has(e.id)||i.set(e.id,e);return[...i.values()]},[n,t,e]),o=a.some(e=>e.points.length>1);return a.length?(0,W.jsxs)(`section`,{className:`training-metric-workbench`,"aria-label":`Training metrics`,children:[o?(0,W.jsx)(`div`,{className:`training-metric-workbench-controls`,children:(0,W.jsx)(We,{compact:!0,floating:!0,label:`Metric display`,value:r,options:[{value:`raw`,label:`Raw values`},{value:`smoothed`,label:`Smoothed trend`}],onChange:e=>i(e)})}):null,(0,W.jsx)(`div`,{className:`training-metric-chart-grid`,children:a.map(e=>(0,W.jsx)(gn,{display:r,loading:t&&!e.points.length,metric:e,pending:n&&!e.points.length},e.id))})]}):(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`This run did not report chartable metrics.`})}var gn=(0,P.memo)(function({metric:e,display:t,loading:n,pending:r}){let i=(0,P.useMemo)(()=>t===`smoothed`?yn(e.points,3):e.points,[t,e.points]),a=(0,P.useMemo)(()=>e.points.length?bn(e.points.map(e=>e.value)):null,[e.points]),o=t=>xn(t,e.format),s=e.xLabel??`training step`;return(0,W.jsxs)(`article`,{className:`training-metric-chart-card`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`div`,{className:`training-metric-chart-title`,children:[(0,W.jsx)(`h4`,{children:e.label}),(0,W.jsx)(`span`,{children:e.points.length?`${e.points.length} ${e.points.length===1?`point`:`points`}`:r?`Live`:`No data`})]}),(0,W.jsx)(`div`,{className:`training-metric-chart-header-actions`,children:a?(0,W.jsx)(`strong`,{children:o(a.latest)}):null})]}),e.points.length?(0,W.jsx)(`div`,{className:`training-metric-card-chart`,"aria-label":`${e.label} by ${s}`,children:(0,W.jsx)(Me,{height:`100%`,width:`100%`,children:(0,W.jsxs)(pn,{data:i,margin:{top:18,right:18,bottom:4,left:0},children:[(0,W.jsx)(Ae,{stroke:`var(--border-default)`,strokeDasharray:`3 4`,vertical:!1}),(0,W.jsx)(ke,{axisLine:!1,dataKey:`step`,fontSize:10,stroke:`var(--text-muted)`,tickLine:!1}),(0,W.jsx)(we,{axisLine:!1,dataKey:`value`,domain:e.bounds??(e.format===`percent`?[0,1]:[`auto`,`auto`]),fontSize:10,stroke:`var(--text-muted)`,tickFormatter:o,tickLine:!1,width:66}),(0,W.jsx)(v,{content:t=>(0,W.jsx)(_n,{active:t.active,format:o,label:e.label,payload:t.payload,xLabel:s}),isAnimationActive:!1}),(0,W.jsx)(dn,{activeDot:{fill:`var(--accent-primary)`,r:5},dataKey:`value`,dot:{fill:`var(--accent-primary)`,r:2.5},isAnimationActive:!1,stroke:`var(--accent-primary)`,strokeWidth:2,type:`monotone`})]})})}):(0,W.jsxs)(`div`,{className:n?`training-metric-chart-empty is-loading`:`training-metric-chart-empty`,children:[n?(0,W.jsxs)(`span`,{className:`sr-only`,children:[`Loading `,e.label]}):null,n?null:(0,W.jsx)(`span`,{children:r?`Waiting for rollout…`:`No data reported`})]}),a?(0,W.jsxs)(`dl`,{className:`training-metric-card-stats`,children:[(0,W.jsx)(G,{label:`Mean`,value:o(a.mean)}),(0,W.jsx)(G,{label:`Min`,value:o(a.min)}),(0,W.jsx)(G,{label:`Max`,value:o(a.max)}),(0,W.jsx)(G,{label:`Std. dev.`,value:o(a.standardDeviation)})]}):null]})});function _n({active:e,payload:t,label:n,format:r,xLabel:i}){if(!e||!t.length)return null;let a=t[0]?.payload;return typeof a?.value==`number`?(0,W.jsxs)(`div`,{className:`training-chart-tooltip`,children:[(0,W.jsxs)(`strong`,{children:[vn(i),` `,String(a.step??`—`)]}),(0,W.jsx)(`dl`,{children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:n}),(0,W.jsx)(`dd`,{children:r(a.value)})]})})]}):null}function vn(e){return e.replace(/^./,e=>e.toUpperCase())}function G({label:e,value:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e}),(0,W.jsx)(`dd`,{children:t})]})}function yn(e,t){return e.map((n,r)=>{let i=e.slice(Math.max(0,r-t+1),r+1);return{step:n.step,value:i.reduce((e,t)=>e+t.value,0)/i.length}})}function bn(e){let t=[...e].sort((e,t)=>e-t),n=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,t)=>e+(t-n)**2,0)/e.length;return{latest:e.at(-1),mean:n,min:t[0],max:t.at(-1),standardDeviation:Math.sqrt(r)}}function xn(e,t=`number`){return t===`percent`?`${(e*100).toFixed(2)}%`:t===`scientific`?e.toExponential(2):Math.abs(e)>=1e3?e.toLocaleString(void 0,{maximumFractionDigits:2}):e.toFixed(4)}var Sn=n();function Cn(e){let t=(0,P.useId)(),[n,r]=(0,P.useState)(null),i=e=>{let t=e.currentTarget.getBoundingClientRect();r({left:Math.max(12,Math.min(t.left,window.innerWidth-292)),top:Math.max(12,Math.min(t.bottom+8,window.innerHeight-168))})};return(0,P.useEffect)(()=>{if(!n)return;let e=()=>r(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e),window.removeEventListener(`keydown`,t)}},[n]),{hideTooltip:()=>r(null),triggerProps:{"aria-describedby":n?t:void 0,onPointerEnter:i,onPointerLeave:()=>r(null),onFocus:i,onBlur:()=>r(null)},tooltip:n?(0,Sn.createPortal)((0,W.jsx)(`aside`,{role:`tooltip`,id:t,className:`run-evidence-tooltip`,style:n,children:e}),document.body):null}}function wn({recovery:e,compact:t=!1,sourceJobId:n}){if(!e)return null;let r=j(`runs`,null,{area:`console`,resourceId:`hosted-job:${n??e.sourceJobId}`}),i=j(`runs`,null,{area:`console`,resourceId:`hosted-job:${e.checkpointJobId??e.sourceJobId}`}),a=A(r),o=`${A(i)}#outputs`;return(0,W.jsxs)(`span`,{className:`training-recovery-lineage${t?` compact`:``}`,children:[(0,W.jsx)(`span`,{children:`Resumed from`}),(0,W.jsxs)(`a`,{className:`app-tooltip`,"data-tooltip":`Open source run`,"aria-label":`Open recovery source run ${n??e.sourceJobId}`,href:a,onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),Ue(r))},children:[(n??e.sourceJobId).slice(0,6),`…`]}),(0,W.jsxs)(`a`,{className:`app-tooltip`,"data-tooltip":`Inspect recovery checkpoint in source outputs`,"aria-label":`Inspect recovery checkpoint ${e.checkpointId}`,href:o,children:[e.checkpointId.slice(0,6),`…`]}),e.replayGroups?.length?(0,W.jsxs)(`span`,{children:[e.replayCompleted?`Replayed`:`Replaying`,` `,e.replayGroups.length===1?`group`:`groups`,` `,e.replayGroups.map(e=>e.groupIndex+1).join(`, `),` after checkpoint restore · Previous update was not saved`]}):null,(0,W.jsxs)(`span`,{children:[`Checkpoint recovery`,t?``:` · policy v${e.policyVersion} · ${e.completedGroups} inherited groups · ${e.optimizerStateRestored?`optimizer checkpoint restored`:`optimizer checkpoint not restored yet`}`]})]})}function Tn({continuation:e,recovery:t,compact:n=!1}){if(t)return(0,W.jsx)(wn,{recovery:t,compact:n});if(!e)return null;let r=A(j(`runs`,null,{area:`console`,resourceId:`hosted-run:${e.sourceJobId}`})),i=e=>`${e.slice(0,6)}…`;return(0,W.jsxs)(`div`,{className:`training-run-lineage${n?` training-run-lineage-compact`:``}`,children:[n?null:(0,W.jsx)(`span`,{children:`Continues from`}),(0,W.jsxs)(`a`,{href:r,"aria-label":`Open parent run ${e.sourceJobId}`,children:[(0,W.jsx)(Xe,{size:12,"aria-hidden":!0}),i(e.sourceJobId)]}),(0,W.jsxs)(`a`,{href:`${r}#outputs`,"aria-label":`Inspect checkpoint ${e.checkpointId} in parent run outputs`,children:[(0,W.jsx)(rt,{size:12,"aria-hidden":!0}),i(e.checkpointId)]})]})}function En({continuation:e}){return e?.optimizerMode===`reset`?(0,W.jsx)(`span`,{className:`training-optimizer-reset app-tooltip`,"data-tooltip":`Optimizer state reset; parent adapter weights retained`,"aria-label":`Optimizer state reset for this run`,children:`Optimizer reset`}):null}function Dn({continuation:e}){return(0,W.jsxs)(`div`,{className:`training-adapter-stack`,"aria-label":`Continual adapter lineage`,children:[(0,W.jsxs)(`div`,{className:`training-adapter-parent`,children:[(0,W.jsx)(`span`,{children:`Frozen parent`}),(0,W.jsx)(`b`,{children:e.parentRank?`Rank ${e.parentRank}`:`Rank unavailable`})]}),(0,W.jsxs)(`div`,{className:`training-adapter-current`,children:[(0,W.jsx)(`strong`,{children:`Continual learning`}),(0,W.jsx)(`span`,{children:`This update`}),(0,W.jsx)(`b`,{children:e.trainableRank?`Rank ${e.trainableRank}`:`Rank unavailable`}),(0,W.jsx)(`small`,{children:e.materialized?`Parent materialized`:`Materialization pending`})]})]})}function On({enabled:e}){let t=e===void 0?`Continual learning configuration is loading.`:`Continual learning ${e?`is configured`:`is not configured`} for this run. This setting does not indicate current execution.`,{triggerProps:n,tooltip:r}=Cn(t);return(0,W.jsxs)(`span`,{...n,tabIndex:0,className:`training-continual-setting`,"aria-label":t,children:[`Continual learning`,` `,(0,W.jsxs)(`small`,{className:`training-continual-badge${e===void 0?` pending`:e?``:` off`}`,children:[e?(0,W.jsx)(Ye,{size:10,"aria-hidden":`true`}):null,e===void 0?`…`:e?`On`:`Off`]}),r]})}function K({label:e,value:t=e,tone:n,pulse:r=!1}){return(0,W.jsxs)(`span`,{className:`labs-status-badge ${n??kn(t)}${r?` is-live`:``}`,title:e,children:[r?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`labs-status-live-dot`}):null,(0,W.jsx)(`span`,{className:`labs-status-badge-label`,children:e})]})}function kn(e){let t=e.trim().toLowerCase().replaceAll(`_`,` `);return t.includes(`ready`)||t.includes(`passed`)||t.includes(`succeeded`)||t.includes(`published`)||t.includes(`released`)||t.includes(`merged`)||t.includes(`imported`)?`positive`:t.includes(`planning`)||t.includes(`applying`)||t.includes(`running`)||t.includes(`evaluating`)||t.includes(`pushing`)?`info`:t.includes(`awaiting`)||t.includes(`paused`)||t.includes(`pr open`)||t.includes(`blocked`)||t.includes(`review`)||t.includes(`dirty`)||t.includes(`pending`)?`warning`:t.includes(`failed`)||t.includes(`rejected`)||t.includes(`closed`)||t.includes(`error`)||t.includes(`disabled`)?`negative`:`neutral`}var An=[`baseline`,`adaptation`,`candidate_adaptation`,`candidate`];function q(e){let t=new Map;for(let n of e){let e=`${n.phase}\u0000${n.taskId}`,r=t.get(e);(!r||n.startedAt>r.startedAt||n.startedAt===r.startedAt&&n.attemptId>r.attemptId)&&t.set(e,n)}return[...t.values()]}function jn(e){let t=q(e.attempts);return Object.fromEntries(An.map(e=>{let n=t.filter(t=>t.phase===e),r=n.map(e=>e.costUsd).filter(e=>e!==null);return[e,{inputTokens:n.reduce((e,t)=>e+t.inputTokens,0),outputTokens:n.reduce((e,t)=>e+t.outputTokens,0),totalTokens:n.reduce((e,t)=>e+t.totalTokens,0),costUsd:r.length?r.reduce((e,t)=>e+t,0):null}]}))}function Mn(e){let t=q(e.attempts??[]),{summary:n,pairs:r}=Ke({attempts:t});return{...n,pairs:r,baselinePassedCount:r.filter(e=>e.baseline.passed).length,refinedPassedCount:r.filter(e=>e.refined.passed).length,cohorts:{adaptation:n.cohorts.adaptation,held_out:n.cohorts.heldOut}}}function J(e){if(!e)return[];let t=new Map;for(let n of[...e.modelTasksets??[],...e.tasksets??[]])t.set(`${n.id}:${n.revision}:${n.contentHash}`,n);return[...t.values()]}function Y(e,t){return(t?.modelRuns??[]).filter(t=>t.modelId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))??[]}function X(e,t,n){if(!n)return[];let r=t.filter(t=>t.target.kind===`model`&&t.target.id===e.id),i=new Set(r.flatMap(e=>e.target.kind===`model`&&e.target.trainingPlanId?[e.target.trainingPlanId]:[])),a=new Set(r.flatMap(e=>e.tasksetRef?[e.tasksetRef.id]:[]));return e.tasksetId&&a.add(e.tasksetId),n.plans.filter(t=>t.modelId===e.id||i.has(t.id)||t.modelId===null&&a.has(t.tasksetId)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function Z(e,t,n){if(!n)return[];let r=new Set(X(e,t,n).map(e=>e.id)),i=new Set(Y(e,n).map(e=>e.id));return n.jobs.filter(t=>r.has(t.planId)||t.metadata.modelProjectId===e.id||typeof t.metadata.modelRunId==`string`&&i.has(t.metadata.modelRunId)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function Nn(e,t,n){if(!n)return[];let r=new Set(X(e,t,n).map(e=>e.tasksetId));for(let n of t)n.target.kind===`model`&&n.target.id===e.id&&n.tasksetRef&&r.add(n.tasksetRef.id);return e.tasksetId&&r.add(e.tasksetId),J(n).filter(e=>r.has(e.id))}function Pn(e,t,n){if(!n)return[];let r=X(e,t,n),i=new Map(r.map(e=>[e.id,e])),a=Z(e,t,n),o=new Map(a.map(e=>[e.id,e])),s=Fn(e,t,n),c=new Set(a.map(e=>e.id));return n.models.filter(t=>t.modelId===e.id||c.has(t.jobId)).sort((e,t)=>e.importedAt.localeCompare(t.importedAt)).map((e,t)=>{let r=o.get(e.jobId)??null;return{lineage:e,number:t+1,job:r,plan:r?i.get(r.planId)??null:null,taskset:J(n).find(t=>t.id===e.tasksetId)??null,current:s?.modelArtifactLineageId===e.id}}).sort((e,t)=>t.number-e.number)}function Fn(e,t,n){if(!n)return null;let r=new Set(Z(e,t,n).map(e=>e.id)),i=new Set(n.models.filter(t=>t.modelId===e.id||r.has(t.jobId)).map(e=>e.id)),a=new Set(t.flatMap(t=>t.target.kind===`model`&&t.target.id===e.id&&t.tasksetRef?[t.tasksetRef.id]:[]));return e.tasksetId&&a.add(e.tasksetId),n.modelBindings.filter(t=>t.status===`active`&&t.role===`chat_manual`&&(t.roleTargetId===e.id||a.has(t.roleTargetId)||t.roleTargetId==="default"&&i.has(t.modelArtifactLineageId))).sort((e,t)=>t.promotedAt.localeCompare(e.promotedAt))[0]??null}function In(e,t=1e3){let[n,r]=(0,P.useState)(()=>Date.now());return(0,P.useEffect)(()=>{if(!e)return;r(Date.now());let n=window.setInterval(()=>r(Date.now()),t);return()=>window.clearInterval(n)},[e,t]),n}var Ln=new Set([`queued`,`starting`,`running`,`reconciling`,`cancelling`]);function Q(e){return Ln.has(e)}function $({job:e,lifecycleRun:t}){return t?.status===`running`&&(e?.status===`cancelling`||e?.status===`reconciling`)?e.status:t?.status??e?.status??`not_run`}function Rn({status:e}){let t=Q(e);return(0,W.jsx)(K,{label:m(e),pulse:t,tone:t?`positive`:void 0,value:e})}function zn({workproduct:e,runs:t,training:n,onOpenDataset:r,onOpenEntry:i,onNewRun:a,readOnly:o=!1,mode:s=`training`}){let c=n.payload,l=(0,P.useMemo)(()=>Z(e,t,c),[t,c,e]),u=(0,P.useMemo)(()=>Pn(e,t,c),[t,c,e]),d=(0,P.useMemo)(()=>X(e,t,c),[t,c,e]),m=(0,P.useMemo)(()=>new Map(d.map(e=>[e.id,e])),[d]),h=Y(e,c),g=J(c),_=c?.comparisonSeriesEntries??[],v=(0,P.useMemo)(()=>Wn(Un(l,u,h),s),[l,h,s,u]),[y,b]=(0,P.useState)(!1),x=y?v:v.slice(0,5),S=v.length,C=In(v.some(e=>Q($(e)))),ee=(0,P.useMemo)(()=>{let e=S,t=new Map;for(let n of v)t.set(n.key,e),--e;return t},[v,S]);function w(e){i(e.key)}return(0,W.jsxs)(`section`,{className:`labs-model-version-index`,"aria-label":`Model runs`,children:[(0,W.jsx)(Ze,{title:s===`evals`?`Evaluations`:`Training Runs`,description:s===`evals`?`Evaluation-only runs, held-out results, and grader evidence.`:`Training runs, optimizer progress, checkpoints, and immutable outputs.`,actions:!o&&s===`training`?(0,W.jsx)(`button`,{className:`training-button`,type:`button`,onClick:a,children:`New training run`}):null}),(0,W.jsx)(`div`,{className:`training-table-wrap`,children:(0,W.jsxs)(`table`,{className:`training-data-table labs-model-runs-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`Run`}),(0,W.jsx)(`th`,{children:`Status`}),(0,W.jsx)(`th`,{children:`Method`}),(0,W.jsx)(`th`,{children:`Based on`}),(0,W.jsx)(`th`,{children:`Taskset`}),(0,W.jsx)(`th`,{children:`Result`}),(0,W.jsx)(`th`,{children:`Duration`}),(0,W.jsx)(`th`,{children:`Updated`})]})}),(0,W.jsxs)(`tbody`,{children:[v.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:8,children:(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`No runs yet.`})})}),x.map(e=>{let t=ee.get(e.key)??null,n=e.version?.plan??(e.job?m.get(e.job.planId)??null:null),i=e.version?.taskset??g.find(t=>t.id===(e.lifecycleRun?.taskset.id??n?.tasksetId))??null,a=e.version;return(0,W.jsxs)(`tr`,{onClick:()=>w(e),children:[(0,W.jsx)(`td`,{children:(0,W.jsxs)(`button`,{className:`labs-version-row-button`,type:`button`,onClick:t=>{t.stopPropagation(),w(e)},children:[(0,W.jsx)(`strong`,{children:`Run ${t}`}),(0,W.jsx)(`small`,{children:a?`Created Version ${a.number}`:e.lifecycleRun?.kind===`evaluation`?`Evaluation`:e.lifecycleRun?.kind===`rollout_smoke`?`Preflight rollout`:`Training`})]})}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Rn,{status:$(e)})}),(0,W.jsx)(`td`,{children:e.lifecycleRun?.kind===`evaluation`?`Evaluation`:f(e.lifecycleRun?.method??n?.recipe.method??Jn(e.job))}),(0,W.jsx)(`td`,{children:Vn(e.lifecycleRun,_,e.job)}),(0,W.jsx)(`td`,{children:i?(0,W.jsx)(`button`,{className:`labs-version-dataset-link`,type:`button`,onClick:e=>{e.stopPropagation(),r(i.id)},children:i.name}):typeof e.job?.metadata.tasksetId==`string`?e.job.metadata.tasksetId:`Unavailable`}),(0,W.jsx)(`td`,{children:qn(e)}),(0,W.jsx)(`td`,{children:Yn(e,C)}),(0,W.jsx)(`td`,{children:p(e.lifecycleRun?.updatedAt??a?.lineage.importedAt??e.job?.updatedAt??``)})]},e.key)})]})]})}),v.length>5?(0,W.jsx)(`div`,{className:`labs-model-run-list-actions`,children:(0,W.jsx)(`button`,{className:`training-button secondary labs-compact-button`,type:`button`,onClick:()=>b(e=>!e),children:y?`Show latest 5`:`Show all ${v.length} activities`})}):null]})}function Bn({workproduct:e,runs:t,training:n,onOpenDataset:r,onOpenEntry:i,onToast:a,readOnly:o=!1}){let s=n.payload,c=(0,P.useMemo)(()=>Pn(e,t,s),[t,s,e]),l=Fn(e,t,s);async function u(t){if(o)return;let r=c.find(e=>e.lineage.id===t);if(!r||!Ge(r.lineage)||!window.confirm(`Set Version ${r.number} as the default for ${e.name}?`))return;let i=await n.actions.bindModel(r.lineage.id,`chat_manual`,e.id);a(i?`Version ${r.number} is now the project default.`:`The default Version could not be changed.`,i?`success`:`error`)}async function d(){if(o||!l?.rollbackTargetBindingId||!window.confirm(`Restore the previous default Version for ${e.name}?`))return;let t=await n.actions.rollbackModelBinding(l.id);a(t?`The previous default Version has been restored.`:`The default Version could not be restored.`,t?`success`:`error`)}async function m(e,t){if(o)return;let r=await n.actions.setModelPinned(e,t);a(r?t?`Version pinned.`:`Version unpinned.`:`Version pin could not be changed.`,r?`success`:`error`)}return(0,W.jsxs)(`section`,{className:`labs-model-version-index`,"aria-label":`Model versions`,children:[(0,W.jsxs)(`header`,{className:`labs-model-section-intro`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{children:`Model Versions`}),(0,W.jsx)(`p`,{children:`Trained outputs that can be evaluated, served, and selected as the project default.`})]}),(0,W.jsxs)(`span`,{children:[c.length,` trained`]})]}),(0,W.jsx)(`div`,{className:`training-table-wrap`,children:(0,W.jsxs)(`table`,{className:`training-data-table labs-model-versions-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`Version`}),(0,W.jsx)(`th`,{children:`Status`}),(0,W.jsx)(`th`,{children:`Training`}),(0,W.jsx)(`th`,{children:`Taskset`}),(0,W.jsx)(`th`,{children:`Evaluation`}),(0,W.jsx)(`th`,{children:`Created`}),(0,W.jsx)(`th`,{children:(0,W.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,W.jsxs)(`tbody`,{children:[c.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:7,children:(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`No trained Versions yet. A successful run will appear here.`})})}),c.map(e=>{let t=l?.modelArtifactLineageId===e.lineage.id;return(0,W.jsxs)(`tr`,{onClick:()=>i(e.job?`job:${e.job.id}`:`version:${e.lineage.id}`),children:[(0,W.jsx)(`td`,{children:(0,W.jsxs)(`button`,{className:`labs-version-row-button`,type:`button`,onClick:()=>i(e.job?`job:${e.job.id}`:`version:${e.lineage.id}`),children:[(0,W.jsxs)(`strong`,{children:[`Version `,e.number]}),(0,W.jsx)(`small`,{children:Qn(e.lineage.id)})]})}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Zn,{job:e.job,version:e})}),(0,W.jsx)(`td`,{children:f(e.plan?.recipe.method??Jn(e.job))}),(0,W.jsx)(`td`,{children:e.taskset?(0,W.jsx)(`button`,{className:`labs-version-dataset-link`,type:`button`,onClick:t=>{t.stopPropagation(),r(e.taskset.id)},children:e.taskset.name}):`Unavailable`}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Xn,{job:e.job,version:e})}),(0,W.jsx)(`td`,{children:p(e.lineage.importedAt)}),(0,W.jsx)(`td`,{children:(0,W.jsxs)(`div`,{className:`training-table-actions`,children:[(0,W.jsx)(`button`,{"aria-pressed":e.lineage.pinned||t,className:`labs-version-icon-button`,disabled:o||t,title:t?`The active Version stays pinned`:e.lineage.pinned?`Unpin Version`:`Pin Version`,type:`button`,onClick:t=>{t.stopPropagation(),m(e.lineage.id,!e.lineage.pinned)},children:(0,W.jsx)(Je,{size:14})}),e.current?null:(0,W.jsx)(`button`,{className:`training-button secondary`,disabled:o||!Ge(e.lineage),type:`button`,onClick:t=>{t.stopPropagation(),u(e.lineage.id)},children:`Set as default`}),e.current&&l?.rollbackTargetBindingId?(0,W.jsx)(`button`,{className:`training-button secondary`,disabled:o,type:`button`,onClick:e=>{e.stopPropagation(),d()},children:`Roll back`}):null,(0,W.jsx)(`button`,{"aria-label":`Download Version ${e.number}`,className:`labs-version-icon-button`,type:`button`,onClick:t=>{t.stopPropagation(),n.actions.downloadModelPackage(e.lineage.id)},children:(0,W.jsx)(qe,{size:14})})]})})]},e.lineage.id)})]})]})})]})}function Vn(e,t,n){let r=e?.comparisonSeriesEntry??null,i=r?t.find(e=>e.id===r.entryId)??null:null;if(!i)return typeof n?.metadata.parentHostedArtifactId==`string`?`Prior hosted run`:e?.kind===`evaluation`?`Evaluated Model Version`:`Frozen base`;if(i.parent.kind===`base_model`)return`Frozen base`;let a=t.find(e=>e.seriesId===i.seriesId&&e.modelVersionId===i.parent.id)??null;return a?`${a.label} · Model Version`:`Prior Model Version`}function Hn(e,t){let n=new Map(t.flatMap(e=>e.job?[[e.job.id,e]]:[])),r=e.map(e=>({key:`job:${e.id}`,job:e,version:n.get(e.id)??null})),i=new Set(e.map(e=>e.id));for(let e of t)e.job&&i.has(e.job.id)||r.push({key:`version:${e.lineage.id}`,job:e.job,version:e});return r.sort((e,t)=>Gn(t).localeCompare(Gn(e)))}function Un(e,t,n){let r=new Map(e.flatMap(e=>typeof e.metadata.modelRunId==`string`?[[e.metadata.modelRunId,e]]:[])),i=new Map(t.flatMap(e=>e.job?[[e.job.id,e]]:[])),a=new Map(t.map(e=>[e.lineage.id,e])),o=new Set,s=n.map(t=>{let n=r.get(t.id)??e.find(e=>e.id===t.id)??null;n&&o.add(n.id);let s=n?i.get(n.id):void 0,c=t.adapterArtifactLineageId?a.get(t.adapterArtifactLineageId):void 0;return{key:`model-run:${t.id}`,job:n,lifecycleRun:t,version:s??c??null}});for(let t of e)o.has(t.id)||s.push({key:`job:${t.id}`,job:t,lifecycleRun:null,version:i.get(t.id)??null});return s.sort((e,t)=>Kn(t).localeCompare(Kn(e)))}function Wn(e,t){return e.filter(e=>t===`evals`?e.lifecycleRun?.kind===`evaluation`:e.lifecycleRun?.kind!==`evaluation`)}function Gn(e){return e.version?.lineage.importedAt??e.job?.updatedAt??e.job?.createdAt??``}function Kn(e){return e.lifecycleRun?.updatedAt??e.job?.updatedAt??e.job?.createdAt??``}function qn(e){if(e.version)return`Version ${e.version.number}`;if(e.lifecycleRun?.kind===`evaluation`&&e.lifecycleRun.receipt?.schemaVersion===`openpond.modelEvaluationReceipt.v1`){let t=e.lifecycleRun.receipt.foregroundTokenDelta;return`${t>0?`+`:``}${t.toLocaleString()} tokens`}return e.lifecycleRun?.reward?`Reward ${e.lifecycleRun.reward.raw.toFixed(3)}`:e.lifecycleRun?.status===`failed`||e.job?.status===`failed`?`Failed`:e.lifecycleRun?.status===`succeeded`||e.job?.status===`succeeded`?`Completed`:e.lifecycleRun?.status===`cancelled`||e.job?.status===`cancelled`?`Cancelled`:`No output`}function Jn(e){let t=e?.metadata.trainingMethod;return t===`sft`||t===`dpo`||t===`grpo`||t===`ppo`||t===`sdft`||t===`opd`||t===`opsd`||t===`sdpo`?t:null}function Yn(e,t){let n=$(e),r=e.lifecycleRun?.startedAt??e.job?.startedAt??e.job?.createdAt??null,i=e.lifecycleRun?d(e.lifecycleRun.status,e.lifecycleRun.completedAt,e.lifecycleRun.updatedAt):e.job?d(e.job.status,e.job.completedAt,e.job.updatedAt):null;return Q(n)?h(r,new Date(t).toISOString()):h(r,i)}function Xn({job:e,version:t}){let n=t?!!He(t.lineage)||e?.metadata.frozenEvaluationComplete===!0||!!t.lineage.frozenEvaluationArtifactId||!!t.lineage.managedServing?.customerBindingAllowed:!1,r=t?!!He(t.lineage)||Ve(t.lineage):!1,i=t?n?r?`Passed`:`Failed`:`Not run`:e&&[`queued`,`starting`,`running`,`cancelling`,`reconciling`].includes(e.status)?`Pending`:`Not run`;return(0,W.jsx)(K,{label:i,value:t?r?`passed`:n?`failed`:`not_run`:`not_run`})}function Zn({job:e,version:t}){let n=!!(e&&[`queued`,`starting`,`running`,`cancelling`,`reconciling`].includes(e.status));return(0,W.jsx)(K,{label:t?t.current?`Active`:`Available`:n?`Pending`:`Not created`,value:t?t.current?`current`:`ready`:n?`running`:`not_run`})}function Qn(e){let t=e.replace(/^baseline_run_/,``).replace(/^(?:training_job_|lineage_)(?:artifact_)?/,``).replace(/^model_run_/,``);return t.length<=12?t:t.slice(-8)}export{Tn as C,et as D,hn as E,nt as O,Dn as S,Cn as T,Mn as _,Hn as a,On as b,$ as c,Z as d,X as f,q as g,jn as h,Wn as i,Y as l,Pn as m,Bn as n,Rn as o,J as p,Un as r,Q as s,zn as t,Nn as u,K as v,wn as w,En as x,kn as y};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r}from"./index-DiVhx1GM.js";import{a as i,m as a,o,p as s,r as c,v as l}from"./schemas-Brv9Vmnk.js";import{t as u}from"./icons-4yRSxBZj.js";import{c as d,l as f,n as p,o as m,r as h}from"./training-model-data-B6IZ3x-t.js";import{At as g,Bt as _,C as v,D as y,Dt as b,F as x,Ht as S,It as C,K as ee,Mt as w,Ot as T,P as te,Q as ne,R as E,Rt as re,S as ie,St as ae,T as D,Tt as O,Vt as oe,W as se,X as ce,_ as le,_t as k,a as ue,at as de,b as fe,c as pe,ct as me,d as he,dt as ge,f as _e,ft as ve,g as ye,h as be,i as xe,j as Se,l as Ce,n as we,nt as Te,o as Ee,p as De,q as Oe,r as ke,s as Ae,t as je,tt as Me,u as Ne,ut as Pe,v as Fe,w as Ie,x as Le,xt as Re,yt as ze,zt as Be}from"./CartesianChart-tS7f1HZv.js";import{Bn as Ve,Bt as A,Hn as He,Pt as Ue,Ut as We,Vn as Ge,Wn as Ke,dn as qe,en as Je,gn as Ye,sn as Xe,zt as j}from"./App-CXhxya9x.js";import{t as Ze}from"./ModelProjectPageHeader-BZn9Lu_J.js";var M=a({label:l().max(200),value:l().max(12e3),severity:c([`info`,`warning`,`error`]).default(`info`)}).strict(),Qe=a({kind:c([`trajectory`,`evaluation`]),id:l().min(1).max(240),taskId:l().min(1).max(512).optional()}).strict().refine(e=>e.kind===`evaluation`?!!e.taskId:e.taskId===void 0,{message:`Evaluation feedback requires a task ID; trajectory feedback uses its receipt ID only.`}),$e=a({status:l(),score:s().nullable(),passed:o().nullable()}).strict(),et=a({jobId:l(),kind:c([`trajectory`,`evaluation`]),id:l(),taskId:l().optional(),compositionSha256:l(),training:$e,evaluation:$e,graders:i(a({graderId:l(),role:c([`training`,`evaluation`]),status:l(),rawScore:s().nullable(),normalizedScore:s().nullable(),passed:o().nullable(),message:l().nullable(),failureClass:l().nullable(),feedback:i(l().max(32768)).max(8)}).strict()).max(32)}).strict(),tt=a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l(),groupId:l(),groupIndex:s().int().nonnegative(),optimizerDisposition:c([`applied`,`skipped_no_signal`]),inputPolicyVersion:s().int().nonnegative(),outputPolicyVersion:s().int().nonnegative().optional()}).strict(),N=a({label:l(),state:c([`done`,`active`,`pending`,`missing`,`failed`]),status:l(),detail:l().optional(),diagnostics:i(M).max(100).optional(),feedback:i(Qe).max(100).optional(),error:l().optional(),progress:s().min(0).max(1).optional(),inLoop:o().optional()}).strict(),nt=a({jobId:l(),teamId:l(),modelProjectId:l(),state:l(),policyVersion:s().int().nonnegative(),groupsCompleted:s().int().nonnegative(),groupsTarget:s().int().nonnegative(),live:o(),continuation:a({sourceJobId:l(),artifactId:l(),checkpointId:l(),optimizerMode:c([`continue`,`reset`]),materialized:o(),parentRank:s().int().positive().optional(),trainableRank:s().int().positive().optional()}).strict().optional(),recovery:a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l().optional(),policyVersion:s().int().positive(),completedGroups:s().int().positive(),optimizerStateRestored:o(),optimizerUpdatesApplied:s().int().nonnegative().optional(),replayGroups:i(tt).max(128).optional(),replayCompleted:o().optional(),undurablePolicyVersion:s().int().positive().optional()}).strict().optional(),nodes:i(N).max(10),inference:N.nullable(),groups:i(a({index:s().int().nonnegative(),optimizerDisposition:c([`applied`,`skipped_no_signal`]).optional(),replay:tt.optional(),inherited:a({sourceJobId:l(),checkpointId:l(),checkpointJobId:l(),optimizerDisposition:c([`applied`,`skipped_no_signal`]),inputPolicyVersion:s().int().nonnegative(),outputPolicyVersion:s().int().nonnegative().optional()}).strict().optional(),nodes:i(N).max(5).optional(),state:l(),meanReward:s().nullable(),plannedSlots:s().int().nonnegative(),diagnostics:i(M).max(100).optional(),attempts:i(a({id:l(),slot:s().int().nonnegative(),attempt:s().int().positive(),state:l(),reward:s().nullable(),diagnostics:i(M).max(100).optional(),feedback:i(Qe).max(100).optional()}).strict()).max(1e3)}).strict()).max(50),groupCount:s().int().nonnegative(),logs:i(a({id:l(),at:l(),source:l(),message:l(),level:l()}).strict()).max(200)}).strict(),rt=u(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),P=e(t());function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F.apply(null,arguments)}var it=e=>{var t=e.cx,n=e.cy,r=e.r,i=e.className,a=S(`recharts-dot`,i);return T(t)&&T(n)&&T(r)?P.createElement(`circle`,F({},_(e),ae(e),{className:a,cx:t,cy:n,r})):null},at=[`points`];function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ot(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=ct(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e){var t=lt(e,`string`);return typeof t==`symbol`?t:t+``}function lt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(null,arguments)}function ut(e,t){if(e==null)return{};var n,r,i=dt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ft(e){var t=e.option,n=e.dotProps,r=e.className;if((0,P.isValidElement)(t))return(0,P.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=S(r,typeof t==`boolean`?``:t.className),a=n??{};a.points;var o=ut(a,at);return P.createElement(it,L({},o,{className:i}))}function pt(e,t){return e==null?!1:t?!0:e.length===1}function mt(e){var t=e.points,n=e.dot,r=e.className,i=e.dotClassName,a=e.dataKey,o=e.baseProps,s=e.needClip,c=e.clipPathId,l=e.zIndex,u=l===void 0?E.scatter:l;if(!pt(t,n))return null;var d=fe(n),f=Be(n),p=t.map((e,r)=>{var s=I(I(I({r:3},o),f),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return P.createElement(ft,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&c!=null&&(m.clipPath=`url(#clipPath-${d?``:`dots-`}${c})`),P.createElement(D,{zIndex:u},P.createElement(C,L({className:r},m),p))}function ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ht(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gt(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _t(e){var t=vt(e,`string`);return typeof t==`symbol`?t:t+``}function vt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var yt=e=>{var t=e.point,n=e.childIndex,r=e.mainColor,i=e.activeDot,a=e.dataKey,o=e.clipPath;if(i===!1||t.x==null||t.y==null)return null;var s=R(R(R({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),oe(i)),ae(i)),c=(0,P.isValidElement)(i)?(0,P.cloneElement)(i,s):typeof i==`function`?i(s):P.createElement(it,s);return P.createElement(C,{className:`recharts-active-dot`,clipPath:o},c)};function bt(e){var t=e.points,n=e.mainColor,r=e.activeDot,i=e.itemDataKey,a=e.clipPath,o=e.zIndex,s=o===void 0?E.activeDot:o,c=ze(y),l=pe();if(t==null||l==null)return null;var u=t.find(e=>l.includes(e.payload));return b(u)?null:P.createElement(D,{zIndex:s},P.createElement(yt,{point:u,childIndex:Number(c),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var xt=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function St(e,t){if(e==null)return{};var n,r,i=Ct(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ct(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function wt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Tt(e,t){return`${t}px ${e}px`}function Et(e){return e.length%2==0?e:[...e,...e]}function Dt(e,t){for(var n=[],r=0;r<t;++r)n.push(...e);return n}function Ot(e,t,n){var r=Et(n),i=r.reduce((e,t)=>e+t,0);if(!i)return Tt(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;c<r.length;l+=(u=r[c])??0,++c){var u,d=r[c];if(d!=null&&l+d>o){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Dt(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function kt(e,t,n){return e?Ot(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):Tt(t,n)}function At(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=St(e,xt),a=r??!1,o;if(t!=null){var s=i.pathRef;o=kt(n,wt(s?.current??null),t)}else n!=null&&(o=String(n));return P.createElement(ee,z({},i,{connectNulls:a,strokeDasharray:o}))}function jt(e){var t=(0,P.useRef)(0),n=(0,P.useRef)(0),r=(0,P.useRef)(!1),i=(0,P.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,P.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(w(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Mt=(e,t,n,r)=>Se(e,`xAxis`,t,r),Nt=(e,t,n,r)=>te(e,`xAxis`,t,r),Pt=(e,t,n,r)=>Se(e,`yAxis`,n,r),Ft=(e,t,n,r)=>te(e,`yAxis`,n,r),It=k([ce,Mt,Pt,Nt,Ft],(e,t,n,r,i)=>ve(e,`xAxis`)?de(t,r,!1):de(n,i,!1)),Lt=(e,t,n,r,i)=>i;function Rt(e){return e.type===`line`}var zt=k([x,Lt],(e,t)=>e.filter(Rt).find(e=>e.id===t)),Bt=k([ce,Mt,Pt,Nt,Ft,zt,It,se],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return ln({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function Vt(e){var t=oe(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var Ht=[`id`],Ut=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],Wt=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n,r,i=Gt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Gt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Kt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e){var t=Yt(e,`string`);return typeof t==`symbol`?t:t+``}function Yt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Xt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Zt(e){var t=0,n=0;for(var r of e)r.status===`matched`&&r.prev.x!=null&&r.next.x!=null&&(t+=r.next.x-r.prev.x,n++);return n>0?t/n:0}var U={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Zt(e),r=[];for(var i of e)if(i.status===`matched`)r.push(H(H({},i.next),{},{x:O(i.prev.x,i.next.x,t),y:O(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(H(H({},i.next),{},{x:O(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(H(H({},i.prev),{},{x:O(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:be,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:At,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:E.line,type:`linear`},Qt=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Pe(n,t),payload:e}]},$t=P.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:g,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Pe(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return P.createElement(le,{tooltipEntrySettings:f})});function en(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=V(r,Ht),c=_(s);return P.createElement(mt,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function tn(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,P.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return H(H({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return P.createElement(Le,{value:t?i:void 0},n)}function nn(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=V(i,Ut),g=H(H({},re(h)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return P.createElement(P.Fragment,null,r?.length>1&&P.createElement(Fe,{option:p,DefaultShape:U.shape,shapeProps:g}),P.createElement(en,{points:r,clipPathId:t,props:i}))}function rn(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=Xt(r.current),m=De(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,v=!h,y=jt(a),b=(0,P.useCallback)(e=>e>0&&p>0,[p]);return P.createElement(tn,{points:a,showLabels:v},n.children,P.createElement(_e,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:b,layout:f},(e,i,a)=>{var o=h||i<1,s=o?y(i,p):null;return P.createElement(nn,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),P.createElement(ie,{label:n.label}))}function an(e){var t=e.clipPathId,n=e.props,r=(0,P.useRef)(null),i=(0,P.useRef)(null);return P.createElement(rn,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var on=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:ge(e.payload,t)}),sn=class extends P.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,c=e.left,l=e.width,u=e.height,d=e.id,f=e.needClip,p=e.zIndex;if(t)return null;var m=S(`recharts-line`,i),h=d,g=Vt(n),_=g.r,v=g.strokeWidth,y=fe(n),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${h})`:void 0;return P.createElement(D,{zIndex:p},P.createElement(C,{className:m},f&&P.createElement(`defs`,null,P.createElement(xe,{clipPathId:h,xAxisId:a,yAxisId:o}),!y&&P.createElement(`clipPath`,{id:`clipPath-dots-${h}`},P.createElement(`rect`,{x:c-b/2,y:s-b/2,width:l+b,height:u+b}))),P.createElement(Ee,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:on,errorBarOffset:0},P.createElement(an,{props:this.props,clipPathId:h}))),P.createElement(bt,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}};function cn(e){var t=Re(e,U),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=V(t,Wt),_=ue(p,m).needClip,v=Ce(),y=ne(),b=Te(),x=ze(e=>Bt(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var S=v.height,C=v.width,ee=v.x,w=v.y;return P.createElement(sn,B({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:ee,top:w,needClip:_}))}function ln(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=ge(e,o);if(t===`horizontal`)return{x:me({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(b(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=b(l)?null:n.scale.map(l),d=me({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function un(e){var t=Re(e,U),n=Te();return P.createElement(he,{id:t.id,type:`line`},e=>P.createElement(P.Fragment,null,P.createElement(ye,{legendPayload:Qt(t)}),P.createElement($t,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),P.createElement(Ne,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),P.createElement(cn,B({},t,{id:e}))))}var dn=P.memo(un,Oe);dn.displayName=`Line`;var fn=[`axis`],pn=(0,P.forwardRef)((e,t)=>P.createElement(je,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:fn,tooltipPayloadSearcher:Ie,categoricalChartProps:e,ref:t})),W=r(),mn=[{id:`optimizer.reward`,label:`Mean reward`,points:[]},{id:`reward.variance`,label:`Reward variance`,points:[]},{id:`optimizer.kl`,label:`Policy update KL`,points:[]},{id:`optimizer.policy_loss`,label:`Policy loss`,points:[]},{id:`optimizer.learning_rate`,label:`Learning rate`,points:[],format:`scientific`}];function hn({series:e,loading:t=!1,live:n=!1}){let[r,i]=(0,P.useState)(`raw`),a=(0,P.useMemo)(()=>{let r=e.filter(e=>e.points.length);if(!t&&!n)return r;let i=new Map(r.map(e=>[e.id,e]));for(let e of mn)i.has(e.id)||i.set(e.id,e);return[...i.values()]},[n,t,e]),o=a.some(e=>e.points.length>1);return a.length?(0,W.jsxs)(`section`,{className:`training-metric-workbench`,"aria-label":`Training metrics`,children:[o?(0,W.jsx)(`div`,{className:`training-metric-workbench-controls`,children:(0,W.jsx)(We,{compact:!0,floating:!0,label:`Metric display`,value:r,options:[{value:`raw`,label:`Raw values`},{value:`smoothed`,label:`Smoothed trend`}],onChange:e=>i(e)})}):null,(0,W.jsx)(`div`,{className:`training-metric-chart-grid`,children:a.map(e=>(0,W.jsx)(gn,{display:r,loading:t&&!e.points.length,metric:e,pending:n&&!e.points.length},e.id))})]}):(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`This run did not report chartable metrics.`})}var gn=(0,P.memo)(function({metric:e,display:t,loading:n,pending:r}){let i=(0,P.useMemo)(()=>t===`smoothed`?yn(e.points,3):e.points,[t,e.points]),a=(0,P.useMemo)(()=>e.points.length?bn(e.points.map(e=>e.value)):null,[e.points]),o=t=>xn(t,e.format),s=e.xLabel??`training step`;return(0,W.jsxs)(`article`,{className:`training-metric-chart-card`,children:[(0,W.jsxs)(`header`,{children:[(0,W.jsxs)(`div`,{className:`training-metric-chart-title`,children:[(0,W.jsx)(`h4`,{children:e.label}),(0,W.jsx)(`span`,{children:e.points.length?`${e.points.length} ${e.points.length===1?`point`:`points`}`:r?`Live`:`No data`})]}),(0,W.jsx)(`div`,{className:`training-metric-chart-header-actions`,children:a?(0,W.jsx)(`strong`,{children:o(a.latest)}):null})]}),e.points.length?(0,W.jsx)(`div`,{className:`training-metric-card-chart`,"aria-label":`${e.label} by ${s}`,children:(0,W.jsx)(Me,{height:`100%`,width:`100%`,children:(0,W.jsxs)(pn,{data:i,margin:{top:18,right:18,bottom:4,left:0},children:[(0,W.jsx)(Ae,{stroke:`var(--border-default)`,strokeDasharray:`3 4`,vertical:!1}),(0,W.jsx)(ke,{axisLine:!1,dataKey:`step`,fontSize:10,stroke:`var(--text-muted)`,tickLine:!1}),(0,W.jsx)(we,{axisLine:!1,dataKey:`value`,domain:e.bounds??(e.format===`percent`?[0,1]:[`auto`,`auto`]),fontSize:10,stroke:`var(--text-muted)`,tickFormatter:o,tickLine:!1,width:66}),(0,W.jsx)(v,{content:t=>(0,W.jsx)(_n,{active:t.active,format:o,label:e.label,payload:t.payload,xLabel:s}),isAnimationActive:!1}),(0,W.jsx)(dn,{activeDot:{fill:`var(--accent-primary)`,r:5},dataKey:`value`,dot:{fill:`var(--accent-primary)`,r:2.5},isAnimationActive:!1,stroke:`var(--accent-primary)`,strokeWidth:2,type:`monotone`})]})})}):(0,W.jsxs)(`div`,{className:n?`training-metric-chart-empty is-loading`:`training-metric-chart-empty`,children:[n?(0,W.jsxs)(`span`,{className:`sr-only`,children:[`Loading `,e.label]}):null,n?null:(0,W.jsx)(`span`,{children:r?`Waiting for rollout…`:`No data reported`})]}),a?(0,W.jsxs)(`dl`,{className:`training-metric-card-stats`,children:[(0,W.jsx)(G,{label:`Mean`,value:o(a.mean)}),(0,W.jsx)(G,{label:`Min`,value:o(a.min)}),(0,W.jsx)(G,{label:`Max`,value:o(a.max)}),(0,W.jsx)(G,{label:`Std. dev.`,value:o(a.standardDeviation)})]}):null]})});function _n({active:e,payload:t,label:n,format:r,xLabel:i}){if(!e||!t.length)return null;let a=t[0]?.payload;return typeof a?.value==`number`?(0,W.jsxs)(`div`,{className:`training-chart-tooltip`,children:[(0,W.jsxs)(`strong`,{children:[vn(i),` `,String(a.step??`—`)]}),(0,W.jsx)(`dl`,{children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:n}),(0,W.jsx)(`dd`,{children:r(a.value)})]})})]}):null}function vn(e){return e.replace(/^./,e=>e.toUpperCase())}function G({label:e,value:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e}),(0,W.jsx)(`dd`,{children:t})]})}function yn(e,t){return e.map((n,r)=>{let i=e.slice(Math.max(0,r-t+1),r+1);return{step:n.step,value:i.reduce((e,t)=>e+t.value,0)/i.length}})}function bn(e){let t=[...e].sort((e,t)=>e-t),n=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,t)=>e+(t-n)**2,0)/e.length;return{latest:e.at(-1),mean:n,min:t[0],max:t.at(-1),standardDeviation:Math.sqrt(r)}}function xn(e,t=`number`){return t===`percent`?`${(e*100).toFixed(2)}%`:t===`scientific`?e.toExponential(2):Math.abs(e)>=1e3?e.toLocaleString(void 0,{maximumFractionDigits:2}):e.toFixed(4)}var Sn=n();function Cn(e){let t=(0,P.useId)(),[n,r]=(0,P.useState)(null),i=e=>{let t=e.currentTarget.getBoundingClientRect();r({left:Math.max(12,Math.min(t.left,window.innerWidth-292)),top:Math.max(12,Math.min(t.bottom+8,window.innerHeight-168))})};return(0,P.useEffect)(()=>{if(!n)return;let e=()=>r(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e),window.removeEventListener(`keydown`,t)}},[n]),{hideTooltip:()=>r(null),triggerProps:{"aria-describedby":n?t:void 0,onPointerEnter:i,onPointerLeave:()=>r(null),onFocus:i,onBlur:()=>r(null)},tooltip:n?(0,Sn.createPortal)((0,W.jsx)(`aside`,{role:`tooltip`,id:t,className:`run-evidence-tooltip`,style:n,children:e}),document.body):null}}function wn({recovery:e,compact:t=!1,sourceJobId:n}){if(!e)return null;let r=j(`runs`,null,{area:`console`,resourceId:`hosted-job:${n??e.sourceJobId}`}),i=j(`runs`,null,{area:`console`,resourceId:`hosted-job:${e.checkpointJobId??e.sourceJobId}`}),a=A(r),o=`${A(i)}#outputs`;return(0,W.jsxs)(`span`,{className:`training-recovery-lineage${t?` compact`:``}`,children:[(0,W.jsx)(`span`,{children:`Resumed from`}),(0,W.jsxs)(`a`,{className:`app-tooltip`,"data-tooltip":`Open source run`,"aria-label":`Open recovery source run ${n??e.sourceJobId}`,href:a,onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),Ue(r))},children:[(n??e.sourceJobId).slice(0,6),`…`]}),(0,W.jsxs)(`a`,{className:`app-tooltip`,"data-tooltip":`Inspect recovery checkpoint in source outputs`,"aria-label":`Inspect recovery checkpoint ${e.checkpointId}`,href:o,children:[e.checkpointId.slice(0,6),`…`]}),e.replayGroups?.length?(0,W.jsxs)(`span`,{children:[e.replayCompleted?`Replayed`:`Replaying`,` `,e.replayGroups.length===1?`group`:`groups`,` `,e.replayGroups.map(e=>e.groupIndex+1).join(`, `),` after checkpoint restore · Previous update was not saved`]}):null,(0,W.jsxs)(`span`,{children:[`Checkpoint recovery`,t?``:` · policy v${e.policyVersion} · ${e.completedGroups} inherited groups · ${e.optimizerStateRestored?`optimizer checkpoint restored`:`optimizer checkpoint not restored yet`}`]})]})}function Tn({continuation:e,recovery:t,compact:n=!1}){if(t)return(0,W.jsx)(wn,{recovery:t,compact:n});if(!e)return null;let r=A(j(`runs`,null,{area:`console`,resourceId:`hosted-run:${e.sourceJobId}`})),i=e=>`${e.slice(0,6)}…`;return(0,W.jsxs)(`div`,{className:`training-run-lineage${n?` training-run-lineage-compact`:``}`,children:[n?null:(0,W.jsx)(`span`,{children:`Continues from`}),(0,W.jsxs)(`a`,{href:r,"aria-label":`Open parent run ${e.sourceJobId}`,children:[(0,W.jsx)(Xe,{size:12,"aria-hidden":!0}),i(e.sourceJobId)]}),(0,W.jsxs)(`a`,{href:`${r}#outputs`,"aria-label":`Inspect checkpoint ${e.checkpointId} in parent run outputs`,children:[(0,W.jsx)(rt,{size:12,"aria-hidden":!0}),i(e.checkpointId)]})]})}function En({continuation:e}){return e?.optimizerMode===`reset`?(0,W.jsx)(`span`,{className:`training-optimizer-reset app-tooltip`,"data-tooltip":`Optimizer state reset; parent adapter weights retained`,"aria-label":`Optimizer state reset for this run`,children:`Optimizer reset`}):null}function Dn({continuation:e}){return(0,W.jsxs)(`div`,{className:`training-adapter-stack`,"aria-label":`Continual adapter lineage`,children:[(0,W.jsxs)(`div`,{className:`training-adapter-parent`,children:[(0,W.jsx)(`span`,{children:`Frozen parent`}),(0,W.jsx)(`b`,{children:e.parentRank?`Rank ${e.parentRank}`:`Rank unavailable`})]}),(0,W.jsxs)(`div`,{className:`training-adapter-current`,children:[(0,W.jsx)(`strong`,{children:`Continual learning`}),(0,W.jsx)(`span`,{children:`This update`}),(0,W.jsx)(`b`,{children:e.trainableRank?`Rank ${e.trainableRank}`:`Rank unavailable`}),(0,W.jsx)(`small`,{children:e.materialized?`Parent materialized`:`Materialization pending`})]})]})}function On({enabled:e}){let t=e===void 0?`Continual learning configuration is loading.`:`Continual learning ${e?`is configured`:`is not configured`} for this run. This setting does not indicate current execution.`,{triggerProps:n,tooltip:r}=Cn(t);return(0,W.jsxs)(`span`,{...n,tabIndex:0,className:`training-continual-setting`,"aria-label":t,children:[`Continual learning`,` `,(0,W.jsxs)(`small`,{className:`training-continual-badge${e===void 0?` pending`:e?``:` off`}`,children:[e?(0,W.jsx)(Ye,{size:10,"aria-hidden":`true`}):null,e===void 0?`…`:e?`On`:`Off`]}),r]})}function K({label:e,value:t=e,tone:n,pulse:r=!1}){return(0,W.jsxs)(`span`,{className:`labs-status-badge ${n??kn(t)}${r?` is-live`:``}`,title:e,children:[r?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`labs-status-live-dot`}):null,(0,W.jsx)(`span`,{className:`labs-status-badge-label`,children:e})]})}function kn(e){let t=e.trim().toLowerCase().replaceAll(`_`,` `);return t.includes(`ready`)||t.includes(`passed`)||t.includes(`succeeded`)||t.includes(`published`)||t.includes(`released`)||t.includes(`merged`)||t.includes(`imported`)?`positive`:t.includes(`planning`)||t.includes(`applying`)||t.includes(`running`)||t.includes(`evaluating`)||t.includes(`pushing`)?`info`:t.includes(`awaiting`)||t.includes(`paused`)||t.includes(`pr open`)||t.includes(`blocked`)||t.includes(`review`)||t.includes(`dirty`)||t.includes(`pending`)?`warning`:t.includes(`failed`)||t.includes(`rejected`)||t.includes(`closed`)||t.includes(`error`)||t.includes(`disabled`)?`negative`:`neutral`}var An=[`baseline`,`adaptation`,`candidate_adaptation`,`candidate`];function q(e){let t=new Map;for(let n of e){let e=`${n.phase}\u0000${n.taskId}`,r=t.get(e);(!r||n.startedAt>r.startedAt||n.startedAt===r.startedAt&&n.attemptId>r.attemptId)&&t.set(e,n)}return[...t.values()]}function jn(e){let t=q(e.attempts);return Object.fromEntries(An.map(e=>{let n=t.filter(t=>t.phase===e),r=n.map(e=>e.costUsd).filter(e=>e!==null);return[e,{inputTokens:n.reduce((e,t)=>e+t.inputTokens,0),outputTokens:n.reduce((e,t)=>e+t.outputTokens,0),totalTokens:n.reduce((e,t)=>e+t.totalTokens,0),costUsd:r.length?r.reduce((e,t)=>e+t,0):null}]}))}function Mn(e){let t=q(e.attempts??[]),{summary:n,pairs:r}=Ke({attempts:t});return{...n,pairs:r,baselinePassedCount:r.filter(e=>e.baseline.passed).length,refinedPassedCount:r.filter(e=>e.refined.passed).length,cohorts:{adaptation:n.cohorts.adaptation,held_out:n.cohorts.heldOut}}}function J(e){if(!e)return[];let t=new Map;for(let n of[...e.modelTasksets??[],...e.tasksets??[]])t.set(`${n.id}:${n.revision}:${n.contentHash}`,n);return[...t.values()]}function Y(e,t){return(t?.modelRuns??[]).filter(t=>t.modelId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))??[]}function X(e,t,n){if(!n)return[];let r=t.filter(t=>t.target.kind===`model`&&t.target.id===e.id),i=new Set(r.flatMap(e=>e.target.kind===`model`&&e.target.trainingPlanId?[e.target.trainingPlanId]:[])),a=new Set(r.flatMap(e=>e.tasksetRef?[e.tasksetRef.id]:[]));return e.tasksetId&&a.add(e.tasksetId),n.plans.filter(t=>t.modelId===e.id||i.has(t.id)||t.modelId===null&&a.has(t.tasksetId)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function Z(e,t,n){if(!n)return[];let r=new Set(X(e,t,n).map(e=>e.id)),i=new Set(Y(e,n).map(e=>e.id));return n.jobs.filter(t=>r.has(t.planId)||t.metadata.modelProjectId===e.id||typeof t.metadata.modelRunId==`string`&&i.has(t.metadata.modelRunId)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function Nn(e,t,n){if(!n)return[];let r=new Set(X(e,t,n).map(e=>e.tasksetId));for(let n of t)n.target.kind===`model`&&n.target.id===e.id&&n.tasksetRef&&r.add(n.tasksetRef.id);return e.tasksetId&&r.add(e.tasksetId),J(n).filter(e=>r.has(e.id))}function Pn(e,t,n){if(!n)return[];let r=X(e,t,n),i=new Map(r.map(e=>[e.id,e])),a=Z(e,t,n),o=new Map(a.map(e=>[e.id,e])),s=Fn(e,t,n),c=new Set(a.map(e=>e.id));return n.models.filter(t=>t.modelId===e.id||c.has(t.jobId)).sort((e,t)=>e.importedAt.localeCompare(t.importedAt)).map((e,t)=>{let r=o.get(e.jobId)??null;return{lineage:e,number:t+1,job:r,plan:r?i.get(r.planId)??null:null,taskset:J(n).find(t=>t.id===e.tasksetId)??null,current:s?.modelArtifactLineageId===e.id}}).sort((e,t)=>t.number-e.number)}function Fn(e,t,n){if(!n)return null;let r=new Set(Z(e,t,n).map(e=>e.id)),i=new Set(n.models.filter(t=>t.modelId===e.id||r.has(t.jobId)).map(e=>e.id)),a=new Set(t.flatMap(t=>t.target.kind===`model`&&t.target.id===e.id&&t.tasksetRef?[t.tasksetRef.id]:[]));return e.tasksetId&&a.add(e.tasksetId),n.modelBindings.filter(t=>t.status===`active`&&t.role===`chat_manual`&&(t.roleTargetId===e.id||a.has(t.roleTargetId)||t.roleTargetId==="default"&&i.has(t.modelArtifactLineageId))).sort((e,t)=>t.promotedAt.localeCompare(e.promotedAt))[0]??null}function In(e,t=1e3){let[n,r]=(0,P.useState)(()=>Date.now());return(0,P.useEffect)(()=>{if(!e)return;r(Date.now());let n=window.setInterval(()=>r(Date.now()),t);return()=>window.clearInterval(n)},[e,t]),n}var Ln=new Set([`queued`,`starting`,`running`,`reconciling`,`cancelling`]);function Q(e){return Ln.has(e)}function $({job:e,lifecycleRun:t}){return t?.status===`running`&&(e?.status===`cancelling`||e?.status===`reconciling`)?e.status:t?.status??e?.status??`not_run`}function Rn({status:e}){let t=Q(e);return(0,W.jsx)(K,{label:m(e),pulse:t,tone:t?`positive`:void 0,value:e})}function zn({workproduct:e,runs:t,training:n,onOpenDataset:r,onOpenEntry:i,onNewRun:a,readOnly:o=!1,mode:s=`training`}){let c=n.payload,l=(0,P.useMemo)(()=>Z(e,t,c),[t,c,e]),u=(0,P.useMemo)(()=>Pn(e,t,c),[t,c,e]),d=(0,P.useMemo)(()=>X(e,t,c),[t,c,e]),m=(0,P.useMemo)(()=>new Map(d.map(e=>[e.id,e])),[d]),h=Y(e,c),g=J(c),_=c?.comparisonSeriesEntries??[],v=(0,P.useMemo)(()=>Wn(Un(l,u,h),s),[l,h,s,u]),[y,b]=(0,P.useState)(!1),x=y?v:v.slice(0,5),S=v.length,C=In(v.some(e=>Q($(e)))),ee=(0,P.useMemo)(()=>{let e=S,t=new Map;for(let n of v)t.set(n.key,e),--e;return t},[v,S]);function w(e){i(e.key)}return(0,W.jsxs)(`section`,{className:`labs-model-version-index`,"aria-label":`Model runs`,children:[(0,W.jsx)(Ze,{title:s===`evals`?`Evaluations`:`Training Runs`,description:s===`evals`?`Evaluation-only runs, held-out results, and grader evidence.`:`Training runs, optimizer progress, checkpoints, and immutable outputs.`,actions:!o&&s===`training`?(0,W.jsx)(`button`,{className:`training-button`,type:`button`,onClick:a,children:`New training run`}):null}),(0,W.jsx)(`div`,{className:`training-table-wrap`,children:(0,W.jsxs)(`table`,{className:`training-data-table labs-model-runs-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`Run`}),(0,W.jsx)(`th`,{children:`Status`}),(0,W.jsx)(`th`,{children:`Method`}),(0,W.jsx)(`th`,{children:`Based on`}),(0,W.jsx)(`th`,{children:`Taskset`}),(0,W.jsx)(`th`,{children:`Result`}),(0,W.jsx)(`th`,{children:`Duration`}),(0,W.jsx)(`th`,{children:`Updated`})]})}),(0,W.jsxs)(`tbody`,{children:[v.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:8,children:(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`No runs yet.`})})}),x.map(e=>{let t=ee.get(e.key)??null,n=e.version?.plan??(e.job?m.get(e.job.planId)??null:null),i=e.version?.taskset??g.find(t=>t.id===(e.lifecycleRun?.taskset.id??n?.tasksetId))??null,a=e.version;return(0,W.jsxs)(`tr`,{onClick:()=>w(e),children:[(0,W.jsx)(`td`,{children:(0,W.jsxs)(`button`,{className:`labs-version-row-button`,type:`button`,onClick:t=>{t.stopPropagation(),w(e)},children:[(0,W.jsx)(`strong`,{children:`Run ${t}`}),(0,W.jsx)(`small`,{children:a?`Created Version ${a.number}`:e.lifecycleRun?.kind===`evaluation`?`Evaluation`:e.lifecycleRun?.kind===`rollout_smoke`?`Preflight rollout`:`Training`})]})}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Rn,{status:$(e)})}),(0,W.jsx)(`td`,{children:e.lifecycleRun?.kind===`evaluation`?`Evaluation`:f(e.lifecycleRun?.method??n?.recipe.method??Jn(e.job))}),(0,W.jsx)(`td`,{children:Vn(e.lifecycleRun,_,e.job)}),(0,W.jsx)(`td`,{children:i?(0,W.jsx)(`button`,{className:`labs-version-dataset-link`,type:`button`,onClick:e=>{e.stopPropagation(),r(i.id)},children:i.name}):typeof e.job?.metadata.tasksetId==`string`?e.job.metadata.tasksetId:`Unavailable`}),(0,W.jsx)(`td`,{children:qn(e)}),(0,W.jsx)(`td`,{children:Yn(e,C)}),(0,W.jsx)(`td`,{children:p(e.lifecycleRun?.updatedAt??a?.lineage.importedAt??e.job?.updatedAt??``)})]},e.key)})]})]})}),v.length>5?(0,W.jsx)(`div`,{className:`labs-model-run-list-actions`,children:(0,W.jsx)(`button`,{className:`training-button secondary labs-compact-button`,type:`button`,onClick:()=>b(e=>!e),children:y?`Show latest 5`:`Show all ${v.length} activities`})}):null]})}function Bn({workproduct:e,runs:t,training:n,onOpenDataset:r,onOpenEntry:i,onToast:a,readOnly:o=!1}){let s=n.payload,c=(0,P.useMemo)(()=>Pn(e,t,s),[t,s,e]),l=Fn(e,t,s);async function u(t){if(o)return;let r=c.find(e=>e.lineage.id===t);if(!r||!Ge(r.lineage)||!window.confirm(`Set Version ${r.number} as the default for ${e.name}?`))return;let i=await n.actions.bindModel(r.lineage.id,`chat_manual`,e.id);a(i?`Version ${r.number} is now the project default.`:`The default Version could not be changed.`,i?`success`:`error`)}async function d(){if(o||!l?.rollbackTargetBindingId||!window.confirm(`Restore the previous default Version for ${e.name}?`))return;let t=await n.actions.rollbackModelBinding(l.id);a(t?`The previous default Version has been restored.`:`The default Version could not be restored.`,t?`success`:`error`)}async function m(e,t){if(o)return;let r=await n.actions.setModelPinned(e,t);a(r?t?`Version pinned.`:`Version unpinned.`:`Version pin could not be changed.`,r?`success`:`error`)}return(0,W.jsxs)(`section`,{className:`labs-model-version-index`,"aria-label":`Model versions`,children:[(0,W.jsxs)(`header`,{className:`labs-model-section-intro`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{children:`Model Versions`}),(0,W.jsx)(`p`,{children:`Trained outputs that can be evaluated, served, and selected as the project default.`})]}),(0,W.jsxs)(`span`,{children:[c.length,` trained`]})]}),(0,W.jsx)(`div`,{className:`training-table-wrap`,children:(0,W.jsxs)(`table`,{className:`training-data-table labs-model-versions-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{children:`Version`}),(0,W.jsx)(`th`,{children:`Status`}),(0,W.jsx)(`th`,{children:`Training`}),(0,W.jsx)(`th`,{children:`Taskset`}),(0,W.jsx)(`th`,{children:`Evaluation`}),(0,W.jsx)(`th`,{children:`Created`}),(0,W.jsx)(`th`,{children:(0,W.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,W.jsxs)(`tbody`,{children:[c.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:7,children:(0,W.jsx)(`div`,{className:`training-run-placeholder`,children:`No trained Versions yet. A successful run will appear here.`})})}),c.map(e=>{let t=l?.modelArtifactLineageId===e.lineage.id;return(0,W.jsxs)(`tr`,{onClick:()=>i(e.job?`job:${e.job.id}`:`version:${e.lineage.id}`),children:[(0,W.jsx)(`td`,{children:(0,W.jsxs)(`button`,{className:`labs-version-row-button`,type:`button`,onClick:()=>i(e.job?`job:${e.job.id}`:`version:${e.lineage.id}`),children:[(0,W.jsxs)(`strong`,{children:[`Version `,e.number]}),(0,W.jsx)(`small`,{children:Qn(e.lineage.id)})]})}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Zn,{job:e.job,version:e})}),(0,W.jsx)(`td`,{children:f(e.plan?.recipe.method??Jn(e.job))}),(0,W.jsx)(`td`,{children:e.taskset?(0,W.jsx)(`button`,{className:`labs-version-dataset-link`,type:`button`,onClick:t=>{t.stopPropagation(),r(e.taskset.id)},children:e.taskset.name}):`Unavailable`}),(0,W.jsx)(`td`,{children:(0,W.jsx)(Xn,{job:e.job,version:e})}),(0,W.jsx)(`td`,{children:p(e.lineage.importedAt)}),(0,W.jsx)(`td`,{children:(0,W.jsxs)(`div`,{className:`training-table-actions`,children:[(0,W.jsx)(`button`,{"aria-pressed":e.lineage.pinned||t,className:`labs-version-icon-button`,disabled:o||t,title:t?`The active Version stays pinned`:e.lineage.pinned?`Unpin Version`:`Pin Version`,type:`button`,onClick:t=>{t.stopPropagation(),m(e.lineage.id,!e.lineage.pinned)},children:(0,W.jsx)(Je,{size:14})}),e.current?null:(0,W.jsx)(`button`,{className:`training-button secondary`,disabled:o||!Ge(e.lineage),type:`button`,onClick:t=>{t.stopPropagation(),u(e.lineage.id)},children:`Set as default`}),e.current&&l?.rollbackTargetBindingId?(0,W.jsx)(`button`,{className:`training-button secondary`,disabled:o,type:`button`,onClick:e=>{e.stopPropagation(),d()},children:`Roll back`}):null,(0,W.jsx)(`button`,{"aria-label":`Download Version ${e.number}`,className:`labs-version-icon-button`,type:`button`,onClick:t=>{t.stopPropagation(),n.actions.downloadModelPackage(e.lineage.id)},children:(0,W.jsx)(qe,{size:14})})]})})]},e.lineage.id)})]})]})})]})}function Vn(e,t,n){let r=e?.comparisonSeriesEntry??null,i=r?t.find(e=>e.id===r.entryId)??null:null;if(!i)return typeof n?.metadata.parentHostedArtifactId==`string`?`Prior hosted run`:e?.kind===`evaluation`?`Evaluated Model Version`:`Frozen base`;if(i.parent.kind===`base_model`)return`Frozen base`;let a=t.find(e=>e.seriesId===i.seriesId&&e.modelVersionId===i.parent.id)??null;return a?`${a.label} · Model Version`:`Prior Model Version`}function Hn(e,t){let n=new Map(t.flatMap(e=>e.job?[[e.job.id,e]]:[])),r=e.map(e=>({key:`job:${e.id}`,job:e,version:n.get(e.id)??null})),i=new Set(e.map(e=>e.id));for(let e of t)e.job&&i.has(e.job.id)||r.push({key:`version:${e.lineage.id}`,job:e.job,version:e});return r.sort((e,t)=>Gn(t).localeCompare(Gn(e)))}function Un(e,t,n){let r=new Map(e.flatMap(e=>typeof e.metadata.modelRunId==`string`?[[e.metadata.modelRunId,e]]:[])),i=new Map(t.flatMap(e=>e.job?[[e.job.id,e]]:[])),a=new Map(t.map(e=>[e.lineage.id,e])),o=new Set,s=n.map(t=>{let n=r.get(t.id)??e.find(e=>e.id===t.id)??null;n&&o.add(n.id);let s=n?i.get(n.id):void 0,c=t.adapterArtifactLineageId?a.get(t.adapterArtifactLineageId):void 0;return{key:`model-run:${t.id}`,job:n,lifecycleRun:t,version:s??c??null}});for(let t of e)o.has(t.id)||s.push({key:`job:${t.id}`,job:t,lifecycleRun:null,version:i.get(t.id)??null});return s.sort((e,t)=>Kn(t).localeCompare(Kn(e)))}function Wn(e,t){return e.filter(e=>t===`evals`?e.lifecycleRun?.kind===`evaluation`:e.lifecycleRun?.kind!==`evaluation`)}function Gn(e){return e.version?.lineage.importedAt??e.job?.updatedAt??e.job?.createdAt??``}function Kn(e){return e.lifecycleRun?.updatedAt??e.job?.updatedAt??e.job?.createdAt??``}function qn(e){if(e.version)return`Version ${e.version.number}`;if(e.lifecycleRun?.kind===`evaluation`&&e.lifecycleRun.receipt?.schemaVersion===`openpond.modelEvaluationReceipt.v1`){let t=e.lifecycleRun.receipt.foregroundTokenDelta;return`${t>0?`+`:``}${t.toLocaleString()} tokens`}return e.lifecycleRun?.reward?`Reward ${e.lifecycleRun.reward.raw.toFixed(3)}`:e.lifecycleRun?.status===`failed`||e.job?.status===`failed`?`Failed`:e.lifecycleRun?.status===`succeeded`||e.job?.status===`succeeded`?`Completed`:e.lifecycleRun?.status===`cancelled`||e.job?.status===`cancelled`?`Cancelled`:`No output`}function Jn(e){let t=e?.metadata.trainingMethod;return t===`sft`||t===`dpo`||t===`grpo`||t===`ppo`||t===`sdft`||t===`opd`||t===`opsd`||t===`sdpo`?t:null}function Yn(e,t){let n=$(e),r=e.lifecycleRun?.startedAt??e.job?.startedAt??e.job?.createdAt??null,i=e.lifecycleRun?d(e.lifecycleRun.status,e.lifecycleRun.completedAt,e.lifecycleRun.updatedAt):e.job?d(e.job.status,e.job.completedAt,e.job.updatedAt):null;return Q(n)?h(r,new Date(t).toISOString()):h(r,i)}function Xn({job:e,version:t}){let n=t?!!He(t.lineage)||e?.metadata.frozenEvaluationComplete===!0||!!t.lineage.frozenEvaluationArtifactId||!!t.lineage.managedServing?.customerBindingAllowed:!1,r=t?!!He(t.lineage)||Ve(t.lineage):!1,i=t?n?r?`Passed`:`Failed`:`Not run`:e&&[`queued`,`starting`,`running`,`cancelling`,`reconciling`].includes(e.status)?`Pending`:`Not run`;return(0,W.jsx)(K,{label:i,value:t?r?`passed`:n?`failed`:`not_run`:`not_run`})}function Zn({job:e,version:t}){let n=!!(e&&[`queued`,`starting`,`running`,`cancelling`,`reconciling`].includes(e.status));return(0,W.jsx)(K,{label:t?t.current?`Active`:`Available`:n?`Pending`:`Not created`,value:t?t.current?`current`:`ready`:n?`running`:`not_run`})}function Qn(e){let t=e.replace(/^baseline_run_/,``).replace(/^(?:training_job_|lineage_)(?:artifact_)?/,``).replace(/^model_run_/,``);return t.length<=12?t:t.slice(-8)}export{Tn as C,et as D,hn as E,nt as O,Dn as S,Cn as T,Mn as _,Hn as a,On as b,$ as c,Z as d,X as f,q as g,jn as h,Wn as i,Y as l,Pn as m,Bn as n,Rn as o,J as p,Un as r,Q as s,zn as t,Nn as u,K as v,wn as w,En as x,kn as y};