openpond 0.2.0 → 0.2.1
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.
- package/dist/chunks/actions-command-QP3NMDK4.js +2 -0
- package/dist/chunks/app-layer-N7VFRVJ2.js +3 -0
- package/dist/chunks/app-server-runtime-OCLPUI7F.js +2 -0
- package/dist/chunks/apps-AMG75TI4.js +2 -0
- package/dist/chunks/chunk-22UARBPW.js +3 -0
- package/dist/chunks/chunk-3A7HZJNE.js +1 -0
- package/dist/chunks/chunk-3M53YXEI.js +2 -0
- package/dist/chunks/chunk-3NDRIQTI.js +2 -0
- package/dist/chunks/chunk-5BBVEWG3.js +2 -0
- package/dist/chunks/chunk-5O7ZVCMV.js +6 -0
- package/dist/chunks/chunk-6FA3GG5B.js +33 -0
- package/dist/chunks/chunk-6MI4KKWF.js +2 -0
- package/dist/chunks/chunk-BBG546O6.js +6 -0
- package/dist/chunks/chunk-BX4J2VDU.js +2 -0
- package/dist/chunks/chunk-BZMVB3GS.js +2 -0
- package/dist/chunks/chunk-C5LOZSVS.js +2 -0
- package/dist/chunks/chunk-CWQWV2T3.js +2 -0
- package/dist/chunks/chunk-DUA3QP6Y.js +19 -0
- package/dist/chunks/chunk-EAPFMACH.js +10 -0
- package/dist/chunks/chunk-ES2ISFJC.js +66 -0
- package/dist/chunks/chunk-F65NIZLM.js +2199 -0
- package/dist/chunks/chunk-FGJ5LFPL.js +5 -0
- package/dist/chunks/chunk-FTQLQJQV.js +2 -0
- package/dist/chunks/chunk-FY7OQ5RK.js +24 -0
- package/dist/chunks/chunk-FYCJSUFV.js +53 -0
- package/dist/chunks/chunk-GLUWATL5.js +2 -0
- package/dist/chunks/chunk-H7IWJN7L.js +17 -0
- package/dist/chunks/chunk-HZP5U2AA.js +3 -0
- package/dist/chunks/chunk-I5K74TOH.js +3 -0
- package/dist/chunks/chunk-IR3YJWPW.js +7 -0
- package/dist/chunks/chunk-KU7QOHFT.js +2872 -0
- package/dist/chunks/chunk-KV553EWX.js +16 -0
- package/dist/chunks/chunk-MGN6GLNZ.js +2 -0
- package/dist/chunks/chunk-OG5Q6NXK.js +28 -0
- package/dist/chunks/chunk-OGPHXXCD.js +1 -0
- package/dist/chunks/chunk-PI36UHRA.js +18 -0
- package/dist/chunks/chunk-RWSAGQTP.js +2 -0
- package/dist/chunks/chunk-SAE4OIPC.js +2 -0
- package/dist/chunks/chunk-SDO4FC4Q.js +2 -0
- package/dist/chunks/chunk-UKUVMXOW.js +12 -0
- package/dist/chunks/chunk-VCLCFK3O.js +36 -0
- package/dist/chunks/chunk-VYUMTRB3.js +5 -0
- package/dist/chunks/chunk-X37KMV27.js +1 -0
- package/dist/chunks/chunk-XDHAGACI.js +3 -0
- package/dist/chunks/chunk-XEOEKFG6.js +71 -0
- package/dist/chunks/chunk-ZF7TEGY5.js +5 -0
- package/dist/chunks/chunk-ZVOO7FKM.js +2 -0
- package/dist/chunks/cli-M2FG7SSI.js +2 -0
- package/dist/chunks/configuration-command-XBKBIZBO.js +2 -0
- package/dist/chunks/continual-D75WA7E7.js +7 -0
- package/dist/chunks/core-commands-LUZVWXQR.js +2 -0
- package/dist/chunks/database-X2CUV732.js +2 -0
- package/dist/chunks/desktop-test-KGC4JVJ7.js +3 -0
- package/dist/chunks/dist-NKLXFA37.js +2 -0
- package/dist/chunks/extension-NQ7N5LEY.js +5 -0
- package/dist/chunks/help-MWK66XZK.js +8 -0
- package/dist/chunks/module-ES6BEMUI-ZVL3F6NW.js +2 -0
- package/dist/chunks/module-asyncify-2EFITU5U-R7TVXNAE.js +2 -0
- package/dist/chunks/opchat-XJZA3QKZ.js +3 -0
- package/dist/chunks/organizations-UECDFEYE.js +2 -0
- package/dist/chunks/profile-KUMIZURM.js +3 -0
- package/dist/chunks/project-agent-NILMJHLV.js +2 -0
- package/dist/chunks/sandbox-command-QHH65OSE.js +2 -0
- package/dist/chunks/sandbox-template-N7I63PNU.js +10 -0
- package/dist/chunks/src-724HF43W.js +82 -0
- package/dist/chunks/src-VTKTTKQO.js +319 -0
- package/dist/chunks/taskset-PISBOILQ.js +2 -0
- package/dist/chunks/teams-bot-UV4RU53M.js +3 -0
- package/dist/chunks/training-2NDOWH5S.js +2 -0
- package/dist/chunks/workspaces-XXT4KUD3.js +2 -0
- package/dist/cli.js +3 -109
- package/dist/index.js +1 -31230
- package/dist/sandbox-template/manifest.js +1 -18380
- package/dist/web/assets/App-DxecRQUL.js +176 -0
- package/dist/web/assets/AppDialog-B65Eo3gp.js +1 -0
- package/dist/web/assets/AppTerminalPanel-B2EKQM7W.js +2 -0
- package/dist/web/assets/{AppsView-B1NUuAIf.js → AppsView-BBoVe7s2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-DOvYxXeP.js → BrowserSidebar-CSM1atSJ.js} +1 -1
- package/dist/web/assets/{CartesianChart-pOrYpzBr.js → CartesianChart-CJKfXiEG.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-CgbR-MBJ.js → CollaborationTabs-BMZamWFC.js} +1 -1
- package/dist/web/assets/{CommandMenu-CrIr4qUX.js → CommandMenu-B3U1z2eo.js} +1 -1
- package/dist/web/assets/{CommunityView-CvAVQ_HZ.js → CommunityView-CTyRUcfy.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-DybcKwwd.js → ComposerCreateImproveStrip-D7usvRtK.js} +1 -1
- package/dist/web/assets/GetStartedView-Ibu7oKWJ.js +1 -0
- package/dist/web/assets/HostedModelLearningReview-qnzIkT70.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings--PKjpYsy.js +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-s9uUN6fV.js +1 -0
- package/dist/web/assets/{LabSkillSidebar-CuaYrtiu.js → LabSkillSidebar-BKYseMiJ.js} +1 -1
- package/dist/web/assets/LabsRoute-C1FWCoYb.css +1 -0
- package/dist/web/assets/LabsRoute-DoRs0K6v.js +32 -0
- package/dist/web/assets/MainChatThread-DvuyMcMB.js +2 -0
- package/dist/web/assets/MainPane-BWwcxgHD.js +8 -0
- package/dist/web/assets/{MarkdownText-DOlVQR8a.js → MarkdownText-D8XC5UT_.js} +1 -1
- package/dist/web/assets/{Messages-DMubppta.js → Messages-e4A8JUjD.js} +6 -6
- package/dist/web/assets/{NativeSkillSidebar-DSFwZ-od.js → NativeSkillSidebar-D2Joh8XB.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-Dj0ePIJ-.js → NewExperienceSwitcher-CzGebt2E.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-B8NQV-Ji.js → NewProjectDialog-CdMTSxUE.js} +1 -1
- package/dist/web/assets/{OutputsPage-D_LDYTgV.js → OutputsPage-m7cSb8dW.js} +1 -1
- package/dist/web/assets/{ProjectsPage-xjDYPc_W.js → ProjectsPage-C9mz8W1g.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-B4LEqKEj.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-j0VckZUu.js → RightSidebarHomePanel-DOeUsH7h.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-1aT4bBY-.js → ScheduledWorkPage-UXZSSWgA.js} +1 -1
- package/dist/web/assets/{SettingsView-BSpuMDpv.js → SettingsView-CQm1ai73.js} +7 -7
- package/dist/web/assets/TeamChatView-C4haojB7.js +3 -0
- package/dist/web/assets/{TerminalOverlay-CrSwUk2d.js → TerminalOverlay-p2GZsuyQ.js} +3 -3
- package/dist/web/assets/{TrainingCreationPanel-B4HMRwUg.js → TrainingCreationPanel-BYJSlO8X.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-D4r1tN3I.js → TrainingDraftPanel-DR5KlayH.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-2aymqwIM.js → UsageSettingsSection-BQToNXE4.js} +5 -5
- package/dist/web/assets/{WorkSidebarPanel-B0X0OiR6.js → WorkSidebarPanel--EeytWeg.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-BrovSYhn.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-OAfMEt7L.js → WorkspaceEnvironmentMenu-l-keRgvj.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-YxcPH2Rq.js → WorkspaceGitDialogs-aicWzaZu.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-COKTiQZl.js → WorkspaceMonacoEditor-CO_E74jM.js} +36 -36
- package/dist/web/assets/{arrow-up-right-_TX-awvK.js → arrow-up-right-rwPXNfVn.js} +1 -1
- package/dist/web/assets/chat-file-links-B3jDstSC.js +1 -0
- package/dist/web/assets/chevron-up-D089nvYQ.js +1 -0
- package/dist/web/assets/{clipboard-CyRSS8Sy.js → clipboard-DwEExyU4.js} +1 -1
- package/dist/web/assets/{cloud-upload-uBJBUYTy.js → cloud-upload-D2he0-vQ.js} +1 -1
- package/dist/web/assets/{cssMode-BrXSsZYs.js → cssMode-DS4k0NcI.js} +1 -1
- package/dist/web/assets/{folder-open-DktdZNW7.js → folder-open-CAOLduKD.js} +1 -1
- package/dist/web/assets/{folder-plus-DO06i9Vo.js → folder-plus-D56MrxVT.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-zFSIkPs7.js → git-commit-horizontal-CeNM0oKJ.js} +1 -1
- package/dist/web/assets/{htmlMode-X9UMFkjt.js → htmlMode-Xkni5erh.js} +1 -1
- package/dist/web/assets/{index-ByQIHpc9.css → index-BGMzUaup.css} +1 -1
- package/dist/web/assets/{index-UOGdfLzi.js → index-KwyAyscP.js} +1 -1
- package/dist/web/assets/{info-BEJXUqCD.js → info-CcrBaEE_.js} +1 -1
- package/dist/web/assets/{jsonMode-DIsB-j2E.js → jsonMode-C4YPbQB7.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CmZ17KpA.js → lspLanguageFeatures-CF5oMTz6.js} +1 -1
- package/dist/web/assets/{minimize-2-DumTpFtE.js → minimize-2-DzHQnInk.js} +1 -1
- package/dist/web/assets/{monaco.contribution-DJ_NmcHu.js → monaco.contribution-0EN4mGCC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-YVDfJcG4.js → monaco.contribution-B4qcTP0w.js} +2 -2
- package/dist/web/assets/{monaco.contribution-LZEujgny.js → monaco.contribution-CJK_NrBm.js} +2 -2
- package/dist/web/assets/{monaco.contribution-D6w5PJji.js → monaco.contribution-CkPGKNd-.js} +2 -2
- package/dist/web/assets/{play-CLFeH7CU.js → play-p3-AMTPL.js} +1 -1
- package/dist/web/assets/{python-Djbda_qZ.js → python-B0kpTxAZ.js} +1 -1
- package/dist/web/assets/{refresh-cw-B4IpQ_7Q.js → refresh-cw-_jbTIzzr.js} +1 -1
- package/dist/web/assets/{save-BbTHztnA.js → save-Cy6hEotx.js} +1 -1
- package/dist/web/assets/{square-BJrVbmz6.js → square-DKQkcrOH.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-BopU5W9S.js → toggleHighContrast-Bnk1VVVq.js} +1 -1
- package/dist/web/assets/{tsMode-CH_0_YDX.js → tsMode-BDrSVy7V.js} +1 -1
- package/dist/web/assets/{upload-UumVeufu.js → upload-COn0my_O.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-BRa23U7O.js → useLocalAgentSchedules-iZNB4Oee.js} +1 -1
- package/dist/web/assets/{wifi-off-BWJWivn6.js → wifi-off-Cqt-ZLXY.js} +1 -1
- package/dist/web/assets/{workers-pTe8RvSI.js → workers-hu0Ym93h.js} +1 -1
- package/dist/web/assets/{yaml-DNLASORn.js → yaml-D-JLDGL6.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +4 -3
- package/dist/chunks/actions-command-6N5XWMR6.js +0 -185
- package/dist/chunks/app-layer-F3CGXB33.js +0 -216
- package/dist/chunks/app-server-runtime-RHO5TFUC.js +0 -23
- package/dist/chunks/apps-L5XCL7QY.js +0 -429
- package/dist/chunks/chunk-26AMV5ZI.js +0 -634
- package/dist/chunks/chunk-3EB7I67T.js +0 -630
- package/dist/chunks/chunk-3ELF4FXY.js +0 -96
- package/dist/chunks/chunk-3VEYNDHN.js +0 -669
- package/dist/chunks/chunk-4KA25HUP.js +0 -5648
- package/dist/chunks/chunk-4L3ZJS2T.js +0 -1207
- package/dist/chunks/chunk-6SMNG6YA.js +0 -1303
- package/dist/chunks/chunk-7RIGZB7N.js +0 -1148
- package/dist/chunks/chunk-A6G3PFA5.js +0 -2164
- package/dist/chunks/chunk-BVY5JYM6.js +0 -512
- package/dist/chunks/chunk-DLQQIWN2.js +0 -648
- package/dist/chunks/chunk-FJ2JGB2N.js +0 -1373
- package/dist/chunks/chunk-FQS2QL5F.js +0 -14522
- package/dist/chunks/chunk-G65WAOJV.js +0 -1643
- package/dist/chunks/chunk-JTHL5XJ2.js +0 -1838
- package/dist/chunks/chunk-K4TZEHAW.js +0 -602
- package/dist/chunks/chunk-KCRCIQPD.js +0 -66
- package/dist/chunks/chunk-KSRWKXRB.js +0 -12
- package/dist/chunks/chunk-MUMPWI4O.js +0 -92
- package/dist/chunks/chunk-NTK22KJD.js +0 -10707
- package/dist/chunks/chunk-OCBRPU2K.js +0 -629
- package/dist/chunks/chunk-PS37DB5F.js +0 -183
- package/dist/chunks/chunk-R3C3MNSI.js +0 -140
- package/dist/chunks/chunk-SMNFI2FU.js +0 -113
- package/dist/chunks/chunk-UACZUFIA.js +0 -47
- package/dist/chunks/chunk-UZMVNKXM.js +0 -1275
- package/dist/chunks/chunk-VT6BLHMB.js +0 -67198
- package/dist/chunks/chunk-W5GKHH77.js +0 -168
- package/dist/chunks/chunk-X6F4LBTQ.js +0 -832
- package/dist/chunks/chunk-X7ZG4TSW.js +0 -3063
- package/dist/chunks/chunk-XA4KBDMY.js +0 -13723
- package/dist/chunks/chunk-YVCYVDNP.js +0 -746
- package/dist/chunks/chunk-ZNQEROWP.js +0 -254
- package/dist/chunks/cli-D2MUUBEX.js +0 -23
- package/dist/chunks/configuration-command-NR6JYIUD.js +0 -187
- package/dist/chunks/continual-37CE4LLJ.js +0 -803
- package/dist/chunks/core-commands-SWGIOZLW.js +0 -50
- package/dist/chunks/database-DEYUZDIM.js +0 -20
- package/dist/chunks/desktop-test-QOS7G5NE.js +0 -148
- package/dist/chunks/dist-AKYCQNNF.js +0 -187
- package/dist/chunks/extension-HJUJBQAD.js +0 -9378
- package/dist/chunks/help-J6PZ23IC.js +0 -67
- package/dist/chunks/opchat-ABX5YBAT.js +0 -169
- package/dist/chunks/organizations-CPNC47DO.js +0 -806
- package/dist/chunks/profile-Q3HB5MIO.js +0 -1136
- package/dist/chunks/project-agent-YHUBX4OR.js +0 -516
- package/dist/chunks/sandbox-command-YFL5QTWX.js +0 -1661
- package/dist/chunks/sandbox-template-Z6P7NTNF.js +0 -1655
- package/dist/chunks/src-7XEENEBI.js +0 -3628
- package/dist/chunks/src-KBBIV4NT.js +0 -56125
- package/dist/chunks/taskset-2TRZBRRT.js +0 -66
- package/dist/chunks/teams-bot-WD33NLH5.js +0 -146
- package/dist/chunks/training-4XH37UZB.js +0 -17
- package/dist/chunks/workspaces-WG2MH2WE.js +0 -99
- package/dist/web/assets/App-C9aGkxVg.js +0 -173
- package/dist/web/assets/AppDialog-CK6_lg8c.js +0 -1
- package/dist/web/assets/AppTerminalPanel-BKqgX4sd.js +0 -2
- package/dist/web/assets/GetStartedView-DVInkexN.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-NaaPElmM.js +0 -1
- package/dist/web/assets/LabsRoute-BRR6x3SX.js +0 -2
- package/dist/web/assets/LabsRoute-CGFgymTX.css +0 -1
- package/dist/web/assets/MainChatThread-BfkjCZB9.js +0 -2
- package/dist/web/assets/MainPane-Gw-YK38n.js +0 -8
- package/dist/web/assets/RightChatPanelStack-BktRQ9wg.js +0 -1
- package/dist/web/assets/TeamChatView-BPWJbDf1.js +0 -3
- package/dist/web/assets/WorkspaceDiffPanel-Pg7GL0br.js +0 -14
- package/dist/web/assets/chat-file-links-CWLsRYvW.js +0 -1
- package/dist/web/assets/chevron-up--mNnEqha.js +0 -1
- package/dist/web/assets/index-BEPmTPIA.js +0 -1
|
@@ -1,634 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
resolveApiBaseUrlOption
|
|
4
|
-
} from "./chunk-SMNFI2FU.js";
|
|
5
|
-
import {
|
|
6
|
-
optionString,
|
|
7
|
-
parseBooleanOption,
|
|
8
|
-
parseIntegerOption,
|
|
9
|
-
parseNumberOption
|
|
10
|
-
} from "./chunk-MUMPWI4O.js";
|
|
11
|
-
|
|
12
|
-
// src/cli/training.ts
|
|
13
|
-
import { readFile } from "node:fs/promises";
|
|
14
|
-
import { request as requestHttp } from "node:http";
|
|
15
|
-
import { randomUUID } from "node:crypto";
|
|
16
|
-
import os from "node:os";
|
|
17
|
-
import path from "node:path";
|
|
18
|
-
import { createInterface } from "node:readline/promises";
|
|
19
|
-
var DEFAULT_LOCAL_TRAINING_API_URL = "http://127.0.0.1:17874";
|
|
20
|
-
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
21
|
-
"cancelled",
|
|
22
|
-
"completed",
|
|
23
|
-
"failed",
|
|
24
|
-
"succeeded"
|
|
25
|
-
]);
|
|
26
|
-
async function runTrainingCommand(options, rest, dependencies = {}) {
|
|
27
|
-
const subcommand = rest[0];
|
|
28
|
-
const id = rest[1];
|
|
29
|
-
if (!subcommand || ![
|
|
30
|
-
"start",
|
|
31
|
-
"status",
|
|
32
|
-
"watch",
|
|
33
|
-
"logs",
|
|
34
|
-
"cancel",
|
|
35
|
-
"resume",
|
|
36
|
-
"artifacts",
|
|
37
|
-
"benchmark",
|
|
38
|
-
"create-project"
|
|
39
|
-
].includes(
|
|
40
|
-
subcommand
|
|
41
|
-
) || !id) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"usage: training <create-project|start|status|watch|logs|cancel|resume|artifacts|benchmark> <taskset-id|model-run-id|run-id|model-id>"
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
if (rest.length > 2) {
|
|
47
|
-
throw new Error(`training ${subcommand} accepts exactly one identifier`);
|
|
48
|
-
}
|
|
49
|
-
const baseUrl = resolveApiBaseUrlOption(options) ?? process.env.OPENPOND_LOCAL_API_URL?.replace(/\/$/, "") ?? DEFAULT_LOCAL_TRAINING_API_URL;
|
|
50
|
-
const client = new TrainingApiClient({
|
|
51
|
-
baseUrl,
|
|
52
|
-
request: dependencies.request ?? await createLocalAuthenticatedRequest(baseUrl)
|
|
53
|
-
});
|
|
54
|
-
const json = parseBooleanOption(options.json);
|
|
55
|
-
if (subcommand === "create-project") {
|
|
56
|
-
const project = await createManagedModelProject({
|
|
57
|
-
client,
|
|
58
|
-
options,
|
|
59
|
-
tasksetId: id
|
|
60
|
-
});
|
|
61
|
-
printResult(project, json);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (subcommand === "benchmark") {
|
|
65
|
-
await startHarnessRefinerBenchmark({
|
|
66
|
-
client,
|
|
67
|
-
modelId: id,
|
|
68
|
-
options,
|
|
69
|
-
json,
|
|
70
|
-
sleep: dependencies.sleep
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (subcommand === "resume") {
|
|
75
|
-
const run = await client.modelRun(id, "resume", "POST");
|
|
76
|
-
printResult(run, json);
|
|
77
|
-
await watchTraining({
|
|
78
|
-
client,
|
|
79
|
-
runId: id,
|
|
80
|
-
json,
|
|
81
|
-
intervalMs: parseIntegerOption(options.intervalMs, "interval-ms") ?? 2e3,
|
|
82
|
-
sleep: dependencies.sleep
|
|
83
|
-
});
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (subcommand === "start") {
|
|
87
|
-
await startTraining({
|
|
88
|
-
client,
|
|
89
|
-
dependencies,
|
|
90
|
-
json,
|
|
91
|
-
modelRunId: id,
|
|
92
|
-
options
|
|
93
|
-
});
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (subcommand === "watch") {
|
|
97
|
-
await watchTraining({
|
|
98
|
-
client,
|
|
99
|
-
runId: id,
|
|
100
|
-
json,
|
|
101
|
-
intervalMs: parseIntegerOption(options.intervalMs, "interval-ms") ?? 2e3,
|
|
102
|
-
sleep: dependencies.sleep
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const endpoint = subcommand === "status" ? "status" : subcommand === "logs" ? "logs" : subcommand === "artifacts" ? "artifacts" : "cancel";
|
|
107
|
-
const result = await client.modelRun(
|
|
108
|
-
id,
|
|
109
|
-
endpoint,
|
|
110
|
-
subcommand === "cancel" ? "POST" : "GET"
|
|
111
|
-
);
|
|
112
|
-
printResult(result, json);
|
|
113
|
-
}
|
|
114
|
-
async function createLocalAuthenticatedRequest(baseUrl) {
|
|
115
|
-
const url = new URL(baseUrl);
|
|
116
|
-
if (url.protocol !== "http:" || !["127.0.0.1", "localhost", "::1"].includes(url.hostname)) {
|
|
117
|
-
return fetch;
|
|
118
|
-
}
|
|
119
|
-
const appHome = process.env.OPENPOND_HOME?.trim() || path.join(os.homedir(), ".openpond", "openpond-app");
|
|
120
|
-
const token = (await readFile(path.join(appHome, "token"), "utf8")).trim();
|
|
121
|
-
if (!token) {
|
|
122
|
-
throw new Error("OpenPond local capability token is empty.");
|
|
123
|
-
}
|
|
124
|
-
return (async (resource, init = {}) => {
|
|
125
|
-
const target = resource instanceof Request ? new URL(resource.url) : new URL(String(resource));
|
|
126
|
-
const headers = new Headers(init.headers);
|
|
127
|
-
headers.set("authorization", `Bearer ${token}`);
|
|
128
|
-
const nodeHeaders = {};
|
|
129
|
-
headers.forEach((value, name) => {
|
|
130
|
-
nodeHeaders[name] = value;
|
|
131
|
-
});
|
|
132
|
-
return new Promise((resolve, reject) => {
|
|
133
|
-
let settled = false;
|
|
134
|
-
const request = requestHttp(
|
|
135
|
-
target,
|
|
136
|
-
{
|
|
137
|
-
method: init.method ?? "GET",
|
|
138
|
-
headers: nodeHeaders
|
|
139
|
-
},
|
|
140
|
-
(response) => {
|
|
141
|
-
const chunks = [];
|
|
142
|
-
response.on("data", (chunk) => chunks.push(chunk));
|
|
143
|
-
response.once("error", rejectOnce);
|
|
144
|
-
response.once("end", () => {
|
|
145
|
-
if (settled) return;
|
|
146
|
-
settled = true;
|
|
147
|
-
const responseHeaders = new Headers();
|
|
148
|
-
for (const [name, value] of Object.entries(response.headers)) {
|
|
149
|
-
if (Array.isArray(value)) {
|
|
150
|
-
for (const item of value) responseHeaders.append(name, item);
|
|
151
|
-
} else if (value !== void 0) {
|
|
152
|
-
responseHeaders.set(name, value);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
resolve(
|
|
156
|
-
new Response(new Uint8Array(Buffer.concat(chunks)), {
|
|
157
|
-
status: response.statusCode ?? 500,
|
|
158
|
-
statusText: response.statusMessage,
|
|
159
|
-
headers: responseHeaders
|
|
160
|
-
})
|
|
161
|
-
);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
const rejectOnce = (error) => {
|
|
166
|
-
if (settled) return;
|
|
167
|
-
settled = true;
|
|
168
|
-
reject(error);
|
|
169
|
-
};
|
|
170
|
-
request.once("error", rejectOnce);
|
|
171
|
-
if (init.signal) {
|
|
172
|
-
const abort = () => request.destroy(
|
|
173
|
-
init.signal?.reason instanceof Error ? init.signal.reason : new Error("Training API request aborted.")
|
|
174
|
-
);
|
|
175
|
-
if (init.signal.aborted) abort();
|
|
176
|
-
else init.signal.addEventListener("abort", abort, { once: true });
|
|
177
|
-
}
|
|
178
|
-
if (init.body !== void 0 && init.body !== null) {
|
|
179
|
-
if (typeof init.body !== "string" && !(init.body instanceof Uint8Array)) {
|
|
180
|
-
request.destroy(
|
|
181
|
-
new Error("Local Training API supports string or byte request bodies.")
|
|
182
|
-
);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
request.write(init.body);
|
|
186
|
-
}
|
|
187
|
-
request.end();
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
var TrainingApiClient = class {
|
|
192
|
-
baseUrl;
|
|
193
|
-
request;
|
|
194
|
-
constructor(input) {
|
|
195
|
-
this.baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
196
|
-
this.request = input.request ?? fetch;
|
|
197
|
-
}
|
|
198
|
-
modelRun(id, action, method, body) {
|
|
199
|
-
return this.json(
|
|
200
|
-
`/v1/training/model-runs/${encodeURIComponent(id)}/${action}`,
|
|
201
|
-
method,
|
|
202
|
-
body
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
prepareModelProject(id, body) {
|
|
206
|
-
return this.json(
|
|
207
|
-
`/v1/training/model-projects/${encodeURIComponent(id)}/training/prepare`,
|
|
208
|
-
"POST",
|
|
209
|
-
body
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
startModelProject(id, body) {
|
|
213
|
-
return this.json(
|
|
214
|
-
`/v1/training/model-projects/${encodeURIComponent(id)}/training/start`,
|
|
215
|
-
"POST",
|
|
216
|
-
body
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
trainingState() {
|
|
220
|
-
return this.json("/v1/training", "GET");
|
|
221
|
-
}
|
|
222
|
-
startHarnessRefinerBenchmark(modelId, body) {
|
|
223
|
-
return this.json(
|
|
224
|
-
`/v1/training/models/${encodeURIComponent(modelId)}/harness-refiner-benchmark`,
|
|
225
|
-
"POST",
|
|
226
|
-
body
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
importTasksetDraftPackage(body) {
|
|
230
|
-
return this.json("/v1/training/taskset-drafts/import", "POST", body);
|
|
231
|
-
}
|
|
232
|
-
publishTasksetDraft(draftId, modelId) {
|
|
233
|
-
return this.json(
|
|
234
|
-
`/v1/training/taskset-drafts/${encodeURIComponent(draftId)}/publish`,
|
|
235
|
-
"POST",
|
|
236
|
-
modelId ? { modelId } : {}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
tasksetReadiness(tasksetId) {
|
|
240
|
-
return this.json("/v1/training/readiness", "POST", { tasksetId });
|
|
241
|
-
}
|
|
242
|
-
deleteTasksetDraft(draftId) {
|
|
243
|
-
return this.json(
|
|
244
|
-
`/v1/training/taskset-drafts/${encodeURIComponent(draftId)}`,
|
|
245
|
-
"DELETE"
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
saveModelProject(project) {
|
|
249
|
-
return this.json("/v1/training/models", "PUT", project);
|
|
250
|
-
}
|
|
251
|
-
async json(pathname, method, body) {
|
|
252
|
-
const response = await this.request(`${this.baseUrl}${pathname}`, {
|
|
253
|
-
method,
|
|
254
|
-
headers: body === void 0 ? { Accept: "application/json" } : {
|
|
255
|
-
Accept: "application/json",
|
|
256
|
-
"Content-Type": "application/json"
|
|
257
|
-
},
|
|
258
|
-
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
259
|
-
});
|
|
260
|
-
const text = await response.text();
|
|
261
|
-
let payload = null;
|
|
262
|
-
if (text) {
|
|
263
|
-
try {
|
|
264
|
-
payload = JSON.parse(text);
|
|
265
|
-
} catch {
|
|
266
|
-
payload = text;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (!response.ok) {
|
|
270
|
-
const message = payload && typeof payload === "object" && "error" in payload && typeof payload.error === "string" ? payload.error : `${response.status} ${response.statusText}`.trim();
|
|
271
|
-
throw new Error(`Training API request failed: ${message}`);
|
|
272
|
-
}
|
|
273
|
-
return payload;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
async function startHarnessRefinerBenchmark(input) {
|
|
277
|
-
const state = await input.client.trainingState();
|
|
278
|
-
const project = modelProject(state, input.modelId);
|
|
279
|
-
const providerId = optionString(input.options, "provider") || "openpond";
|
|
280
|
-
const modelId = optionString(input.options, "model") || "openpond-chat";
|
|
281
|
-
const effort = optionString(input.options, "reasoningEffort") || "high";
|
|
282
|
-
const maximumSpendUsd = parseNumberOption(input.options.maxSpend, "max-spend") ?? 10;
|
|
283
|
-
if (maximumSpendUsd <= 0) throw new Error("max-spend must be greater than zero");
|
|
284
|
-
if (parseBooleanOption(input.options.detach)) {
|
|
285
|
-
throw new Error("Harness Refiner benchmark runs must be watched to terminal state.");
|
|
286
|
-
}
|
|
287
|
-
const run = await input.client.startHarnessRefinerBenchmark(input.modelId, {
|
|
288
|
-
profileId: project.profileId,
|
|
289
|
-
model: { providerId, modelId },
|
|
290
|
-
reasoningEffort: effort === "none" ? "none" : effort,
|
|
291
|
-
maximumSpendUsd
|
|
292
|
-
});
|
|
293
|
-
printResult(run, input.json);
|
|
294
|
-
const runId = objectString(run, "id");
|
|
295
|
-
if (!runId) throw new Error("Benchmark start did not return a Model Run id.");
|
|
296
|
-
await watchTraining({
|
|
297
|
-
client: input.client,
|
|
298
|
-
runId,
|
|
299
|
-
json: input.json,
|
|
300
|
-
intervalMs: parseIntegerOption(input.options.intervalMs, "interval-ms") ?? 2e3,
|
|
301
|
-
sleep: input.sleep
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
function modelProject(value, modelId) {
|
|
305
|
-
if (!value || typeof value !== "object" || !("modelProjects" in value)) {
|
|
306
|
-
throw new Error("Training state did not include Models.");
|
|
307
|
-
}
|
|
308
|
-
const projects = Array.isArray(value.modelProjects) ? value.modelProjects : [];
|
|
309
|
-
const project = projects.find(
|
|
310
|
-
(candidate) => candidate && typeof candidate === "object" && "id" in candidate && candidate.id === modelId
|
|
311
|
-
);
|
|
312
|
-
const profileId = project && typeof project === "object" ? objectString(project, "profileId") : null;
|
|
313
|
-
if (!profileId) throw new Error(`Model ${modelId} was not found.`);
|
|
314
|
-
return { profileId };
|
|
315
|
-
}
|
|
316
|
-
function objectString(value, key) {
|
|
317
|
-
if (!value || typeof value !== "object" || !(key in value)) return null;
|
|
318
|
-
const candidate = value[key];
|
|
319
|
-
return typeof candidate === "string" && candidate ? candidate : null;
|
|
320
|
-
}
|
|
321
|
-
async function createManagedModelProject(input) {
|
|
322
|
-
const recipePath = optionString(input.options, "recipe");
|
|
323
|
-
if (!recipePath) {
|
|
324
|
-
throw new Error("training create-project requires --recipe <versioned-recipe.json>");
|
|
325
|
-
}
|
|
326
|
-
const recipe = await readJsonObject(recipePath, "Training recipe");
|
|
327
|
-
const state = await input.client.trainingState();
|
|
328
|
-
const taskset = trainingStateRecord(state, "tasksets", input.tasksetId, "Taskset");
|
|
329
|
-
const profileId = optionString(input.options, "profile") || objectString(taskset, "profileId");
|
|
330
|
-
if (!profileId) {
|
|
331
|
-
throw new Error(
|
|
332
|
-
`The Taskset has no Profile id (received ${typeof taskset.profileId}: ${String(taskset.profileId)}).`
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
const tasksetProfileId = objectString(taskset, "profileId");
|
|
336
|
-
if (tasksetProfileId !== profileId) {
|
|
337
|
-
throw new Error(
|
|
338
|
-
`Taskset ${input.tasksetId} belongs to Profile ${tasksetProfileId ?? "unknown"}, not ${profileId}.`
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
const projectId = optionString(input.options, "projectId") || `model_${randomUUID()}`;
|
|
342
|
-
const projects = trainingStateRecords(state, "modelProjects");
|
|
343
|
-
const existingProject = projects.find(
|
|
344
|
-
(project) => objectString(project, "id") === projectId
|
|
345
|
-
);
|
|
346
|
-
const rolloutPlacement = enumOption(
|
|
347
|
-
input.options,
|
|
348
|
-
"rolloutPlacement",
|
|
349
|
-
["local", "remote"],
|
|
350
|
-
"local"
|
|
351
|
-
);
|
|
352
|
-
const gpuPlacementObjective = enumOption(
|
|
353
|
-
input.options,
|
|
354
|
-
"gpuPlacementObjective",
|
|
355
|
-
["fast", "balanced", "economical"],
|
|
356
|
-
"balanced"
|
|
357
|
-
);
|
|
358
|
-
const runPreset = enumOption(
|
|
359
|
-
input.options,
|
|
360
|
-
"runPreset",
|
|
361
|
-
["small", "standard", "custom", "small_experiment"],
|
|
362
|
-
"custom"
|
|
363
|
-
);
|
|
364
|
-
const maximumSpendUsd = parseNumberOption(input.options.maxSpend, "max-spend") ?? null;
|
|
365
|
-
if (maximumSpendUsd !== null && maximumSpendUsd < 0) {
|
|
366
|
-
throw new Error("max-spend must be non-negative");
|
|
367
|
-
}
|
|
368
|
-
const retentionDays = parseIntegerOption(
|
|
369
|
-
input.options.retentionDays,
|
|
370
|
-
"retention-days"
|
|
371
|
-
) ?? null;
|
|
372
|
-
if (retentionDays !== null && retentionDays < 0) {
|
|
373
|
-
throw new Error("retention-days must be non-negative");
|
|
374
|
-
}
|
|
375
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
376
|
-
const contentHash = objectString(taskset, "contentHash");
|
|
377
|
-
const revision = objectNumber(taskset, "revision");
|
|
378
|
-
if (!contentHash || !revision || revision < 1) {
|
|
379
|
-
throw new Error("The Taskset does not have an immutable published revision.");
|
|
380
|
-
}
|
|
381
|
-
const method = objectString(recipe, "method");
|
|
382
|
-
if (!method) throw new Error("Training recipe must declare its method.");
|
|
383
|
-
const baseModel = managedBasePreferenceFromRecipe(recipe);
|
|
384
|
-
if (existingProject) {
|
|
385
|
-
const existingSetup = objectRecord(existingProject, "trainingSetup");
|
|
386
|
-
const existingTasksetRef = objectRecord(existingSetup, "tasksetRef");
|
|
387
|
-
if (objectString(existingTasksetRef, "id") !== input.tasksetId || objectString(existingProject, "profileId") !== profileId) {
|
|
388
|
-
throw new Error(
|
|
389
|
-
`Model Project ${projectId} already exists for a different Profile or Taskset.`
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
if (objectRecord(existingSetup, "baseModel")) {
|
|
393
|
-
throw new Error(`Model Project ${projectId} already exists.`);
|
|
394
|
-
}
|
|
395
|
-
return input.client.saveModelProject({
|
|
396
|
-
...existingProject,
|
|
397
|
-
revision: objectNumber(existingProject, "revision") ?? 1,
|
|
398
|
-
defaultBaseModel: baseModel,
|
|
399
|
-
trainingSetup: {
|
|
400
|
-
...existingSetup,
|
|
401
|
-
baseModel,
|
|
402
|
-
recipe
|
|
403
|
-
},
|
|
404
|
-
updatedAt: timestamp
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
return input.client.saveModelProject({
|
|
408
|
-
schemaVersion: "openpond.modelProject.v2",
|
|
409
|
-
id: projectId,
|
|
410
|
-
profileId,
|
|
411
|
-
revision: 1,
|
|
412
|
-
name: optionString(input.options, "name") || objectString(taskset, "name") || "Managed Model",
|
|
413
|
-
objective: optionString(input.options, "objective") || objectString(taskset, "objective"),
|
|
414
|
-
defaultBaseModel: baseModel,
|
|
415
|
-
defaultDestinationId: optionString(input.options, "destination") || "openpond_managed",
|
|
416
|
-
trainingSetup: {
|
|
417
|
-
tasksetRef: { id: input.tasksetId, revision, contentHash },
|
|
418
|
-
tasksetRelease: null,
|
|
419
|
-
harnessRelease: null,
|
|
420
|
-
baseModel,
|
|
421
|
-
method,
|
|
422
|
-
destinationId: optionString(input.options, "destination") || "openpond_managed",
|
|
423
|
-
managedRolloutPlacement: rolloutPlacement,
|
|
424
|
-
managedGpuPlacementObjective: gpuPlacementObjective,
|
|
425
|
-
managedGpuRequirement: "any",
|
|
426
|
-
runPreset,
|
|
427
|
-
recipe,
|
|
428
|
-
preferredMaximumSpendUsd: maximumSpendUsd,
|
|
429
|
-
preferredRetentionDays: retentionDays
|
|
430
|
-
},
|
|
431
|
-
hosted: null,
|
|
432
|
-
tasksetSyncs: [],
|
|
433
|
-
createdAt: timestamp,
|
|
434
|
-
updatedAt: timestamp
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
function managedBasePreferenceFromRecipe(recipe) {
|
|
438
|
-
const recipeBase = objectRecord(recipe, "baseModel");
|
|
439
|
-
const modelId = objectString(recipeBase, "id");
|
|
440
|
-
const revision = objectString(recipeBase, "revision");
|
|
441
|
-
const tokenizerRevision = objectString(recipeBase, "tokenizerRevision");
|
|
442
|
-
const chatTemplateHash = objectString(recipeBase, "chatTemplateHash");
|
|
443
|
-
if (!modelId || !revision || !tokenizerRevision || !chatTemplateHash) {
|
|
444
|
-
throw new Error(
|
|
445
|
-
"Managed GRPO recipe must pin baseModel id, revision, tokenizerRevision, and chatTemplateHash."
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
return {
|
|
449
|
-
schemaVersion: "openpond.baseModelPreference.v1",
|
|
450
|
-
modelId,
|
|
451
|
-
revision,
|
|
452
|
-
tokenizerRevision,
|
|
453
|
-
chatTemplateHash,
|
|
454
|
-
modelAssetId: null,
|
|
455
|
-
source: "managed"
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
function trainingStateRecord(state, key, id, label) {
|
|
459
|
-
const match = trainingStateRecords(state, key).find(
|
|
460
|
-
(candidate) => objectString(candidate, "id") === id
|
|
461
|
-
);
|
|
462
|
-
if (!match) throw new Error(`${label} ${id} was not found.`);
|
|
463
|
-
return match;
|
|
464
|
-
}
|
|
465
|
-
function trainingStateRecords(state, key) {
|
|
466
|
-
if (!state || typeof state !== "object" || !(key in state)) return [];
|
|
467
|
-
const value = state[key];
|
|
468
|
-
return Array.isArray(value) ? value.filter(
|
|
469
|
-
(candidate) => Boolean(candidate) && typeof candidate === "object" && !Array.isArray(candidate)
|
|
470
|
-
) : [];
|
|
471
|
-
}
|
|
472
|
-
function objectNumber(value, key) {
|
|
473
|
-
if (!value || typeof value !== "object" || !(key in value)) return null;
|
|
474
|
-
const candidate = value[key];
|
|
475
|
-
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate : null;
|
|
476
|
-
}
|
|
477
|
-
function objectRecord(value, key) {
|
|
478
|
-
if (!value || typeof value !== "object" || !(key in value)) return null;
|
|
479
|
-
const candidate = value[key];
|
|
480
|
-
return candidate && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : null;
|
|
481
|
-
}
|
|
482
|
-
function enumOption(options, key, values, fallback) {
|
|
483
|
-
const value = optionString(options, key) || fallback;
|
|
484
|
-
if (!values.includes(value)) {
|
|
485
|
-
throw new Error(`${key} must be one of ${values.join(", ")}`);
|
|
486
|
-
}
|
|
487
|
-
return value;
|
|
488
|
-
}
|
|
489
|
-
async function readJsonObject(file, label) {
|
|
490
|
-
let parsed;
|
|
491
|
-
try {
|
|
492
|
-
parsed = JSON.parse(await readFile(file, "utf8"));
|
|
493
|
-
} catch (error) {
|
|
494
|
-
throw new Error(
|
|
495
|
-
`Could not read ${label} ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
499
|
-
throw new Error(`${label} must be a JSON object.`);
|
|
500
|
-
}
|
|
501
|
-
return parsed;
|
|
502
|
-
}
|
|
503
|
-
async function startTraining(input) {
|
|
504
|
-
const maximumSpendUsd = parseNumberOption(
|
|
505
|
-
input.options.maxSpend,
|
|
506
|
-
"max-spend"
|
|
507
|
-
) ?? null;
|
|
508
|
-
if (maximumSpendUsd !== null && maximumSpendUsd < 0) {
|
|
509
|
-
throw new Error("max-spend must be non-negative");
|
|
510
|
-
}
|
|
511
|
-
const retentionDays = parseIntegerOption(input.options.retentionDays, "retention-days") ?? null;
|
|
512
|
-
if (retentionDays !== null && retentionDays <= 0) {
|
|
513
|
-
throw new Error("retention-days must be a positive integer");
|
|
514
|
-
}
|
|
515
|
-
const manifestPath = optionString(input.options, "manifest");
|
|
516
|
-
const manifest = manifestPath ? await readManifest(manifestPath) : void 0;
|
|
517
|
-
const comparisonSeriesEntryId = optionString(
|
|
518
|
-
input.options,
|
|
519
|
-
"comparisonSeriesEntry"
|
|
520
|
-
) || null;
|
|
521
|
-
const controls = { maximumSpendUsd, retentionDays };
|
|
522
|
-
const preparation = await input.client.prepareModelProject(
|
|
523
|
-
input.modelRunId,
|
|
524
|
-
controls
|
|
525
|
-
);
|
|
526
|
-
if (!input.json) {
|
|
527
|
-
console.log("Preparation:");
|
|
528
|
-
console.log(JSON.stringify(preparation, null, 2));
|
|
529
|
-
}
|
|
530
|
-
const confirmed = parseBooleanOption(input.options.yes) || await confirmStart(input.dependencies.confirm);
|
|
531
|
-
if (!confirmed) {
|
|
532
|
-
throw new Error("Training start cancelled.");
|
|
533
|
-
}
|
|
534
|
-
const result = await input.client.startModelProject(
|
|
535
|
-
input.modelRunId,
|
|
536
|
-
{
|
|
537
|
-
...controls,
|
|
538
|
-
exportApproved: parseBooleanOption(input.options.exportApproved),
|
|
539
|
-
manifest,
|
|
540
|
-
comparisonSeriesEntryId
|
|
541
|
-
}
|
|
542
|
-
);
|
|
543
|
-
printResult(result, input.json);
|
|
544
|
-
if (parseBooleanOption(input.options.detach)) return;
|
|
545
|
-
const runId = readRunId(result) ?? input.modelRunId;
|
|
546
|
-
await watchTraining({
|
|
547
|
-
client: input.client,
|
|
548
|
-
runId,
|
|
549
|
-
json: input.json,
|
|
550
|
-
intervalMs: 2e3,
|
|
551
|
-
sleep: input.dependencies.sleep
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
async function watchTraining(input) {
|
|
555
|
-
if (input.intervalMs < 250) {
|
|
556
|
-
throw new Error("interval-ms must be at least 250");
|
|
557
|
-
}
|
|
558
|
-
const sleep = input.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
559
|
-
let previous = "";
|
|
560
|
-
for (; ; ) {
|
|
561
|
-
const status = await input.client.modelRun(
|
|
562
|
-
input.runId,
|
|
563
|
-
"status",
|
|
564
|
-
"GET"
|
|
565
|
-
);
|
|
566
|
-
const serialized = JSON.stringify(status);
|
|
567
|
-
if (input.json || serialized !== previous) {
|
|
568
|
-
printResult(status, input.json);
|
|
569
|
-
previous = serialized;
|
|
570
|
-
}
|
|
571
|
-
if (TERMINAL_STATUSES.has(readStatus(status))) return;
|
|
572
|
-
await sleep(input.intervalMs);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
async function readManifest(path2) {
|
|
576
|
-
let parsed;
|
|
577
|
-
try {
|
|
578
|
-
parsed = JSON.parse(await readFile(path2, "utf8"));
|
|
579
|
-
} catch (error) {
|
|
580
|
-
throw new Error(
|
|
581
|
-
`Could not read Harness Run Manifest ${path2}: ${error instanceof Error ? error.message : String(error)}`
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
585
|
-
throw new Error("Harness Run Manifest must be a JSON object.");
|
|
586
|
-
}
|
|
587
|
-
return parsed;
|
|
588
|
-
}
|
|
589
|
-
async function confirmStart(injected) {
|
|
590
|
-
const message = "Start this exact prepared training run? Downloads, provisioning, or spend may begin.";
|
|
591
|
-
if (injected) return injected(message);
|
|
592
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
593
|
-
throw new Error(
|
|
594
|
-
"training start requires --yes when standard input is not interactive"
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
const prompt = createInterface({
|
|
598
|
-
input: process.stdin,
|
|
599
|
-
output: process.stdout
|
|
600
|
-
});
|
|
601
|
-
try {
|
|
602
|
-
const answer = await prompt.question(`${message} [y/N] `);
|
|
603
|
-
return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
|
|
604
|
-
} finally {
|
|
605
|
-
prompt.close();
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
function readRunId(value) {
|
|
609
|
-
if (!value || typeof value !== "object") return null;
|
|
610
|
-
const job = "job" in value ? value.job : null;
|
|
611
|
-
if (!job || typeof job !== "object" || !("id" in job)) return null;
|
|
612
|
-
return typeof job.id === "string" ? job.id : null;
|
|
613
|
-
}
|
|
614
|
-
function readStatus(value) {
|
|
615
|
-
if (!value || typeof value !== "object") return "";
|
|
616
|
-
if ("state" in value && typeof value.state === "string") {
|
|
617
|
-
return value.state;
|
|
618
|
-
}
|
|
619
|
-
return "status" in value && typeof value.status === "string" ? value.status : "";
|
|
620
|
-
}
|
|
621
|
-
function printResult(value, json) {
|
|
622
|
-
if (json) {
|
|
623
|
-
console.log(JSON.stringify(value));
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
console.log(JSON.stringify(value, null, 2));
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
export {
|
|
630
|
-
DEFAULT_LOCAL_TRAINING_API_URL,
|
|
631
|
-
runTrainingCommand,
|
|
632
|
-
createLocalAuthenticatedRequest,
|
|
633
|
-
TrainingApiClient
|
|
634
|
-
};
|