@elizaos/plugin-training 2.0.3-beta.5 → 2.0.3-beta.7

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 (363) hide show
  1. package/dist/backends/native.d.ts +96 -0
  2. package/dist/backends/native.d.ts.map +1 -0
  3. package/dist/backends/native.js +308 -0
  4. package/dist/backends/native.js.map +1 -0
  5. package/dist/cli/train.d.ts +22 -0
  6. package/dist/cli/train.d.ts.map +1 -0
  7. package/dist/cli/train.js +219 -0
  8. package/dist/cli/train.js.map +1 -0
  9. package/dist/core/action-benchmark-runner.d.ts +55 -0
  10. package/dist/core/action-benchmark-runner.d.ts.map +1 -0
  11. package/dist/core/action-benchmark-runner.js +341 -0
  12. package/dist/core/action-benchmark-runner.js.map +1 -0
  13. package/dist/core/artifact-store.d.ts +72 -0
  14. package/dist/core/artifact-store.d.ts.map +1 -0
  15. package/dist/core/artifact-store.js +50 -0
  16. package/dist/core/artifact-store.js.map +1 -0
  17. package/dist/core/benchmark-matrix-artifact.d.ts +102 -0
  18. package/dist/core/benchmark-matrix-artifact.d.ts.map +1 -0
  19. package/dist/core/benchmark-matrix-artifact.js +381 -0
  20. package/dist/core/benchmark-matrix-artifact.js.map +1 -0
  21. package/dist/core/benchmark-vs-cerebras-runner.d.ts +37 -0
  22. package/dist/core/benchmark-vs-cerebras-runner.d.ts.map +1 -0
  23. package/dist/core/benchmark-vs-cerebras-runner.js +151 -0
  24. package/dist/core/benchmark-vs-cerebras-runner.js.map +1 -0
  25. package/dist/core/cerebras-eval-model.d.ts +54 -0
  26. package/dist/core/cerebras-eval-model.d.ts.map +1 -0
  27. package/dist/core/cerebras-eval-model.js +249 -0
  28. package/dist/core/cerebras-eval-model.js.map +1 -0
  29. package/dist/core/cli.d.ts +15 -0
  30. package/dist/core/cli.d.ts.map +1 -0
  31. package/dist/core/cli.js +1003 -0
  32. package/dist/core/cli.js.map +1 -0
  33. package/dist/core/context-audit.d.ts +51 -0
  34. package/dist/core/context-audit.d.ts.map +1 -0
  35. package/dist/core/context-audit.js +166 -0
  36. package/dist/core/context-audit.js.map +1 -0
  37. package/dist/core/context-catalog.d.ts +47 -0
  38. package/dist/core/context-catalog.d.ts.map +1 -0
  39. package/dist/core/context-catalog.js +269 -0
  40. package/dist/core/context-catalog.js.map +1 -0
  41. package/dist/core/context-types.d.ts +3 -0
  42. package/dist/core/context-types.d.ts.map +1 -0
  43. package/dist/core/context-types.js +18 -0
  44. package/dist/core/context-types.js.map +1 -0
  45. package/dist/core/dataset-generator.d.ts +135 -0
  46. package/dist/core/dataset-generator.d.ts.map +1 -0
  47. package/dist/core/dataset-generator.js +895 -0
  48. package/dist/core/dataset-generator.js.map +1 -0
  49. package/dist/core/eliza1-benchmark-recipe.d.ts +18 -0
  50. package/dist/core/eliza1-benchmark-recipe.d.ts.map +1 -0
  51. package/dist/core/eliza1-benchmark-recipe.js +64 -0
  52. package/dist/core/eliza1-benchmark-recipe.js.map +1 -0
  53. package/dist/core/eliza1-bundle-stager.d.ts +57 -0
  54. package/dist/core/eliza1-bundle-stager.d.ts.map +1 -0
  55. package/dist/core/eliza1-bundle-stager.js +149 -0
  56. package/dist/core/eliza1-bundle-stager.js.map +1 -0
  57. package/dist/core/ensure-cron-job.d.ts +53 -0
  58. package/dist/core/ensure-cron-job.d.ts.map +1 -0
  59. package/dist/core/ensure-cron-job.js +51 -0
  60. package/dist/core/ensure-cron-job.js.map +1 -0
  61. package/dist/core/eval-comparison-artifact.d.ts +72 -0
  62. package/dist/core/eval-comparison-artifact.d.ts.map +1 -0
  63. package/dist/core/eval-comparison-artifact.js +281 -0
  64. package/dist/core/eval-comparison-artifact.js.map +1 -0
  65. package/dist/core/feed-generation-runner.d.ts +37 -0
  66. package/dist/core/feed-generation-runner.d.ts.map +1 -0
  67. package/dist/core/feed-generation-runner.js +232 -0
  68. package/dist/core/feed-generation-runner.js.map +1 -0
  69. package/dist/core/html-escape.d.ts +5 -0
  70. package/dist/core/html-escape.d.ts.map +1 -0
  71. package/dist/core/html-escape.js +11 -0
  72. package/dist/core/html-escape.js.map +1 -0
  73. package/dist/core/huggingface-dataset-ingest.d.ts +52 -0
  74. package/dist/core/huggingface-dataset-ingest.d.ts.map +1 -0
  75. package/dist/core/huggingface-dataset-ingest.js +134 -0
  76. package/dist/core/huggingface-dataset-ingest.js.map +1 -0
  77. package/dist/core/index.d.ts +29 -0
  78. package/dist/core/index.d.ts.map +1 -0
  79. package/dist/core/index.js +204 -0
  80. package/dist/core/index.js.map +1 -0
  81. package/dist/core/privacy-filter.d.ts +95 -0
  82. package/dist/core/privacy-filter.d.ts.map +1 -0
  83. package/dist/core/privacy-filter.js +324 -0
  84. package/dist/core/privacy-filter.js.map +1 -0
  85. package/dist/core/promotion-gate.d.ts +117 -0
  86. package/dist/core/promotion-gate.d.ts.map +1 -0
  87. package/dist/core/promotion-gate.js +85 -0
  88. package/dist/core/promotion-gate.js.map +1 -0
  89. package/dist/core/promotion-persist.d.ts +116 -0
  90. package/dist/core/promotion-persist.d.ts.map +1 -0
  91. package/dist/core/promotion-persist.js +93 -0
  92. package/dist/core/promotion-persist.js.map +1 -0
  93. package/dist/core/prompt-compare.d.ts +99 -0
  94. package/dist/core/prompt-compare.d.ts.map +1 -0
  95. package/dist/core/prompt-compare.js +210 -0
  96. package/dist/core/prompt-compare.js.map +1 -0
  97. package/dist/core/replay-validator.d.ts +136 -0
  98. package/dist/core/replay-validator.d.ts.map +1 -0
  99. package/dist/core/replay-validator.js +312 -0
  100. package/dist/core/replay-validator.js.map +1 -0
  101. package/dist/core/roleplay-executor.d.ts +123 -0
  102. package/dist/core/roleplay-executor.d.ts.map +1 -0
  103. package/dist/core/roleplay-executor.js +675 -0
  104. package/dist/core/roleplay-executor.js.map +1 -0
  105. package/dist/core/roleplay-trajectories.d.ts +54 -0
  106. package/dist/core/roleplay-trajectories.d.ts.map +1 -0
  107. package/dist/core/roleplay-trajectories.js +88 -0
  108. package/dist/core/roleplay-trajectories.js.map +1 -0
  109. package/dist/core/scenario-blueprints.d.ts +62 -0
  110. package/dist/core/scenario-blueprints.d.ts.map +1 -0
  111. package/dist/core/scenario-blueprints.js +850 -0
  112. package/dist/core/scenario-blueprints.js.map +1 -0
  113. package/dist/core/scenario-runner.d.ts +36 -0
  114. package/dist/core/scenario-runner.d.ts.map +1 -0
  115. package/dist/core/scenario-runner.js +216 -0
  116. package/dist/core/scenario-runner.js.map +1 -0
  117. package/dist/core/skill-scoring-cron.d.ts +57 -0
  118. package/dist/core/skill-scoring-cron.d.ts.map +1 -0
  119. package/dist/core/skill-scoring-cron.js +180 -0
  120. package/dist/core/skill-scoring-cron.js.map +1 -0
  121. package/dist/core/test-trajectory-collector.d.ts +37 -0
  122. package/dist/core/test-trajectory-collector.d.ts.map +1 -0
  123. package/dist/core/test-trajectory-collector.js +225 -0
  124. package/dist/core/test-trajectory-collector.js.map +1 -0
  125. package/dist/core/track-c-queue-task.d.ts +37 -0
  126. package/dist/core/track-c-queue-task.d.ts.map +1 -0
  127. package/dist/core/track-c-queue-task.js +104 -0
  128. package/dist/core/track-c-queue-task.js.map +1 -0
  129. package/dist/core/training-analysis-index.d.ts +104 -0
  130. package/dist/core/training-analysis-index.d.ts.map +1 -0
  131. package/dist/core/training-analysis-index.js +3297 -0
  132. package/dist/core/training-analysis-index.js.map +1 -0
  133. package/dist/core/training-collection-runner.d.ts +508 -0
  134. package/dist/core/training-collection-runner.d.ts.map +1 -0
  135. package/dist/core/training-collection-runner.js +2299 -0
  136. package/dist/core/training-collection-runner.js.map +1 -0
  137. package/dist/core/training-config.d.ts +52 -0
  138. package/dist/core/training-config.d.ts.map +1 -0
  139. package/dist/core/training-config.js +117 -0
  140. package/dist/core/training-config.js.map +1 -0
  141. package/dist/core/training-orchestrator.d.ts +112 -0
  142. package/dist/core/training-orchestrator.d.ts.map +1 -0
  143. package/dist/core/training-orchestrator.js +729 -0
  144. package/dist/core/training-orchestrator.js.map +1 -0
  145. package/dist/core/training-readiness-report.d.ts +52 -0
  146. package/dist/core/training-readiness-report.d.ts.map +1 -0
  147. package/dist/core/training-readiness-report.js +765 -0
  148. package/dist/core/training-readiness-report.js.map +1 -0
  149. package/dist/core/trajectory-consumer.d.ts +15 -0
  150. package/dist/core/trajectory-consumer.d.ts.map +1 -0
  151. package/dist/core/trajectory-consumer.js +61 -0
  152. package/dist/core/trajectory-consumer.js.map +1 -0
  153. package/dist/core/trajectory-export-bundle.d.ts +95 -0
  154. package/dist/core/trajectory-export-bundle.d.ts.map +1 -0
  155. package/dist/core/trajectory-export-bundle.js +561 -0
  156. package/dist/core/trajectory-export-bundle.js.map +1 -0
  157. package/dist/core/trajectory-export-cron.d.ts +57 -0
  158. package/dist/core/trajectory-export-cron.d.ts.map +1 -0
  159. package/dist/core/trajectory-export-cron.js +170 -0
  160. package/dist/core/trajectory-export-cron.js.map +1 -0
  161. package/dist/core/trajectory-hf-upload.d.ts +50 -0
  162. package/dist/core/trajectory-hf-upload.d.ts.map +1 -0
  163. package/dist/core/trajectory-hf-upload.js +111 -0
  164. package/dist/core/trajectory-hf-upload.js.map +1 -0
  165. package/dist/core/trajectory-task-datasets.d.ts +62 -0
  166. package/dist/core/trajectory-task-datasets.d.ts.map +1 -0
  167. package/dist/core/trajectory-task-datasets.js +427 -0
  168. package/dist/core/trajectory-task-datasets.js.map +1 -0
  169. package/dist/core/wait-for-service.d.ts +25 -0
  170. package/dist/core/wait-for-service.d.ts.map +1 -0
  171. package/dist/core/wait-for-service.js +19 -0
  172. package/dist/core/wait-for-service.js.map +1 -0
  173. package/dist/core/workspace-runtime.d.ts +4 -0
  174. package/dist/core/workspace-runtime.d.ts.map +1 -0
  175. package/dist/core/workspace-runtime.js +25 -0
  176. package/dist/core/workspace-runtime.js.map +1 -0
  177. package/dist/dspy/artifact.d.ts +54 -0
  178. package/dist/dspy/artifact.d.ts.map +1 -0
  179. package/dist/dspy/artifact.js +61 -0
  180. package/dist/dspy/artifact.js.map +1 -0
  181. package/dist/dspy/chain-of-thought.d.ts +27 -0
  182. package/dist/dspy/chain-of-thought.d.ts.map +1 -0
  183. package/dist/dspy/chain-of-thought.js +43 -0
  184. package/dist/dspy/chain-of-thought.js.map +1 -0
  185. package/dist/dspy/examples.d.ts +72 -0
  186. package/dist/dspy/examples.d.ts.map +1 -0
  187. package/dist/dspy/examples.js +105 -0
  188. package/dist/dspy/examples.js.map +1 -0
  189. package/dist/dspy/index.d.ts +15 -0
  190. package/dist/dspy/index.d.ts.map +1 -0
  191. package/dist/dspy/index.js +40 -0
  192. package/dist/dspy/index.js.map +1 -0
  193. package/dist/dspy/lm-adapter.d.ts +100 -0
  194. package/dist/dspy/lm-adapter.d.ts.map +1 -0
  195. package/dist/dspy/lm-adapter.js +81 -0
  196. package/dist/dspy/lm-adapter.js.map +1 -0
  197. package/dist/dspy/optimizers/dspy-bootstrap-fewshot.d.ts +23 -0
  198. package/dist/dspy/optimizers/dspy-bootstrap-fewshot.d.ts.map +1 -0
  199. package/dist/dspy/optimizers/dspy-bootstrap-fewshot.js +85 -0
  200. package/dist/dspy/optimizers/dspy-bootstrap-fewshot.js.map +1 -0
  201. package/dist/dspy/optimizers/dspy-copro.d.ts +29 -0
  202. package/dist/dspy/optimizers/dspy-copro.d.ts.map +1 -0
  203. package/dist/dspy/optimizers/dspy-copro.js +141 -0
  204. package/dist/dspy/optimizers/dspy-copro.js.map +1 -0
  205. package/dist/dspy/optimizers/dspy-mipro.d.ts +37 -0
  206. package/dist/dspy/optimizers/dspy-mipro.d.ts.map +1 -0
  207. package/dist/dspy/optimizers/dspy-mipro.js +194 -0
  208. package/dist/dspy/optimizers/dspy-mipro.js.map +1 -0
  209. package/dist/dspy/optimizers/index.d.ts +5 -0
  210. package/dist/dspy/optimizers/index.d.ts.map +1 -0
  211. package/dist/dspy/optimizers/index.js +11 -0
  212. package/dist/dspy/optimizers/index.js.map +1 -0
  213. package/dist/dspy/optimizers/types.d.ts +39 -0
  214. package/dist/dspy/optimizers/types.d.ts.map +1 -0
  215. package/dist/dspy/optimizers/types.js +1 -0
  216. package/dist/dspy/optimizers/types.js.map +1 -0
  217. package/dist/dspy/predict.d.ts +49 -0
  218. package/dist/dspy/predict.d.ts.map +1 -0
  219. package/dist/dspy/predict.js +73 -0
  220. package/dist/dspy/predict.js.map +1 -0
  221. package/dist/dspy/signature.d.ts +88 -0
  222. package/dist/dspy/signature.d.ts.map +1 -0
  223. package/dist/dspy/signature.js +205 -0
  224. package/dist/dspy/signature.js.map +1 -0
  225. package/dist/index.d.ts +15 -0
  226. package/dist/index.d.ts.map +1 -0
  227. package/dist/index.js +15 -0
  228. package/dist/index.js.map +1 -0
  229. package/dist/optimizers/bootstrap-fewshot.d.ts +42 -0
  230. package/dist/optimizers/bootstrap-fewshot.d.ts.map +1 -0
  231. package/dist/optimizers/bootstrap-fewshot.js +92 -0
  232. package/dist/optimizers/bootstrap-fewshot.js.map +1 -0
  233. package/dist/optimizers/gepa.d.ts +63 -0
  234. package/dist/optimizers/gepa.d.ts.map +1 -0
  235. package/dist/optimizers/gepa.js +232 -0
  236. package/dist/optimizers/gepa.js.map +1 -0
  237. package/dist/optimizers/index.d.ts +7 -0
  238. package/dist/optimizers/index.d.ts.map +1 -0
  239. package/dist/optimizers/index.js +51 -0
  240. package/dist/optimizers/index.js.map +1 -0
  241. package/dist/optimizers/instruction-search.d.ts +39 -0
  242. package/dist/optimizers/instruction-search.d.ts.map +1 -0
  243. package/dist/optimizers/instruction-search.js +108 -0
  244. package/dist/optimizers/instruction-search.js.map +1 -0
  245. package/dist/optimizers/prompt-evolution.d.ts +39 -0
  246. package/dist/optimizers/prompt-evolution.d.ts.map +1 -0
  247. package/dist/optimizers/prompt-evolution.js +101 -0
  248. package/dist/optimizers/prompt-evolution.js.map +1 -0
  249. package/dist/optimizers/scoring.d.ts +139 -0
  250. package/dist/optimizers/scoring.d.ts.map +1 -0
  251. package/dist/optimizers/scoring.js +299 -0
  252. package/dist/optimizers/scoring.js.map +1 -0
  253. package/dist/optimizers/types.d.ts +105 -0
  254. package/dist/optimizers/types.d.ts.map +1 -0
  255. package/dist/optimizers/types.js +1 -0
  256. package/dist/optimizers/types.js.map +1 -0
  257. package/dist/register-runtime.d.ts +3 -0
  258. package/dist/register-runtime.d.ts.map +1 -0
  259. package/dist/register-runtime.js +60 -0
  260. package/dist/register-runtime.js.map +1 -0
  261. package/dist/register-terminal-view.d.ts +15 -0
  262. package/dist/register-terminal-view.d.ts.map +1 -0
  263. package/dist/register-terminal-view.js +31 -0
  264. package/dist/register-terminal-view.js.map +1 -0
  265. package/dist/routes/experience-routes.d.ts +21 -0
  266. package/dist/routes/experience-routes.d.ts.map +1 -0
  267. package/dist/routes/experience-routes.js +513 -0
  268. package/dist/routes/experience-routes.js.map +1 -0
  269. package/dist/routes/index.d.ts +5 -0
  270. package/dist/routes/index.d.ts.map +1 -0
  271. package/dist/routes/index.js +17 -0
  272. package/dist/routes/index.js.map +1 -0
  273. package/dist/routes/training-routes.d.ts +10 -0
  274. package/dist/routes/training-routes.d.ts.map +1 -0
  275. package/dist/routes/training-routes.js +1239 -0
  276. package/dist/routes/training-routes.js.map +1 -0
  277. package/dist/routes/training-vast-routes.d.ts +35 -0
  278. package/dist/routes/training-vast-routes.d.ts.map +1 -0
  279. package/dist/routes/training-vast-routes.js +249 -0
  280. package/dist/routes/training-vast-routes.js.map +1 -0
  281. package/dist/routes/trajectory-routes.d.ts +19 -0
  282. package/dist/routes/trajectory-routes.d.ts.map +1 -0
  283. package/dist/routes/trajectory-routes.js +1122 -0
  284. package/dist/routes/trajectory-routes.js.map +1 -0
  285. package/dist/services/index.d.ts +9 -0
  286. package/dist/services/index.d.ts.map +1 -0
  287. package/dist/services/index.js +63 -0
  288. package/dist/services/index.js.map +1 -0
  289. package/dist/services/training-backend-check.d.ts +8 -0
  290. package/dist/services/training-backend-check.d.ts.map +1 -0
  291. package/dist/services/training-backend-check.js +31 -0
  292. package/dist/services/training-backend-check.js.map +1 -0
  293. package/dist/services/training-service-like.d.ts +40 -0
  294. package/dist/services/training-service-like.d.ts.map +1 -0
  295. package/dist/services/training-service-like.js +1 -0
  296. package/dist/services/training-service-like.js.map +1 -0
  297. package/dist/services/training-service-registry.d.ts +4 -0
  298. package/dist/services/training-service-registry.d.ts.map +1 -0
  299. package/dist/services/training-service-registry.js +12 -0
  300. package/dist/services/training-service-registry.js.map +1 -0
  301. package/dist/services/training-service.d.ts +59 -0
  302. package/dist/services/training-service.d.ts.map +1 -0
  303. package/dist/services/training-service.js +154 -0
  304. package/dist/services/training-service.js.map +1 -0
  305. package/dist/services/training-trigger.d.ts +177 -0
  306. package/dist/services/training-trigger.d.ts.map +1 -0
  307. package/dist/services/training-trigger.js +300 -0
  308. package/dist/services/training-trigger.js.map +1 -0
  309. package/dist/services/training-vast-service.d.ts +149 -0
  310. package/dist/services/training-vast-service.d.ts.map +1 -0
  311. package/dist/services/training-vast-service.js +648 -0
  312. package/dist/services/training-vast-service.js.map +1 -0
  313. package/dist/services/vast-inference-stats.d.ts +37 -0
  314. package/dist/services/vast-inference-stats.d.ts.map +1 -0
  315. package/dist/services/vast-inference-stats.js +81 -0
  316. package/dist/services/vast-inference-stats.js.map +1 -0
  317. package/dist/services/vast-job-store.d.ts +74 -0
  318. package/dist/services/vast-job-store.d.ts.map +1 -0
  319. package/dist/services/vast-job-store.js +194 -0
  320. package/dist/services/vast-job-store.js.map +1 -0
  321. package/dist/services/vast-subprocess.d.ts +27 -0
  322. package/dist/services/vast-subprocess.d.ts.map +1 -0
  323. package/dist/services/vast-subprocess.js +78 -0
  324. package/dist/services/vast-subprocess.js.map +1 -0
  325. package/dist/setup-routes.d.ts +17 -0
  326. package/dist/setup-routes.d.ts.map +1 -0
  327. package/dist/setup-routes.js +319 -0
  328. package/dist/setup-routes.js.map +1 -0
  329. package/dist/ui/FineTuningSpatialView.d.ts +49 -0
  330. package/dist/ui/FineTuningSpatialView.d.ts.map +1 -0
  331. package/dist/ui/FineTuningSpatialView.js +154 -0
  332. package/dist/ui/FineTuningSpatialView.js.map +1 -0
  333. package/dist/ui/FineTuningView.d.ts +7 -0
  334. package/dist/ui/FineTuningView.d.ts.map +1 -0
  335. package/dist/ui/FineTuningView.helpers.d.ts +17 -0
  336. package/dist/ui/FineTuningView.helpers.d.ts.map +1 -0
  337. package/dist/ui/FineTuningView.helpers.js +30 -0
  338. package/dist/ui/FineTuningView.helpers.js.map +1 -0
  339. package/dist/ui/FineTuningView.interact.d.ts +2 -0
  340. package/dist/ui/FineTuningView.interact.d.ts.map +1 -0
  341. package/dist/ui/FineTuningView.interact.js +300 -0
  342. package/dist/ui/FineTuningView.interact.js.map +1 -0
  343. package/dist/ui/FineTuningView.js +4653 -0
  344. package/dist/ui/FineTuningView.js.map +1 -0
  345. package/dist/ui/fine-tuning-panels.d.ts +100 -0
  346. package/dist/ui/fine-tuning-panels.d.ts.map +1 -0
  347. package/dist/ui/fine-tuning-panels.helpers.d.ts +19 -0
  348. package/dist/ui/fine-tuning-panels.helpers.d.ts.map +1 -0
  349. package/dist/ui/fine-tuning-panels.helpers.js +77 -0
  350. package/dist/ui/fine-tuning-panels.helpers.js.map +1 -0
  351. package/dist/ui/fine-tuning-panels.js +928 -0
  352. package/dist/ui/fine-tuning-panels.js.map +1 -0
  353. package/dist/ui/index.d.ts +5 -0
  354. package/dist/ui/index.d.ts.map +1 -0
  355. package/dist/ui/index.js +5 -0
  356. package/dist/ui/index.js.map +1 -0
  357. package/dist/ui/training-view-bundle.d.ts +3 -0
  358. package/dist/ui/training-view-bundle.d.ts.map +1 -0
  359. package/dist/ui/training-view-bundle.js +7 -0
  360. package/dist/ui/training-view-bundle.js.map +1 -0
  361. package/dist/views/bundle.js +5312 -0
  362. package/dist/views/bundle.js.map +1 -0
  363. package/package.json +7 -7
@@ -0,0 +1,4653 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useAgentElement } from "@elizaos/ui/agent-surface";
3
+ import { client } from "@elizaos/ui/api";
4
+ import {
5
+ Button,
6
+ registerDetailExtension
7
+ } from "@elizaos/ui/components";
8
+ import { useIntervalWhenDocumentVisible } from "@elizaos/ui/hooks";
9
+ import { ContentLayout } from "@elizaos/ui/layouts";
10
+ import { useAppSelector } from "@elizaos/ui/state";
11
+ import {
12
+ confirmDesktopAction,
13
+ openExternalUrl,
14
+ parsePositiveFloat,
15
+ parsePositiveInteger
16
+ } from "@elizaos/ui/utils";
17
+ import {
18
+ useCallback,
19
+ useEffect,
20
+ useMemo,
21
+ useState
22
+ } from "react";
23
+ import {
24
+ ELIZA_ONE_BENCHMARK_TIER_LIST,
25
+ ELIZA_ONE_BENCHMARK_TIERS
26
+ } from "../core/eliza1-benchmark-recipe.js";
27
+ import { asArray, parseCollectionTierList } from "./FineTuningView.helpers";
28
+ import { interact } from "./FineTuningView.interact";
29
+ import {
30
+ asTrainingEvent,
31
+ FINE_TUNING_ACTION_CLASS,
32
+ FINE_TUNING_PANEL_CLASS,
33
+ FINE_TUNING_SECTION_CLASS,
34
+ FINE_TUNING_SECTION_HEADER_CLASS,
35
+ FINE_TUNING_STATUS_CARD_CLASS
36
+ } from "./fine-tuning-panels.helpers";
37
+ import {
38
+ DatasetSection,
39
+ LiveEventsPanel,
40
+ TrainedModelsSection,
41
+ TrainingJobsSection,
42
+ TrajectoriesSection
43
+ } from "./fine-tuning-panels.js";
44
+ const FINE_TUNING_DETAIL_PANEL_ID = "plugin-dash-fine-tuning";
45
+ const DEFAULT_ELIZA1_HF_DATASET_FILES = ELIZA_ONE_BENCHMARK_TIERS.flatMap(
46
+ (tier) => [
47
+ "train.jsonl",
48
+ "val.jsonl",
49
+ "test.jsonl",
50
+ "manifest.json",
51
+ "validation.json"
52
+ ].map((file) => `sft/${tier}/${file}`)
53
+ );
54
+ function localViewerUrl(path) {
55
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(path)) return path;
56
+ return encodeURI(`file://${path}`);
57
+ }
58
+ function recordValue(value) {
59
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
60
+ }
61
+ function stringSummaryValue(value) {
62
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
63
+ }
64
+ function numberSummaryValue(value) {
65
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
66
+ }
67
+ function formatModelInventorySummary(modelInventory) {
68
+ if (!modelInventory?.length) return "";
69
+ const tiers = [
70
+ ...new Set(
71
+ modelInventory.map((model) => model.tier).filter((tier) => Boolean(tier))
72
+ )
73
+ ];
74
+ const base = modelInventory.filter(
75
+ (model) => model.variant === "base"
76
+ ).length;
77
+ const trained = modelInventory.filter(
78
+ (model) => model.variant === "trained"
79
+ ).length;
80
+ const parts = [];
81
+ if (base || trained) parts.push(`base:${base} trained:${trained}`);
82
+ if (tiers.length) parts.push(`tiers:${tiers.join(",")}`);
83
+ return parts.length ? ` ${parts.join(" ")}` : "";
84
+ }
85
+ function nullableStringValue(value) {
86
+ return typeof value === "string" && value.trim() ? value.trim() : null;
87
+ }
88
+ function nullableNumberValue(value) {
89
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
90
+ }
91
+ function formatNullableMetric(value, suffix = "") {
92
+ const numberValue = nullableNumberValue(value);
93
+ return numberValue === null ? "n/a" : `${numberValue}${suffix}`;
94
+ }
95
+ function compactDisplayValue(value) {
96
+ const raw = typeof value === "string" ? value : value === null || value === void 0 ? "" : JSON.stringify(value);
97
+ return raw.length > 160 ? `${raw.slice(0, 157)}...` : raw;
98
+ }
99
+ function formatEvalComparisonSummary(result) {
100
+ const artifact = recordValue(result.artifact);
101
+ if (!Object.keys(artifact).length) return null;
102
+ const models = recordValue(artifact.models);
103
+ const metrics = recordValue(artifact.metrics);
104
+ const base = nullableStringValue(models.base) ?? "base";
105
+ const trained = nullableStringValue(models.trained) ?? "trained";
106
+ const backend = nullableStringValue(models.backend) ?? "n/a";
107
+ return `${base} -> ${trained} backend:${backend} base:${formatNullableMetric(
108
+ metrics.baseScore
109
+ )} trained:${formatNullableMetric(
110
+ metrics.trainedScore
111
+ )} improvement:${formatNullableMetric(
112
+ metrics.improvementPercent,
113
+ "%"
114
+ )} delta:${formatNullableMetric(
115
+ metrics.improvementAbsolute
116
+ )} prompts:${formatNullableMetric(metrics.promptCount)} latency:${formatNullableMetric(
117
+ metrics.baseLatencyMs,
118
+ "ms"
119
+ )}->${formatNullableMetric(metrics.trainedLatencyMs, "ms")}`;
120
+ }
121
+ function summarizeAnalysisCoverage(analysisIndex) {
122
+ if (!analysisIndex) return null;
123
+ const artifacts = asArray(analysisIndex.manifest.artifacts);
124
+ const manifestCoverage = recordValue(
125
+ analysisIndex.manifest.coverage
126
+ );
127
+ if (Object.keys(manifestCoverage).length > 0) {
128
+ const dataSources2 = recordValue(manifestCoverage.dataSources);
129
+ const readableSamples2 = recordValue(manifestCoverage.readableSamples);
130
+ const evals = recordValue(manifestCoverage.evals);
131
+ const benchmarks = recordValue(manifestCoverage.benchmarks);
132
+ const models = recordValue(manifestCoverage.models);
133
+ const inventory = Array.isArray(models.inventory) ? models.inventory.map(recordValue) : [];
134
+ const benchmarkTierCoverage = Array.isArray(benchmarks.tierCoverage) ? benchmarks.tierCoverage.map(recordValue).map((tier) => ({
135
+ tier: nullableStringValue(tier.tier) ?? "unknown",
136
+ hasBase: tier.hasBase === true,
137
+ hasTrained: tier.hasTrained === true,
138
+ hasReference: tier.hasReference === true,
139
+ hasImprovement: tier.hasImprovement === true
140
+ })) : [];
141
+ const benchmarkComparisons2 = artifacts.filter((artifact) => artifact.kind === "benchmark_matrix").flatMap((artifact) => {
142
+ const payload = recordValue(artifact.payload);
143
+ return Array.isArray(payload.comparisons) ? payload.comparisons.map(recordValue) : [];
144
+ }).map((comparison) => ({
145
+ tier: nullableStringValue(comparison.tier),
146
+ benchmark: nullableStringValue(comparison.benchmark),
147
+ baseScore: nullableNumberValue(comparison.baseScore),
148
+ trainedScore: nullableNumberValue(comparison.trainedScore),
149
+ referenceScore: nullableNumberValue(comparison.referenceScore),
150
+ improvementPercent: nullableNumberValue(comparison.improvementPercent),
151
+ trainedVsReferencePercent: nullableNumberValue(
152
+ comparison.trainedVsReferencePercent
153
+ )
154
+ }));
155
+ return {
156
+ dataSources: {
157
+ huggingFace: numberSummaryValue(dataSources2.huggingFace) ?? 0,
158
+ feed: numberSummaryValue(dataSources2.feed) ?? 0,
159
+ natural: numberSummaryValue(dataSources2.natural) ?? 0,
160
+ scenarios: numberSummaryValue(dataSources2.scenarios) ?? 0,
161
+ tests: numberSummaryValue(dataSources2.tests) ?? 0,
162
+ trainingJsonl: numberSummaryValue(dataSources2.trainingJsonl) ?? 0
163
+ },
164
+ readableSamples: {
165
+ huggingFace: numberSummaryValue(readableSamples2.huggingFace) ?? 0,
166
+ feed: numberSummaryValue(readableSamples2.feed) ?? 0,
167
+ natural: numberSummaryValue(readableSamples2.natural) ?? 0,
168
+ scenarios: numberSummaryValue(readableSamples2.scenarios) ?? 0,
169
+ tests: numberSummaryValue(readableSamples2.tests) ?? 0,
170
+ trainingJsonl: numberSummaryValue(readableSamples2.trainingJsonl) ?? 0,
171
+ total: numberSummaryValue(readableSamples2.total) ?? 0
172
+ },
173
+ evals: numberSummaryValue(evals.artifacts) ?? 0,
174
+ benchmarkMatrices: numberSummaryValue(benchmarks.matrices) ?? 0,
175
+ models: numberSummaryValue(models.artifacts) ?? 0,
176
+ benchmarkModelStats: {
177
+ modelCount: inventory.length,
178
+ bestModelId: null,
179
+ bestAverageScore: null
180
+ },
181
+ allEliza1TiersCovered: benchmarks.allEliza1TiersCovered === true,
182
+ benchmarkTierCoverage,
183
+ benchmarkComparisons: benchmarkComparisons2
184
+ };
185
+ }
186
+ const summaryFor = (artifact) => recordValue(artifact.summary);
187
+ const schemaOf = (artifact) => stringSummaryValue(summaryFor(artifact).schema);
188
+ const sourceKindOf = (artifact) => stringSummaryValue(recordValue(summaryFor(artifact).source).kind);
189
+ const sourceLabelOf = (artifact) => {
190
+ const source = summaryFor(artifact).source;
191
+ return stringSummaryValue(source) ?? stringSummaryValue(recordValue(source).kind);
192
+ };
193
+ const isNaturalTrajectoryBundle = (artifact) => artifact.kind === "trajectory_bundle" && sourceLabelOf(artifact) === "training_collection_natural_trajectories";
194
+ const isTestTrajectoryDataset = (artifact) => artifact.kind === "trajectory_dataset" && sourceKindOf(artifact) === "app_core_test_trajectory";
195
+ const sampleCount = (artifact, keys) => keys.reduce((count, key) => {
196
+ const samples = summaryFor(artifact)[key];
197
+ return count + (Array.isArray(samples) ? samples.length : 0);
198
+ }, 0);
199
+ const sampleCountFor = (predicate, keys) => artifacts.filter(predicate).reduce((count, artifact) => count + sampleCount(artifact, keys), 0);
200
+ const modelStats = artifacts.flatMap((artifact) => {
201
+ const summary = summaryFor(artifact);
202
+ return Array.isArray(summary.modelStats) ? summary.modelStats.map(recordValue) : [];
203
+ });
204
+ const scoredModels = modelStats.map((stat) => ({
205
+ modelId: stringSummaryValue(stat.modelId),
206
+ averageScore: numberSummaryValue(stat.averageScore)
207
+ })).filter(
208
+ (stat) => stat.modelId !== void 0 && stat.averageScore !== void 0
209
+ );
210
+ const bestModel = scoredModels.sort(
211
+ (left, right) => right.averageScore - left.averageScore
212
+ )[0];
213
+ const benchmarkComparisons = artifacts.filter((artifact) => artifact.kind === "benchmark_matrix").flatMap((artifact) => {
214
+ const payload = recordValue(artifact.payload);
215
+ return Array.isArray(payload.comparisons) ? payload.comparisons.map(recordValue) : [];
216
+ }).map((comparison) => ({
217
+ tier: nullableStringValue(comparison.tier),
218
+ benchmark: nullableStringValue(comparison.benchmark),
219
+ baseScore: nullableNumberValue(comparison.baseScore),
220
+ trainedScore: nullableNumberValue(comparison.trainedScore),
221
+ referenceScore: nullableNumberValue(comparison.referenceScore),
222
+ improvementPercent: nullableNumberValue(comparison.improvementPercent),
223
+ trainedVsReferencePercent: nullableNumberValue(
224
+ comparison.trainedVsReferencePercent
225
+ )
226
+ }));
227
+ const dataSources = {
228
+ huggingFace: artifacts.filter(
229
+ (artifact) => artifact.kind === "trajectory_dataset" && (schemaOf(artifact) === "eliza_huggingface_dataset_ingest" || sourceKindOf(artifact) === "huggingface_dataset")
230
+ ).length,
231
+ feed: artifacts.filter(
232
+ (artifact) => artifact.kind === "trajectory_dataset" && (schemaOf(artifact) === "feed_training_trajectory_export" || schemaOf(artifact) === "feed_parallel_generation")
233
+ ).length,
234
+ natural: artifacts.filter(isNaturalTrajectoryBundle).length,
235
+ scenarios: artifacts.filter(
236
+ (artifact) => artifact.kind === "scenario_run" || schemaOf(artifact) === "eliza_scenario_native_export"
237
+ ).length,
238
+ tests: artifacts.filter(isTestTrajectoryDataset).length,
239
+ trainingJsonl: artifacts.filter(
240
+ (artifact) => schemaOf(artifact) === "eliza_training_jsonl_dataset"
241
+ ).length
242
+ };
243
+ const readableSamples = {
244
+ huggingFace: sampleCountFor(
245
+ (artifact) => artifact.kind === "trajectory_dataset" && schemaOf(artifact) === "eliza_huggingface_dataset_ingest",
246
+ ["hfSamplePreviews"]
247
+ ),
248
+ feed: sampleCountFor(
249
+ (artifact) => artifact.kind === "trajectory_dataset" && (schemaOf(artifact) === "feed_training_trajectory_export" || schemaOf(artifact) === "feed_parallel_generation"),
250
+ ["feedSamplePreviews"]
251
+ ),
252
+ natural: sampleCountFor(isNaturalTrajectoryBundle, ["samplePreviews"]),
253
+ scenarios: sampleCountFor(
254
+ (artifact) => artifact.kind === "scenario_run" || schemaOf(artifact) === "eliza_scenario_native_export",
255
+ ["turnPreviews", "scenarioNativeSamplePreviews"]
256
+ ),
257
+ tests: sampleCountFor(isTestTrajectoryDataset, ["testSamplePreviews"]),
258
+ trainingJsonl: sampleCountFor(
259
+ (artifact) => schemaOf(artifact) === "eliza_training_jsonl_dataset",
260
+ ["samplePreviews"]
261
+ ),
262
+ total: 0
263
+ };
264
+ readableSamples.total = readableSamples.huggingFace + readableSamples.feed + readableSamples.natural + readableSamples.scenarios + readableSamples.tests + readableSamples.trainingJsonl;
265
+ return {
266
+ dataSources,
267
+ readableSamples,
268
+ evals: artifacts.filter((artifact) => artifact.kind === "eval").length,
269
+ benchmarkMatrices: artifacts.filter(
270
+ (artifact) => artifact.kind === "benchmark_matrix"
271
+ ).length,
272
+ models: artifacts.filter((artifact) => artifact.kind === "model").length,
273
+ benchmarkModelStats: {
274
+ modelCount: modelStats.length,
275
+ bestModelId: bestModel?.modelId ?? null,
276
+ bestAverageScore: bestModel?.averageScore ?? null
277
+ },
278
+ allEliza1TiersCovered: false,
279
+ benchmarkTierCoverage: [],
280
+ benchmarkComparisons
281
+ };
282
+ }
283
+ const AGENT_FIELD_INPUT_CLASS = "h-10 w-full rounded-xl border border-border/60 bg-bg/50 px-3 text-sm text-txt outline-none focus:border-accent";
284
+ function AgentInlineButton({
285
+ agentId,
286
+ label,
287
+ group,
288
+ description,
289
+ className,
290
+ variant = "outline",
291
+ size = "sm",
292
+ disabled,
293
+ onClick,
294
+ title,
295
+ children
296
+ }) {
297
+ const { ref, agentProps } = useAgentElement({
298
+ id: agentId,
299
+ role: "button",
300
+ label,
301
+ group,
302
+ description,
303
+ onActivate: onClick
304
+ });
305
+ return /* @__PURE__ */ jsx(
306
+ Button,
307
+ {
308
+ ref,
309
+ variant,
310
+ size,
311
+ className,
312
+ disabled,
313
+ onClick,
314
+ "aria-label": label,
315
+ title,
316
+ ...agentProps,
317
+ children
318
+ }
319
+ );
320
+ }
321
+ function AgentTextField({
322
+ agentId,
323
+ label,
324
+ group,
325
+ description,
326
+ className,
327
+ value,
328
+ onChange,
329
+ placeholder,
330
+ type = "text"
331
+ }) {
332
+ const { ref, agentProps } = useAgentElement({
333
+ id: agentId,
334
+ role: type === "number" ? "number-input" : "text-input",
335
+ label,
336
+ group,
337
+ description,
338
+ getValue: () => value,
339
+ onFill: onChange
340
+ });
341
+ return /* @__PURE__ */ jsx(
342
+ "input",
343
+ {
344
+ ref,
345
+ type,
346
+ className,
347
+ value,
348
+ onChange: (event) => onChange(event.target.value),
349
+ placeholder,
350
+ "aria-label": label,
351
+ ...agentProps
352
+ }
353
+ );
354
+ }
355
+ function AgentTextAreaField({
356
+ agentId,
357
+ label,
358
+ group,
359
+ description,
360
+ className,
361
+ value,
362
+ onChange,
363
+ placeholder
364
+ }) {
365
+ const { ref, agentProps } = useAgentElement({
366
+ id: agentId,
367
+ role: "textarea",
368
+ label,
369
+ group,
370
+ description,
371
+ getValue: () => value,
372
+ onFill: onChange
373
+ });
374
+ return /* @__PURE__ */ jsx(
375
+ "textarea",
376
+ {
377
+ ref,
378
+ className,
379
+ value,
380
+ onChange: (event) => onChange(event.target.value),
381
+ placeholder,
382
+ "aria-label": label,
383
+ ...agentProps
384
+ }
385
+ );
386
+ }
387
+ function AgentNativeSelect({
388
+ agentId,
389
+ label,
390
+ group,
391
+ description,
392
+ className,
393
+ value,
394
+ onChange,
395
+ options,
396
+ children
397
+ }) {
398
+ const { ref, agentProps } = useAgentElement({
399
+ id: agentId,
400
+ role: "select",
401
+ label,
402
+ group,
403
+ description,
404
+ options,
405
+ getValue: () => value,
406
+ onFill: onChange
407
+ });
408
+ return /* @__PURE__ */ jsx(
409
+ "select",
410
+ {
411
+ ref,
412
+ className,
413
+ value,
414
+ onChange: (event) => onChange(event.target.value),
415
+ "aria-label": label,
416
+ ...agentProps,
417
+ children
418
+ }
419
+ );
420
+ }
421
+ function AgentCheckboxField({
422
+ agentId,
423
+ label,
424
+ group,
425
+ description,
426
+ checked,
427
+ onChange
428
+ }) {
429
+ const { ref, agentProps } = useAgentElement({
430
+ id: agentId,
431
+ role: "toggle",
432
+ label,
433
+ group,
434
+ description,
435
+ status: checked ? "active" : "inactive",
436
+ getValue: () => checked,
437
+ onActivate: () => onChange(!checked),
438
+ onFill: (value) => onChange(value === "true" || value === "1")
439
+ });
440
+ return /* @__PURE__ */ jsx(
441
+ "input",
442
+ {
443
+ ref,
444
+ type: "checkbox",
445
+ checked,
446
+ onChange: (event) => onChange(event.target.checked),
447
+ "aria-label": label,
448
+ "aria-current": checked ? "true" : void 0,
449
+ ...agentProps
450
+ }
451
+ );
452
+ }
453
+ function ReadinessCheckRow({
454
+ check,
455
+ readinessActionRunning,
456
+ onRunRecommendation,
457
+ t
458
+ }) {
459
+ const { ref, agentProps } = useAgentElement({
460
+ id: `readiness-run-${check.id}`,
461
+ role: "button",
462
+ label: `Run recommendation for ${check.label}`,
463
+ group: "readiness",
464
+ description: `Run the recommended action for the ${check.label} check`,
465
+ onActivate: () => {
466
+ if (check.recommendedAction) {
467
+ onRunRecommendation(check.id, check.recommendedAction);
468
+ }
469
+ }
470
+ });
471
+ return /* @__PURE__ */ jsxs("div", { className: "grid gap-2 pt-2", children: [
472
+ /* @__PURE__ */ jsxs("div", { children: [
473
+ /* @__PURE__ */ jsxs("div", { className: "font-mono text-xs text-txt", children: [
474
+ check.label,
475
+ " \xB7 ",
476
+ check.status
477
+ ] }),
478
+ /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-muted", children: check.note })
479
+ ] }),
480
+ check.recommendedAction ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-2", children: [
481
+ /* @__PURE__ */ jsxs("div", { className: "break-all font-mono text-xs text-muted", children: [
482
+ check.recommendedAction.capability,
483
+ Object.keys(check.recommendedAction.params).length > 0 ? ` ${JSON.stringify(check.recommendedAction.params)}` : ""
484
+ ] }),
485
+ /* @__PURE__ */ jsx(
486
+ Button,
487
+ {
488
+ ref,
489
+ variant: "outline",
490
+ size: "sm",
491
+ className: FINE_TUNING_ACTION_CLASS,
492
+ disabled: readinessActionRunning !== null,
493
+ onClick: () => {
494
+ if (check.recommendedAction) {
495
+ onRunRecommendation(check.id, check.recommendedAction);
496
+ }
497
+ },
498
+ ...agentProps,
499
+ children: readinessActionRunning === check.id ? t("finetuningview.RunningRecommendation", {
500
+ defaultValue: "Running"
501
+ }) : t("finetuningview.RunRecommendation", {
502
+ defaultValue: "Run recommendation"
503
+ })
504
+ }
505
+ )
506
+ ] }) : null
507
+ ] });
508
+ }
509
+ function TrainingActionButton({
510
+ agentId,
511
+ label,
512
+ group,
513
+ description,
514
+ disabled,
515
+ onClick,
516
+ children
517
+ }) {
518
+ const { ref, agentProps } = useAgentElement({
519
+ id: agentId,
520
+ role: "button",
521
+ label,
522
+ group,
523
+ description
524
+ });
525
+ return /* @__PURE__ */ jsx(
526
+ Button,
527
+ {
528
+ ref,
529
+ variant: "outline",
530
+ size: "sm",
531
+ className: FINE_TUNING_ACTION_CLASS,
532
+ disabled,
533
+ onClick,
534
+ "aria-label": label,
535
+ ...agentProps,
536
+ children
537
+ }
538
+ );
539
+ }
540
+ function FineTuningView({
541
+ contentHeader
542
+ } = {}) {
543
+ const handleRestart = useAppSelector((s) => s.handleRestart);
544
+ const setActionNotice = useAppSelector(
545
+ (s) => s.setActionNotice
546
+ );
547
+ const t = useAppSelector((s) => s.t);
548
+ const [pageLoading, setPageLoading] = useState(true);
549
+ const [errorMessage, setErrorMessage] = useState(null);
550
+ const [status, setStatus] = useState(null);
551
+ const [trajectoryList, setTrajectoryList] = useState({
552
+ available: false,
553
+ total: 0,
554
+ trajectories: []
555
+ });
556
+ const [selectedTrajectory, setSelectedTrajectory] = useState(null);
557
+ const [trajectoryLoading, setTrajectoryLoading] = useState(false);
558
+ const [publishingTrajectories, setPublishingTrajectories] = useState(false);
559
+ const [publishConfigured, setPublishConfigured] = useState(true);
560
+ const [datasets, setDatasets] = useState([]);
561
+ const [jobs, setJobs] = useState([]);
562
+ const [models, setModels] = useState([]);
563
+ const [analysisIndex, setAnalysisIndex] = useState(null);
564
+ const analysisCoverage = useMemo(
565
+ () => summarizeAnalysisCoverage(analysisIndex),
566
+ [analysisIndex]
567
+ );
568
+ const [analysisBuilding, setAnalysisBuilding] = useState(false);
569
+ const [readinessBuilding, setReadinessBuilding] = useState(false);
570
+ const [readinessReport, setReadinessReport] = useState(null);
571
+ const [readinessActionRunning, setReadinessActionRunning] = useState(null);
572
+ const [collectionRunning, setCollectionRunning] = useState(false);
573
+ const [collectionPreflightRunning, setCollectionPreflightRunning] = useState(false);
574
+ const [collectionResult, setCollectionResult] = useState(null);
575
+ const [collectionPreflightResult, setCollectionPreflightResult] = useState(null);
576
+ const [collectionPreflightProbe, setCollectionPreflightProbe] = useState(true);
577
+ const [collectionHistory, setCollectionHistory] = useState(null);
578
+ const [collectionHistoryLoading, setCollectionHistoryLoading] = useState(false);
579
+ const [hfIngestRunning, setHfIngestRunning] = useState(false);
580
+ const [hfIngestResult, setHfIngestResult] = useState(null);
581
+ const [hfRepoId, setHfRepoId] = useState("elizaos/eliza-1-training");
582
+ const [hfRevision, setHfRevision] = useState("main");
583
+ const [hfFiles, setHfFiles] = useState(
584
+ DEFAULT_ELIZA1_HF_DATASET_FILES.join("\n")
585
+ );
586
+ const [hfOutputDir, setHfOutputDir] = useState("");
587
+ const [hfDryRun, setHfDryRun] = useState(true);
588
+ const [feedGenerationRunning, setFeedGenerationRunning] = useState(false);
589
+ const [feedGenerationResult, setFeedGenerationResult] = useState(null);
590
+ const [feedArchetypes, setFeedArchetypes] = useState("trader");
591
+ const [feedNumAgents, setFeedNumAgents] = useState("1");
592
+ const [feedTicks, setFeedTicks] = useState("1");
593
+ const [feedParallel, setFeedParallel] = useState("1");
594
+ const [feedOutputDir, setFeedOutputDir] = useState("");
595
+ const [feedCleanup, setFeedCleanup] = useState(true);
596
+ const [feedDryRun, setFeedDryRun] = useState(true);
597
+ const [naturalSanitizedJsonlPath, setNaturalSanitizedJsonlPath] = useState("");
598
+ const [naturalRawJsonlPath, setNaturalRawJsonlPath] = useState("");
599
+ const [naturalRunId, setNaturalRunId] = useState("");
600
+ const [naturalTasks, setNaturalTasks] = useState("response,action_planner");
601
+ const [naturalIncludeRaw, setNaturalIncludeRaw] = useState(false);
602
+ const [scenarioFilter, setScenarioFilter] = useState(
603
+ "deterministic-pr-smoke"
604
+ );
605
+ const [scenarioOutputDir, setScenarioOutputDir] = useState("");
606
+ const [scenarioDryRun, setScenarioDryRun] = useState(true);
607
+ const [scenarioExportNative, setScenarioExportNative] = useState(true);
608
+ const [scenarioDeterministicProxy, setScenarioDeterministicProxy] = useState(true);
609
+ const [scenarioRunning, setScenarioRunning] = useState(false);
610
+ const [scenarioResult, setScenarioResult] = useState(null);
611
+ const [evalComparisonRunning, setEvalComparisonRunning] = useState(false);
612
+ const [evalComparisonResult, setEvalComparisonResult] = useState(null);
613
+ const [evalComparisonEnabled, setEvalComparisonEnabled] = useState(true);
614
+ const [evalComparisonManifestPath, setEvalComparisonManifestPath] = useState("");
615
+ const [evalComparisonBaseModel, setEvalComparisonBaseModel] = useState("eliza-1-2b-base");
616
+ const [evalComparisonTrainedModelPath, setEvalComparisonTrainedModelPath] = useState("eliza-1-2b-trained");
617
+ const [evalComparisonBackend, setEvalComparisonBackend] = useState("cpu");
618
+ const [evalComparisonOutputDir, setEvalComparisonOutputDir] = useState("");
619
+ const [evalComparisonDryRun, setEvalComparisonDryRun] = useState(true);
620
+ const [benchmarkRunning, setBenchmarkRunning] = useState(false);
621
+ const [benchmarkResult, setBenchmarkResult] = useState(null);
622
+ const [benchmarkTiers, setBenchmarkTiers] = useState("2b");
623
+ const [benchmarkKind, setBenchmarkKind] = useState("eliza_harness_action_selection");
624
+ const [benchmarkVariants, setBenchmarkVariants] = useState("both");
625
+ const [benchmarkMaxSamples, setBenchmarkMaxSamples] = useState("50");
626
+ const [benchmarkResultsDb, setBenchmarkResultsDb] = useState("");
627
+ const [benchmarkTrainedModelPath, setBenchmarkTrainedModelPath] = useState("");
628
+ const [benchmarkMatrixOutputDir, setBenchmarkMatrixOutputDir] = useState("");
629
+ const [benchmarkDryRun, setBenchmarkDryRun] = useState(true);
630
+ const [bundleStageRunning, setBundleStageRunning] = useState(false);
631
+ const [bundleStageResult, setBundleStageResult] = useState(null);
632
+ const [bundleStageRepoId, setBundleStageRepoId] = useState("elizaos/eliza-1");
633
+ const [bundleStageTier, setBundleStageTier] = useState("2b");
634
+ const [bundleStageLocalDir, setBundleStageLocalDir] = useState(
635
+ "/tmp/eliza-1-bundles"
636
+ );
637
+ const [bundleStageOutputDir, setBundleStageOutputDir] = useState("");
638
+ const [bundleStageMaxBytes, setBundleStageMaxBytes] = useState("8589934592");
639
+ const [bundleStageApply, setBundleStageApply] = useState(false);
640
+ const [actionBenchmarkRunning, setActionBenchmarkRunning] = useState(false);
641
+ const [actionBenchmarkResult, setActionBenchmarkResult] = useState(null);
642
+ const [actionBenchmarkFilter, setActionBenchmarkFilter] = useState("");
643
+ const [actionBenchmarkRunsPerCase, setActionBenchmarkRunsPerCase] = useState("1");
644
+ const [actionBenchmarkOutputDir, setActionBenchmarkOutputDir] = useState("");
645
+ const [actionBenchmarkModelId, setActionBenchmarkModelId] = useState("eliza-1-2b-trained");
646
+ const [actionBenchmarkRuntimeModel, setActionBenchmarkRuntimeModel] = useState("eliza-1-2b-trained");
647
+ const [actionBenchmarkPairEnabled, setActionBenchmarkPairEnabled] = useState(true);
648
+ const [actionBenchmarkPairTiers, setActionBenchmarkPairTiers] = useState("2b");
649
+ const [actionBenchmarkBaseModelId, setActionBenchmarkBaseModelId] = useState("eliza-1-2b-base");
650
+ const [actionBenchmarkBaseRuntimeModel, setActionBenchmarkBaseRuntimeModel] = useState("eliza-1-2b-base");
651
+ const [actionBenchmarkProvider, setActionBenchmarkProvider] = useState("local-llama-cpp");
652
+ const [actionBenchmarkBaseUrl, setActionBenchmarkBaseUrl] = useState(
653
+ "http://localhost:11434/v1"
654
+ );
655
+ const [actionBenchmarkVariant, setActionBenchmarkVariant] = useState("trained");
656
+ const [actionBenchmarkTier, setActionBenchmarkTier] = useState("2b");
657
+ const [actionBenchmarkMatrixBenchmark, setActionBenchmarkMatrixBenchmark] = useState("eliza_harness_action_selection");
658
+ const [actionBenchmarkDatasetVersion, setActionBenchmarkDatasetVersion] = useState("eliza-native-v1");
659
+ const [actionBenchmarkUseMocks, setActionBenchmarkUseMocks] = useState(false);
660
+ const [actionBenchmarkCapture, setActionBenchmarkCapture] = useState(true);
661
+ const [actionBenchmarkDryRun, setActionBenchmarkDryRun] = useState(true);
662
+ const [selectedDatasetId, setSelectedDatasetId] = useState("");
663
+ const [selectedJobId, setSelectedJobId] = useState("");
664
+ const [selectedModelId, setSelectedModelId] = useState("");
665
+ const [buildLimit, setBuildLimit] = useState("250");
666
+ const [buildMinCalls, setBuildMinCalls] = useState("1");
667
+ const [datasetBuilding, setDatasetBuilding] = useState(false);
668
+ const [startBackend, setStartBackend] = useState(
669
+ "cpu"
670
+ );
671
+ const [startModel, setStartModel] = useState("");
672
+ const [startIterations, setStartIterations] = useState("");
673
+ const [startBatchSize, setStartBatchSize] = useState("");
674
+ const [startLearningRate, setStartLearningRate] = useState("");
675
+ const [startingJob, setStartingJob] = useState(false);
676
+ const [cancellingJobId, setCancellingJobId] = useState("");
677
+ const [importModelName, setImportModelName] = useState("");
678
+ const [importBaseModel, setImportBaseModel] = useState("");
679
+ const [importOllamaUrl, setImportOllamaUrl] = useState(
680
+ "http://localhost:11434"
681
+ );
682
+ const [activateProviderModel, setActivateProviderModel] = useState("");
683
+ const [modelAction, setModelAction] = useState("");
684
+ const [smokeResult, setSmokeResult] = useState(null);
685
+ const [trainingEvents, setTrainingEvents] = useState(
686
+ []
687
+ );
688
+ const selectedJob = useMemo(
689
+ () => jobs.find((job) => job.id === selectedJobId) ?? null,
690
+ [jobs, selectedJobId]
691
+ );
692
+ const selectedModel = useMemo(
693
+ () => models.find((model) => model.id === selectedModelId) ?? null,
694
+ [models, selectedModelId]
695
+ );
696
+ const activeRunningJob = useMemo(
697
+ () => jobs.find((job) => job.status === "running" || job.status === "queued") ?? null,
698
+ [jobs]
699
+ );
700
+ const loadStatus = useCallback(async () => {
701
+ const nextStatus = await client.getTrainingStatus();
702
+ setStatus(nextStatus);
703
+ }, []);
704
+ const loadTrajectories = useCallback(async () => {
705
+ const listed = await client.listTrainingTrajectories({
706
+ limit: 100,
707
+ offset: 0
708
+ });
709
+ setTrajectoryList(listed);
710
+ }, []);
711
+ const loadDatasets = useCallback(async () => {
712
+ const listed = await client.listTrainingDatasets();
713
+ const nextDatasets = asArray(listed.datasets);
714
+ setDatasets(nextDatasets);
715
+ setSelectedDatasetId((prev) => {
716
+ if (prev && nextDatasets.some((dataset) => dataset.id === prev)) {
717
+ return prev;
718
+ }
719
+ return nextDatasets[0]?.id ?? "";
720
+ });
721
+ }, []);
722
+ const loadJobs = useCallback(async () => {
723
+ const listed = await client.listTrainingJobs();
724
+ const nextJobs = asArray(listed.jobs);
725
+ setJobs(nextJobs);
726
+ setSelectedJobId((prev) => {
727
+ if (prev && nextJobs.some((job) => job.id === prev)) return prev;
728
+ return nextJobs[0]?.id ?? "";
729
+ });
730
+ }, []);
731
+ const loadModels = useCallback(async () => {
732
+ const listed = await client.listTrainingModels();
733
+ const nextModels = asArray(listed.models);
734
+ setModels(nextModels);
735
+ setSelectedModelId((prev) => {
736
+ if (prev && nextModels.some((model) => model.id === prev)) return prev;
737
+ return nextModels[0]?.id ?? "";
738
+ });
739
+ }, []);
740
+ const loadCollectionHistory = useCallback(async () => {
741
+ setCollectionHistoryLoading(true);
742
+ try {
743
+ const listed = await client.listTrainingCollections({ limit: 10 });
744
+ setCollectionHistory(listed);
745
+ } catch (err) {
746
+ setActionNotice(
747
+ err instanceof Error ? err.message : t("finetuningview.FailedToLoadCollectionHistory", {
748
+ defaultValue: "Failed to load collection history"
749
+ }),
750
+ "error",
751
+ 4200
752
+ );
753
+ } finally {
754
+ setCollectionHistoryLoading(false);
755
+ }
756
+ }, [setActionNotice, t]);
757
+ const refreshAll = useCallback(async () => {
758
+ setPageLoading(true);
759
+ setErrorMessage(null);
760
+ try {
761
+ await Promise.all([
762
+ loadStatus(),
763
+ loadTrajectories(),
764
+ loadDatasets(),
765
+ loadJobs(),
766
+ loadModels(),
767
+ loadCollectionHistory()
768
+ ]);
769
+ } catch (err) {
770
+ setErrorMessage(
771
+ err instanceof Error ? err.message : t("finetuningview.FailedToRefreshState")
772
+ );
773
+ } finally {
774
+ setPageLoading(false);
775
+ }
776
+ }, [
777
+ loadCollectionHistory,
778
+ loadDatasets,
779
+ loadJobs,
780
+ loadModels,
781
+ loadStatus,
782
+ loadTrajectories,
783
+ t
784
+ ]);
785
+ const loadTrajectoryDetail = useCallback(
786
+ async (trajectoryId) => {
787
+ setTrajectoryLoading(true);
788
+ try {
789
+ const result = await client.getTrainingTrajectory(trajectoryId);
790
+ setSelectedTrajectory(result.trajectory);
791
+ } catch (err) {
792
+ const message = err instanceof Error ? err.message : t("finetuningview.FailedToLoadTrajectoryDetail");
793
+ setActionNotice(message, "error", 4200);
794
+ } finally {
795
+ setTrajectoryLoading(false);
796
+ }
797
+ },
798
+ [setActionNotice, t]
799
+ );
800
+ const handlePublishTrajectories = useCallback(async () => {
801
+ setPublishingTrajectories(true);
802
+ try {
803
+ const response = await fetch("/api/training/trajectories/publish", {
804
+ method: "POST",
805
+ headers: { "content-type": "application/json" },
806
+ body: JSON.stringify({})
807
+ });
808
+ if (response.status === 409) {
809
+ setPublishConfigured(false);
810
+ const detail = await response.json().catch(() => null);
811
+ setActionNotice(
812
+ detail?.error ?? t("finetuningview.HuggingFacePublishNotConfigured"),
813
+ "error",
814
+ 5200
815
+ );
816
+ return;
817
+ }
818
+ const payload = await response.json().catch(() => null);
819
+ if (!response.ok) {
820
+ setActionNotice(
821
+ payload?.error ?? t("finetuningview.FailedToPublishTrajectories"),
822
+ "error",
823
+ 5200
824
+ );
825
+ return;
826
+ }
827
+ setPublishConfigured(true);
828
+ setActionNotice(
829
+ t("finetuningview.PublishedTrajectoriesMessage", {
830
+ count: payload?.trajectoriesPublished ?? 0,
831
+ repo: payload?.cloudUpload?.huggingFaceRepo ?? ""
832
+ }),
833
+ "success",
834
+ 4200
835
+ );
836
+ } catch (err) {
837
+ setActionNotice(
838
+ err instanceof Error ? err.message : t("finetuningview.FailedToPublishTrajectories"),
839
+ "error",
840
+ 5200
841
+ );
842
+ } finally {
843
+ setPublishingTrajectories(false);
844
+ }
845
+ }, [setActionNotice, t]);
846
+ const handleBuildDataset = useCallback(async () => {
847
+ setDatasetBuilding(true);
848
+ try {
849
+ const limit = parsePositiveInteger(buildLimit);
850
+ const minLlmCallsPerTrajectory = parsePositiveInteger(buildMinCalls);
851
+ const request = {};
852
+ if (typeof limit === "number") request.limit = limit;
853
+ if (typeof minLlmCallsPerTrajectory === "number") {
854
+ request.minLlmCallsPerTrajectory = minLlmCallsPerTrajectory;
855
+ }
856
+ const result = await client.buildTrainingDataset(request);
857
+ setSelectedDatasetId(result.dataset.id);
858
+ await Promise.all([loadDatasets(), loadStatus()]);
859
+ setActionNotice(
860
+ t("finetuningview.BuiltDatasetMessage", {
861
+ id: result.dataset.id,
862
+ count: result.dataset.sampleCount
863
+ }),
864
+ "success",
865
+ 3800
866
+ );
867
+ } catch (err) {
868
+ setActionNotice(
869
+ err instanceof Error ? err.message : t("finetuningview.FailedToBuildDataset"),
870
+ "error",
871
+ 4200
872
+ );
873
+ } finally {
874
+ setDatasetBuilding(false);
875
+ }
876
+ }, [buildLimit, buildMinCalls, loadDatasets, loadStatus, setActionNotice, t]);
877
+ const handleBuildAnalysisIndex = useCallback(async () => {
878
+ setAnalysisBuilding(true);
879
+ try {
880
+ const result = await client.buildTrainingAnalysisIndex();
881
+ setAnalysisIndex(result);
882
+ setActionNotice(
883
+ t("finetuningview.BuiltAnalysisIndexMessage", {
884
+ count: result.manifest.artifacts.length
885
+ }),
886
+ "success",
887
+ 4200
888
+ );
889
+ } catch (err) {
890
+ setActionNotice(
891
+ err instanceof Error ? err.message : t("finetuningview.FailedToBuildAnalysisIndex"),
892
+ "error",
893
+ 5200
894
+ );
895
+ } finally {
896
+ setAnalysisBuilding(false);
897
+ }
898
+ }, [setActionNotice, t]);
899
+ const handleBuildReadinessReport = useCallback(async () => {
900
+ setReadinessBuilding(true);
901
+ try {
902
+ const result = await client.buildTrainingReadinessReport();
903
+ setReadinessReport(result);
904
+ setActionNotice(
905
+ t("finetuningview.ReadinessReportCompleted", {
906
+ status: result.report.status,
907
+ missing: result.report.counts.missing ?? 0
908
+ }),
909
+ result.report.status === "missing" ? "error" : "success",
910
+ 5200
911
+ );
912
+ } catch (err) {
913
+ setActionNotice(
914
+ err instanceof Error ? err.message : t("finetuningview.FailedToBuildReadinessReport"),
915
+ "error",
916
+ 5200
917
+ );
918
+ } finally {
919
+ setReadinessBuilding(false);
920
+ }
921
+ }, [setActionNotice, t]);
922
+ const handleRunReadinessRecommendation = useCallback(
923
+ async (checkId, action) => {
924
+ setReadinessActionRunning(checkId);
925
+ try {
926
+ const result = await interact(action.capability, action.params);
927
+ if (action.capability === "terminal-training-build-analysis-index") {
928
+ setAnalysisIndex(result);
929
+ } else if (action.capability === "terminal-training-build-readiness-report") {
930
+ setReadinessReport(result);
931
+ } else if (action.capability === "terminal-training-ingest-hf-dataset") {
932
+ setHfIngestResult(result);
933
+ } else if (action.capability === "terminal-training-feed-generate") {
934
+ setFeedGenerationResult(result);
935
+ } else if (action.capability === "terminal-training-run-eval-comparison") {
936
+ setEvalComparisonResult(result);
937
+ } else if (action.capability === "terminal-training-run-scenarios") {
938
+ setScenarioResult(result);
939
+ } else if (action.capability === "terminal-training-run-benchmark-vs-cerebras") {
940
+ setBenchmarkResult(result);
941
+ } else if (action.capability === "terminal-training-stage-eliza1-bundle") {
942
+ setBundleStageResult(result);
943
+ } else if (action.capability === "terminal-training-run-action-benchmark") {
944
+ setActionBenchmarkResult(result);
945
+ } else if (action.capability === "terminal-training-run-collection") {
946
+ setCollectionResult(result);
947
+ await loadCollectionHistory();
948
+ }
949
+ if (action.capability !== "terminal-training-build-readiness-report") {
950
+ const refreshed = await client.buildTrainingReadinessReport();
951
+ setReadinessReport(refreshed);
952
+ }
953
+ setActionNotice(
954
+ t("finetuningview.ReadinessRecommendationCompleted", {
955
+ defaultValue: `Ran ${action.capability}`
956
+ }),
957
+ "success",
958
+ 5200
959
+ );
960
+ } catch (err) {
961
+ setActionNotice(
962
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunReadinessRecommendation", {
963
+ defaultValue: "Failed to run readiness recommendation"
964
+ }),
965
+ "error",
966
+ 5200
967
+ );
968
+ } finally {
969
+ setReadinessActionRunning(null);
970
+ }
971
+ },
972
+ [loadCollectionHistory, setActionNotice, t]
973
+ );
974
+ const handleRunTrainingCollection = useCallback(
975
+ async (preflightOnly = false) => {
976
+ if (preflightOnly) {
977
+ setCollectionPreflightRunning(true);
978
+ } else {
979
+ setCollectionRunning(true);
980
+ }
981
+ try {
982
+ const hfFilesList = hfFiles.split(/\r?\n|,/).map((file) => file.trim()).filter(Boolean);
983
+ const actionBenchmarkTiers = parseCollectionTierList(
984
+ actionBenchmarkPairTiers
985
+ );
986
+ const actionBenchmarkTierForSinglePair = actionBenchmarkTier.trim() || void 0;
987
+ const useDerivedActionBenchmarkPairs = actionBenchmarkPairEnabled && actionBenchmarkTiers.length > 0 && (actionBenchmarkTiers.length > 1 || actionBenchmarkTiers[0] !== actionBenchmarkTierForSinglePair);
988
+ const naturalTaskList = naturalTasks.split(",").map((task) => task.trim()).filter(Boolean);
989
+ const naturalTrajectoryOptions = naturalSanitizedJsonlPath.trim() || naturalRawJsonlPath.trim() || naturalRunId.trim() || naturalTaskList.length > 0 || naturalIncludeRaw ? {
990
+ sanitizedJsonlPath: naturalSanitizedJsonlPath.trim() || void 0,
991
+ rawJsonlPath: naturalRawJsonlPath.trim() || void 0,
992
+ includeRawJsonl: naturalIncludeRaw || !!naturalRawJsonlPath.trim(),
993
+ tasks: naturalTaskList.length > 0 ? naturalTaskList : void 0,
994
+ source: {
995
+ kind: "training_collection_natural_trajectories",
996
+ runId: naturalRunId.trim() || void 0,
997
+ metadata: {
998
+ ui: true,
999
+ sanitizedJsonlPath: naturalSanitizedJsonlPath.trim() || void 0,
1000
+ rawJsonlPath: naturalRawJsonlPath.trim() || void 0
1001
+ }
1002
+ }
1003
+ } : void 0;
1004
+ const result = await client.runTrainingCollection({
1005
+ preflightOnly,
1006
+ preflightProbe: collectionPreflightProbe,
1007
+ includeHuggingFace: true,
1008
+ includeFeed: true,
1009
+ includeNaturalTrajectories: true,
1010
+ includeTestTrajectories: true,
1011
+ includeScenarios: true,
1012
+ includeEvalComparison: evalComparisonEnabled,
1013
+ includeActionBenchmark: true,
1014
+ includeBenchmarkVsCerebras: true,
1015
+ includeEliza1ModelRegistry: true,
1016
+ includeEliza1BundleStage: true,
1017
+ includeBenchmarkMatrix: true,
1018
+ huggingFace: {
1019
+ repoId: hfRepoId.trim() || void 0,
1020
+ revision: hfRevision.trim() || void 0,
1021
+ files: hfFilesList.length > 0 ? hfFilesList : void 0,
1022
+ dryRun: hfDryRun,
1023
+ outputDir: hfOutputDir.trim() || void 0
1024
+ },
1025
+ feed: {
1026
+ archetypes: feedArchetypes.trim() || void 0,
1027
+ numAgents: parsePositiveInteger(feedNumAgents),
1028
+ ticks: parsePositiveInteger(feedTicks),
1029
+ parallel: parsePositiveInteger(feedParallel),
1030
+ cleanup: feedCleanup,
1031
+ dryRun: feedDryRun,
1032
+ outputDir: feedOutputDir.trim() || void 0
1033
+ },
1034
+ naturalTrajectories: naturalTrajectoryOptions,
1035
+ scenarios: {
1036
+ dryRun: scenarioDryRun,
1037
+ scenario: scenarioFilter.trim() || void 0,
1038
+ outputDir: scenarioOutputDir.trim() || void 0,
1039
+ exportNative: scenarioExportNative,
1040
+ useDeterministicProxy: scenarioDeterministicProxy
1041
+ },
1042
+ evalComparison: {
1043
+ manifestPath: evalComparisonManifestPath.trim() || void 0,
1044
+ model: evalComparisonManifestPath.trim() ? void 0 : evalComparisonBaseModel.trim() || void 0,
1045
+ trainedModelPath: evalComparisonManifestPath.trim() ? void 0 : evalComparisonTrainedModelPath.trim() || void 0,
1046
+ backend: evalComparisonManifestPath.trim() ? void 0 : evalComparisonBackend,
1047
+ outputDir: evalComparisonOutputDir.trim() || void 0,
1048
+ dryRun: evalComparisonDryRun
1049
+ },
1050
+ actionBenchmark: {
1051
+ filter: actionBenchmarkFilter.trim() || void 0,
1052
+ runsPerCase: parsePositiveInteger(actionBenchmarkRunsPerCase),
1053
+ outputDir: actionBenchmarkOutputDir.trim() || void 0,
1054
+ provider: actionBenchmarkProvider.trim() || void 0,
1055
+ modelId: actionBenchmarkModelId.trim() || void 0,
1056
+ runtimeModel: actionBenchmarkRuntimeModel.trim() || void 0,
1057
+ baseUrl: actionBenchmarkBaseUrl.trim() || void 0,
1058
+ variant: actionBenchmarkVariant,
1059
+ tier: actionBenchmarkTier.trim() || void 0,
1060
+ benchmark: actionBenchmarkMatrixBenchmark.trim() || void 0,
1061
+ datasetVersion: actionBenchmarkDatasetVersion.trim() || void 0,
1062
+ useMocks: actionBenchmarkUseMocks,
1063
+ forceTrajectoryCapture: actionBenchmarkCapture,
1064
+ dryRun: actionBenchmarkDryRun
1065
+ },
1066
+ actionBenchmarkPair: actionBenchmarkPairEnabled ? !useDerivedActionBenchmarkPairs ? {
1067
+ tier: actionBenchmarkTierForSinglePair,
1068
+ base: {
1069
+ modelId: actionBenchmarkBaseModelId.trim() || void 0,
1070
+ runtimeModel: actionBenchmarkBaseRuntimeModel.trim() || void 0,
1071
+ variant: "base"
1072
+ },
1073
+ trained: {
1074
+ modelId: actionBenchmarkModelId.trim() || void 0,
1075
+ runtimeModel: actionBenchmarkRuntimeModel.trim() || void 0,
1076
+ variant: "trained"
1077
+ }
1078
+ } : void 0 : void 0,
1079
+ actionBenchmarkPairs: useDerivedActionBenchmarkPairs ? actionBenchmarkTiers.map((tier) => ({
1080
+ tier,
1081
+ base: { variant: "base" },
1082
+ trained: { variant: "trained" }
1083
+ })) : void 0,
1084
+ benchmarkVsCerebras: {
1085
+ tiers: benchmarkTiers.trim() || void 0,
1086
+ benchmark: benchmarkKind,
1087
+ variants: benchmarkVariants,
1088
+ maxSamples: parsePositiveInteger(benchmarkMaxSamples),
1089
+ dryRun: benchmarkDryRun,
1090
+ resultsDb: benchmarkResultsDb.trim() || void 0,
1091
+ trainedModelPath: benchmarkTrainedModelPath.trim() || void 0,
1092
+ matrixOutputDir: benchmarkMatrixOutputDir.trim() || void 0
1093
+ },
1094
+ eliza1BundleStage: {
1095
+ repoId: bundleStageRepoId.trim() || void 0,
1096
+ tier: bundleStageTier.trim() || void 0,
1097
+ localDir: bundleStageLocalDir.trim() || void 0,
1098
+ outputDir: bundleStageOutputDir.trim() || void 0,
1099
+ maxBytes: parsePositiveInteger(bundleStageMaxBytes),
1100
+ apply: bundleStageApply
1101
+ }
1102
+ });
1103
+ if ("preflight" in result) {
1104
+ setCollectionPreflightResult(result.preflight);
1105
+ setActionNotice(
1106
+ t("finetuningview.CollectionPreflightCompleted", {
1107
+ defaultValue: "Collection preflight completed"
1108
+ }),
1109
+ "success",
1110
+ 5200
1111
+ );
1112
+ return;
1113
+ }
1114
+ setCollectionResult(result);
1115
+ setCollectionPreflightResult(
1116
+ result.manifest.evidence.preflight ?? null
1117
+ );
1118
+ setAnalysisIndex(result.analysis);
1119
+ await loadCollectionHistory();
1120
+ setActionNotice(
1121
+ t("finetuningview.TrainingCollectionCompleted", {
1122
+ count: result.analysis.manifest.artifacts.length
1123
+ }),
1124
+ "success",
1125
+ 5200
1126
+ );
1127
+ } catch (err) {
1128
+ setActionNotice(
1129
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunTrainingCollection"),
1130
+ "error",
1131
+ 5200
1132
+ );
1133
+ } finally {
1134
+ if (preflightOnly) {
1135
+ setCollectionPreflightRunning(false);
1136
+ } else {
1137
+ setCollectionRunning(false);
1138
+ }
1139
+ }
1140
+ },
1141
+ [
1142
+ actionBenchmarkCapture,
1143
+ actionBenchmarkDryRun,
1144
+ actionBenchmarkFilter,
1145
+ actionBenchmarkBaseModelId,
1146
+ actionBenchmarkBaseRuntimeModel,
1147
+ actionBenchmarkDatasetVersion,
1148
+ actionBenchmarkMatrixBenchmark,
1149
+ actionBenchmarkModelId,
1150
+ actionBenchmarkBaseUrl,
1151
+ actionBenchmarkOutputDir,
1152
+ actionBenchmarkPairEnabled,
1153
+ actionBenchmarkPairTiers,
1154
+ actionBenchmarkProvider,
1155
+ actionBenchmarkRunsPerCase,
1156
+ actionBenchmarkRuntimeModel,
1157
+ actionBenchmarkTier,
1158
+ actionBenchmarkUseMocks,
1159
+ actionBenchmarkVariant,
1160
+ benchmarkDryRun,
1161
+ benchmarkKind,
1162
+ benchmarkMatrixOutputDir,
1163
+ benchmarkMaxSamples,
1164
+ benchmarkResultsDb,
1165
+ benchmarkTiers,
1166
+ benchmarkTrainedModelPath,
1167
+ benchmarkVariants,
1168
+ bundleStageApply,
1169
+ bundleStageLocalDir,
1170
+ bundleStageMaxBytes,
1171
+ bundleStageOutputDir,
1172
+ bundleStageRepoId,
1173
+ bundleStageTier,
1174
+ collectionPreflightProbe,
1175
+ evalComparisonBackend,
1176
+ evalComparisonBaseModel,
1177
+ evalComparisonDryRun,
1178
+ evalComparisonEnabled,
1179
+ evalComparisonManifestPath,
1180
+ evalComparisonOutputDir,
1181
+ evalComparisonTrainedModelPath,
1182
+ feedArchetypes,
1183
+ feedCleanup,
1184
+ feedDryRun,
1185
+ feedNumAgents,
1186
+ feedOutputDir,
1187
+ feedParallel,
1188
+ feedTicks,
1189
+ hfDryRun,
1190
+ hfFiles,
1191
+ hfOutputDir,
1192
+ hfRepoId,
1193
+ hfRevision,
1194
+ loadCollectionHistory,
1195
+ naturalIncludeRaw,
1196
+ naturalRawJsonlPath,
1197
+ naturalRunId,
1198
+ naturalSanitizedJsonlPath,
1199
+ naturalTasks,
1200
+ scenarioDeterministicProxy,
1201
+ scenarioDryRun,
1202
+ scenarioExportNative,
1203
+ scenarioFilter,
1204
+ scenarioOutputDir,
1205
+ setActionNotice,
1206
+ t
1207
+ ]
1208
+ );
1209
+ const handleRunEvalComparison = useCallback(async () => {
1210
+ setEvalComparisonRunning(true);
1211
+ try {
1212
+ const result = await client.runTrainingLocalEvalComparison({
1213
+ manifestPath: evalComparisonManifestPath.trim() || void 0,
1214
+ model: evalComparisonManifestPath.trim() ? void 0 : evalComparisonBaseModel.trim() || void 0,
1215
+ trainedModelPath: evalComparisonManifestPath.trim() ? void 0 : evalComparisonTrainedModelPath.trim() || void 0,
1216
+ backend: evalComparisonManifestPath.trim() ? void 0 : evalComparisonBackend,
1217
+ outputDir: evalComparisonOutputDir.trim() || void 0,
1218
+ dryRun: evalComparisonDryRun
1219
+ });
1220
+ setEvalComparisonResult(result);
1221
+ setActionNotice(
1222
+ result.exitCode === 0 ? t("finetuningview.EvalComparisonCompleted") : t("finetuningview.EvalComparisonFailed", {
1223
+ exitCode: result.exitCode
1224
+ }),
1225
+ result.exitCode === 0 ? "success" : "error",
1226
+ 5200
1227
+ );
1228
+ if (!evalComparisonDryRun) {
1229
+ void handleBuildAnalysisIndex();
1230
+ }
1231
+ } catch (err) {
1232
+ setActionNotice(
1233
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunEvalComparison"),
1234
+ "error",
1235
+ 5200
1236
+ );
1237
+ } finally {
1238
+ setEvalComparisonRunning(false);
1239
+ }
1240
+ }, [
1241
+ evalComparisonBackend,
1242
+ evalComparisonBaseModel,
1243
+ evalComparisonDryRun,
1244
+ evalComparisonManifestPath,
1245
+ evalComparisonOutputDir,
1246
+ evalComparisonTrainedModelPath,
1247
+ handleBuildAnalysisIndex,
1248
+ setActionNotice,
1249
+ t
1250
+ ]);
1251
+ const handleRunBenchmarkVsCerebras = useCallback(async () => {
1252
+ setBenchmarkRunning(true);
1253
+ try {
1254
+ const maxSamples = parsePositiveInteger(benchmarkMaxSamples);
1255
+ const result = await client.runTrainingBenchmarkVsCerebras({
1256
+ tiers: benchmarkTiers.trim() || void 0,
1257
+ benchmark: benchmarkKind,
1258
+ variants: benchmarkVariants,
1259
+ maxSamples: typeof maxSamples === "number" ? maxSamples : void 0,
1260
+ dryRun: benchmarkDryRun,
1261
+ resultsDb: benchmarkResultsDb.trim() || void 0,
1262
+ trainedModelPath: benchmarkTrainedModelPath.trim() || void 0,
1263
+ matrixOutputDir: benchmarkMatrixOutputDir.trim() || void 0
1264
+ });
1265
+ setBenchmarkResult(result);
1266
+ setActionNotice(
1267
+ result.exitCode === 0 ? t("finetuningview.BenchmarkVsCerebrasCompleted") : t("finetuningview.BenchmarkVsCerebrasFailed", {
1268
+ exitCode: result.exitCode
1269
+ }),
1270
+ result.exitCode === 0 ? "success" : "error",
1271
+ 5200
1272
+ );
1273
+ if (!benchmarkDryRun) {
1274
+ void handleBuildAnalysisIndex();
1275
+ }
1276
+ } catch (err) {
1277
+ setActionNotice(
1278
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunBenchmarkVsCerebras"),
1279
+ "error",
1280
+ 5200
1281
+ );
1282
+ } finally {
1283
+ setBenchmarkRunning(false);
1284
+ }
1285
+ }, [
1286
+ benchmarkDryRun,
1287
+ benchmarkKind,
1288
+ benchmarkMatrixOutputDir,
1289
+ benchmarkMaxSamples,
1290
+ benchmarkResultsDb,
1291
+ benchmarkTiers,
1292
+ benchmarkTrainedModelPath,
1293
+ benchmarkVariants,
1294
+ handleBuildAnalysisIndex,
1295
+ setActionNotice,
1296
+ t
1297
+ ]);
1298
+ const handleStageEliza1Bundle = useCallback(async () => {
1299
+ setBundleStageRunning(true);
1300
+ try {
1301
+ const result = await client.stageEliza1Bundle({
1302
+ repoId: bundleStageRepoId.trim() || void 0,
1303
+ tier: bundleStageTier.trim() || void 0,
1304
+ localDir: bundleStageLocalDir.trim() || void 0,
1305
+ outputDir: bundleStageOutputDir.trim() || void 0,
1306
+ maxBytes: parsePositiveInteger(bundleStageMaxBytes),
1307
+ apply: bundleStageApply
1308
+ });
1309
+ setBundleStageResult(result);
1310
+ setActionNotice(
1311
+ result.exitCode === 0 ? t("finetuningview.Eliza1BundleStageCompleted") : t("finetuningview.Eliza1BundleStageFailed", {
1312
+ exitCode: result.exitCode
1313
+ }),
1314
+ result.exitCode === 0 ? "success" : "error",
1315
+ 5200
1316
+ );
1317
+ } catch (err) {
1318
+ setActionNotice(
1319
+ err instanceof Error ? err.message : t("finetuningview.FailedToStageEliza1Bundle"),
1320
+ "error",
1321
+ 5200
1322
+ );
1323
+ } finally {
1324
+ setBundleStageRunning(false);
1325
+ }
1326
+ }, [
1327
+ bundleStageApply,
1328
+ bundleStageLocalDir,
1329
+ bundleStageMaxBytes,
1330
+ bundleStageOutputDir,
1331
+ bundleStageRepoId,
1332
+ bundleStageTier,
1333
+ setActionNotice,
1334
+ t
1335
+ ]);
1336
+ const handleIngestHuggingFaceDataset = useCallback(async () => {
1337
+ setHfIngestRunning(true);
1338
+ try {
1339
+ const files = hfFiles.split(/\r?\n|,/).map((file) => file.trim()).filter(Boolean);
1340
+ const result = await client.ingestHuggingFaceTrainingDataset({
1341
+ repoId: hfRepoId.trim() || void 0,
1342
+ revision: hfRevision.trim() || void 0,
1343
+ files: files.length > 0 ? files : void 0,
1344
+ outputDir: hfOutputDir.trim() || void 0,
1345
+ dryRun: hfDryRun
1346
+ });
1347
+ setHfIngestResult(result);
1348
+ setActionNotice(
1349
+ t("finetuningview.IngestedHuggingFaceDatasetMessage", {
1350
+ files: result.manifest.counts.files ?? result.manifest.files.length,
1351
+ rows: result.manifest.counts.jsonlRows ?? 0
1352
+ }),
1353
+ "success",
1354
+ 5200
1355
+ );
1356
+ if (!hfDryRun) {
1357
+ void handleBuildAnalysisIndex();
1358
+ }
1359
+ } catch (err) {
1360
+ setActionNotice(
1361
+ err instanceof Error ? err.message : t("finetuningview.FailedToIngestHuggingFaceDataset"),
1362
+ "error",
1363
+ 5200
1364
+ );
1365
+ } finally {
1366
+ setHfIngestRunning(false);
1367
+ }
1368
+ }, [
1369
+ handleBuildAnalysisIndex,
1370
+ hfDryRun,
1371
+ hfFiles,
1372
+ hfOutputDir,
1373
+ hfRepoId,
1374
+ hfRevision,
1375
+ setActionNotice,
1376
+ t
1377
+ ]);
1378
+ const handleRunActionBenchmark = useCallback(async () => {
1379
+ setActionBenchmarkRunning(true);
1380
+ try {
1381
+ const result = await client.runTrainingActionBenchmark({
1382
+ filter: actionBenchmarkFilter.trim() || void 0,
1383
+ runsPerCase: parsePositiveInteger(actionBenchmarkRunsPerCase),
1384
+ outputDir: actionBenchmarkOutputDir.trim() || void 0,
1385
+ provider: actionBenchmarkProvider.trim() || void 0,
1386
+ modelId: actionBenchmarkModelId.trim() || void 0,
1387
+ runtimeModel: actionBenchmarkRuntimeModel.trim() || void 0,
1388
+ baseUrl: actionBenchmarkBaseUrl.trim() || void 0,
1389
+ variant: actionBenchmarkVariant,
1390
+ tier: actionBenchmarkTier.trim() || void 0,
1391
+ benchmark: actionBenchmarkMatrixBenchmark.trim() || void 0,
1392
+ datasetVersion: actionBenchmarkDatasetVersion.trim() || void 0,
1393
+ useMocks: actionBenchmarkUseMocks,
1394
+ forceTrajectoryCapture: actionBenchmarkCapture,
1395
+ dryRun: actionBenchmarkDryRun
1396
+ });
1397
+ setActionBenchmarkResult(result);
1398
+ setActionNotice(
1399
+ result.exitCode === 0 ? t("finetuningview.ActionBenchmarkCompleted") : t("finetuningview.ActionBenchmarkFailed", {
1400
+ exitCode: result.exitCode
1401
+ }),
1402
+ result.exitCode === 0 ? "success" : "error",
1403
+ 5200
1404
+ );
1405
+ if (!actionBenchmarkDryRun) {
1406
+ void handleBuildAnalysisIndex();
1407
+ }
1408
+ } catch (err) {
1409
+ setActionNotice(
1410
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunActionBenchmark"),
1411
+ "error",
1412
+ 5200
1413
+ );
1414
+ } finally {
1415
+ setActionBenchmarkRunning(false);
1416
+ }
1417
+ }, [
1418
+ actionBenchmarkCapture,
1419
+ actionBenchmarkDryRun,
1420
+ actionBenchmarkFilter,
1421
+ actionBenchmarkDatasetVersion,
1422
+ actionBenchmarkMatrixBenchmark,
1423
+ actionBenchmarkModelId,
1424
+ actionBenchmarkBaseUrl,
1425
+ actionBenchmarkOutputDir,
1426
+ actionBenchmarkProvider,
1427
+ actionBenchmarkRunsPerCase,
1428
+ actionBenchmarkRuntimeModel,
1429
+ actionBenchmarkTier,
1430
+ actionBenchmarkUseMocks,
1431
+ actionBenchmarkVariant,
1432
+ handleBuildAnalysisIndex,
1433
+ setActionNotice,
1434
+ t
1435
+ ]);
1436
+ const handleRunFeedGeneration = useCallback(async () => {
1437
+ setFeedGenerationRunning(true);
1438
+ try {
1439
+ const result = await client.runFeedTrainingGeneration({
1440
+ archetypes: feedArchetypes.trim() || void 0,
1441
+ numAgents: parsePositiveInteger(feedNumAgents),
1442
+ ticks: parsePositiveInteger(feedTicks),
1443
+ parallel: parsePositiveInteger(feedParallel),
1444
+ cleanup: feedCleanup,
1445
+ dryRun: feedDryRun,
1446
+ outputDir: feedOutputDir.trim() || void 0
1447
+ });
1448
+ setFeedGenerationResult(result);
1449
+ setActionNotice(
1450
+ t("finetuningview.FeedGenerationCompleted"),
1451
+ "success",
1452
+ 5200
1453
+ );
1454
+ if (!feedDryRun) {
1455
+ void handleBuildAnalysisIndex();
1456
+ }
1457
+ } catch (err) {
1458
+ setActionNotice(
1459
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunFeedGeneration"),
1460
+ "error",
1461
+ 5200
1462
+ );
1463
+ } finally {
1464
+ setFeedGenerationRunning(false);
1465
+ }
1466
+ }, [
1467
+ feedArchetypes,
1468
+ feedCleanup,
1469
+ feedDryRun,
1470
+ feedNumAgents,
1471
+ feedOutputDir,
1472
+ feedParallel,
1473
+ feedTicks,
1474
+ handleBuildAnalysisIndex,
1475
+ setActionNotice,
1476
+ t
1477
+ ]);
1478
+ const handleRunScenarios = useCallback(async () => {
1479
+ setScenarioRunning(true);
1480
+ try {
1481
+ const result = await client.runTrainingScenarios({
1482
+ scenario: scenarioFilter.trim() || void 0,
1483
+ outputDir: scenarioOutputDir.trim() || void 0,
1484
+ exportNative: scenarioExportNative,
1485
+ useDeterministicProxy: scenarioDeterministicProxy,
1486
+ dryRun: scenarioDryRun
1487
+ });
1488
+ setScenarioResult(result);
1489
+ setActionNotice(
1490
+ result.exitCode === 0 ? t("finetuningview.ScenariosCompleted") : t("finetuningview.ScenariosFailed", {
1491
+ exitCode: result.exitCode
1492
+ }),
1493
+ result.exitCode === 0 ? "success" : "error",
1494
+ 5200
1495
+ );
1496
+ if (!scenarioDryRun) {
1497
+ void handleBuildAnalysisIndex();
1498
+ }
1499
+ } catch (err) {
1500
+ setActionNotice(
1501
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunScenarios"),
1502
+ "error",
1503
+ 5200
1504
+ );
1505
+ } finally {
1506
+ setScenarioRunning(false);
1507
+ }
1508
+ }, [
1509
+ handleBuildAnalysisIndex,
1510
+ scenarioDeterministicProxy,
1511
+ scenarioDryRun,
1512
+ scenarioExportNative,
1513
+ scenarioFilter,
1514
+ scenarioOutputDir,
1515
+ setActionNotice,
1516
+ t
1517
+ ]);
1518
+ const handleStartJob = useCallback(async () => {
1519
+ setStartingJob(true);
1520
+ try {
1521
+ const options = {
1522
+ datasetId: selectedDatasetId || void 0,
1523
+ backend: startBackend,
1524
+ model: startModel.trim() || void 0,
1525
+ iterations: parsePositiveInteger(startIterations),
1526
+ batchSize: parsePositiveInteger(startBatchSize),
1527
+ learningRate: parsePositiveFloat(startLearningRate)
1528
+ };
1529
+ const result = await client.startTrainingJob(options);
1530
+ setSelectedJobId(result.job.id);
1531
+ await Promise.all([loadJobs(), loadStatus()]);
1532
+ setActionNotice(
1533
+ t("finetuningview.StartedTrainingJobMessage", { id: result.job.id }),
1534
+ "success",
1535
+ 3200
1536
+ );
1537
+ } catch (err) {
1538
+ setActionNotice(
1539
+ err instanceof Error ? err.message : t("finetuningview.FailedToStartTrainingJob"),
1540
+ "error",
1541
+ 4200
1542
+ );
1543
+ } finally {
1544
+ setStartingJob(false);
1545
+ }
1546
+ }, [
1547
+ loadJobs,
1548
+ loadStatus,
1549
+ selectedDatasetId,
1550
+ setActionNotice,
1551
+ startBackend,
1552
+ startBatchSize,
1553
+ startIterations,
1554
+ startLearningRate,
1555
+ startModel,
1556
+ t
1557
+ ]);
1558
+ const handleCancelJob = useCallback(
1559
+ async (jobId) => {
1560
+ setCancellingJobId(jobId);
1561
+ try {
1562
+ await client.cancelTrainingJob(jobId);
1563
+ await Promise.all([loadJobs(), loadStatus()]);
1564
+ setActionNotice(
1565
+ t("finetuningview.CancelledJobMessage", { id: jobId }),
1566
+ "success",
1567
+ 2600
1568
+ );
1569
+ } catch (err) {
1570
+ setActionNotice(
1571
+ err instanceof Error ? err.message : t("finetuningview.FailedToCancelJob", { id: jobId }),
1572
+ "error",
1573
+ 4200
1574
+ );
1575
+ } finally {
1576
+ setCancellingJobId("");
1577
+ }
1578
+ },
1579
+ [loadJobs, loadStatus, setActionNotice, t]
1580
+ );
1581
+ const handleImportSelectedModel = useCallback(async () => {
1582
+ if (!selectedModel) return;
1583
+ const actionId = `import:${selectedModel.id}`;
1584
+ setModelAction(actionId);
1585
+ try {
1586
+ const result = await client.importTrainingModelToOllama(
1587
+ selectedModel.id,
1588
+ {
1589
+ modelName: importModelName.trim() || void 0,
1590
+ baseModel: importBaseModel.trim() || void 0,
1591
+ ollamaUrl: importOllamaUrl.trim() || void 0
1592
+ }
1593
+ );
1594
+ await loadModels();
1595
+ setActivateProviderModel(
1596
+ result.model.ollamaModel ? `ollama/${result.model.ollamaModel}` : ""
1597
+ );
1598
+ setActionNotice(
1599
+ t("finetuningview.ImportedModelToOllamaMessage", {
1600
+ id: result.model.id,
1601
+ ollamaModel: result.model.ollamaModel ? ` as ${result.model.ollamaModel}` : ""
1602
+ }),
1603
+ "success",
1604
+ 4200
1605
+ );
1606
+ } catch (err) {
1607
+ setActionNotice(
1608
+ err instanceof Error ? err.message : t("finetuningview.FailedToImportModelToOllama"),
1609
+ "error",
1610
+ 4200
1611
+ );
1612
+ } finally {
1613
+ setModelAction("");
1614
+ }
1615
+ }, [
1616
+ importBaseModel,
1617
+ importModelName,
1618
+ importOllamaUrl,
1619
+ loadModels,
1620
+ selectedModel,
1621
+ setActionNotice,
1622
+ t
1623
+ ]);
1624
+ const handleActivateSelectedModel = useCallback(async () => {
1625
+ if (!selectedModel) return;
1626
+ const actionId = `activate:${selectedModel.id}`;
1627
+ setModelAction(actionId);
1628
+ try {
1629
+ const result = await client.activateTrainingModel(
1630
+ selectedModel.id,
1631
+ activateProviderModel.trim() || void 0
1632
+ );
1633
+ await loadModels();
1634
+ setActionNotice(
1635
+ t("finetuningview.ActivatedModelMessage", {
1636
+ id: result.modelId,
1637
+ providerModel: result.providerModel
1638
+ }),
1639
+ "success",
1640
+ 4200
1641
+ );
1642
+ if (result.needsRestart) {
1643
+ const shouldRestart = await confirmDesktopAction({
1644
+ title: t("finetuningview.RestartAgentTitle"),
1645
+ message: t("finetuningview.RestartAgentMessage"),
1646
+ confirmLabel: t("finetuningview.Restart"),
1647
+ cancelLabel: t("restartbanner.Later"),
1648
+ type: "question"
1649
+ });
1650
+ if (shouldRestart) {
1651
+ await handleRestart();
1652
+ }
1653
+ }
1654
+ } catch (err) {
1655
+ setActionNotice(
1656
+ err instanceof Error ? err.message : t("finetuningview.FailedToActivateModel"),
1657
+ "error",
1658
+ 4200
1659
+ );
1660
+ } finally {
1661
+ setModelAction("");
1662
+ }
1663
+ }, [
1664
+ activateProviderModel,
1665
+ handleRestart,
1666
+ loadModels,
1667
+ selectedModel,
1668
+ setActionNotice,
1669
+ t
1670
+ ]);
1671
+ const handleBenchmarkSelectedModel = useCallback(async () => {
1672
+ if (!selectedModel) return;
1673
+ const actionId = `benchmark:${selectedModel.id}`;
1674
+ setModelAction(actionId);
1675
+ try {
1676
+ const result = await client.benchmarkTrainingModel(selectedModel.id);
1677
+ await loadModels();
1678
+ setActionNotice(
1679
+ t("finetuningview.BenchmarkStatusMessage", {
1680
+ status: result.status,
1681
+ id: selectedModel.id
1682
+ }),
1683
+ result.status === "passed" ? "success" : "error",
1684
+ 4200
1685
+ );
1686
+ } catch (err) {
1687
+ setActionNotice(
1688
+ err instanceof Error ? err.message : t("finetuningview.FailedToBenchmarkModel"),
1689
+ "error",
1690
+ 4200
1691
+ );
1692
+ } finally {
1693
+ setModelAction("");
1694
+ }
1695
+ }, [loadModels, selectedModel, setActionNotice, t]);
1696
+ const handleSmokeTestSelectedModel = useCallback(async () => {
1697
+ if (!selectedModel) return;
1698
+ const actionId = `smoke:${selectedModel.id}`;
1699
+ setModelAction(actionId);
1700
+ try {
1701
+ const result = await client.sendChatRest(
1702
+ "Model smoke test. Reply with exactly: MODEL_OK"
1703
+ );
1704
+ setSmokeResult(result.text);
1705
+ setActionNotice(t("finetuningview.SmokeTestCompleted"), "success", 3200);
1706
+ } catch (err) {
1707
+ setSmokeResult(null);
1708
+ setActionNotice(
1709
+ err instanceof Error ? err.message : t("finetuningview.FailedToRunSmokeTest"),
1710
+ "error",
1711
+ 4200
1712
+ );
1713
+ } finally {
1714
+ setModelAction("");
1715
+ }
1716
+ }, [selectedModel, setActionNotice, t]);
1717
+ useEffect(() => {
1718
+ void refreshAll();
1719
+ }, [refreshAll]);
1720
+ useIntervalWhenDocumentVisible(() => {
1721
+ void loadStatus();
1722
+ void loadJobs();
1723
+ void loadModels();
1724
+ }, 5e3);
1725
+ useEffect(() => {
1726
+ const unbind = client.onWsEvent(
1727
+ "training_event",
1728
+ (rawEnvelope) => {
1729
+ const event = asTrainingEvent(
1730
+ rawEnvelope
1731
+ );
1732
+ if (!event) return;
1733
+ setTrainingEvents((prev) => {
1734
+ const merged = [event, ...prev];
1735
+ return merged.slice(0, 240);
1736
+ });
1737
+ if (event.kind !== "job_log") {
1738
+ void loadStatus();
1739
+ void loadJobs();
1740
+ void loadModels();
1741
+ if (event.kind === "dataset_built") {
1742
+ void loadDatasets();
1743
+ }
1744
+ }
1745
+ }
1746
+ );
1747
+ return () => {
1748
+ unbind();
1749
+ };
1750
+ }, [loadDatasets, loadJobs, loadModels, loadStatus]);
1751
+ const onBuildDataset = useCallback(() => {
1752
+ void handleBuildDataset();
1753
+ }, [handleBuildDataset]);
1754
+ const onRefreshDatasets = useCallback(() => {
1755
+ void loadDatasets();
1756
+ }, [loadDatasets]);
1757
+ const onStartJob = useCallback(() => {
1758
+ void handleStartJob();
1759
+ }, [handleStartJob]);
1760
+ const onRefreshJobs = useCallback(() => {
1761
+ void loadJobs();
1762
+ void loadStatus();
1763
+ }, [loadJobs, loadStatus]);
1764
+ const onCancelJob = useCallback(
1765
+ (jobId) => {
1766
+ void handleCancelJob(jobId);
1767
+ },
1768
+ [handleCancelJob]
1769
+ );
1770
+ const onImportModel = useCallback(() => {
1771
+ void handleImportSelectedModel();
1772
+ }, [handleImportSelectedModel]);
1773
+ const onActivateModel = useCallback(() => {
1774
+ void handleActivateSelectedModel();
1775
+ }, [handleActivateSelectedModel]);
1776
+ const onBenchmarkModel = useCallback(() => {
1777
+ void handleBenchmarkSelectedModel();
1778
+ }, [handleBenchmarkSelectedModel]);
1779
+ const onSmokeTestModel = useCallback(() => {
1780
+ void handleSmokeTestSelectedModel();
1781
+ }, [handleSmokeTestSelectedModel]);
1782
+ if (pageLoading) {
1783
+ return /* @__PURE__ */ jsx(ContentLayout, { contentHeader, children: /* @__PURE__ */ jsx("div", { "data-testid": "fine-tuning-view", className: "text-sm text-muted", children: t("finetuningview.LoadingFineTuning") }) });
1784
+ }
1785
+ return /* @__PURE__ */ jsx(ContentLayout, { contentHeader, children: /* @__PURE__ */ jsxs("div", { "data-testid": "fine-tuning-view", className: "space-y-4 pb-32", children: [
1786
+ /* @__PURE__ */ jsxs("section", { className: "px-2 py-2", children: [
1787
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
1788
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold text-txt", children: t("finetuningview.FineTuning") }) }),
1789
+ /* @__PURE__ */ jsx(
1790
+ TrainingActionButton,
1791
+ {
1792
+ agentId: "action-refresh-all",
1793
+ label: t("finetuningview.RefreshAll"),
1794
+ group: "overview",
1795
+ description: "Refresh all training status, datasets, jobs, and models",
1796
+ onClick: () => {
1797
+ void refreshAll();
1798
+ },
1799
+ children: t("finetuningview.RefreshAll")
1800
+ }
1801
+ )
1802
+ ] }),
1803
+ errorMessage && /* @__PURE__ */ jsx("div", { className: "mt-3 px-1 py-2 text-sm text-danger", children: errorMessage })
1804
+ ] }),
1805
+ /* @__PURE__ */ jsxs("section", { className: FINE_TUNING_SECTION_CLASS, children: [
1806
+ /* @__PURE__ */ jsx("div", { className: FINE_TUNING_SECTION_HEADER_CLASS, children: /* @__PURE__ */ jsx("div", { className: "text-lg font-semibold text-txt", children: t("finetuningview.Status") }) }),
1807
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 text-sm md:grid-cols-3 xl:grid-cols-6", children: [
1808
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1809
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Runtime") }),
1810
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.runtimeAvailable ? t("finetuningview.Ready") : t("finetuningview.Offline") })
1811
+ ] }),
1812
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1813
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.RunningJobs") }),
1814
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.runningJobs ?? 0 })
1815
+ ] }),
1816
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1817
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.QueuedJobs") }),
1818
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.queuedJobs ?? 0 })
1819
+ ] }),
1820
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1821
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Datasets") }),
1822
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.datasetCount ?? 0 })
1823
+ ] }),
1824
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1825
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Models") }),
1826
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.modelCount ?? 0 })
1827
+ ] }),
1828
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_STATUS_CARD_CLASS, children: [
1829
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.FailedJobs") }),
1830
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-base font-semibold text-txt", children: status?.failedJobs ?? 0 })
1831
+ ] })
1832
+ ] })
1833
+ ] }),
1834
+ /* @__PURE__ */ jsx(
1835
+ TrajectoriesSection,
1836
+ {
1837
+ trajectoryList,
1838
+ selectedTrajectory,
1839
+ trajectoryLoading,
1840
+ publishingTrajectories,
1841
+ publishConfigured,
1842
+ onRefresh: () => {
1843
+ void loadTrajectories();
1844
+ },
1845
+ onSelectTrajectory: (trajectoryId) => {
1846
+ void loadTrajectoryDetail(trajectoryId);
1847
+ },
1848
+ onPublishTrajectories: () => {
1849
+ void handlePublishTrajectories();
1850
+ },
1851
+ t
1852
+ }
1853
+ ),
1854
+ /* @__PURE__ */ jsxs("section", { className: FINE_TUNING_SECTION_CLASS, children: [
1855
+ /* @__PURE__ */ jsxs("div", { className: FINE_TUNING_SECTION_HEADER_CLASS, children: [
1856
+ /* @__PURE__ */ jsx("div", { className: "text-lg font-semibold text-txt", children: t("finetuningview.TrainingAnalysisIndex", {
1857
+ defaultValue: "Training analysis"
1858
+ }) }),
1859
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
1860
+ /* @__PURE__ */ jsx(
1861
+ TrainingActionButton,
1862
+ {
1863
+ agentId: "action-collect-and-index",
1864
+ label: t("finetuningview.CollectAndIndex", {
1865
+ defaultValue: "Collect and index"
1866
+ }),
1867
+ group: "analysis",
1868
+ description: "Run the full training data collection and build the analysis index",
1869
+ disabled: collectionRunning,
1870
+ onClick: () => {
1871
+ void handleRunTrainingCollection();
1872
+ },
1873
+ children: collectionRunning ? t("finetuningview.Collecting", {
1874
+ defaultValue: "Collecting"
1875
+ }) : t("finetuningview.CollectAndIndex", {
1876
+ defaultValue: "Collect and index"
1877
+ })
1878
+ }
1879
+ ),
1880
+ /* @__PURE__ */ jsx(
1881
+ TrainingActionButton,
1882
+ {
1883
+ agentId: "action-collection-preflight",
1884
+ label: "Run collection preflight",
1885
+ group: "analysis",
1886
+ description: "Run a preflight check of the training data collection without writing artifacts",
1887
+ disabled: collectionPreflightRunning,
1888
+ onClick: () => {
1889
+ void handleRunTrainingCollection(true);
1890
+ },
1891
+ children: collectionPreflightRunning ? "Checking" : "Run collection preflight"
1892
+ }
1893
+ ),
1894
+ /* @__PURE__ */ jsx(
1895
+ TrainingActionButton,
1896
+ {
1897
+ agentId: "action-build-analysis-index",
1898
+ label: t("finetuningview.BuildAnalysisIndex", {
1899
+ defaultValue: "Build index"
1900
+ }),
1901
+ group: "analysis",
1902
+ description: "Build the training analysis index from collected artifacts",
1903
+ disabled: analysisBuilding,
1904
+ onClick: () => {
1905
+ void handleBuildAnalysisIndex();
1906
+ },
1907
+ children: analysisBuilding ? t("finetuningview.Indexing", { defaultValue: "Indexing" }) : t("finetuningview.BuildAnalysisIndex", {
1908
+ defaultValue: "Build index"
1909
+ })
1910
+ }
1911
+ ),
1912
+ /* @__PURE__ */ jsx(
1913
+ TrainingActionButton,
1914
+ {
1915
+ agentId: "action-build-readiness-report",
1916
+ label: t("finetuningview.BuildReadinessReport", {
1917
+ defaultValue: "Readiness report"
1918
+ }),
1919
+ group: "analysis",
1920
+ description: "Build the training readiness report and surface missing checks",
1921
+ disabled: readinessBuilding,
1922
+ onClick: () => {
1923
+ void handleBuildReadinessReport();
1924
+ },
1925
+ children: readinessBuilding ? t("finetuningview.CheckingReadiness", {
1926
+ defaultValue: "Checking"
1927
+ }) : t("finetuningview.BuildReadinessReport", {
1928
+ defaultValue: "Readiness report"
1929
+ })
1930
+ }
1931
+ )
1932
+ ] })
1933
+ ] }),
1934
+ /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} p-3 text-sm`, children: [
1935
+ /* @__PURE__ */ jsx("div", { className: "mb-3 pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
1936
+ /* @__PURE__ */ jsx(
1937
+ AgentCheckboxField,
1938
+ {
1939
+ agentId: "analysis-probe-endpoints",
1940
+ label: "Probe live endpoints",
1941
+ group: "analysis",
1942
+ description: "Probe live endpoints during the collection preflight",
1943
+ checked: collectionPreflightProbe,
1944
+ onChange: setCollectionPreflightProbe
1945
+ }
1946
+ ),
1947
+ "Probe live endpoints"
1948
+ ] }) }),
1949
+ /* @__PURE__ */ jsxs("div", { className: "mb-3 pb-2", children: [
1950
+ /* @__PURE__ */ jsx("div", { className: "mb-2 text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Natural trajectory import" }),
1951
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
1952
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2", children: [
1953
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: "Sanitized JSONL" }),
1954
+ /* @__PURE__ */ jsx(
1955
+ AgentTextField,
1956
+ {
1957
+ agentId: "natural-sanitized-jsonl",
1958
+ label: "Sanitized JSONL path",
1959
+ group: "natural-import",
1960
+ description: "Path to the sanitized trajectory JSONL file",
1961
+ className: AGENT_FIELD_INPUT_CLASS,
1962
+ value: naturalSanitizedJsonlPath,
1963
+ onChange: setNaturalSanitizedJsonlPath,
1964
+ placeholder: "/path/to/trajectories.sanitized.jsonl"
1965
+ }
1966
+ )
1967
+ ] }),
1968
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2", children: [
1969
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: "Raw JSONL" }),
1970
+ /* @__PURE__ */ jsx(
1971
+ AgentTextField,
1972
+ {
1973
+ agentId: "natural-raw-jsonl",
1974
+ label: "Raw JSONL path",
1975
+ group: "natural-import",
1976
+ description: "Path to the raw trajectory JSONL file",
1977
+ className: AGENT_FIELD_INPUT_CLASS,
1978
+ value: naturalRawJsonlPath,
1979
+ onChange: setNaturalRawJsonlPath,
1980
+ placeholder: "/path/to/trajectories.raw.jsonl"
1981
+ }
1982
+ )
1983
+ ] }),
1984
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
1985
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: "Run ID" }),
1986
+ /* @__PURE__ */ jsx(
1987
+ AgentTextField,
1988
+ {
1989
+ agentId: "natural-run-id",
1990
+ label: "Run ID",
1991
+ group: "natural-import",
1992
+ description: "Run identifier for the imported trajectories",
1993
+ className: AGENT_FIELD_INPUT_CLASS,
1994
+ value: naturalRunId,
1995
+ onChange: setNaturalRunId,
1996
+ placeholder: "app-run-1"
1997
+ }
1998
+ )
1999
+ ] }),
2000
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2001
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: "Task buckets" }),
2002
+ /* @__PURE__ */ jsx(
2003
+ AgentTextField,
2004
+ {
2005
+ agentId: "natural-task-buckets",
2006
+ label: "Task buckets",
2007
+ group: "natural-import",
2008
+ description: "Comma-separated task buckets to import",
2009
+ className: AGENT_FIELD_INPUT_CLASS,
2010
+ value: naturalTasks,
2011
+ onChange: setNaturalTasks,
2012
+ placeholder: "response,action_planner"
2013
+ }
2014
+ )
2015
+ ] }),
2016
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
2017
+ /* @__PURE__ */ jsx(
2018
+ AgentCheckboxField,
2019
+ {
2020
+ agentId: "natural-include-raw",
2021
+ label: "Include raw trajectories",
2022
+ group: "natural-import",
2023
+ description: "Include raw trajectories in the import",
2024
+ checked: naturalIncludeRaw,
2025
+ onChange: setNaturalIncludeRaw
2026
+ }
2027
+ ),
2028
+ "Include raw"
2029
+ ] })
2030
+ ] })
2031
+ ] }),
2032
+ readinessReport ? /* @__PURE__ */ jsxs("div", { className: "mb-3 pb-2", children: [
2033
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
2034
+ /* @__PURE__ */ jsxs("div", { children: [
2035
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Readiness") }),
2036
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: readinessReport.report.status })
2037
+ ] }),
2038
+ /* @__PURE__ */ jsxs("div", { children: [
2039
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ReadyChecks") }),
2040
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2041
+ readinessReport.report.counts.ready ?? 0,
2042
+ "/",
2043
+ readinessReport.report.counts.checks ?? 0
2044
+ ] })
2045
+ ] }),
2046
+ /* @__PURE__ */ jsxs("div", { children: [
2047
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Missing") }),
2048
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-xs text-txt", children: readinessReport.report.counts.missing ?? 0 })
2049
+ ] }),
2050
+ /* @__PURE__ */ jsxs("div", { children: [
2051
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Report") }),
2052
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: readinessReport.reportPath })
2053
+ ] })
2054
+ ] }),
2055
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
2056
+ /* @__PURE__ */ jsx(
2057
+ AgentInlineButton,
2058
+ {
2059
+ agentId: "readiness-open-report",
2060
+ label: "Open readiness report",
2061
+ group: "readiness",
2062
+ description: "Open the readiness report file",
2063
+ className: FINE_TUNING_ACTION_CLASS,
2064
+ onClick: () => {
2065
+ void openExternalUrl(
2066
+ localViewerUrl(readinessReport.reportPath)
2067
+ );
2068
+ },
2069
+ children: "Open readiness report"
2070
+ }
2071
+ ),
2072
+ readinessReport.report.analysisIndexHtmlPath ? /* @__PURE__ */ jsx(
2073
+ AgentInlineButton,
2074
+ {
2075
+ agentId: "readiness-open-viewer",
2076
+ label: "Open readiness viewer",
2077
+ group: "readiness",
2078
+ description: "Open the readiness analysis viewer",
2079
+ className: FINE_TUNING_ACTION_CLASS,
2080
+ onClick: () => {
2081
+ void openExternalUrl(
2082
+ localViewerUrl(
2083
+ readinessReport.report.analysisIndexHtmlPath
2084
+ )
2085
+ );
2086
+ },
2087
+ children: "Open readiness viewer"
2088
+ }
2089
+ ) : null,
2090
+ /* @__PURE__ */ jsx(
2091
+ AgentInlineButton,
2092
+ {
2093
+ agentId: "readiness-open-output",
2094
+ label: "Open readiness output",
2095
+ group: "readiness",
2096
+ description: "Open the readiness output directory",
2097
+ className: FINE_TUNING_ACTION_CLASS,
2098
+ onClick: () => {
2099
+ void openExternalUrl(
2100
+ localViewerUrl(readinessReport.outputDir)
2101
+ );
2102
+ },
2103
+ children: "Open readiness output"
2104
+ }
2105
+ )
2106
+ ] }),
2107
+ readinessReport.report.checks.some(
2108
+ (check) => check.status !== "ready"
2109
+ ) ? /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: readinessReport.report.checks.filter((check) => check.status !== "ready").slice(0, 5).map((check) => /* @__PURE__ */ jsx(
2110
+ ReadinessCheckRow,
2111
+ {
2112
+ check,
2113
+ readinessActionRunning,
2114
+ onRunRecommendation: handleRunReadinessRecommendation,
2115
+ t
2116
+ },
2117
+ check.id
2118
+ )) }) : null
2119
+ ] }) : null,
2120
+ collectionPreflightResult ? /* @__PURE__ */ jsxs("div", { className: "mb-3 pb-2", children: [
2121
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Collection preflight" }),
2122
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: [
2123
+ "live:",
2124
+ collectionPreflightResult.liveRequired ? "yes" : "no",
2125
+ " ",
2126
+ collectionPreflightResult.checks.map(
2127
+ (check) => `${check.id}:${check.status}${check.path ? `->${check.path}` : ""}`
2128
+ ).join(" | ")
2129
+ ] })
2130
+ ] }) : null,
2131
+ collectionResult ? /* @__PURE__ */ jsxs("div", { className: "mb-3 grid gap-3 pb-2 md:grid-cols-2 xl:grid-cols-4", children: [
2132
+ /* @__PURE__ */ jsxs("div", { children: [
2133
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Collection") }),
2134
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.outputDir })
2135
+ ] }),
2136
+ /* @__PURE__ */ jsxs("div", { children: [
2137
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Manifest") }),
2138
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifestPath })
2139
+ ] }),
2140
+ /* @__PURE__ */ jsxs("div", { children: [
2141
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Run summary") }),
2142
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.readmePath }),
2143
+ /* @__PURE__ */ jsx(
2144
+ AgentInlineButton,
2145
+ {
2146
+ agentId: "collection-open-summary",
2147
+ label: "Open collection summary",
2148
+ group: "collection-result",
2149
+ description: "Open the collection run summary",
2150
+ className: `${FINE_TUNING_ACTION_CLASS} mt-2`,
2151
+ onClick: () => void openExternalUrl(
2152
+ localViewerUrl(collectionResult.readmePath)
2153
+ ),
2154
+ children: "Open summary"
2155
+ }
2156
+ )
2157
+ ] }),
2158
+ /* @__PURE__ */ jsxs("div", { children: [
2159
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Steps") }),
2160
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-xs text-txt", children: collectionResult.manifest.steps.map((step) => `${step.id}:${step.status}`).join(" ") })
2161
+ ] }),
2162
+ /* @__PURE__ */ jsxs("div", { children: [
2163
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Viewer") }),
2164
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.analysis.indexHtmlPath }),
2165
+ /* @__PURE__ */ jsx(
2166
+ AgentInlineButton,
2167
+ {
2168
+ agentId: "collection-open-viewer",
2169
+ label: "Open collection viewer",
2170
+ group: "collection-result",
2171
+ description: "Open the collection analysis viewer",
2172
+ className: `${FINE_TUNING_ACTION_CLASS} mt-2`,
2173
+ onClick: () => void openExternalUrl(
2174
+ localViewerUrl(
2175
+ collectionResult.manifest.analysis.indexHtmlPath
2176
+ )
2177
+ ),
2178
+ children: "Open viewer"
2179
+ }
2180
+ )
2181
+ ] }),
2182
+ /* @__PURE__ */ jsxs("div", { children: [
2183
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Collection index" }),
2184
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.collectionIndex.indexHtmlPath }),
2185
+ /* @__PURE__ */ jsx(
2186
+ AgentInlineButton,
2187
+ {
2188
+ agentId: "collection-open-index",
2189
+ label: "Open collection index",
2190
+ group: "collection-result",
2191
+ description: "Open the collection index",
2192
+ className: `${FINE_TUNING_ACTION_CLASS} mt-2`,
2193
+ onClick: () => void openExternalUrl(
2194
+ localViewerUrl(
2195
+ collectionResult.collectionIndex.indexHtmlPath
2196
+ )
2197
+ ),
2198
+ children: "Open index"
2199
+ }
2200
+ )
2201
+ ] }),
2202
+ /* @__PURE__ */ jsxs("div", { children: [
2203
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Readiness") }),
2204
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2205
+ collectionResult.manifest.readiness.status,
2206
+ " ",
2207
+ collectionResult.manifest.readiness.ready,
2208
+ "/",
2209
+ collectionResult.manifest.readiness.ready + collectionResult.manifest.readiness.partial + collectionResult.manifest.readiness.missing
2210
+ ] })
2211
+ ] }),
2212
+ /* @__PURE__ */ jsxs("div", { children: [
2213
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Data sources" }),
2214
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2215
+ "hf:",
2216
+ collectionResult.manifest.evidence.dataSources.huggingFaceDatasets,
2217
+ " ",
2218
+ "feed:",
2219
+ collectionResult.manifest.evidence.dataSources.feedDatasets,
2220
+ " ",
2221
+ "natural:",
2222
+ collectionResult.manifest.evidence.dataSources.naturalTrajectoryBundles,
2223
+ " ",
2224
+ "scenarios:",
2225
+ collectionResult.manifest.evidence.dataSources.scenarioRuns,
2226
+ " ",
2227
+ "native:",
2228
+ collectionResult.manifest.evidence.dataSources.scenarioNativeDatasets,
2229
+ " ",
2230
+ "tests:",
2231
+ collectionResult.manifest.evidence.dataSources.testTrajectories,
2232
+ " ",
2233
+ "jsonl:",
2234
+ collectionResult.manifest.evidence.dataSources.trainingJsonlDatasets
2235
+ ] })
2236
+ ] }),
2237
+ /* @__PURE__ */ jsxs("div", { children: [
2238
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Eval evidence" }),
2239
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2240
+ "evals:",
2241
+ collectionResult.manifest.evidence.evals.evalArtifacts,
2242
+ " ",
2243
+ "matrices:",
2244
+ collectionResult.manifest.evidence.evals.benchmarkMatrices,
2245
+ " ",
2246
+ "models:",
2247
+ collectionResult.manifest.evidence.training.models,
2248
+ formatModelInventorySummary(
2249
+ collectionResult.manifest.evidence.training.modelInventory
2250
+ )
2251
+ ] })
2252
+ ] }),
2253
+ /* @__PURE__ */ jsxs("div", { children: [
2254
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark evidence" }),
2255
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2256
+ "pairs:",
2257
+ collectionResult.manifest.evidence.benchmarks.actionBenchmarkPairs,
2258
+ " ",
2259
+ "sources:",
2260
+ collectionResult.manifest.evidence.benchmarks.actionBenchmarkMatrixSources,
2261
+ " ",
2262
+ "rows:",
2263
+ collectionResult.manifest.evidence.benchmarks.benchmarkRows,
2264
+ " ",
2265
+ "comparisons:",
2266
+ collectionResult.manifest.evidence.benchmarks.benchmarkComparisons
2267
+ ] })
2268
+ ] }),
2269
+ /* @__PURE__ */ jsxs("div", { children: [
2270
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark tiers" }),
2271
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.benchmarks.tiers.length > 0 ? collectionResult.manifest.evidence.benchmarks.tiers.join(
2272
+ ","
2273
+ ) : "none" })
2274
+ ] }),
2275
+ /* @__PURE__ */ jsxs("div", { children: [
2276
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark readiness" }),
2277
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2278
+ "smallest:",
2279
+ collectionResult.manifest.evidence.benchmarkReadiness.smallestTier,
2280
+ " ",
2281
+ "improvement:",
2282
+ collectionResult.manifest.evidence.benchmarkReadiness.baseTrainedImprovement,
2283
+ " ",
2284
+ "all-tier:",
2285
+ collectionResult.manifest.evidence.benchmarkReadiness.allEliza1TierImprovements,
2286
+ " ",
2287
+ "samples:",
2288
+ collectionResult.manifest.evidence.readinessGaps.find(
2289
+ (gap) => gap.id === "readable_source_samples"
2290
+ )?.status ?? "ready"
2291
+ ] })
2292
+ ] }),
2293
+ collectionResult.manifest.evidence.preflight ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2294
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Live preflight" }),
2295
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: [
2296
+ "live:",
2297
+ collectionResult.manifest.evidence.preflight.liveRequired ? "yes" : "no",
2298
+ " ",
2299
+ collectionResult.manifest.evidence.preflight.checks.map(
2300
+ (check) => `${check.id}:${check.status}${check.path ? `->${check.path}` : ""}`
2301
+ ).join(" | ")
2302
+ ] })
2303
+ ] }) : null,
2304
+ collectionResult.manifest.evidence.artifactLinks.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2305
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Evidence artifacts" }),
2306
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.artifactLinks.slice(0, 8).map(
2307
+ (artifact) => `${artifact.category}:${artifact.title} -> ${artifact.path}`
2308
+ ).join(" | ") })
2309
+ ] }) : null,
2310
+ collectionResult.manifest.evidence.stepArtifacts?.length ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2311
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Step artifact outputs" }),
2312
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.stepArtifacts.flatMap(
2313
+ (step) => step.paths.slice(0, 3).map(
2314
+ (path) => `${step.stepId}:${path.label}->${path.path}${step.command?.length ? ` cmd:${step.command.join(" ")}` : ""}${step.stdout ? ` stdout:${step.stdout}` : ""}${step.stderr ? ` stderr:${step.stderr}` : ""}`
2315
+ )
2316
+ ).slice(0, 8).join(" | ") })
2317
+ ] }) : null,
2318
+ collectionResult.manifest.evidence.feed?.runs.length ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2319
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Feed generation evidence" }),
2320
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.feed.runs.slice(0, 4).map(
2321
+ (run) => `${run.sourceKind ?? run.schema ?? "feed"} ${run.archetype ?? "all"} trajectories:${run.trajectories ?? "n/a"} ticks:${run.totalTicks ?? "n/a"} errors:${run.errors ?? "n/a"} -> ${run.path}`
2322
+ ).join(" | ") })
2323
+ ] }) : null,
2324
+ collectionResult.manifest.evidence.feed?.trajectorySamples.length ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2325
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Feed trajectory samples" }),
2326
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.feed.trajectorySamples.slice(0, 5).map(
2327
+ (sample) => `${sample.trajectoryId ?? "trajectory"} ${sample.archetype ?? "archetype"} scenario:${sample.scenarioId ?? "n/a"} score:${sample.score ?? "n/a"} steps:${sample.steps ?? "n/a"} first:${sample.firstStep ?? "n/a"} input:${sample.firstInput ?? "n/a"} output:${sample.firstOutput ?? "n/a"}`
2328
+ ).join(" | ") })
2329
+ ] }) : null,
2330
+ collectionResult.manifest.evidence.sourceSamples && Object.values(
2331
+ collectionResult.manifest.evidence.sourceSamples
2332
+ ).flat().length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2333
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Collection source samples" }),
2334
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: Object.entries(
2335
+ collectionResult.manifest.evidence.sourceSamples
2336
+ ).flatMap(
2337
+ ([category, samples]) => samples.slice(0, 2).map((sample) => {
2338
+ const input = typeof sample.input === "string" ? sample.input : JSON.stringify(sample.input);
2339
+ const output = typeof sample.output === "string" ? sample.output : JSON.stringify(sample.output);
2340
+ return `${category}:${sample.trajectoryId ?? sample.title} task:${sample.task ?? "n/a"} model:${sample.model ?? "n/a"} input:${input ?? "n/a"} output:${output ?? "n/a"}`;
2341
+ })
2342
+ ).slice(0, 8).join(" | ") })
2343
+ ] }) : null,
2344
+ collectionResult.manifest.evidence.evals.comparisonInventory?.length ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2345
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Eval comparison evidence" }),
2346
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.evals.comparisonInventory.slice(0, 5).map(
2347
+ (comparison) => `${comparison.baseModel ?? "base"} -> ${comparison.trainedModel ?? "trained"} backend:${comparison.backend ?? "n/a"} base:${comparison.baseScore ?? "n/a"} trained:${comparison.trainedScore ?? "n/a"} improvement:${comparison.improvementPercent ?? "n/a"}% latency:${comparison.baseLatencyMs ?? "n/a"}ms->${comparison.trainedLatencyMs ?? "n/a"}ms report:${comparison.reportPath ?? comparison.path}`
2348
+ ).join(" | ") })
2349
+ ] }) : null,
2350
+ collectionResult.manifest.evidence.benchmarks.improvementComparisons.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2351
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark improvement" }),
2352
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.benchmarks.improvementComparisons.slice(0, 5).map(
2353
+ (comparison) => `${comparison.tier ?? "tier"} ${comparison.benchmark ?? "benchmark"} base:${comparison.baseScore ?? "n/a"} trained:${comparison.trainedScore ?? "n/a"} improvement:${comparison.improvementPercent ?? "n/a"}% evidence:${comparison.modelBacked ? "model-backed" : "partial"}`
2354
+ ).join(" | ") })
2355
+ ] }) : null,
2356
+ /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2357
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Baseline progression" }),
2358
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: [
2359
+ "order:",
2360
+ collectionResult.manifest.evidence.benchmarks.baselineProgress.tierOrder.join(
2361
+ " -> "
2362
+ ),
2363
+ " ",
2364
+ "established:",
2365
+ collectionResult.manifest.evidence.benchmarks.baselineProgress.establishedTiers.join(
2366
+ ","
2367
+ ) || "none",
2368
+ " ",
2369
+ "next:",
2370
+ collectionResult.manifest.evidence.benchmarks.baselineProgress.nextTier ?? "none",
2371
+ " ",
2372
+ "remaining:",
2373
+ collectionResult.manifest.evidence.benchmarks.baselineProgress.remainingTiers.join(
2374
+ ","
2375
+ ) || "none"
2376
+ ] })
2377
+ ] }),
2378
+ collectionResult.manifest.evidence.benchmarks.caseSamples?.length ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2379
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark case samples" }),
2380
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.benchmarks.caseSamples.slice(0, 5).map(
2381
+ (sample) => `${sample.tier ?? "tier"} ${sample.variant ?? "variant"} ${sample.caseId ?? "case"} pass:${sample.pass} input:${sample.prompt ?? "n/a"} expected:${sample.expectedAction ?? "n/a"} actual:${sample.actualAction ?? "n/a"} output:${sample.response ?? "n/a"} trajectory:${sample.trajectoryPath ?? "n/a"}`
2382
+ ).join(" | ") })
2383
+ ] }) : null,
2384
+ collectionResult.manifest.evidence.readinessGaps.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2385
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Readiness gaps" }),
2386
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: collectionResult.manifest.evidence.readinessGaps.slice(0, 5).map(
2387
+ (gap) => `${gap.id}:${gap.status}${gap.recommendedCapability ? ` -> ${gap.recommendedCapability}` : ""}`
2388
+ ).join(" | ") })
2389
+ ] }) : null
2390
+ ] }) : null,
2391
+ collectionHistory ? /* @__PURE__ */ jsxs("div", { className: "mb-3 pb-2", children: [
2392
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex flex-wrap items-center justify-between gap-2", children: [
2393
+ /* @__PURE__ */ jsxs("div", { children: [
2394
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Saved collection runs" }),
2395
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: collectionHistory.root }),
2396
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: collectionHistory.indexHtmlPath })
2397
+ ] }),
2398
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
2399
+ /* @__PURE__ */ jsx(
2400
+ AgentInlineButton,
2401
+ {
2402
+ agentId: "collection-history-refresh",
2403
+ label: "Refresh collection runs",
2404
+ group: "collection-history",
2405
+ description: "Reload the saved collection runs list",
2406
+ className: FINE_TUNING_ACTION_CLASS,
2407
+ disabled: collectionHistoryLoading,
2408
+ onClick: () => {
2409
+ void loadCollectionHistory();
2410
+ },
2411
+ children: collectionHistoryLoading ? "Refreshing" : "Refresh runs"
2412
+ }
2413
+ ),
2414
+ /* @__PURE__ */ jsx(
2415
+ AgentInlineButton,
2416
+ {
2417
+ agentId: "collection-history-open-index",
2418
+ label: "Open collection runs index",
2419
+ group: "collection-history",
2420
+ description: "Open the saved collection runs index",
2421
+ className: FINE_TUNING_ACTION_CLASS,
2422
+ onClick: () => void openExternalUrl(
2423
+ localViewerUrl(collectionHistory.indexHtmlPath)
2424
+ ),
2425
+ children: "Open collection index"
2426
+ }
2427
+ )
2428
+ ] })
2429
+ ] }),
2430
+ collectionHistory.collections.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid gap-2", children: collectionHistory.collections.slice(0, 5).map((run) => /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
2431
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2432
+ /* @__PURE__ */ jsxs("div", { className: "break-all font-mono text-xs text-txt", children: [
2433
+ run.generatedAt,
2434
+ " ",
2435
+ run.readinessStatus,
2436
+ " ready:",
2437
+ run.readiness.ready,
2438
+ " partial:",
2439
+ run.readiness.partial,
2440
+ " missing:",
2441
+ run.readiness.missing
2442
+ ] }),
2443
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: run.outputDir }),
2444
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2445
+ "artifacts:",
2446
+ run.artifactCount,
2447
+ " steps:",
2448
+ run.stepCounts.succeeded ?? 0,
2449
+ " ok/",
2450
+ run.stepCounts.failed ?? 0,
2451
+ " failed sources hf:",
2452
+ run.dataSources.huggingFaceDatasets,
2453
+ " feed:",
2454
+ run.dataSources.feedDatasets,
2455
+ " natural:",
2456
+ run.dataSources.naturalTrajectoryBundles,
2457
+ " cases:",
2458
+ run.benchmarks.caseSamples,
2459
+ " comparisons:",
2460
+ run.benchmarks.benchmarkComparisons,
2461
+ " tiers:",
2462
+ run.benchmarks.tiers.join(",") || "n/a",
2463
+ run.benchmarks.comparisonInventory?.length ? ` ${run.benchmarks.comparisonInventory.slice(0, 2).map(
2464
+ (comparison) => `${comparison.tier ?? "tier"} ${comparison.benchmark ?? "benchmark"} base:${comparison.baseScore ?? "n/a"} trained:${comparison.trainedScore ?? "n/a"} reference:${comparison.referenceScore ?? "n/a"} improvement:${comparison.improvementPercent ?? "n/a"}% vs-reference:${comparison.trainedVsReferencePercent ?? "n/a"}% ${comparison.dryRun ? "dry-run" : comparison.modelBacked ? "model-backed" : comparison.useMocks ? "mocked" : "unverified"}`
2465
+ ).join(" ")}` : "",
2466
+ " ",
2467
+ "evals:",
2468
+ run.evals?.evalArtifacts ?? 0,
2469
+ " ",
2470
+ "eval-comparisons:",
2471
+ run.evals?.evalComparisons ?? 0,
2472
+ run.evals?.comparisonInventory?.length ? ` ${run.evals.comparisonInventory.slice(0, 2).map(
2473
+ (comparison) => `${comparison.baseModel ?? "base"}->${comparison.trainedModel ?? "trained"} improvement:${comparison.improvementPercent ?? "n/a"}%`
2474
+ ).join(" ")}` : ""
2475
+ ] }),
2476
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2477
+ "baseline established:",
2478
+ run.benchmarks.baselineProgress.establishedTiers.join(
2479
+ ","
2480
+ ) || "none",
2481
+ " ",
2482
+ "next:",
2483
+ run.benchmarks.baselineProgress.nextTier ?? "none",
2484
+ " ",
2485
+ "remaining:",
2486
+ run.benchmarks.baselineProgress.remainingTiers.join(
2487
+ ","
2488
+ ) || "none"
2489
+ ] }),
2490
+ run.training ? /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2491
+ "models:",
2492
+ run.training.models,
2493
+ " training-runs:",
2494
+ run.training.trainingRuns,
2495
+ " inventory:",
2496
+ run.training.modelInventory.length,
2497
+ run.training.modelInventory.length ? ` ${run.training.modelInventory.slice(0, 2).map(
2498
+ (model) => `${model.tier ?? "tier"} ${model.variant ?? "variant"} ${model.model ?? "model"} base:${model.baseModel ?? "n/a"} score:${model.baseEvalScore ?? "n/a"}->${model.trainedEvalScore ?? "n/a"} output:${model.outputPath ?? "n/a"} improvement:${model.evalImprovementPercent ?? "n/a"}%`
2499
+ ).join(" ")}` : ""
2500
+ ] }) : null,
2501
+ run.readinessGaps?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
2502
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2503
+ "gaps:",
2504
+ " ",
2505
+ run.readinessGaps.slice(0, 4).map(
2506
+ (gap) => `${gap.id}:${gap.status}${gap.recommendedCapability ? `->${gap.recommendedCapability}` : ""}`
2507
+ ).join(" | ")
2508
+ ] }),
2509
+ run.readinessGaps.some(
2510
+ (gap) => gap.recommendedCapability
2511
+ ) ? /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: run.readinessGaps.filter(
2512
+ (gap) => gap.recommendedCapability
2513
+ ).slice(0, 4).map((gap) => /* @__PURE__ */ jsxs(
2514
+ AgentInlineButton,
2515
+ {
2516
+ agentId: `history-gap-${run.manifestPath}-${gap.id}`,
2517
+ label: `Run recommendation for ${gap.id}`,
2518
+ group: "collection-history",
2519
+ description: `Run the recommended action ${gap.recommendedCapability} for gap ${gap.id}`,
2520
+ title: `${gap.id}: ${gap.recommendedCapability}`,
2521
+ className: FINE_TUNING_ACTION_CLASS,
2522
+ disabled: readinessActionRunning === `history:${gap.id}`,
2523
+ onClick: () => {
2524
+ const capability = gap.recommendedCapability;
2525
+ if (!capability) return;
2526
+ void handleRunReadinessRecommendation(
2527
+ `history:${gap.id}`,
2528
+ {
2529
+ label: gap.label,
2530
+ capability,
2531
+ params: gap.recommendedParams ?? {}
2532
+ }
2533
+ );
2534
+ },
2535
+ children: [
2536
+ "Run ",
2537
+ gap.id
2538
+ ]
2539
+ },
2540
+ `${run.manifestPath}:${gap.id}:${gap.recommendedCapability}`
2541
+ )) }) : null
2542
+ ] }) : null,
2543
+ run.coverage ? /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2544
+ "coverage samples:",
2545
+ run.coverage.readableSamples.total,
2546
+ " hf:",
2547
+ run.coverage.dataSources.huggingFace,
2548
+ " feed:",
2549
+ run.coverage.dataSources.feed,
2550
+ " natural:",
2551
+ run.coverage.dataSources.natural,
2552
+ " scenarios:",
2553
+ run.coverage.dataSources.scenarios,
2554
+ " tests:",
2555
+ run.coverage.dataSources.tests,
2556
+ " jsonl:",
2557
+ run.coverage.dataSources.trainingJsonl,
2558
+ " ",
2559
+ "scored-evals:",
2560
+ run.coverage.evals.scoredComparisons,
2561
+ "/",
2562
+ run.coverage.evals.comparisons,
2563
+ " scored-bench:",
2564
+ run.coverage.benchmarks.scoredComparisons,
2565
+ "/",
2566
+ run.coverage.benchmarks.comparisons,
2567
+ " all-tiers:",
2568
+ run.coverage.benchmarks.allEliza1TiersCovered ? "yes" : "no"
2569
+ ] }) : null,
2570
+ run.sourceSamples && Object.values(run.sourceSamples).flat().length > 0 ? /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-muted", children: [
2571
+ "source samples:",
2572
+ " ",
2573
+ Object.entries(run.sourceSamples).flatMap(
2574
+ ([category, samples]) => samples.slice(0, 2).map((sample) => {
2575
+ const input = compactDisplayValue(
2576
+ sample.input
2577
+ );
2578
+ const output = compactDisplayValue(
2579
+ sample.output
2580
+ );
2581
+ return `${category}:${sample.trajectoryId ?? sample.scenarioId ?? sample.title} task:${sample.task ?? sample.sourceKind ?? "n/a"} input:${input || "n/a"} output:${output || "n/a"}`;
2582
+ })
2583
+ ).slice(0, 8).join(" | ")
2584
+ ] }) : null,
2585
+ run.sourceArtifacts?.length ? /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: run.sourceArtifacts.slice(0, 6).map((artifact) => /* @__PURE__ */ jsxs(
2586
+ AgentInlineButton,
2587
+ {
2588
+ agentId: `history-source-artifact-${run.manifestPath}-${artifact.category}-${artifact.path}`,
2589
+ label: `Open source artifact ${artifact.category}:${artifact.title}`,
2590
+ group: "collection-history",
2591
+ description: `Open the source artifact ${artifact.path}`,
2592
+ variant: "ghost",
2593
+ className: FINE_TUNING_ACTION_CLASS,
2594
+ onClick: () => void openExternalUrl(
2595
+ localViewerUrl(artifact.path)
2596
+ ),
2597
+ children: [
2598
+ artifact.category,
2599
+ ":",
2600
+ artifact.title
2601
+ ]
2602
+ },
2603
+ `${artifact.category}:${artifact.path}`
2604
+ )) }) : null,
2605
+ run.evidenceArtifacts?.length ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: run.evidenceArtifacts.slice(0, 6).map((artifact) => /* @__PURE__ */ jsxs(
2606
+ AgentInlineButton,
2607
+ {
2608
+ agentId: `history-evidence-artifact-${run.manifestPath}-${artifact.category}-${artifact.path}`,
2609
+ label: `Open evidence artifact ${artifact.category}:${artifact.title}`,
2610
+ group: "collection-history",
2611
+ description: `Open the evidence artifact ${artifact.path}`,
2612
+ variant: "ghost",
2613
+ className: FINE_TUNING_ACTION_CLASS,
2614
+ onClick: () => void openExternalUrl(
2615
+ localViewerUrl(artifact.path)
2616
+ ),
2617
+ children: [
2618
+ artifact.category,
2619
+ ":",
2620
+ artifact.title
2621
+ ]
2622
+ },
2623
+ `${artifact.category}:${artifact.path}`
2624
+ )) }) : null
2625
+ ] }),
2626
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
2627
+ /* @__PURE__ */ jsx(
2628
+ AgentInlineButton,
2629
+ {
2630
+ agentId: `history-run-viewer-${run.manifestPath}`,
2631
+ label: `Open saved viewer for ${run.generatedAt}`,
2632
+ group: "collection-history",
2633
+ description: "Open the saved collection run viewer",
2634
+ className: FINE_TUNING_ACTION_CLASS,
2635
+ onClick: () => void openExternalUrl(
2636
+ localViewerUrl(run.analysisIndexHtmlPath)
2637
+ ),
2638
+ children: "Open saved viewer"
2639
+ }
2640
+ ),
2641
+ /* @__PURE__ */ jsx(
2642
+ AgentInlineButton,
2643
+ {
2644
+ agentId: `history-run-summary-${run.manifestPath}`,
2645
+ label: `Open saved summary for ${run.generatedAt}`,
2646
+ group: "collection-history",
2647
+ description: "Open the saved collection run summary",
2648
+ className: FINE_TUNING_ACTION_CLASS,
2649
+ onClick: () => void openExternalUrl(
2650
+ localViewerUrl(run.readmePath)
2651
+ ),
2652
+ children: "Open saved summary"
2653
+ }
2654
+ )
2655
+ ] })
2656
+ ] }) }, run.manifestPath)) }) : /* @__PURE__ */ jsx("div", { className: "font-mono text-xs text-muted", children: "None" })
2657
+ ] }) : null,
2658
+ analysisIndex ? /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
2659
+ /* @__PURE__ */ jsxs("div", { children: [
2660
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Artifacts") }),
2661
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: analysisIndex.manifest.artifacts.length })
2662
+ ] }),
2663
+ /* @__PURE__ */ jsxs("div", { children: [
2664
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Viewer") }),
2665
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: analysisIndex.indexHtmlPath }),
2666
+ /* @__PURE__ */ jsx(
2667
+ AgentInlineButton,
2668
+ {
2669
+ agentId: "analysis-open-viewer",
2670
+ label: "Open analysis viewer",
2671
+ group: "analysis",
2672
+ description: "Open the analysis index viewer",
2673
+ className: `${FINE_TUNING_ACTION_CLASS} mt-2`,
2674
+ onClick: () => void openExternalUrl(
2675
+ localViewerUrl(analysisIndex.indexHtmlPath)
2676
+ ),
2677
+ children: "Open viewer"
2678
+ }
2679
+ )
2680
+ ] }),
2681
+ /* @__PURE__ */ jsxs("div", { children: [
2682
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Manifest") }),
2683
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: analysisIndex.manifestPath })
2684
+ ] }),
2685
+ /* @__PURE__ */ jsxs("div", { children: [
2686
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Output") }),
2687
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: analysisIndex.outputDir })
2688
+ ] }),
2689
+ analysisCoverage ? /* @__PURE__ */ jsxs(Fragment, { children: [
2690
+ /* @__PURE__ */ jsxs("div", { children: [
2691
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Source coverage" }),
2692
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2693
+ "hf:",
2694
+ analysisCoverage.dataSources.huggingFace,
2695
+ " feed:",
2696
+ analysisCoverage.dataSources.feed,
2697
+ " natural:",
2698
+ analysisCoverage.dataSources.natural,
2699
+ " scenarios:",
2700
+ analysisCoverage.dataSources.scenarios,
2701
+ " tests:",
2702
+ analysisCoverage.dataSources.tests,
2703
+ " jsonl:",
2704
+ analysisCoverage.dataSources.trainingJsonl
2705
+ ] })
2706
+ ] }),
2707
+ /* @__PURE__ */ jsxs("div", { children: [
2708
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Readable samples" }),
2709
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2710
+ "total:",
2711
+ analysisCoverage.readableSamples.total,
2712
+ " hf:",
2713
+ analysisCoverage.readableSamples.huggingFace,
2714
+ " feed:",
2715
+ analysisCoverage.readableSamples.feed,
2716
+ " natural:",
2717
+ analysisCoverage.readableSamples.natural,
2718
+ " scenarios:",
2719
+ analysisCoverage.readableSamples.scenarios,
2720
+ " tests:",
2721
+ analysisCoverage.readableSamples.tests,
2722
+ " jsonl:",
2723
+ analysisCoverage.readableSamples.trainingJsonl
2724
+ ] })
2725
+ ] }),
2726
+ /* @__PURE__ */ jsxs("div", { children: [
2727
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Eval coverage" }),
2728
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 font-mono text-xs text-txt", children: [
2729
+ "evals:",
2730
+ analysisCoverage.evals,
2731
+ " matrices:",
2732
+ analysisCoverage.benchmarkMatrices,
2733
+ " models:",
2734
+ analysisCoverage.models
2735
+ ] })
2736
+ ] }),
2737
+ /* @__PURE__ */ jsxs("div", { children: [
2738
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Benchmark model stats" }),
2739
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: [
2740
+ "models:",
2741
+ analysisCoverage.benchmarkModelStats.modelCount,
2742
+ " best:",
2743
+ analysisCoverage.benchmarkModelStats.bestModelId ?? "none",
2744
+ analysisCoverage.benchmarkModelStats.bestAverageScore !== null ? ` avg:${analysisCoverage.benchmarkModelStats.bestAverageScore}` : ""
2745
+ ] })
2746
+ ] }),
2747
+ /* @__PURE__ */ jsxs("div", { children: [
2748
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Eliza-1 tier coverage" }),
2749
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: [
2750
+ analysisCoverage.allEliza1TiersCovered ? "all tiers covered" : "partial",
2751
+ " ",
2752
+ analysisCoverage.benchmarkTierCoverage.map(
2753
+ (tier) => `${tier.tier}:${tier.hasBase ? "base" : "-"}/${tier.hasTrained ? "trained" : "-"}/${tier.hasReference ? "ref" : "-"}/${tier.hasImprovement ? "improvement" : "-"}`
2754
+ ).join(" ")
2755
+ ] })
2756
+ ] }),
2757
+ analysisCoverage.benchmarkComparisons.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
2758
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Analysis benchmark improvement" }),
2759
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: analysisCoverage.benchmarkComparisons.slice(0, 5).map(
2760
+ (comparison) => `${comparison.tier ?? "tier"} ${comparison.benchmark ?? "benchmark"} base:${comparison.baseScore ?? "n/a"} trained:${comparison.trainedScore ?? "n/a"} reference:${comparison.referenceScore ?? "n/a"} improvement:${comparison.improvementPercent ?? "n/a"}% vs-ref:${comparison.trainedVsReferencePercent ?? "n/a"}%`
2761
+ ).join(" | ") })
2762
+ ] }) : null
2763
+ ] }) : null
2764
+ ] }) : /* @__PURE__ */ jsx("div", { className: "text-xs text-muted", children: t("finetuningview.NoAnalysisIndexBuilt") })
2765
+ ] }),
2766
+ /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-4 p-3 text-sm`, children: [
2767
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
2768
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
2769
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2770
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.HuggingFaceRepo") }),
2771
+ /* @__PURE__ */ jsx(
2772
+ AgentTextField,
2773
+ {
2774
+ agentId: "hf-repo-id",
2775
+ label: "HuggingFace repo",
2776
+ group: "hf-ingest",
2777
+ description: "HuggingFace dataset repo id to ingest",
2778
+ className: AGENT_FIELD_INPUT_CLASS,
2779
+ value: hfRepoId,
2780
+ onChange: setHfRepoId,
2781
+ placeholder: "elizaos/eliza-1-training"
2782
+ }
2783
+ )
2784
+ ] }),
2785
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2786
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Revision") }),
2787
+ /* @__PURE__ */ jsx(
2788
+ AgentTextField,
2789
+ {
2790
+ agentId: "hf-revision",
2791
+ label: "HuggingFace revision",
2792
+ group: "hf-ingest",
2793
+ description: "Dataset revision/branch to ingest",
2794
+ className: AGENT_FIELD_INPUT_CLASS,
2795
+ value: hfRevision,
2796
+ onChange: setHfRevision,
2797
+ placeholder: "main"
2798
+ }
2799
+ )
2800
+ ] }),
2801
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2", children: [
2802
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Output") }),
2803
+ /* @__PURE__ */ jsx(
2804
+ AgentTextField,
2805
+ {
2806
+ agentId: "hf-output-dir",
2807
+ label: "HuggingFace output directory",
2808
+ group: "hf-ingest",
2809
+ description: "Output directory for the ingested dataset",
2810
+ className: AGENT_FIELD_INPUT_CLASS,
2811
+ value: hfOutputDir,
2812
+ onChange: setHfOutputDir,
2813
+ placeholder: "default"
2814
+ }
2815
+ )
2816
+ ] }),
2817
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2 xl:col-span-4", children: [
2818
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Files") }),
2819
+ /* @__PURE__ */ jsx(
2820
+ AgentTextAreaField,
2821
+ {
2822
+ agentId: "hf-files",
2823
+ label: "HuggingFace files",
2824
+ group: "hf-ingest",
2825
+ description: "Newline-separated dataset files to ingest",
2826
+ className: "min-h-24 w-full border-border/60 bg-transparent px-3 py-2 font-mono text-xs text-txt outline-none focus:border-accent",
2827
+ value: hfFiles,
2828
+ onChange: setHfFiles
2829
+ }
2830
+ )
2831
+ ] })
2832
+ ] }),
2833
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
2834
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
2835
+ /* @__PURE__ */ jsx(
2836
+ AgentCheckboxField,
2837
+ {
2838
+ agentId: "hf-dry-run",
2839
+ label: "HuggingFace ingest dry run",
2840
+ group: "hf-ingest",
2841
+ description: "Run the HuggingFace ingest as a dry run",
2842
+ checked: hfDryRun,
2843
+ onChange: setHfDryRun
2844
+ }
2845
+ ),
2846
+ t("finetuningview.DryRun")
2847
+ ] }),
2848
+ /* @__PURE__ */ jsx(
2849
+ TrainingActionButton,
2850
+ {
2851
+ agentId: "action-ingest-hf-dataset",
2852
+ label: t("finetuningview.IngestHuggingFaceDataset"),
2853
+ group: "huggingface",
2854
+ description: "Ingest the configured HuggingFace dataset files into a training dataset",
2855
+ disabled: hfIngestRunning,
2856
+ onClick: () => {
2857
+ void handleIngestHuggingFaceDataset();
2858
+ },
2859
+ children: hfIngestRunning ? t("finetuningview.Ingesting") : t("finetuningview.IngestHuggingFaceDataset")
2860
+ }
2861
+ )
2862
+ ] })
2863
+ ] }),
2864
+ hfIngestResult && /* @__PURE__ */ jsxs(Fragment, { children: [
2865
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
2866
+ /* @__PURE__ */ jsxs("div", { children: [
2867
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Files") }),
2868
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: hfIngestResult.manifest.counts.files ?? hfIngestResult.manifest.files.length })
2869
+ ] }),
2870
+ /* @__PURE__ */ jsxs("div", { children: [
2871
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Rows") }),
2872
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: hfIngestResult.manifest.counts.jsonlRows ?? 0 })
2873
+ ] }),
2874
+ /* @__PURE__ */ jsxs("div", { children: [
2875
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Manifest") }),
2876
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: hfIngestResult.manifestPath })
2877
+ ] }),
2878
+ /* @__PURE__ */ jsxs("div", { children: [
2879
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Output") }),
2880
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: hfIngestResult.outputDir })
2881
+ ] })
2882
+ ] }),
2883
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
2884
+ /* @__PURE__ */ jsx(
2885
+ AgentInlineButton,
2886
+ {
2887
+ agentId: "hf-open-manifest",
2888
+ label: "Open HF manifest",
2889
+ group: "hf-ingest",
2890
+ description: "Open the HuggingFace ingest manifest",
2891
+ className: FINE_TUNING_ACTION_CLASS,
2892
+ onClick: () => {
2893
+ void openExternalUrl(
2894
+ localViewerUrl(hfIngestResult.manifestPath)
2895
+ );
2896
+ },
2897
+ children: "Open HF manifest"
2898
+ }
2899
+ ),
2900
+ /* @__PURE__ */ jsx(
2901
+ AgentInlineButton,
2902
+ {
2903
+ agentId: "hf-open-output",
2904
+ label: "Open HF output",
2905
+ group: "hf-ingest",
2906
+ description: "Open the HuggingFace ingest output directory",
2907
+ className: FINE_TUNING_ACTION_CLASS,
2908
+ onClick: () => {
2909
+ void openExternalUrl(
2910
+ localViewerUrl(hfIngestResult.outputDir)
2911
+ );
2912
+ },
2913
+ children: "Open HF output"
2914
+ }
2915
+ )
2916
+ ] })
2917
+ ] })
2918
+ ] }),
2919
+ /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-4 p-3 text-sm`, children: [
2920
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
2921
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5", children: [
2922
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2923
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Archetypes") }),
2924
+ /* @__PURE__ */ jsx(
2925
+ AgentTextField,
2926
+ {
2927
+ agentId: "feed-archetypes",
2928
+ label: "Feed archetypes",
2929
+ group: "feed-gen",
2930
+ description: "Comma-separated archetypes for feed generation",
2931
+ className: AGENT_FIELD_INPUT_CLASS,
2932
+ value: feedArchetypes,
2933
+ onChange: setFeedArchetypes,
2934
+ placeholder: "trader"
2935
+ }
2936
+ )
2937
+ ] }),
2938
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2939
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Agents") }),
2940
+ /* @__PURE__ */ jsx(
2941
+ AgentTextField,
2942
+ {
2943
+ agentId: "feed-num-agents",
2944
+ label: "Feed agents",
2945
+ group: "feed-gen",
2946
+ description: "Number of agents for feed generation",
2947
+ className: AGENT_FIELD_INPUT_CLASS,
2948
+ value: feedNumAgents,
2949
+ onChange: setFeedNumAgents,
2950
+ type: "number"
2951
+ }
2952
+ )
2953
+ ] }),
2954
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2955
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Ticks") }),
2956
+ /* @__PURE__ */ jsx(
2957
+ AgentTextField,
2958
+ {
2959
+ agentId: "feed-ticks",
2960
+ label: "Feed ticks",
2961
+ group: "feed-gen",
2962
+ description: "Number of simulation ticks for feed generation",
2963
+ className: AGENT_FIELD_INPUT_CLASS,
2964
+ value: feedTicks,
2965
+ onChange: setFeedTicks,
2966
+ type: "number"
2967
+ }
2968
+ )
2969
+ ] }),
2970
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2971
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Parallel") }),
2972
+ /* @__PURE__ */ jsx(
2973
+ AgentTextField,
2974
+ {
2975
+ agentId: "feed-parallel",
2976
+ label: "Feed parallelism",
2977
+ group: "feed-gen",
2978
+ description: "Parallelism for feed generation",
2979
+ className: AGENT_FIELD_INPUT_CLASS,
2980
+ value: feedParallel,
2981
+ onChange: setFeedParallel,
2982
+ type: "number"
2983
+ }
2984
+ )
2985
+ ] }),
2986
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
2987
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Output") }),
2988
+ /* @__PURE__ */ jsx(
2989
+ AgentTextField,
2990
+ {
2991
+ agentId: "feed-output-dir",
2992
+ label: "Feed output directory",
2993
+ group: "feed-gen",
2994
+ description: "Output directory for generated feed trajectories",
2995
+ className: AGENT_FIELD_INPUT_CLASS,
2996
+ value: feedOutputDir,
2997
+ onChange: setFeedOutputDir,
2998
+ placeholder: "default"
2999
+ }
3000
+ )
3001
+ ] })
3002
+ ] }),
3003
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
3004
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3005
+ /* @__PURE__ */ jsx(
3006
+ AgentCheckboxField,
3007
+ {
3008
+ agentId: "feed-cleanup",
3009
+ label: "Feed cleanup",
3010
+ group: "feed-gen",
3011
+ description: "Clean up intermediate feed artifacts",
3012
+ checked: feedCleanup,
3013
+ onChange: setFeedCleanup
3014
+ }
3015
+ ),
3016
+ t("finetuningview.Cleanup")
3017
+ ] }),
3018
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3019
+ /* @__PURE__ */ jsx(
3020
+ AgentCheckboxField,
3021
+ {
3022
+ agentId: "feed-dry-run",
3023
+ label: "Feed generation dry run",
3024
+ group: "feed-gen",
3025
+ description: "Run feed generation as a dry run",
3026
+ checked: feedDryRun,
3027
+ onChange: setFeedDryRun
3028
+ }
3029
+ ),
3030
+ t("finetuningview.DryRun")
3031
+ ] }),
3032
+ /* @__PURE__ */ jsx(
3033
+ TrainingActionButton,
3034
+ {
3035
+ agentId: "action-generate-feed-trajectories",
3036
+ label: t("finetuningview.GenerateFeedTrajectories"),
3037
+ group: "feed",
3038
+ description: "Generate feed simulation trajectories for the configured archetypes",
3039
+ disabled: feedGenerationRunning,
3040
+ onClick: () => {
3041
+ void handleRunFeedGeneration();
3042
+ },
3043
+ children: feedGenerationRunning ? t("finetuningview.Generating") : t("finetuningview.GenerateFeedTrajectories")
3044
+ }
3045
+ )
3046
+ ] })
3047
+ ] }),
3048
+ feedGenerationResult && /* @__PURE__ */ jsxs(Fragment, { children: [
3049
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
3050
+ /* @__PURE__ */ jsxs("div", { children: [
3051
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
3052
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: feedGenerationResult.exitCode })
3053
+ ] }),
3054
+ /* @__PURE__ */ jsxs("div", { children: [
3055
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Output") }),
3056
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: feedGenerationResult.outputDir })
3057
+ ] }),
3058
+ /* @__PURE__ */ jsxs("div", { className: "md:col-span-2", children: [
3059
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
3060
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: feedGenerationResult.command.join(" ") })
3061
+ ] }),
3062
+ feedGenerationResult.artifacts.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
3063
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Feed artifacts" }),
3064
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: feedGenerationResult.artifacts.map(
3065
+ (artifact) => `${artifact.schema ?? "feed"}${artifact.sourceKind ? ` source:${artifact.sourceKind}` : ""} trajectories:${artifact.trajectories ?? "n/a"} manifest:${artifact.manifestPath}${artifact.exportPath ? ` export:${artifact.exportPath}` : ""}${artifact.outputDir ? ` output:${artifact.outputDir}` : ""}`
3066
+ ).join(" | ") })
3067
+ ] }) : null
3068
+ ] }),
3069
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3070
+ /* @__PURE__ */ jsx(
3071
+ AgentInlineButton,
3072
+ {
3073
+ agentId: "feed-open-output",
3074
+ label: "Open feed output",
3075
+ group: "feed-gen",
3076
+ description: "Open the feed generation output directory",
3077
+ className: FINE_TUNING_ACTION_CLASS,
3078
+ onClick: () => {
3079
+ void openExternalUrl(
3080
+ localViewerUrl(feedGenerationResult.outputDir)
3081
+ );
3082
+ },
3083
+ children: "Open feed output"
3084
+ }
3085
+ ),
3086
+ feedGenerationResult.artifacts[0]?.manifestPath ? /* @__PURE__ */ jsx(
3087
+ AgentInlineButton,
3088
+ {
3089
+ agentId: "feed-open-manifest",
3090
+ label: "Open feed manifest",
3091
+ group: "feed-gen",
3092
+ description: "Open the feed generation manifest",
3093
+ className: FINE_TUNING_ACTION_CLASS,
3094
+ onClick: () => {
3095
+ void openExternalUrl(
3096
+ localViewerUrl(
3097
+ feedGenerationResult.artifacts[0].manifestPath
3098
+ )
3099
+ );
3100
+ },
3101
+ children: "Open feed manifest"
3102
+ }
3103
+ ) : null,
3104
+ feedGenerationResult.artifacts[0]?.exportPath ? /* @__PURE__ */ jsx(
3105
+ AgentInlineButton,
3106
+ {
3107
+ agentId: "feed-open-export",
3108
+ label: "Open feed export",
3109
+ group: "feed-gen",
3110
+ description: "Open the feed generation export",
3111
+ className: FINE_TUNING_ACTION_CLASS,
3112
+ onClick: () => {
3113
+ const exportPath = feedGenerationResult.artifacts[0]?.exportPath;
3114
+ if (!exportPath) return;
3115
+ void openExternalUrl(localViewerUrl(exportPath));
3116
+ },
3117
+ children: "Open feed export"
3118
+ }
3119
+ ) : null
3120
+ ] })
3121
+ ] })
3122
+ ] }),
3123
+ /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-4 p-3 text-sm`, children: [
3124
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
3125
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [
3126
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3127
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Scenario") }),
3128
+ /* @__PURE__ */ jsx(
3129
+ AgentTextField,
3130
+ {
3131
+ agentId: "scenario-filter",
3132
+ label: "Scenario filter",
3133
+ group: "scenarios",
3134
+ description: "Filter expression to select scenarios to run",
3135
+ className: AGENT_FIELD_INPUT_CLASS,
3136
+ value: scenarioFilter,
3137
+ onChange: setScenarioFilter,
3138
+ placeholder: "deterministic-pr-smoke"
3139
+ }
3140
+ )
3141
+ ] }),
3142
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted sm:col-span-2", children: [
3143
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Output") }),
3144
+ /* @__PURE__ */ jsx(
3145
+ AgentTextField,
3146
+ {
3147
+ agentId: "scenario-output-dir",
3148
+ label: "Scenario output directory",
3149
+ group: "scenarios",
3150
+ description: "Output directory for scenario results",
3151
+ className: AGENT_FIELD_INPUT_CLASS,
3152
+ value: scenarioOutputDir,
3153
+ onChange: setScenarioOutputDir,
3154
+ placeholder: "default"
3155
+ }
3156
+ )
3157
+ ] })
3158
+ ] }),
3159
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
3160
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3161
+ /* @__PURE__ */ jsx(
3162
+ AgentCheckboxField,
3163
+ {
3164
+ agentId: "scenario-export-native",
3165
+ label: "Export native trajectories",
3166
+ group: "scenarios",
3167
+ description: "Export native trajectories from scenario runs",
3168
+ checked: scenarioExportNative,
3169
+ onChange: setScenarioExportNative
3170
+ }
3171
+ ),
3172
+ t("finetuningview.ExportNative")
3173
+ ] }),
3174
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3175
+ /* @__PURE__ */ jsx(
3176
+ AgentCheckboxField,
3177
+ {
3178
+ agentId: "scenario-deterministic-proxy",
3179
+ label: "Deterministic proxy",
3180
+ group: "scenarios",
3181
+ description: "Use a deterministic proxy for scenario runs",
3182
+ checked: scenarioDeterministicProxy,
3183
+ onChange: setScenarioDeterministicProxy
3184
+ }
3185
+ ),
3186
+ t("finetuningview.Proxy")
3187
+ ] }),
3188
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3189
+ /* @__PURE__ */ jsx(
3190
+ AgentCheckboxField,
3191
+ {
3192
+ agentId: "scenario-dry-run",
3193
+ label: "Scenario dry run",
3194
+ group: "scenarios",
3195
+ description: "Run the scenario suite as a dry run",
3196
+ checked: scenarioDryRun,
3197
+ onChange: setScenarioDryRun
3198
+ }
3199
+ ),
3200
+ t("finetuningview.DryRun")
3201
+ ] }),
3202
+ /* @__PURE__ */ jsx(
3203
+ TrainingActionButton,
3204
+ {
3205
+ agentId: "action-run-scenarios",
3206
+ label: t("finetuningview.RunScenarios"),
3207
+ group: "scenarios",
3208
+ description: "Run the configured scenario suite and export native trajectories",
3209
+ disabled: scenarioRunning,
3210
+ onClick: () => {
3211
+ void handleRunScenarios();
3212
+ },
3213
+ children: scenarioRunning ? t("finetuningview.RunningScenarios") : t("finetuningview.RunScenarios")
3214
+ }
3215
+ )
3216
+ ] })
3217
+ ] }),
3218
+ scenarioResult && /* @__PURE__ */ jsxs(Fragment, { children: [
3219
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-5", children: [
3220
+ /* @__PURE__ */ jsxs("div", { children: [
3221
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
3222
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: scenarioResult.exitCode })
3223
+ ] }),
3224
+ /* @__PURE__ */ jsxs("div", { children: [
3225
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Matrix") }),
3226
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: scenarioResult.matrixPath })
3227
+ ] }),
3228
+ /* @__PURE__ */ jsxs("div", { children: [
3229
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Viewer") }),
3230
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: scenarioResult.viewerHtmlPath })
3231
+ ] }),
3232
+ /* @__PURE__ */ jsxs("div", { children: [
3233
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.NativeJsonl") }),
3234
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: scenarioResult.nativeJsonlPath ?? "n/a" })
3235
+ ] }),
3236
+ /* @__PURE__ */ jsxs("div", { children: [
3237
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
3238
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: scenarioResult.command.join(" ") })
3239
+ ] })
3240
+ ] }),
3241
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3242
+ /* @__PURE__ */ jsx(
3243
+ AgentInlineButton,
3244
+ {
3245
+ agentId: "scenario-open-viewer",
3246
+ label: "Open scenario viewer",
3247
+ group: "scenarios",
3248
+ description: "Open the scenario results viewer",
3249
+ className: FINE_TUNING_ACTION_CLASS,
3250
+ onClick: () => {
3251
+ void openExternalUrl(
3252
+ localViewerUrl(scenarioResult.viewerHtmlPath)
3253
+ );
3254
+ },
3255
+ children: "Open scenario viewer"
3256
+ }
3257
+ ),
3258
+ /* @__PURE__ */ jsx(
3259
+ AgentInlineButton,
3260
+ {
3261
+ agentId: "scenario-open-matrix",
3262
+ label: "Open scenario matrix",
3263
+ group: "scenarios",
3264
+ description: "Open the scenario results matrix",
3265
+ className: FINE_TUNING_ACTION_CLASS,
3266
+ onClick: () => {
3267
+ void openExternalUrl(
3268
+ localViewerUrl(scenarioResult.matrixPath)
3269
+ );
3270
+ },
3271
+ children: "Open scenario matrix"
3272
+ }
3273
+ ),
3274
+ scenarioResult.nativeJsonlPath ? /* @__PURE__ */ jsx(
3275
+ AgentInlineButton,
3276
+ {
3277
+ agentId: "scenario-open-native-jsonl",
3278
+ label: "Open native JSONL",
3279
+ group: "scenarios",
3280
+ description: "Open the scenario native JSONL export",
3281
+ className: FINE_TUNING_ACTION_CLASS,
3282
+ onClick: () => {
3283
+ if (scenarioResult.nativeJsonlPath) {
3284
+ void openExternalUrl(
3285
+ localViewerUrl(scenarioResult.nativeJsonlPath)
3286
+ );
3287
+ }
3288
+ },
3289
+ children: "Open native JSONL"
3290
+ }
3291
+ ) : null,
3292
+ /* @__PURE__ */ jsx(
3293
+ AgentInlineButton,
3294
+ {
3295
+ agentId: "scenario-open-output",
3296
+ label: "Open scenario output",
3297
+ group: "scenarios",
3298
+ description: "Open the scenario output directory",
3299
+ className: FINE_TUNING_ACTION_CLASS,
3300
+ onClick: () => {
3301
+ void openExternalUrl(
3302
+ localViewerUrl(scenarioResult.outputDir)
3303
+ );
3304
+ },
3305
+ children: "Open scenario output"
3306
+ }
3307
+ )
3308
+ ] })
3309
+ ] })
3310
+ ] }),
3311
+ /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-4 p-3 text-sm`, children: [
3312
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
3313
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-5", children: [
3314
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2", children: [
3315
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Manifest") }),
3316
+ /* @__PURE__ */ jsx(
3317
+ AgentTextField,
3318
+ {
3319
+ agentId: "eval-manifest-path",
3320
+ label: "Eval manifest path",
3321
+ group: "eval-comparison",
3322
+ description: "Training manifest path for the eval comparison",
3323
+ className: AGENT_FIELD_INPUT_CLASS,
3324
+ value: evalComparisonManifestPath,
3325
+ onChange: setEvalComparisonManifestPath,
3326
+ placeholder: "training manifest path"
3327
+ }
3328
+ )
3329
+ ] }),
3330
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3331
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BaseModel") }),
3332
+ /* @__PURE__ */ jsx(
3333
+ AgentTextField,
3334
+ {
3335
+ agentId: "eval-base-model",
3336
+ label: "Eval base model",
3337
+ group: "eval-comparison",
3338
+ description: "Base model id for the eval comparison",
3339
+ className: AGENT_FIELD_INPUT_CLASS,
3340
+ value: evalComparisonBaseModel,
3341
+ onChange: setEvalComparisonBaseModel,
3342
+ placeholder: "eliza-1-2b-base"
3343
+ }
3344
+ )
3345
+ ] }),
3346
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3347
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.TrainedModel") }),
3348
+ /* @__PURE__ */ jsx(
3349
+ AgentTextField,
3350
+ {
3351
+ agentId: "eval-trained-model",
3352
+ label: "Eval trained model",
3353
+ group: "eval-comparison",
3354
+ description: "Trained model path for the eval comparison",
3355
+ className: AGENT_FIELD_INPUT_CLASS,
3356
+ value: evalComparisonTrainedModelPath,
3357
+ onChange: setEvalComparisonTrainedModelPath,
3358
+ placeholder: "eliza-1-2b-trained"
3359
+ }
3360
+ )
3361
+ ] }),
3362
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3363
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Backend") }),
3364
+ /* @__PURE__ */ jsxs(
3365
+ AgentNativeSelect,
3366
+ {
3367
+ agentId: "eval-backend",
3368
+ label: "Eval backend",
3369
+ group: "eval-comparison",
3370
+ description: "Compute backend for the eval comparison",
3371
+ className: AGENT_FIELD_INPUT_CLASS,
3372
+ value: evalComparisonBackend,
3373
+ onChange: (value) => setEvalComparisonBackend(value),
3374
+ options: ["cpu", "mlx", "cuda"],
3375
+ children: [
3376
+ /* @__PURE__ */ jsx("option", { value: "cpu", children: "cpu" }),
3377
+ /* @__PURE__ */ jsx("option", { value: "mlx", children: "mlx" }),
3378
+ /* @__PURE__ */ jsx("option", { value: "cuda", children: "cuda" })
3379
+ ]
3380
+ }
3381
+ )
3382
+ ] }),
3383
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted md:col-span-2 xl:col-span-5", children: [
3384
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Output") }),
3385
+ /* @__PURE__ */ jsx(
3386
+ AgentTextField,
3387
+ {
3388
+ agentId: "eval-output-dir",
3389
+ label: "Eval output directory",
3390
+ group: "eval-comparison",
3391
+ description: "Output directory for the eval comparison",
3392
+ className: AGENT_FIELD_INPUT_CLASS,
3393
+ value: evalComparisonOutputDir,
3394
+ onChange: setEvalComparisonOutputDir,
3395
+ placeholder: "default"
3396
+ }
3397
+ )
3398
+ ] })
3399
+ ] }),
3400
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
3401
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3402
+ /* @__PURE__ */ jsx(
3403
+ AgentCheckboxField,
3404
+ {
3405
+ agentId: "eval-include-in-collection",
3406
+ label: "Include eval in collection",
3407
+ group: "eval-comparison",
3408
+ description: "Include the eval comparison in the collection run",
3409
+ checked: evalComparisonEnabled,
3410
+ onChange: setEvalComparisonEnabled
3411
+ }
3412
+ ),
3413
+ t("finetuningview.IncludeInCollection")
3414
+ ] }),
3415
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3416
+ /* @__PURE__ */ jsx(
3417
+ AgentCheckboxField,
3418
+ {
3419
+ agentId: "eval-dry-run",
3420
+ label: "Eval comparison dry run",
3421
+ group: "eval-comparison",
3422
+ description: "Run the eval comparison as a dry run",
3423
+ checked: evalComparisonDryRun,
3424
+ onChange: setEvalComparisonDryRun
3425
+ }
3426
+ ),
3427
+ t("finetuningview.DryRun")
3428
+ ] }),
3429
+ /* @__PURE__ */ jsx(
3430
+ TrainingActionButton,
3431
+ {
3432
+ agentId: "action-run-eval-comparison",
3433
+ label: t("finetuningview.RunEvalComparison"),
3434
+ group: "eval-comparison",
3435
+ description: "Run a local eval comparison between the base and trained models",
3436
+ disabled: evalComparisonRunning,
3437
+ onClick: () => {
3438
+ void handleRunEvalComparison();
3439
+ },
3440
+ children: evalComparisonRunning ? t("finetuningview.Evaluating") : t("finetuningview.RunEvalComparison")
3441
+ }
3442
+ )
3443
+ ] })
3444
+ ] }),
3445
+ evalComparisonResult && /* @__PURE__ */ jsxs(Fragment, { children: [
3446
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
3447
+ /* @__PURE__ */ jsxs("div", { children: [
3448
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
3449
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: evalComparisonResult.exitCode })
3450
+ ] }),
3451
+ /* @__PURE__ */ jsxs("div", { children: [
3452
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Artifact") }),
3453
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: evalComparisonResult.artifactPath })
3454
+ ] }),
3455
+ /* @__PURE__ */ jsxs("div", { children: [
3456
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Report") }),
3457
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: evalComparisonResult.reportPath })
3458
+ ] }),
3459
+ /* @__PURE__ */ jsxs("div", { children: [
3460
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
3461
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: evalComparisonResult.command.join(" ") })
3462
+ ] }),
3463
+ formatEvalComparisonSummary(evalComparisonResult) ? /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 xl:col-span-4", children: [
3464
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: "Eval metrics" }),
3465
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: formatEvalComparisonSummary(evalComparisonResult) })
3466
+ ] }) : null
3467
+ ] }),
3468
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3469
+ /* @__PURE__ */ jsx(
3470
+ AgentInlineButton,
3471
+ {
3472
+ agentId: "eval-open-artifact",
3473
+ label: "Open eval artifact",
3474
+ group: "eval-comparison",
3475
+ description: "Open the eval comparison artifact",
3476
+ className: FINE_TUNING_ACTION_CLASS,
3477
+ onClick: () => {
3478
+ void openExternalUrl(
3479
+ localViewerUrl(evalComparisonResult.artifactPath)
3480
+ );
3481
+ },
3482
+ children: "Open eval artifact"
3483
+ }
3484
+ ),
3485
+ /* @__PURE__ */ jsx(
3486
+ AgentInlineButton,
3487
+ {
3488
+ agentId: "eval-open-report",
3489
+ label: "Open eval report",
3490
+ group: "eval-comparison",
3491
+ description: "Open the eval comparison report",
3492
+ className: FINE_TUNING_ACTION_CLASS,
3493
+ onClick: () => {
3494
+ void openExternalUrl(
3495
+ localViewerUrl(evalComparisonResult.reportPath)
3496
+ );
3497
+ },
3498
+ children: "Open eval report"
3499
+ }
3500
+ ),
3501
+ /* @__PURE__ */ jsx(
3502
+ AgentInlineButton,
3503
+ {
3504
+ agentId: "eval-open-output",
3505
+ label: "Open eval output",
3506
+ group: "eval-comparison",
3507
+ description: "Open the eval comparison output directory",
3508
+ className: FINE_TUNING_ACTION_CLASS,
3509
+ onClick: () => {
3510
+ void openExternalUrl(
3511
+ localViewerUrl(evalComparisonResult.outputDir)
3512
+ );
3513
+ },
3514
+ children: "Open eval output"
3515
+ }
3516
+ )
3517
+ ] })
3518
+ ] })
3519
+ ] }),
3520
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
3521
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5", children: [
3522
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3523
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Tiers") }),
3524
+ /* @__PURE__ */ jsx(
3525
+ AgentTextField,
3526
+ {
3527
+ agentId: "benchmark-tiers",
3528
+ label: "Benchmark tiers",
3529
+ group: "benchmark",
3530
+ description: "Comma-separated benchmark tiers to run",
3531
+ className: AGENT_FIELD_INPUT_CLASS,
3532
+ value: benchmarkTiers,
3533
+ onChange: setBenchmarkTiers,
3534
+ placeholder: ELIZA_ONE_BENCHMARK_TIER_LIST
3535
+ }
3536
+ )
3537
+ ] }),
3538
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3539
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Benchmark") }),
3540
+ /* @__PURE__ */ jsxs(
3541
+ AgentNativeSelect,
3542
+ {
3543
+ agentId: "benchmark-kind",
3544
+ label: "Benchmark kind",
3545
+ group: "benchmark",
3546
+ description: "Which benchmark suite to run",
3547
+ className: AGENT_FIELD_INPUT_CLASS,
3548
+ value: benchmarkKind,
3549
+ onChange: (value) => setBenchmarkKind(
3550
+ value
3551
+ ),
3552
+ options: [
3553
+ "eliza_harness_action_selection",
3554
+ "hermes",
3555
+ "clawbench",
3556
+ "all"
3557
+ ],
3558
+ children: [
3559
+ /* @__PURE__ */ jsx("option", { value: "eliza_harness_action_selection", children: "eliza_harness_action_selection" }),
3560
+ /* @__PURE__ */ jsx("option", { value: "hermes", children: "hermes" }),
3561
+ /* @__PURE__ */ jsx("option", { value: "clawbench", children: "clawbench" }),
3562
+ /* @__PURE__ */ jsx("option", { value: "all", children: "all" })
3563
+ ]
3564
+ }
3565
+ )
3566
+ ] }),
3567
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3568
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Variants") }),
3569
+ /* @__PURE__ */ jsxs(
3570
+ AgentNativeSelect,
3571
+ {
3572
+ agentId: "benchmark-variants",
3573
+ label: "Benchmark variants",
3574
+ group: "benchmark",
3575
+ description: "Which model variants to benchmark",
3576
+ className: AGENT_FIELD_INPUT_CLASS,
3577
+ value: benchmarkVariants,
3578
+ onChange: (value) => setBenchmarkVariants(value),
3579
+ options: ["both", "base", "trained"],
3580
+ children: [
3581
+ /* @__PURE__ */ jsx("option", { value: "both", children: "both" }),
3582
+ /* @__PURE__ */ jsx("option", { value: "base", children: "base" }),
3583
+ /* @__PURE__ */ jsx("option", { value: "trained", children: "trained" })
3584
+ ]
3585
+ }
3586
+ )
3587
+ ] }),
3588
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3589
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.MaxSamples") }),
3590
+ /* @__PURE__ */ jsx(
3591
+ AgentTextField,
3592
+ {
3593
+ agentId: "benchmark-max-samples",
3594
+ label: "Benchmark max samples",
3595
+ group: "benchmark",
3596
+ description: "Maximum samples per benchmark run",
3597
+ className: AGENT_FIELD_INPUT_CLASS,
3598
+ value: benchmarkMaxSamples,
3599
+ onChange: setBenchmarkMaxSamples,
3600
+ type: "number",
3601
+ placeholder: "50"
3602
+ }
3603
+ )
3604
+ ] }),
3605
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3606
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.ResultsDb") }),
3607
+ /* @__PURE__ */ jsx(
3608
+ AgentTextField,
3609
+ {
3610
+ agentId: "benchmark-results-db",
3611
+ label: "Benchmark results DB",
3612
+ group: "benchmark",
3613
+ description: "Path to the benchmark results database",
3614
+ className: AGENT_FIELD_INPUT_CLASS,
3615
+ value: benchmarkResultsDb,
3616
+ onChange: setBenchmarkResultsDb,
3617
+ placeholder: "default"
3618
+ }
3619
+ )
3620
+ ] }),
3621
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted sm:col-span-2 xl:col-span-2", children: [
3622
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.TrainedModelPath") }),
3623
+ /* @__PURE__ */ jsx(
3624
+ AgentTextField,
3625
+ {
3626
+ agentId: "benchmark-trained-model-path",
3627
+ label: "Benchmark trained model path",
3628
+ group: "benchmark",
3629
+ description: "Path to the trained model for benchmarking",
3630
+ className: AGENT_FIELD_INPUT_CLASS,
3631
+ value: benchmarkTrainedModelPath,
3632
+ onChange: setBenchmarkTrainedModelPath,
3633
+ placeholder: "packages/training/checkpoints/eliza-1-2b/final"
3634
+ }
3635
+ )
3636
+ ] }),
3637
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3638
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.MatrixOutput") }),
3639
+ /* @__PURE__ */ jsx(
3640
+ AgentTextField,
3641
+ {
3642
+ agentId: "benchmark-matrix-output",
3643
+ label: "Benchmark matrix output",
3644
+ group: "benchmark",
3645
+ description: "Output directory for the benchmark matrix",
3646
+ className: AGENT_FIELD_INPUT_CLASS,
3647
+ value: benchmarkMatrixOutputDir,
3648
+ onChange: setBenchmarkMatrixOutputDir,
3649
+ placeholder: "default"
3650
+ }
3651
+ )
3652
+ ] })
3653
+ ] }),
3654
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
3655
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3656
+ /* @__PURE__ */ jsx(
3657
+ AgentCheckboxField,
3658
+ {
3659
+ agentId: "benchmark-dry-run",
3660
+ label: "Benchmark dry run",
3661
+ group: "benchmark",
3662
+ description: "Run the benchmark suite as a dry run",
3663
+ checked: benchmarkDryRun,
3664
+ onChange: setBenchmarkDryRun
3665
+ }
3666
+ ),
3667
+ t("finetuningview.DryRun")
3668
+ ] }),
3669
+ /* @__PURE__ */ jsx(
3670
+ TrainingActionButton,
3671
+ {
3672
+ agentId: "action-run-benchmark-vs-cerebras",
3673
+ label: t("finetuningview.RunBenchmarkVsCerebras"),
3674
+ group: "benchmark",
3675
+ description: "Run the benchmark-vs-Cerebras suite for the configured tiers and variants",
3676
+ disabled: benchmarkRunning,
3677
+ onClick: () => {
3678
+ void handleRunBenchmarkVsCerebras();
3679
+ },
3680
+ children: benchmarkRunning ? t("finetuningview.RunningBenchmark") : t("finetuningview.RunBenchmarkVsCerebras")
3681
+ }
3682
+ )
3683
+ ] })
3684
+ ] }),
3685
+ benchmarkResult && /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-3 p-3 text-sm`, children: [
3686
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
3687
+ /* @__PURE__ */ jsxs("div", { children: [
3688
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
3689
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: benchmarkResult.exitCode })
3690
+ ] }),
3691
+ /* @__PURE__ */ jsxs("div", { children: [
3692
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ResultsDb") }),
3693
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: benchmarkResult.resultsDb ?? t("finetuningview.None") })
3694
+ ] }),
3695
+ /* @__PURE__ */ jsxs("div", { children: [
3696
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.MatrixOutput") }),
3697
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: benchmarkResult.matrixOutputDir ?? t("finetuningview.None") })
3698
+ ] }),
3699
+ /* @__PURE__ */ jsxs("div", { children: [
3700
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.MatrixArtifact") }),
3701
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: benchmarkResult.matrixArtifactPath ?? t("finetuningview.None") })
3702
+ ] }),
3703
+ /* @__PURE__ */ jsxs("div", { children: [
3704
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Output") }),
3705
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: benchmarkResult.outputDir })
3706
+ ] })
3707
+ ] }),
3708
+ /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
3709
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
3710
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: benchmarkResult.command.join(" ") })
3711
+ ] }),
3712
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3713
+ benchmarkResult.matrixArtifactPath ? /* @__PURE__ */ jsx(
3714
+ AgentInlineButton,
3715
+ {
3716
+ agentId: "benchmark-open-matrix-artifact",
3717
+ label: "Open matrix artifact",
3718
+ group: "benchmark",
3719
+ description: "Open the benchmark matrix artifact",
3720
+ className: FINE_TUNING_ACTION_CLASS,
3721
+ onClick: () => {
3722
+ if (benchmarkResult.matrixArtifactPath) {
3723
+ void openExternalUrl(
3724
+ localViewerUrl(benchmarkResult.matrixArtifactPath)
3725
+ );
3726
+ }
3727
+ },
3728
+ children: "Open matrix artifact"
3729
+ }
3730
+ ) : null,
3731
+ benchmarkResult.outputDir ? /* @__PURE__ */ jsx(
3732
+ AgentInlineButton,
3733
+ {
3734
+ agentId: "benchmark-open-output",
3735
+ label: "Open benchmark output",
3736
+ group: "benchmark",
3737
+ description: "Open the benchmark output directory",
3738
+ className: FINE_TUNING_ACTION_CLASS,
3739
+ onClick: () => {
3740
+ void openExternalUrl(
3741
+ localViewerUrl(benchmarkResult.outputDir)
3742
+ );
3743
+ },
3744
+ children: "Open benchmark output"
3745
+ }
3746
+ ) : null
3747
+ ] })
3748
+ ] }),
3749
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
3750
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5", children: [
3751
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3752
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BundleRepo") }),
3753
+ /* @__PURE__ */ jsx(
3754
+ AgentTextField,
3755
+ {
3756
+ agentId: "bundle-repo-id",
3757
+ label: "Bundle repo",
3758
+ group: "bundle-stage",
3759
+ description: "HuggingFace repo id for the bundle",
3760
+ className: AGENT_FIELD_INPUT_CLASS,
3761
+ value: bundleStageRepoId,
3762
+ onChange: setBundleStageRepoId,
3763
+ placeholder: "elizaos/eliza-1"
3764
+ }
3765
+ )
3766
+ ] }),
3767
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3768
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BundleTier") }),
3769
+ /* @__PURE__ */ jsxs(
3770
+ AgentNativeSelect,
3771
+ {
3772
+ agentId: "bundle-tier",
3773
+ label: "Bundle tier",
3774
+ group: "bundle-stage",
3775
+ description: "Model tier to stage",
3776
+ className: AGENT_FIELD_INPUT_CLASS,
3777
+ value: bundleStageTier,
3778
+ onChange: setBundleStageTier,
3779
+ options: ["2b", "4b", "9b", "27b", "27b-256k"],
3780
+ children: [
3781
+ /* @__PURE__ */ jsx("option", { value: "2b", children: "2b" }),
3782
+ /* @__PURE__ */ jsx("option", { value: "4b", children: "4b" }),
3783
+ /* @__PURE__ */ jsx("option", { value: "9b", children: "9b" }),
3784
+ /* @__PURE__ */ jsx("option", { value: "27b", children: "27b" }),
3785
+ /* @__PURE__ */ jsx("option", { value: "27b-256k", children: "27b-256k" })
3786
+ ]
3787
+ }
3788
+ )
3789
+ ] }),
3790
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3791
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.LocalDir") }),
3792
+ /* @__PURE__ */ jsx(
3793
+ AgentTextField,
3794
+ {
3795
+ agentId: "bundle-local-dir",
3796
+ label: "Bundle local directory",
3797
+ group: "bundle-stage",
3798
+ description: "Local directory to stage the bundle into",
3799
+ className: AGENT_FIELD_INPUT_CLASS,
3800
+ value: bundleStageLocalDir,
3801
+ onChange: setBundleStageLocalDir,
3802
+ placeholder: "/tmp/eliza-1-bundles"
3803
+ }
3804
+ )
3805
+ ] }),
3806
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3807
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.MaxBytes") }),
3808
+ /* @__PURE__ */ jsx(
3809
+ AgentTextField,
3810
+ {
3811
+ agentId: "bundle-max-bytes",
3812
+ label: "Bundle max bytes",
3813
+ group: "bundle-stage",
3814
+ description: "Maximum bytes to stage for the bundle",
3815
+ className: AGENT_FIELD_INPUT_CLASS,
3816
+ value: bundleStageMaxBytes,
3817
+ onChange: setBundleStageMaxBytes,
3818
+ type: "number"
3819
+ }
3820
+ )
3821
+ ] }),
3822
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted sm:col-span-2 xl:col-span-1", children: [
3823
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.ManifestOutput") }),
3824
+ /* @__PURE__ */ jsx(
3825
+ AgentTextField,
3826
+ {
3827
+ agentId: "bundle-output-dir",
3828
+ label: "Bundle manifest output",
3829
+ group: "bundle-stage",
3830
+ description: "Output directory for the bundle manifest",
3831
+ className: AGENT_FIELD_INPUT_CLASS,
3832
+ value: bundleStageOutputDir,
3833
+ onChange: setBundleStageOutputDir,
3834
+ placeholder: "default"
3835
+ }
3836
+ )
3837
+ ] })
3838
+ ] }),
3839
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
3840
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
3841
+ /* @__PURE__ */ jsx(
3842
+ AgentCheckboxField,
3843
+ {
3844
+ agentId: "bundle-apply",
3845
+ label: "Apply bundle",
3846
+ group: "bundle-stage",
3847
+ description: "Apply the staged bundle",
3848
+ checked: bundleStageApply,
3849
+ onChange: setBundleStageApply
3850
+ }
3851
+ ),
3852
+ t("finetuningview.Apply")
3853
+ ] }),
3854
+ /* @__PURE__ */ jsx(
3855
+ TrainingActionButton,
3856
+ {
3857
+ agentId: "action-stage-eliza1-bundle",
3858
+ label: t("finetuningview.StageEliza1Bundle"),
3859
+ group: "bundle",
3860
+ description: "Stage the Eliza-1 model bundle for the configured repo and tier",
3861
+ disabled: bundleStageRunning,
3862
+ onClick: () => {
3863
+ void handleStageEliza1Bundle();
3864
+ },
3865
+ children: bundleStageRunning ? t("finetuningview.StagingBundle") : t("finetuningview.StageEliza1Bundle")
3866
+ }
3867
+ )
3868
+ ] })
3869
+ ] }),
3870
+ bundleStageResult && /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-3 p-3 text-sm`, children: [
3871
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
3872
+ /* @__PURE__ */ jsxs("div", { children: [
3873
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
3874
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: bundleStageResult.exitCode })
3875
+ ] }),
3876
+ /* @__PURE__ */ jsxs("div", { children: [
3877
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.PlannedBytes") }),
3878
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: String(
3879
+ bundleStageResult.plan?.plannedBytes ?? t("finetuningview.None")
3880
+ ) })
3881
+ ] }),
3882
+ /* @__PURE__ */ jsxs("div", { children: [
3883
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.FileCount") }),
3884
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: String(
3885
+ bundleStageResult.plan?.fileCount ?? t("finetuningview.None")
3886
+ ) })
3887
+ ] }),
3888
+ /* @__PURE__ */ jsxs("div", { children: [
3889
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.BundleDir") }),
3890
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: String(
3891
+ bundleStageResult.plan?.bundleDir ?? t("finetuningview.None")
3892
+ ) })
3893
+ ] }),
3894
+ /* @__PURE__ */ jsxs("div", { children: [
3895
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Manifest") }),
3896
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: bundleStageResult.manifestPath })
3897
+ ] })
3898
+ ] }),
3899
+ /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
3900
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
3901
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: bundleStageResult.command.join(" ") })
3902
+ ] }),
3903
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3904
+ /* @__PURE__ */ jsx(
3905
+ AgentInlineButton,
3906
+ {
3907
+ agentId: "bundle-open-manifest",
3908
+ label: "Open bundle manifest",
3909
+ group: "bundle-stage",
3910
+ description: "Open the bundle manifest",
3911
+ className: FINE_TUNING_ACTION_CLASS,
3912
+ onClick: () => {
3913
+ void openExternalUrl(
3914
+ localViewerUrl(bundleStageResult.manifestPath)
3915
+ );
3916
+ },
3917
+ children: "Open bundle manifest"
3918
+ }
3919
+ ),
3920
+ /* @__PURE__ */ jsx(
3921
+ AgentInlineButton,
3922
+ {
3923
+ agentId: "bundle-open-output",
3924
+ label: "Open bundle output",
3925
+ group: "bundle-stage",
3926
+ description: "Open the bundle output directory",
3927
+ className: FINE_TUNING_ACTION_CLASS,
3928
+ onClick: () => {
3929
+ void openExternalUrl(
3930
+ localViewerUrl(bundleStageResult.outputDir)
3931
+ );
3932
+ },
3933
+ children: "Open bundle output"
3934
+ }
3935
+ ),
3936
+ bundleStageResult.plan?.bundleDir ? /* @__PURE__ */ jsx(
3937
+ AgentInlineButton,
3938
+ {
3939
+ agentId: "bundle-open-dir",
3940
+ label: "Open bundle directory",
3941
+ group: "bundle-stage",
3942
+ description: "Open the staged bundle directory",
3943
+ className: FINE_TUNING_ACTION_CLASS,
3944
+ onClick: () => {
3945
+ const bundleDir = typeof bundleStageResult.plan?.bundleDir === "string" ? bundleStageResult.plan.bundleDir : null;
3946
+ if (!bundleDir) return;
3947
+ void openExternalUrl(localViewerUrl(bundleDir));
3948
+ },
3949
+ children: "Open bundle dir"
3950
+ }
3951
+ ) : null
3952
+ ] })
3953
+ ] }),
3954
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end", children: [
3955
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [
3956
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3957
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.ActionBenchmarkFilter") }),
3958
+ /* @__PURE__ */ jsx(
3959
+ AgentTextField,
3960
+ {
3961
+ agentId: "action-benchmark-filter",
3962
+ label: "Action benchmark filter",
3963
+ group: "action-benchmark",
3964
+ description: "Case id filter for the action benchmark",
3965
+ className: AGENT_FIELD_INPUT_CLASS,
3966
+ value: actionBenchmarkFilter,
3967
+ onChange: setActionBenchmarkFilter,
3968
+ placeholder: "case-id[,case-id]"
3969
+ }
3970
+ )
3971
+ ] }),
3972
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
3973
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.RunsPerCase") }),
3974
+ /* @__PURE__ */ jsx(
3975
+ AgentTextField,
3976
+ {
3977
+ agentId: "action-benchmark-runs-per-case",
3978
+ label: "Action benchmark runs per case",
3979
+ group: "action-benchmark",
3980
+ description: "Number of runs per benchmark case",
3981
+ className: AGENT_FIELD_INPUT_CLASS,
3982
+ value: actionBenchmarkRunsPerCase,
3983
+ onChange: setActionBenchmarkRunsPerCase,
3984
+ type: "number"
3985
+ }
3986
+ )
3987
+ ] }),
3988
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted sm:col-span-2", children: [
3989
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Output") }),
3990
+ /* @__PURE__ */ jsx(
3991
+ AgentTextField,
3992
+ {
3993
+ agentId: "action-benchmark-output-dir",
3994
+ label: "Action benchmark output directory",
3995
+ group: "action-benchmark",
3996
+ description: "Output directory for the action benchmark",
3997
+ className: AGENT_FIELD_INPUT_CLASS,
3998
+ value: actionBenchmarkOutputDir,
3999
+ onChange: setActionBenchmarkOutputDir,
4000
+ placeholder: "default"
4001
+ }
4002
+ )
4003
+ ] }),
4004
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4005
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Model") }),
4006
+ /* @__PURE__ */ jsx(
4007
+ AgentTextField,
4008
+ {
4009
+ agentId: "action-benchmark-model-id",
4010
+ label: "Action benchmark model",
4011
+ group: "action-benchmark",
4012
+ description: "Model id for the action benchmark",
4013
+ className: AGENT_FIELD_INPUT_CLASS,
4014
+ value: actionBenchmarkModelId,
4015
+ onChange: setActionBenchmarkModelId
4016
+ }
4017
+ )
4018
+ ] }),
4019
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4020
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BaseModel") }),
4021
+ /* @__PURE__ */ jsx(
4022
+ AgentTextField,
4023
+ {
4024
+ agentId: "action-benchmark-base-model-id",
4025
+ label: "Action benchmark base model",
4026
+ group: "action-benchmark",
4027
+ description: "Base model id for the action benchmark",
4028
+ className: AGENT_FIELD_INPUT_CLASS,
4029
+ value: actionBenchmarkBaseModelId,
4030
+ onChange: setActionBenchmarkBaseModelId
4031
+ }
4032
+ )
4033
+ ] }),
4034
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4035
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.CollectionTiers") }),
4036
+ /* @__PURE__ */ jsx(
4037
+ AgentTextField,
4038
+ {
4039
+ agentId: "action-benchmark-pair-tiers",
4040
+ label: "Action benchmark collection tiers",
4041
+ group: "action-benchmark",
4042
+ description: "Collection tiers for the paired action benchmark",
4043
+ className: AGENT_FIELD_INPUT_CLASS,
4044
+ value: actionBenchmarkPairTiers,
4045
+ onChange: setActionBenchmarkPairTiers,
4046
+ placeholder: `${ELIZA_ONE_BENCHMARK_TIER_LIST} or all`
4047
+ }
4048
+ )
4049
+ ] }),
4050
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4051
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.RuntimeModel") }),
4052
+ /* @__PURE__ */ jsx(
4053
+ AgentTextField,
4054
+ {
4055
+ agentId: "action-benchmark-runtime-model",
4056
+ label: "Action benchmark runtime model",
4057
+ group: "action-benchmark",
4058
+ description: "Runtime model for the action benchmark",
4059
+ className: AGENT_FIELD_INPUT_CLASS,
4060
+ value: actionBenchmarkRuntimeModel,
4061
+ onChange: setActionBenchmarkRuntimeModel
4062
+ }
4063
+ )
4064
+ ] }),
4065
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4066
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BaseRuntimeModel") }),
4067
+ /* @__PURE__ */ jsx(
4068
+ AgentTextField,
4069
+ {
4070
+ agentId: "action-benchmark-base-runtime-model",
4071
+ label: "Action benchmark base runtime model",
4072
+ group: "action-benchmark",
4073
+ description: "Base runtime model for the action benchmark",
4074
+ className: AGENT_FIELD_INPUT_CLASS,
4075
+ value: actionBenchmarkBaseRuntimeModel,
4076
+ onChange: setActionBenchmarkBaseRuntimeModel
4077
+ }
4078
+ )
4079
+ ] }),
4080
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4081
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Provider") }),
4082
+ /* @__PURE__ */ jsx(
4083
+ AgentTextField,
4084
+ {
4085
+ agentId: "action-benchmark-provider",
4086
+ label: "Action benchmark provider",
4087
+ group: "action-benchmark",
4088
+ description: "Provider for the action benchmark",
4089
+ className: AGENT_FIELD_INPUT_CLASS,
4090
+ value: actionBenchmarkProvider,
4091
+ onChange: setActionBenchmarkProvider
4092
+ }
4093
+ )
4094
+ ] }),
4095
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4096
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.BaseUrl") }),
4097
+ /* @__PURE__ */ jsx(
4098
+ AgentTextField,
4099
+ {
4100
+ agentId: "action-benchmark-base-url",
4101
+ label: "Action benchmark base URL",
4102
+ group: "action-benchmark",
4103
+ description: "Base URL for the action benchmark provider",
4104
+ className: AGENT_FIELD_INPUT_CLASS,
4105
+ value: actionBenchmarkBaseUrl,
4106
+ onChange: setActionBenchmarkBaseUrl
4107
+ }
4108
+ )
4109
+ ] }),
4110
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4111
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Variant") }),
4112
+ /* @__PURE__ */ jsxs(
4113
+ AgentNativeSelect,
4114
+ {
4115
+ agentId: "action-benchmark-variant",
4116
+ label: "Action benchmark variant",
4117
+ group: "action-benchmark",
4118
+ description: "Model variant for the action benchmark",
4119
+ className: AGENT_FIELD_INPUT_CLASS,
4120
+ value: actionBenchmarkVariant,
4121
+ onChange: (value) => setActionBenchmarkVariant(
4122
+ value
4123
+ ),
4124
+ options: ["trained", "base", "reference"],
4125
+ children: [
4126
+ /* @__PURE__ */ jsx("option", { value: "trained", children: "trained" }),
4127
+ /* @__PURE__ */ jsx("option", { value: "base", children: "base" }),
4128
+ /* @__PURE__ */ jsx("option", { value: "reference", children: "reference" })
4129
+ ]
4130
+ }
4131
+ )
4132
+ ] }),
4133
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4134
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Tier") }),
4135
+ /* @__PURE__ */ jsx(
4136
+ AgentTextField,
4137
+ {
4138
+ agentId: "action-benchmark-tier",
4139
+ label: "Action benchmark tier",
4140
+ group: "action-benchmark",
4141
+ description: "Tier for the action benchmark",
4142
+ className: AGENT_FIELD_INPUT_CLASS,
4143
+ value: actionBenchmarkTier,
4144
+ onChange: setActionBenchmarkTier
4145
+ }
4146
+ )
4147
+ ] }),
4148
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted", children: [
4149
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.Benchmark") }),
4150
+ /* @__PURE__ */ jsx(
4151
+ AgentTextField,
4152
+ {
4153
+ agentId: "action-benchmark-matrix-benchmark",
4154
+ label: "Action benchmark name",
4155
+ group: "action-benchmark",
4156
+ description: "Benchmark name for the action benchmark matrix",
4157
+ className: AGENT_FIELD_INPUT_CLASS,
4158
+ value: actionBenchmarkMatrixBenchmark,
4159
+ onChange: setActionBenchmarkMatrixBenchmark
4160
+ }
4161
+ )
4162
+ ] }),
4163
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-muted sm:col-span-2", children: [
4164
+ /* @__PURE__ */ jsx("span", { className: "font-semibold uppercase tracking-[0.14em]", children: t("finetuningview.DatasetVersion") }),
4165
+ /* @__PURE__ */ jsx(
4166
+ AgentTextField,
4167
+ {
4168
+ agentId: "action-benchmark-dataset-version",
4169
+ label: "Action benchmark dataset version",
4170
+ group: "action-benchmark",
4171
+ description: "Dataset version for the action benchmark",
4172
+ className: AGENT_FIELD_INPUT_CLASS,
4173
+ value: actionBenchmarkDatasetVersion,
4174
+ onChange: setActionBenchmarkDatasetVersion
4175
+ }
4176
+ )
4177
+ ] })
4178
+ ] }),
4179
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
4180
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
4181
+ /* @__PURE__ */ jsx(
4182
+ AgentCheckboxField,
4183
+ {
4184
+ agentId: "action-benchmark-pair-enabled",
4185
+ label: "Pair base and trained",
4186
+ group: "action-benchmark",
4187
+ description: "Pair base and trained variants in the action benchmark",
4188
+ checked: actionBenchmarkPairEnabled,
4189
+ onChange: setActionBenchmarkPairEnabled
4190
+ }
4191
+ ),
4192
+ t("finetuningview.PairBaseTrained")
4193
+ ] }),
4194
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
4195
+ /* @__PURE__ */ jsx(
4196
+ AgentCheckboxField,
4197
+ {
4198
+ agentId: "action-benchmark-use-mocks",
4199
+ label: "Use mocks",
4200
+ group: "action-benchmark",
4201
+ description: "Use mocked responses in the action benchmark",
4202
+ checked: actionBenchmarkUseMocks,
4203
+ onChange: setActionBenchmarkUseMocks
4204
+ }
4205
+ ),
4206
+ t("finetuningview.UseMocks")
4207
+ ] }),
4208
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
4209
+ /* @__PURE__ */ jsx(
4210
+ AgentCheckboxField,
4211
+ {
4212
+ agentId: "action-benchmark-capture",
4213
+ label: "Capture trajectories",
4214
+ group: "action-benchmark",
4215
+ description: "Capture trajectories during the action benchmark",
4216
+ checked: actionBenchmarkCapture,
4217
+ onChange: setActionBenchmarkCapture
4218
+ }
4219
+ ),
4220
+ t("finetuningview.CaptureTrajectories")
4221
+ ] }),
4222
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-2 px-1 text-xs font-semibold uppercase tracking-[0.14em] text-muted", children: [
4223
+ /* @__PURE__ */ jsx(
4224
+ AgentCheckboxField,
4225
+ {
4226
+ agentId: "action-benchmark-dry-run",
4227
+ label: "Action benchmark dry run",
4228
+ group: "action-benchmark",
4229
+ description: "Run the action benchmark as a dry run",
4230
+ checked: actionBenchmarkDryRun,
4231
+ onChange: setActionBenchmarkDryRun
4232
+ }
4233
+ ),
4234
+ t("finetuningview.DryRun")
4235
+ ] }),
4236
+ /* @__PURE__ */ jsx(
4237
+ TrainingActionButton,
4238
+ {
4239
+ agentId: "action-run-action-benchmark",
4240
+ label: t("finetuningview.RunActionBenchmark"),
4241
+ group: "action-benchmark",
4242
+ description: "Run the action-selection benchmark for the configured model and tier",
4243
+ disabled: actionBenchmarkRunning,
4244
+ onClick: () => {
4245
+ void handleRunActionBenchmark();
4246
+ },
4247
+ children: actionBenchmarkRunning ? t("finetuningview.RunningBenchmark") : t("finetuningview.RunActionBenchmark")
4248
+ }
4249
+ )
4250
+ ] })
4251
+ ] }),
4252
+ actionBenchmarkResult && /* @__PURE__ */ jsxs("div", { className: `${FINE_TUNING_PANEL_CLASS} mt-3 p-3 text-sm`, children: [
4253
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
4254
+ /* @__PURE__ */ jsxs("div", { children: [
4255
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.ExitCode") }),
4256
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-mono text-txt", children: actionBenchmarkResult.exitCode })
4257
+ ] }),
4258
+ /* @__PURE__ */ jsxs("div", { children: [
4259
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Report") }),
4260
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: actionBenchmarkResult.reportJsonPath })
4261
+ ] }),
4262
+ /* @__PURE__ */ jsxs("div", { children: [
4263
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Trajectories") }),
4264
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: actionBenchmarkResult.trajectoryDir })
4265
+ ] }),
4266
+ /* @__PURE__ */ jsxs("div", { children: [
4267
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Output") }),
4268
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: actionBenchmarkResult.outputDir })
4269
+ ] })
4270
+ ] }),
4271
+ /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
4272
+ /* @__PURE__ */ jsx("div", { className: "text-xs-tight font-semibold uppercase tracking-[0.14em] text-muted/70", children: t("finetuningview.Command") }),
4273
+ /* @__PURE__ */ jsx("div", { className: "mt-1 break-all font-mono text-xs text-txt", children: actionBenchmarkResult.command.join(" ") })
4274
+ ] }),
4275
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
4276
+ /* @__PURE__ */ jsx(
4277
+ AgentInlineButton,
4278
+ {
4279
+ agentId: "action-benchmark-open-report",
4280
+ label: "Open action report",
4281
+ group: "action-benchmark",
4282
+ description: "Open the action benchmark report",
4283
+ className: FINE_TUNING_ACTION_CLASS,
4284
+ onClick: () => {
4285
+ void openExternalUrl(
4286
+ localViewerUrl(actionBenchmarkResult.reportJsonPath)
4287
+ );
4288
+ },
4289
+ children: "Open action report"
4290
+ }
4291
+ ),
4292
+ /* @__PURE__ */ jsx(
4293
+ AgentInlineButton,
4294
+ {
4295
+ agentId: "action-benchmark-open-summary",
4296
+ label: "Open action summary",
4297
+ group: "action-benchmark",
4298
+ description: "Open the action benchmark summary",
4299
+ className: FINE_TUNING_ACTION_CLASS,
4300
+ onClick: () => {
4301
+ void openExternalUrl(
4302
+ localViewerUrl(actionBenchmarkResult.reportMarkdownPath)
4303
+ );
4304
+ },
4305
+ children: "Open action summary"
4306
+ }
4307
+ ),
4308
+ /* @__PURE__ */ jsx(
4309
+ AgentInlineButton,
4310
+ {
4311
+ agentId: "action-benchmark-open-trajectories",
4312
+ label: "Open action trajectories",
4313
+ group: "action-benchmark",
4314
+ description: "Open the action benchmark trajectories directory",
4315
+ className: FINE_TUNING_ACTION_CLASS,
4316
+ onClick: () => {
4317
+ void openExternalUrl(
4318
+ localViewerUrl(actionBenchmarkResult.trajectoryDir)
4319
+ );
4320
+ },
4321
+ children: "Open action trajectories"
4322
+ }
4323
+ ),
4324
+ /* @__PURE__ */ jsx(
4325
+ AgentInlineButton,
4326
+ {
4327
+ agentId: "action-benchmark-open-output",
4328
+ label: "Open action output",
4329
+ group: "action-benchmark",
4330
+ description: "Open the action benchmark output directory",
4331
+ className: FINE_TUNING_ACTION_CLASS,
4332
+ onClick: () => {
4333
+ void openExternalUrl(
4334
+ localViewerUrl(actionBenchmarkResult.outputDir)
4335
+ );
4336
+ },
4337
+ children: "Open action output"
4338
+ }
4339
+ )
4340
+ ] })
4341
+ ] })
4342
+ ] }),
4343
+ /* @__PURE__ */ jsx(
4344
+ DatasetSection,
4345
+ {
4346
+ buildLimit,
4347
+ setBuildLimit,
4348
+ buildMinCalls,
4349
+ setBuildMinCalls,
4350
+ datasetBuilding,
4351
+ onBuildDataset,
4352
+ onRefreshDatasets,
4353
+ datasets,
4354
+ selectedDatasetId,
4355
+ setSelectedDatasetId,
4356
+ t
4357
+ }
4358
+ ),
4359
+ /* @__PURE__ */ jsx(
4360
+ TrainingJobsSection,
4361
+ {
4362
+ selectedDatasetId,
4363
+ setSelectedDatasetId,
4364
+ datasets,
4365
+ startBackend,
4366
+ setStartBackend,
4367
+ startModel,
4368
+ setStartModel,
4369
+ startIterations,
4370
+ setStartIterations,
4371
+ startBatchSize,
4372
+ setStartBatchSize,
4373
+ startLearningRate,
4374
+ setStartLearningRate,
4375
+ startingJob,
4376
+ activeRunningJob,
4377
+ onStartJob,
4378
+ onRefreshJobs,
4379
+ jobs,
4380
+ selectedJobId,
4381
+ setSelectedJobId,
4382
+ cancellingJobId,
4383
+ onCancelJob,
4384
+ selectedJob,
4385
+ t
4386
+ }
4387
+ ),
4388
+ /* @__PURE__ */ jsx(
4389
+ TrainedModelsSection,
4390
+ {
4391
+ models,
4392
+ selectedModelId,
4393
+ setSelectedModelId,
4394
+ selectedModel,
4395
+ importModelName,
4396
+ setImportModelName,
4397
+ importBaseModel,
4398
+ setImportBaseModel,
4399
+ importOllamaUrl,
4400
+ setImportOllamaUrl,
4401
+ activateProviderModel,
4402
+ setActivateProviderModel,
4403
+ modelAction,
4404
+ smokeResult,
4405
+ onImport: onImportModel,
4406
+ onActivate: onActivateModel,
4407
+ onBenchmark: onBenchmarkModel,
4408
+ onSmokeTest: onSmokeTestModel,
4409
+ t
4410
+ }
4411
+ ),
4412
+ /* @__PURE__ */ jsx(LiveEventsPanel, { events: trainingEvents, t })
4413
+ ] }) });
4414
+ }
4415
+ function formatDashboardNumber(value) {
4416
+ return typeof value === "number" && Number.isFinite(value) ? value.toLocaleString() : "0";
4417
+ }
4418
+ function FineTuningDetailMetric({
4419
+ label,
4420
+ value
4421
+ }) {
4422
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0 rounded-md border border-border/45 bg-card/35 p-3", children: [
4423
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-[0.14em] text-muted", children: label }),
4424
+ /* @__PURE__ */ jsx("div", { className: "mt-1 truncate text-sm font-semibold text-foreground", children: value })
4425
+ ] });
4426
+ }
4427
+ function FineTuningDetailExtension({ app }) {
4428
+ const [history, setHistory] = useState(null);
4429
+ const [loading, setLoading] = useState(false);
4430
+ const [runningGapId, setRunningGapId] = useState(null);
4431
+ const [errorMessage, setErrorMessage] = useState(null);
4432
+ const refreshCollections = useCallback(async () => {
4433
+ setLoading(true);
4434
+ setErrorMessage(null);
4435
+ try {
4436
+ setHistory(await client.listTrainingCollections({ limit: 3 }));
4437
+ } catch (err) {
4438
+ setErrorMessage(err instanceof Error ? err.message : String(err));
4439
+ } finally {
4440
+ setLoading(false);
4441
+ }
4442
+ }, []);
4443
+ useEffect(() => {
4444
+ void refreshCollections();
4445
+ }, [refreshCollections]);
4446
+ const runGapRecommendation = useCallback(
4447
+ async (gap) => {
4448
+ if (!gap.recommendedCapability) return;
4449
+ setRunningGapId(gap.id);
4450
+ setErrorMessage(null);
4451
+ try {
4452
+ await interact(gap.recommendedCapability, gap.recommendedParams ?? {});
4453
+ await refreshCollections();
4454
+ } catch (err) {
4455
+ setErrorMessage(err instanceof Error ? err.message : String(err));
4456
+ } finally {
4457
+ setRunningGapId(null);
4458
+ }
4459
+ },
4460
+ [refreshCollections]
4461
+ );
4462
+ const latest = history?.collections[0] ?? null;
4463
+ const coverage = latest?.coverage;
4464
+ const dataSources = latest ? Object.values(latest.dataSources).reduce((sum, count) => sum + count, 0) : 0;
4465
+ const readableSamples = coverage?.readableSamples.total ?? 0;
4466
+ const scoredComparisons = coverage?.benchmarks.scoredComparisons ?? latest?.benchmarks.benchmarkComparisons ?? 0;
4467
+ const modelCount = coverage?.models.inventoryCount ?? coverage?.models.artifacts ?? 0;
4468
+ const baseline = latest?.benchmarks.baselineProgress;
4469
+ const topGaps = latest?.readinessGaps.slice(0, 3) ?? [];
4470
+ return /* @__PURE__ */ jsxs(
4471
+ "div",
4472
+ {
4473
+ "data-testid": "fine-tuning-detail-extension",
4474
+ className: "flex flex-col gap-3 px-1 py-2",
4475
+ children: [
4476
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
4477
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4478
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-[0.14em] text-muted", children: app.displayName ?? "Fine Tuning" }),
4479
+ /* @__PURE__ */ jsx("h3", { className: "mt-1 truncate text-sm font-semibold text-foreground", children: latest ? "Latest training collection" : "Training collection" }),
4480
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted", children: latest ? `${latest.readinessStatus} readiness, ${latest.artifactCount} artifacts` : "None" })
4481
+ ] }),
4482
+ /* @__PURE__ */ jsx(
4483
+ Button,
4484
+ {
4485
+ type: "button",
4486
+ variant: "outline",
4487
+ size: "sm",
4488
+ onClick: () => void refreshCollections(),
4489
+ disabled: loading,
4490
+ children: loading ? "Refreshing" : "Refresh"
4491
+ }
4492
+ )
4493
+ ] }),
4494
+ errorMessage ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive/35 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: errorMessage }) : null,
4495
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 sm:grid-cols-2 lg:grid-cols-4", children: [
4496
+ /* @__PURE__ */ jsx(
4497
+ FineTuningDetailMetric,
4498
+ {
4499
+ label: "Data sources",
4500
+ value: formatDashboardNumber(dataSources)
4501
+ }
4502
+ ),
4503
+ /* @__PURE__ */ jsx(
4504
+ FineTuningDetailMetric,
4505
+ {
4506
+ label: "Readable samples",
4507
+ value: formatDashboardNumber(readableSamples)
4508
+ }
4509
+ ),
4510
+ /* @__PURE__ */ jsx(
4511
+ FineTuningDetailMetric,
4512
+ {
4513
+ label: "Scored evals",
4514
+ value: formatDashboardNumber(scoredComparisons)
4515
+ }
4516
+ ),
4517
+ /* @__PURE__ */ jsx(
4518
+ FineTuningDetailMetric,
4519
+ {
4520
+ label: "Models",
4521
+ value: formatDashboardNumber(modelCount)
4522
+ }
4523
+ )
4524
+ ] }),
4525
+ latest ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 rounded-md border border-border/40 bg-bg/20 p-3 text-xs text-muted", children: [
4526
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
4527
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4528
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Generated " }),
4529
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: latest.generatedAt })
4530
+ ] }),
4531
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4532
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Tiers " }),
4533
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: latest.benchmarks.tiers.length ? latest.benchmarks.tiers.join(", ") : "none" })
4534
+ ] }),
4535
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4536
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Readiness " }),
4537
+ /* @__PURE__ */ jsxs("span", { className: "text-foreground", children: [
4538
+ latest.readiness.ready,
4539
+ " ready / ",
4540
+ latest.readiness.partial,
4541
+ " ",
4542
+ "partial / ",
4543
+ latest.readiness.missing,
4544
+ " missing"
4545
+ ] })
4546
+ ] }),
4547
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4548
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Steps " }),
4549
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: Object.entries(latest.stepCounts).map(([status, count]) => `${status}:${count}`).join(" ") })
4550
+ ] }),
4551
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4552
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Baseline " }),
4553
+ /* @__PURE__ */ jsxs("span", { className: "text-foreground", children: [
4554
+ "established",
4555
+ " ",
4556
+ baseline?.establishedTiers.length ? baseline.establishedTiers.join(", ") : "none",
4557
+ " ",
4558
+ "/ next ",
4559
+ baseline?.nextTier ?? "none"
4560
+ ] })
4561
+ ] }),
4562
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4563
+ /* @__PURE__ */ jsx("span", { className: "text-muted", children: "Remaining " }),
4564
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: baseline?.remainingTiers.length ? baseline.remainingTiers.join(", ") : "none" })
4565
+ ] })
4566
+ ] }),
4567
+ topGaps.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 rounded border border-border/35 bg-card/25 p-2", children: [
4568
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-[0.14em] text-muted", children: "Next gaps" }),
4569
+ topGaps.map((gap) => /* @__PURE__ */ jsxs(
4570
+ "div",
4571
+ {
4572
+ className: "flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",
4573
+ children: [
4574
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
4575
+ /* @__PURE__ */ jsxs("div", { className: "truncate text-xs font-semibold text-foreground", children: [
4576
+ gap.id,
4577
+ ":",
4578
+ gap.status
4579
+ ] }),
4580
+ /* @__PURE__ */ jsx("div", { className: "line-clamp-2 text-xs text-muted", children: gap.note })
4581
+ ] }),
4582
+ gap.recommendedCapability ? /* @__PURE__ */ jsx(
4583
+ Button,
4584
+ {
4585
+ type: "button",
4586
+ variant: "outline",
4587
+ size: "sm",
4588
+ onClick: () => void runGapRecommendation(gap),
4589
+ disabled: runningGapId === gap.id,
4590
+ title: gap.recommendedCapability,
4591
+ children: runningGapId === gap.id ? "Running" : "Run"
4592
+ }
4593
+ ) : null
4594
+ ]
4595
+ },
4596
+ gap.id
4597
+ ))
4598
+ ] }) : null,
4599
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 pt-1", children: [
4600
+ /* @__PURE__ */ jsx(
4601
+ Button,
4602
+ {
4603
+ type: "button",
4604
+ variant: "outline",
4605
+ size: "sm",
4606
+ onClick: () => void openExternalUrl(
4607
+ localViewerUrl(latest.analysisIndexHtmlPath)
4608
+ ),
4609
+ children: "Open analysis"
4610
+ }
4611
+ ),
4612
+ /* @__PURE__ */ jsx(
4613
+ Button,
4614
+ {
4615
+ type: "button",
4616
+ variant: "outline",
4617
+ size: "sm",
4618
+ onClick: () => void openExternalUrl(localViewerUrl(latest.readmePath)),
4619
+ children: "Open README"
4620
+ }
4621
+ ),
4622
+ /* @__PURE__ */ jsx(
4623
+ Button,
4624
+ {
4625
+ type: "button",
4626
+ variant: "outline",
4627
+ size: "sm",
4628
+ onClick: () => void openExternalUrl(localViewerUrl(latest.manifestPath)),
4629
+ children: "Open manifest"
4630
+ }
4631
+ ),
4632
+ history?.indexHtmlPath ? /* @__PURE__ */ jsx(
4633
+ Button,
4634
+ {
4635
+ type: "button",
4636
+ variant: "outline",
4637
+ size: "sm",
4638
+ onClick: () => void openExternalUrl(localViewerUrl(history.indexHtmlPath)),
4639
+ children: "Open run index"
4640
+ }
4641
+ ) : null
4642
+ ] })
4643
+ ] }) : null
4644
+ ]
4645
+ }
4646
+ );
4647
+ }
4648
+ registerDetailExtension(FINE_TUNING_DETAIL_PANEL_ID, FineTuningDetailExtension);
4649
+ export {
4650
+ FineTuningDetailExtension,
4651
+ FineTuningView
4652
+ };
4653
+ //# sourceMappingURL=FineTuningView.js.map