@tuned-tensor/cli 0.28.1 → 0.29.0

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 (92) hide show
  1. package/README.md +7 -0
  2. package/dist/chunk-CT2RXESA.js +1272 -0
  3. package/dist/chunk-CT2RXESA.js.map +1 -0
  4. package/dist/chunk-G3KT4AYL.js +1623 -0
  5. package/dist/chunk-G3KT4AYL.js.map +1 -0
  6. package/dist/chunk-HKWPQPOJ.js +260 -0
  7. package/dist/chunk-HKWPQPOJ.js.map +1 -0
  8. package/dist/chunk-MM75IAY3.js +138 -0
  9. package/dist/chunk-MM75IAY3.js.map +1 -0
  10. package/dist/{chunk-7CO5DBCY.js → chunk-UY3SU2XA.js} +4949 -4843
  11. package/dist/chunk-UY3SU2XA.js.map +1 -0
  12. package/dist/contracts-4MEIRTIN.js +72 -0
  13. package/dist/dataset-Y5NEUKI5.js +22 -0
  14. package/dist/dataset-Y5NEUKI5.js.map +1 -0
  15. package/dist/index.js +782 -319
  16. package/dist/index.js.map +1 -1
  17. package/dist/local-runtime.js +84 -467
  18. package/dist/local-runtime.js.map +1 -1
  19. package/dist/model-server-7BNWDXHP.js +18 -0
  20. package/dist/model-server-7BNWDXHP.js.map +1 -0
  21. package/dist/{prefetch-LBIOO7ZO.js → prefetch-ZFCK4IBD.js} +3 -2
  22. package/dist/prefetch-ZFCK4IBD.js.map +1 -0
  23. package/docs/local-runtime/model-quality.md +103 -0
  24. package/docs/spec-workflow.md +9 -0
  25. package/node_modules/@isaacs/nonrecursive-glob-match/LICENSE.md +55 -0
  26. package/node_modules/@isaacs/nonrecursive-glob-match/README.md +364 -0
  27. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts +123 -0
  28. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts.map +1 -0
  29. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js +778 -0
  30. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js.map +1 -0
  31. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js +3 -0
  32. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js.map +7 -0
  33. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/numeric-range.d.ts +15 -0
  34. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/numeric-range.d.ts.map +1 -0
  35. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/numeric-range.js +76 -0
  36. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/numeric-range.js.map +1 -0
  37. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/package.json +3 -0
  38. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts +4 -0
  39. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts.map +1 -0
  40. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js +142 -0
  41. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js.map +1 -0
  42. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts +123 -0
  43. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts.map +1 -0
  44. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js +774 -0
  45. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js.map +1 -0
  46. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js +3 -0
  47. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js.map +7 -0
  48. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.d.ts +15 -0
  49. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.d.ts.map +1 -0
  50. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.js +72 -0
  51. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.js.map +1 -0
  52. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/package.json +3 -0
  53. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts +4 -0
  54. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts.map +1 -0
  55. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js +138 -0
  56. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js.map +1 -0
  57. package/node_modules/@isaacs/nonrecursive-glob-match/package.json +56 -0
  58. package/node_modules/@isaacs/nonrecursive-glob-match/src/index.ts +932 -0
  59. package/node_modules/@isaacs/nonrecursive-glob-match/src/numeric-range.ts +79 -0
  60. package/node_modules/@isaacs/nonrecursive-glob-match/src/parse-class.ts +158 -0
  61. package/node_modules/minimatch/README.md +125 -107
  62. package/node_modules/minimatch/dist/commonjs/index.d.ts +49 -38
  63. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -1
  64. package/node_modules/minimatch/dist/commonjs/index.js +782 -359
  65. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -1
  66. package/node_modules/minimatch/dist/esm/index.d.ts +49 -38
  67. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -1
  68. package/node_modules/minimatch/dist/esm/index.js +781 -356
  69. package/node_modules/minimatch/dist/esm/index.js.map +1 -1
  70. package/node_modules/minimatch/package.json +5 -4
  71. package/package.json +3 -2
  72. package/training/adapter/src/train.py +16 -1
  73. package/dist/chunk-7CO5DBCY.js.map +0 -1
  74. package/dist/chunk-FSVTMX4L.js +0 -2820
  75. package/dist/chunk-FSVTMX4L.js.map +0 -1
  76. package/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -22
  77. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +0 -1
  78. package/node_modules/minimatch/dist/commonjs/ast.js +0 -845
  79. package/node_modules/minimatch/dist/commonjs/ast.js.map +0 -1
  80. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
  81. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +0 -1
  82. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -150
  83. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +0 -1
  84. package/node_modules/minimatch/dist/esm/ast.d.ts +0 -22
  85. package/node_modules/minimatch/dist/esm/ast.d.ts.map +0 -1
  86. package/node_modules/minimatch/dist/esm/ast.js +0 -841
  87. package/node_modules/minimatch/dist/esm/ast.js.map +0 -1
  88. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
  89. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +0 -1
  90. package/node_modules/minimatch/dist/esm/brace-expressions.js +0 -146
  91. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
  92. /package/dist/{prefetch-LBIOO7ZO.js.map → contracts-4MEIRTIN.js.map} +0 -0
@@ -2,29 +2,24 @@
2
2
  import {
3
3
  DEFAULT_LOCAL_SPEC_PATH,
4
4
  DatasetNotDownloadedError,
5
+ activateModel,
5
6
  assertFoundationSpecReady,
6
7
  assertLocalRunInputReady,
7
8
  assessHardware,
8
9
  auditRun,
9
- buildSystemMessage,
10
10
  canonicalLocalPipeline,
11
11
  checkAwsGpu,
12
- compileSpecToJsonl,
13
12
  createLocalStore,
14
13
  createRunConsoleReporter,
15
- datasetInputIdentity,
16
14
  decisionPlaceholderIssues,
17
15
  defaultLocalHome,
18
16
  ensureDatasetCached,
19
17
  evaluateGeneralRegressionGate,
20
- evaluationSuiteFromChatJsonl,
21
- exampleToChatRow,
22
- examplesFromChatJsonl,
23
- examplesFromSpec,
24
18
  executeDatasetSplit,
25
19
  fingerprintLocalBaseModel,
26
20
  foundationPlaceholderIssues,
27
21
  generatedPlaceholderIssues,
22
+ getActiveModel,
28
23
  hardenExistingLocalStore,
29
24
  huggingFaceDataset,
30
25
  initLocalRunnerConfigFile,
@@ -37,7 +32,6 @@ import {
37
32
  loadRunRequest,
38
33
  localPathsOverlap,
39
34
  localStorePaths,
40
- normalizeChatJsonlForRelocation,
41
35
  parseLocalRunInput,
42
36
  parseLocalRunnerConfig,
43
37
  pipelineForRunInput,
@@ -46,6 +40,7 @@ import {
46
40
  resolveDownloadConfig,
47
41
  resolveLocalRunInputPaths,
48
42
  resolveProjectConfig,
43
+ rollbackActiveModel,
49
44
  runGpuProcess,
50
45
  runLocalFineTune,
51
46
  runLocalPipeline,
@@ -55,19 +50,51 @@ import {
55
50
  validateBehaviorSpec,
56
51
  validateLocalFineTuneInput,
57
52
  validateLocalPipeline,
53
+ verifyActivationEvidence,
54
+ verifyStoredModel,
58
55
  writePrivateJsonAtomic
59
- } from "./chunk-7CO5DBCY.js";
56
+ } from "./chunk-UY3SU2XA.js";
57
+ import {
58
+ buildFoundationModelServerLaunch,
59
+ buildLocalBaseModelServerLaunch,
60
+ buildLocalModelServerLaunch,
61
+ serveLocalModel,
62
+ verifyLocalModelServerLaunch
63
+ } from "./chunk-HKWPQPOJ.js";
60
64
  import {
61
65
  applySpecLock,
66
+ buildBundledPythonCommand,
67
+ buildFoundationPythonCommand,
68
+ buildModelPrefetchPayload,
69
+ buildModelSourcePrefetchPayload,
70
+ enforceSpecLock,
71
+ findAsset,
72
+ forwardStreamLines,
73
+ listAssets,
74
+ localRuntimePackageRoot,
75
+ minimalMachineLearningEnvironment,
76
+ prefetchBaseModel,
77
+ readSpecLock,
78
+ reportInBackground,
79
+ safeName,
80
+ sanitizeLogLine,
81
+ snapshotDigests,
82
+ specLockPath,
83
+ verifyAsset,
84
+ verifyLocalBaseModel,
85
+ verifyModelPrefetchCacheReport,
86
+ withBundledPythonEnvironment,
87
+ withFoundationPythonEnvironment,
88
+ withHuggingFaceCacheEnvironment,
89
+ withProgressHeartbeat,
90
+ writeSpecLockEntry
91
+ } from "./chunk-CT2RXESA.js";
92
+ import {
62
93
  assertArtifactManifest,
63
94
  assertUsableModelArtifact,
64
95
  baseModelRevisionSchema,
65
96
  behaviorSpecExampleSchema,
66
97
  behaviorSpecSchema,
67
- buildBundledPythonCommand,
68
- buildFoundationPythonCommand,
69
- buildModelPrefetchPayload,
70
- buildModelSourcePrefetchPayload,
71
98
  comparisonReportSchema,
72
99
  datasetColumnsSchema,
73
100
  datasetFormatSchema,
@@ -77,14 +104,11 @@ import {
77
104
  decisionLabels,
78
105
  decisionQuestionSchema,
79
106
  defaultBaseModelRevision,
80
- enforceSpecLock,
81
107
  evalExampleResultSchema,
82
108
  evalReportSchema,
83
109
  evalSplitSchema,
84
- findAsset,
85
110
  fineTuneHyperparametersSchema,
86
111
  fineTuneRunRequestSchema,
87
- forwardStreamLines,
88
112
  foundationHyperparametersSchema,
89
113
  huggingFaceDatasetSourceSchema,
90
114
  huggingFaceRepoIdSchema,
@@ -92,47 +116,34 @@ import {
92
116
  isFoundationSpecFile,
93
117
  isRepoRelativePath,
94
118
  jsonFieldMetricsSchema,
95
- listAssets,
96
119
  localAdapterSpecFileSchema,
97
120
  localBehaviorSpecFileSchema,
98
121
  localDecisionSpecFileSchema,
99
122
  localFoundationSpecFileSchema,
100
- localModelArtifactPath,
101
123
  localRunnerConfigSchema,
102
- localRuntimePackageRoot,
103
- minimalMachineLearningEnvironment,
104
- prefetchBaseModel,
105
124
  projectRuntimeSchema,
106
- pythonEnvironmentPath,
107
- readSpecLock,
108
- reportInBackground,
109
- resolveModelLoader,
110
- resolveRequestedBaseModelRevision,
111
125
  resolveTrainingModel,
112
126
  runProvenanceSchema,
113
127
  runReportSchema,
114
- safeName,
115
- sanitizeLogLine,
116
- snapshotDigests,
117
- specLockPath,
118
128
  specSnapshotSchema,
119
- trainingReportSchema,
120
- verifyAsset,
121
- verifyLocalBaseModel,
122
- verifyModelPrefetchCacheReport,
123
- withBundledPythonEnvironment,
124
- withFoundationPythonEnvironment,
125
- withHuggingFaceCacheEnvironment,
126
- withOfflineHuggingFaceCacheEnvironment,
127
- withProgressHeartbeat,
128
- writeSpecLockEntry
129
- } from "./chunk-FSVTMX4L.js";
129
+ trainingReportSchema
130
+ } from "./chunk-G3KT4AYL.js";
131
+ import {
132
+ buildSystemMessage,
133
+ compileSpecToJsonl,
134
+ datasetInputIdentity,
135
+ evaluationSuiteFromChatJsonl,
136
+ exampleToChatRow,
137
+ examplesFromChatJsonl,
138
+ examplesFromSpec,
139
+ normalizeChatJsonlForRelocation
140
+ } from "./chunk-MM75IAY3.js";
130
141
 
131
142
  // src/local-runtime/index.ts
132
- import { readFileSync as readFileSync3, realpathSync } from "fs";
133
- import { createHash as createHash2 } from "crypto";
134
- import { readFile as readFile2, stat } from "fs/promises";
135
- import { basename, dirname, join as join5, relative, resolve as resolve3 } from "path";
143
+ import { readFileSync, realpathSync } from "fs";
144
+ import { createHash } from "crypto";
145
+ import { readFile, stat } from "fs/promises";
146
+ import { basename, dirname, join as join2, relative, resolve as resolve2 } from "path";
136
147
  import { cwd } from "process";
137
148
  import { fileURLToPath } from "url";
138
149
 
@@ -584,344 +595,6 @@ async function runDoctor(config, request, foundationSpec) {
584
595
  return checks;
585
596
  }
586
597
 
587
- // src/local-runtime/model-server.ts
588
- import { readFileSync as readFileSync2, statSync } from "fs";
589
- import { spawn as spawn2 } from "child_process";
590
- import { isAbsolute, resolve as resolve2, join as join3 } from "path";
591
-
592
- // src/local-runtime/serving-runtime.ts
593
- import { createHash } from "crypto";
594
- import { readFileSync } from "fs";
595
- import { join as join2 } from "path";
596
- var root = localRuntimePackageRoot(import.meta.url);
597
- var project = join2(root, "training/serving");
598
- var hash = createHash("sha256");
599
- for (const name of ["pyproject.toml", "uv.lock"]) hash.update(readFileSync(join2(project, name)));
600
- var SERVING_PYTHON_ENVIRONMENT = pythonEnvironmentPath("uv-serving", hash.digest("hex").slice(0, 20));
601
- function buildServingPythonCommand() {
602
- const commandArgs = [
603
- "run",
604
- "--frozen",
605
- "--quiet",
606
- "--project",
607
- project,
608
- "python",
609
- join2(root, "training/adapter/src/serve.py")
610
- ];
611
- return { command: "uv", commandArgs, displayCommand: ["uv", ...commandArgs] };
612
- }
613
- function withServingPythonEnvironment(env) {
614
- return {
615
- ...env,
616
- UV_PROJECT_ENVIRONMENT: SERVING_PYTHON_ENVIRONMENT,
617
- VLLM_NO_USAGE_STATS: "1",
618
- DO_NOT_TRACK: "1",
619
- VLLM_ALLOW_RUNTIME_LORA_UPDATING: "0"
620
- };
621
- }
622
-
623
- // src/local-runtime/model-server.ts
624
- function localArtifactPath(uri) {
625
- if (!uri.startsWith("file://") && !isAbsolute(uri) && /^[a-z][a-z0-9+.-]*:/i.test(uri)) {
626
- throw new Error(`Local TT serving requires a local file artifact, got: ${uri}`);
627
- }
628
- return localModelArtifactPath(uri);
629
- }
630
- function boundedNumber(name, value, minimum, maximum, integer = false) {
631
- if (!Number.isFinite(value) || value < minimum || value > maximum || integer && !Number.isInteger(value)) {
632
- throw new Error(`${name} must be between ${minimum} and ${maximum}`);
633
- }
634
- return value;
635
- }
636
- function isLoopbackHost(host) {
637
- return host === "127.0.0.1" || host === "localhost" || host === "::1" || host === "[::1]";
638
- }
639
- function httpHost(host) {
640
- return host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
641
- }
642
- function buildModelServerLaunch(args) {
643
- const options = args.options ?? {};
644
- const device = options.device ?? args.config.evaluation.inference.device;
645
- if (device !== "cuda") throw new Error("The pinned vLLM serving runtime requires CUDA; CPU serving is not supported.");
646
- const contextLength = boundedNumber(
647
- "contextLength",
648
- options.contextLength ?? args.foundation?.contextLength ?? 16384,
649
- args.foundation ? 1 : 512,
650
- 131072,
651
- true
652
- );
653
- if (args.foundation && contextLength > args.foundation.contextLength) {
654
- throw new Error("Context length exceeds the foundation checkpoint sequence_length.");
655
- }
656
- const gpuMemoryUtilization = boundedNumber("gpuMemoryUtilization", options.gpuMemoryUtilization ?? 0.8, 0.05, 0.95);
657
- const host = options.host ?? "127.0.0.1";
658
- const remote = !isLoopbackHost(host);
659
- if (remote && !options.allowRemote) {
660
- throw new Error("Refusing a non-loopback model server bind without --allow-remote.");
661
- }
662
- const apiKey = options.apiKeyEnv ? process.env[options.apiKeyEnv]?.trim() : void 0;
663
- if (options.apiKeyEnv && !apiKey) throw new Error(`${options.apiKeyEnv} is not set.`);
664
- if (remote && !apiKey) {
665
- throw new Error("Non-loopback serving requires --api-key-env with a populated environment variable.");
666
- }
667
- const port = boundedNumber("port", options.port ?? 8e3, 1, 65535, true);
668
- const maxTokens = boundedNumber("maxTokens", options.maxTokens ?? Math.min(512, contextLength), 1, 8192, true);
669
- const temperature = boundedNumber("temperature", options.temperature ?? 0, 0, 5);
670
- const topP = boundedNumber("topP", options.topP ?? 1, 0, 1);
671
- const maxConcurrentRequests = boundedNumber(
672
- "maxConcurrentRequests",
673
- options.maxConcurrentRequests ?? 1,
674
- 1,
675
- 8,
676
- true
677
- );
678
- const artifactPath = args.artifactUri ? localArtifactPath(args.artifactUri) : void 0;
679
- const recordedBaseModelPath = options.baseModelArtifactUri ? localArtifactPath(options.baseModelArtifactUri) : void 0;
680
- const configuredBaseModelPath = !args.foundation && args.config.paths.baseModel ? resolve2(args.config.paths.baseModel) : void 0;
681
- if (recordedBaseModelPath && configuredBaseModelPath && resolve2(recordedBaseModelPath) !== configuredBaseModelPath) {
682
- throw new Error(
683
- `Configured paths.baseModel ${configuredBaseModelPath} does not match the base model recorded for this artifact: ` + recordedBaseModelPath
684
- );
685
- }
686
- const localBaseModelPath = recordedBaseModelPath ?? configuredBaseModelPath;
687
- const requestedBaseModelRevision = args.foundation ? void 0 : resolveRequestedBaseModelRevision(
688
- args.baseModel,
689
- options.baseModelRevision
690
- );
691
- const baseModelRevision = localBaseModelPath ? defaultBaseModelRevision(args.baseModel) : requestedBaseModelRevision;
692
- const entrypoint = buildServingPythonCommand();
693
- const env = withServingPythonEnvironment(
694
- withOfflineHuggingFaceCacheEnvironment({
695
- ...minimalMachineLearningEnvironment(process.env),
696
- ...artifactPath ? { TT_MODEL_ARTIFACT: artifactPath } : {},
697
- TT_BASE_MODEL: args.baseModel,
698
- ...localBaseModelPath ? { TT_MODEL_SOURCE: localBaseModelPath } : {},
699
- ...baseModelRevision ? { TT_BASE_MODEL_REVISION: baseModelRevision } : {},
700
- TT_MODEL_NAME: args.modelName,
701
- TT_CONTEXT_LENGTH: String(contextLength),
702
- TT_GPU_MEMORY_UTILIZATION: String(gpuMemoryUtilization),
703
- TT_MODEL_LOADER: args.foundation ? "foundation" : resolveModelLoader(args.baseModel),
704
- ...args.foundation ? {
705
- TT_FOUNDATION_CHECKPOINT: args.foundation.checkpoint,
706
- TT_FOUNDATION_TOKENIZER: args.foundation.tokenizer
707
- } : {},
708
- TT_HOST: host,
709
- TT_PORT: String(port),
710
- TT_DEVICE: device,
711
- TT_MAX_TOKENS: String(maxTokens),
712
- TT_TEMPERATURE: String(temperature),
713
- TT_TOP_P: String(topP),
714
- TT_TRUST_REMOTE_CODE: "false",
715
- TT_MAX_CONCURRENT_REQUESTS: String(maxConcurrentRequests),
716
- ...options.systemPrompt ? { TT_SYSTEM_PROMPT: options.systemPrompt } : {},
717
- ...apiKey ? { TT_API_KEY: apiKey } : {}
718
- }, args.config.paths.modelCache)
719
- );
720
- return {
721
- command: entrypoint.command,
722
- commandArgs: entrypoint.commandArgs,
723
- displayCommand: entrypoint.displayCommand,
724
- env,
725
- url: `http://${httpHost(host)}:${port}`,
726
- modelName: args.modelName,
727
- artifactPath
728
- };
729
- }
730
- function buildLocalModelServerLaunch(args) {
731
- return buildModelServerLaunch({
732
- modelName: args.model.id,
733
- baseModel: args.model.base_model,
734
- artifactUri: args.model.artifact_uri,
735
- config: args.config,
736
- options: args.options
737
- });
738
- }
739
- function buildLocalBaseModelServerLaunch(args) {
740
- return buildModelServerLaunch({
741
- modelName: `base:${args.baseModel}`,
742
- baseModel: args.baseModel,
743
- config: args.config,
744
- options: args.options
745
- });
746
- }
747
- async function verifyLocalModelServerLaunch(launch) {
748
- const modelSource = launch.env.TT_MODEL_SOURCE;
749
- const expectedModelId = launch.env.TT_BASE_MODEL;
750
- if (modelSource && expectedModelId) {
751
- await verifyLocalBaseModel(modelSource, expectedModelId, launch.env.HF_HOME);
752
- }
753
- }
754
- async function serveLocalModel(launch) {
755
- if (process.platform !== "linux") throw new Error("Local vLLM serving requires Linux and an NVIDIA CUDA GPU.");
756
- await verifyLocalModelServerLaunch(launch);
757
- await new Promise((resolveServer, reject) => {
758
- const child = spawn2(launch.command, launch.commandArgs, {
759
- env: launch.env,
760
- stdio: "inherit",
761
- detached: process.platform !== "win32"
762
- });
763
- let stopping = false;
764
- let forceKillTimer;
765
- const killProcessGroup = (signal) => {
766
- if (child.pid && process.platform !== "win32") {
767
- try {
768
- process.kill(-child.pid, signal);
769
- return;
770
- } catch {
771
- }
772
- }
773
- child.kill(signal);
774
- };
775
- const stop = (signal) => {
776
- if (stopping) return;
777
- stopping = true;
778
- killProcessGroup(signal);
779
- forceKillTimer = setTimeout(() => killProcessGroup("SIGKILL"), 5e3);
780
- forceKillTimer.unref();
781
- };
782
- const onSigint = () => stop("SIGINT");
783
- const onSigterm = () => stop("SIGTERM");
784
- const cleanup = () => {
785
- process.off("SIGINT", onSigint);
786
- process.off("SIGTERM", onSigterm);
787
- if (forceKillTimer) clearTimeout(forceKillTimer);
788
- };
789
- process.once("SIGINT", onSigint);
790
- process.once("SIGTERM", onSigterm);
791
- child.once("error", (error) => {
792
- cleanup();
793
- reject(error);
794
- });
795
- child.once("close", (code, signal) => {
796
- cleanup();
797
- if (stopping || signal === "SIGINT" || signal === "SIGTERM") {
798
- resolveServer();
799
- } else if (code === 0) {
800
- resolveServer();
801
- } else {
802
- reject(new Error(`Local model server exited with code ${code ?? "unknown"}.`));
803
- }
804
- });
805
- });
806
- }
807
- function buildFoundationModelServerLaunch(args) {
808
- const checkpoint = resolve2(args.checkpoint);
809
- const tokenizer = resolve2(args.tokenizer);
810
- for (const path of [join3(checkpoint, "model.safetensors"), tokenizer]) {
811
- if (!statSync(path).isFile()) throw new Error(`Expected foundation artifact file: ${path}`);
812
- }
813
- const metadata = JSON.parse(readFileSync2(join3(checkpoint, "config.json"), "utf8"));
814
- const contextLength = boundedNumber("sequence_length", metadata.sequence_length, 1, 131072, true);
815
- return buildModelServerLaunch({
816
- modelName: "foundation",
817
- baseModel: "foundation",
818
- config: args.config,
819
- options: args.options,
820
- foundation: { checkpoint, tokenizer, contextLength }
821
- });
822
- }
823
-
824
- // src/local-runtime/active-model.ts
825
- import { randomUUID } from "crypto";
826
- import { appendFile, chmod, readFile, rename, writeFile as writeFile2 } from "fs/promises";
827
- import { join as join4 } from "path";
828
- function pointerPath(store) {
829
- return join4(store.root, "active-model.json");
830
- }
831
- function historyPath(store) {
832
- return join4(store.root, "activation-history.jsonl");
833
- }
834
- async function readPointer(store) {
835
- if (!await hardenExistingLocalStore(store.root)) return null;
836
- try {
837
- const value = JSON.parse(await readFile(pointerPath(store), "utf8"));
838
- if (value.schema_version !== 1 || !["activate", "rollback"].includes(value.action) || value.model_id !== null && typeof value.model_id !== "string" || value.run_id !== null && typeof value.run_id !== "string" || value.previous_model_id !== null && typeof value.previous_model_id !== "string") {
839
- throw new Error("Active model pointer has an invalid shape.");
840
- }
841
- return value;
842
- } catch (error) {
843
- if (error.code === "ENOENT") return null;
844
- throw error;
845
- }
846
- }
847
- async function writePrivatePointer(path, pointer) {
848
- const temporary = `${path}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;
849
- await writeFile2(temporary, `${JSON.stringify(pointer, null, 2)}
850
- `, {
851
- encoding: "utf8",
852
- mode: 384
853
- });
854
- await rename(temporary, path);
855
- await chmod(path, 384);
856
- }
857
- async function appendPrivateHistory(path, pointer) {
858
- await appendFile(path, `${JSON.stringify(pointer)}
859
- `, {
860
- encoding: "utf8",
861
- mode: 384
862
- });
863
- await chmod(path, 384);
864
- }
865
- async function assertModelCanActivate(store, modelId) {
866
- const model = await store.getModel(modelId);
867
- const run = await store.getRun(model.run_id);
868
- if (run.status !== "completed") {
869
- throw new Error(`Model ${model.id} belongs to run ${run.id}, which is not completed.`);
870
- }
871
- const report = runReportSchema.parse(
872
- JSON.parse(await readFile(join4(model.artifact_dir, "run-report.json"), "utf8"))
873
- );
874
- if (!report.general_regression) {
875
- throw new Error(`Model ${model.id} has no general regression evaluation.`);
876
- }
877
- if (!report.general_regression.passed) {
878
- throw new Error(
879
- `Model ${model.id} failed general regression: ` + (report.general_regression.failures.join(" ") || "regression budget exceeded")
880
- );
881
- }
882
- return model;
883
- }
884
- async function publishPointer(store, pointer) {
885
- await store.ensure();
886
- await writePrivatePointer(pointerPath(store), pointer);
887
- await appendPrivateHistory(historyPath(store), pointer);
888
- return pointer;
889
- }
890
- async function getActiveModel(store) {
891
- const pointer = await readPointer(store);
892
- if (!pointer?.model_id) return { pointer, model: null };
893
- return { pointer, model: await store.getModel(pointer.model_id) };
894
- }
895
- async function activateModel(store, modelId) {
896
- const [model, current] = await Promise.all([
897
- assertModelCanActivate(store, modelId),
898
- readPointer(store)
899
- ]);
900
- if (current?.model_id === model.id) return current;
901
- return publishPointer(store, {
902
- schema_version: 1,
903
- model_id: model.id,
904
- run_id: model.run_id,
905
- previous_model_id: current?.model_id ?? null,
906
- activated_at: (/* @__PURE__ */ new Date()).toISOString(),
907
- action: "activate"
908
- });
909
- }
910
- async function rollbackActiveModel(store) {
911
- const current = await readPointer(store);
912
- if (!current) throw new Error("No active-model history exists to roll back.");
913
- const targetId = current.previous_model_id;
914
- const target = targetId ? await assertModelCanActivate(store, targetId) : null;
915
- return publishPointer(store, {
916
- schema_version: 1,
917
- model_id: target?.id ?? null,
918
- run_id: target?.run_id ?? null,
919
- previous_model_id: current.model_id,
920
- activated_at: (/* @__PURE__ */ new Date()).toISOString(),
921
- action: "rollback"
922
- });
923
- }
924
-
925
598
  // src/local-runtime/parent-signals.ts
926
599
  function listenForParentSignals() {
927
600
  if (process.platform !== "win32" || process.env.TT_PARENT_IPC !== "1" || !process.channel) return;
@@ -940,7 +613,7 @@ listenForParentSignals();
940
613
  function packageVersion() {
941
614
  try {
942
615
  const packageJson = JSON.parse(
943
- readFileSync3(resolve3(localRuntimePackageRoot(import.meta.url), "package.json"), "utf8")
616
+ readFileSync(resolve2(localRuntimePackageRoot(import.meta.url), "package.json"), "utf8")
944
617
  );
945
618
  return typeof packageJson.version === "string" ? packageJson.version : "unknown";
946
619
  } catch {
@@ -1359,7 +1032,7 @@ function readNumberOption(argv, name) {
1359
1032
  return value ? Number(value) : void 0;
1360
1033
  }
1361
1034
  async function configSelectionFromArgv(argv, adjacentTo, input) {
1362
- const specPath = adjacentTo ?? readOption(argv, "--spec") ?? resolve3(cwd(), DEFAULT_LOCAL_SPEC_PATH);
1035
+ const specPath = adjacentTo ?? readOption(argv, "--spec") ?? resolve2(cwd(), DEFAULT_LOCAL_SPEC_PATH);
1363
1036
  const resolved = await resolveProjectConfig(specPath, readOption(argv, "--config"), (message) => console.error(message), input);
1364
1037
  return { config: resolved.config, ...resolved.legacyConfigPath ? { path: resolved.legacyConfigPath } : {} };
1365
1038
  }
@@ -1393,70 +1066,13 @@ function createConsoleReporter(options) {
1393
1066
  if (options.quiet) return void 0;
1394
1067
  return createRunConsoleReporter({ verbose: options.verbose });
1395
1068
  }
1396
- async function verifyStoredModel(model, config) {
1397
- const manifestPath = join5(model.artifact_dir, "artifact-manifest.json");
1398
- const integrity = await assertArtifactManifest(manifestPath, {
1399
- requiredPaths: ["stage-metadata.json", "training-report.json"],
1400
- scopeToRequired: true,
1401
- verifyModel: true
1402
- });
1403
- const manifest = JSON.parse(await readFile2(manifestPath, "utf8"));
1404
- if (!manifest.model) {
1405
- throw new Error(`Artifact manifest does not contain a model contract: ${manifestPath}`);
1406
- }
1407
- const artifact = await assertUsableModelArtifact(model.artifact_uri);
1408
- if (typeof manifest.model.base_model_artifact_uri === "string" && typeof manifest.model.base_model_fingerprint === "string") {
1409
- const actualBaseFingerprint = await fingerprintLocalBaseModel(
1410
- manifest.model.base_model_artifact_uri,
1411
- typeof manifest.model.base_model === "string" ? manifest.model.base_model : void 0,
1412
- config.paths.modelCache
1413
- );
1414
- if (actualBaseFingerprint !== manifest.model.base_model_fingerprint) {
1415
- throw new Error("Recorded local base-model content no longer matches the model artifact contract.");
1416
- }
1417
- }
1418
- if (typeof manifest.model.artifact_root !== "string" || resolve3(manifest.model.artifact_root) !== resolve3(artifact.path)) {
1419
- throw new Error("Stored model record does not match the artifact covered by its manifest.");
1420
- }
1421
- if (manifest.model.base_model !== model.base_model) {
1422
- throw new Error("Stored model base model does not match its artifact manifest.");
1423
- }
1424
- return {
1425
- manifest_path: manifestPath,
1426
- integrity,
1427
- artifact,
1428
- contract: manifest.model
1429
- };
1430
- }
1431
- async function verifyActivationEvidence(model) {
1432
- const generalBaseline = join5(model.artifact_dir, "general-baseline-eval.json");
1433
- const generalCandidate = join5(model.artifact_dir, "general-candidate-eval.json");
1434
- const [hasBaseline, hasCandidate] = await Promise.all([
1435
- stat(generalBaseline).then((metadata) => metadata.isFile(), () => false),
1436
- stat(generalCandidate).then((metadata) => metadata.isFile(), () => false)
1437
- ]);
1438
- if (!hasBaseline || !hasCandidate) {
1439
- throw new Error(
1440
- "This model cannot be activated because the run did not include a general-regression suite. Add evaluation.generalRegression to tunedtensor.json with a held-out dataset, re-run training, then activate. Until then, serve the adapter with `tt serve local-<run-id>`."
1441
- );
1442
- }
1443
- await assertArtifactManifest(join5(model.artifact_dir, "artifact-manifest.json"), {
1444
- requiredPaths: [
1445
- "run-report.json",
1446
- "general-baseline-eval.json",
1447
- "general-candidate-eval.json"
1448
- ],
1449
- scopeToRequired: true,
1450
- verifyModel: true
1451
- });
1452
- }
1453
1069
  async function verifyModelArtifactPath(input, config) {
1454
- const inputPath = resolve3(input);
1070
+ const inputPath = resolve2(input);
1455
1071
  let manifestPath;
1456
1072
  let artifactUri = inputPath;
1457
1073
  if (basename(inputPath) === "artifact-manifest.json") {
1458
1074
  manifestPath = inputPath;
1459
- const raw = JSON.parse(await readFile2(inputPath, "utf8"));
1075
+ const raw = JSON.parse(await readFile(inputPath, "utf8"));
1460
1076
  if (typeof raw.model?.artifact_root !== "string") {
1461
1077
  throw new Error(`Artifact manifest does not contain a model contract: ${inputPath}`);
1462
1078
  }
@@ -1466,11 +1082,11 @@ async function verifyModelArtifactPath(input, config) {
1466
1082
  if (!metadata) throw new Error(`Model not found and artifact path does not exist: ${input}`);
1467
1083
  let current = metadata.isDirectory() ? inputPath : dirname(inputPath);
1468
1084
  for (let depth = 0; depth < 8; depth += 1) {
1469
- const candidate = join5(current, "artifact-manifest.json");
1470
- const raw = await readFile2(candidate, "utf8").catch(() => null);
1085
+ const candidate = join2(current, "artifact-manifest.json");
1086
+ const raw = await readFile(candidate, "utf8").catch(() => null);
1471
1087
  if (raw) {
1472
1088
  const parsed = JSON.parse(raw);
1473
- if (typeof parsed.model?.artifact_root === "string" && resolve3(parsed.model.artifact_root) === resolve3(inputPath)) {
1089
+ if (typeof parsed.model?.artifact_root === "string" && resolve2(parsed.model.artifact_root) === resolve2(inputPath)) {
1474
1090
  manifestPath = candidate;
1475
1091
  break;
1476
1092
  }
@@ -1488,7 +1104,7 @@ async function verifyModelArtifactPath(input, config) {
1488
1104
  scopeToRequired: true,
1489
1105
  verifyModel: true
1490
1106
  });
1491
- const manifest = JSON.parse(await readFile2(manifestPath, "utf8"));
1107
+ const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
1492
1108
  if (!manifest.model) throw new Error(`Artifact manifest does not contain a model contract: ${manifestPath}`);
1493
1109
  const artifact = await assertUsableModelArtifact(artifactUri);
1494
1110
  if (typeof manifest.model.base_model_artifact_uri === "string" && typeof manifest.model.base_model_fingerprint === "string") {
@@ -1501,7 +1117,7 @@ async function verifyModelArtifactPath(input, config) {
1501
1117
  throw new Error("Recorded local base-model content no longer matches the model artifact contract.");
1502
1118
  }
1503
1119
  }
1504
- if (typeof manifest.model.artifact_root !== "string" || resolve3(manifest.model.artifact_root) !== resolve3(artifact.path)) {
1120
+ if (typeof manifest.model.artifact_root !== "string" || resolve2(manifest.model.artifact_root) !== resolve2(artifact.path)) {
1505
1121
  throw new Error("Model path does not match the artifact covered by its manifest.");
1506
1122
  }
1507
1123
  return { manifest_path: manifestPath, integrity, artifact, contract: manifest.model };
@@ -1514,10 +1130,10 @@ async function modelSystemPrompt(args) {
1514
1130
  if (hasFlag(args.argv, "--no-spec-prompt")) return void 0;
1515
1131
  let spec;
1516
1132
  if (specPath) {
1517
- const input = JSON.parse(await readFile2(resolve3(specPath), "utf8"));
1133
+ const input = JSON.parse(await readFile(resolve2(specPath), "utf8"));
1518
1134
  const local = localBehaviorSpecFileSchema.safeParse(input);
1519
1135
  if (!local.success) {
1520
- throw new Error(`--spec must contain a tunedtensor.json behavior spec: ${resolve3(specPath)}`);
1136
+ throw new Error(`--spec must contain a tunedtensor.json behavior spec: ${resolve2(specPath)}`);
1521
1137
  }
1522
1138
  if (isFoundationSpecFile(local.data)) {
1523
1139
  throw new Error("Foundation specs have no Hugging Face base model. Use `tt serve foundation --checkpoint <model-dir> --tokenizer <tokenizer.json>`.");
@@ -1525,10 +1141,10 @@ async function modelSystemPrompt(args) {
1525
1141
  if (isDecisionSpecFile(local.data)) throw new Error(DECISION_SERVE_MESSAGE);
1526
1142
  spec = local.data;
1527
1143
  } else {
1528
- const runRequestPath = join5(args.store.paths.runsDir, args.model.run_id, "request.json");
1144
+ const runRequestPath = join2(args.store.paths.runsDir, args.model.run_id, "request.json");
1529
1145
  let persistedRequest = null;
1530
1146
  try {
1531
- persistedRequest = fineTuneRunRequestSchema.parse(JSON.parse(await readFile2(runRequestPath, "utf8")));
1147
+ persistedRequest = fineTuneRunRequestSchema.parse(JSON.parse(await readFile(runRequestPath, "utf8")));
1532
1148
  } catch (error) {
1533
1149
  if (error.code !== "ENOENT") throw error;
1534
1150
  }
@@ -1541,9 +1157,9 @@ async function modelSystemPrompt(args) {
1541
1157
  }
1542
1158
  const prompt = buildSystemMessage(spec);
1543
1159
  const metadata = JSON.parse(
1544
- await readFile2(join5(args.model.artifact_dir, "stage-metadata.json"), "utf8")
1160
+ await readFile(join2(args.model.artifact_dir, "stage-metadata.json"), "utf8")
1545
1161
  );
1546
- const promptHash = createHash2("sha256").update(prompt).digest("hex");
1162
+ const promptHash = createHash("sha256").update(prompt).digest("hex");
1547
1163
  if (metadata.system_prompt_sha256 !== promptHash) {
1548
1164
  throw new Error(
1549
1165
  "Behavior spec instructions do not match the prompt fingerprint used for this trained model. Pass the original --spec, or use --no-spec-prompt only when this change is intentional."
@@ -1666,10 +1282,10 @@ async function serveBaseModelFromCli(args) {
1666
1282
  if (explicitSpecPath && hasFlag(args.argv, "--no-spec-prompt")) {
1667
1283
  throw new Error("Use only one of --spec or --no-spec-prompt.");
1668
1284
  }
1669
- const defaultSpecPath = resolve3(DEFAULT_LOCAL_SPEC_PATH);
1670
- const specPath = explicitSpecPath ? resolve3(explicitSpecPath) : (await stat(defaultSpecPath).catch(() => null))?.isFile() ? defaultSpecPath : void 0;
1285
+ const defaultSpecPath = resolve2(DEFAULT_LOCAL_SPEC_PATH);
1286
+ const specPath = explicitSpecPath ? resolve2(explicitSpecPath) : (await stat(defaultSpecPath).catch(() => null))?.isFile() ? defaultSpecPath : void 0;
1671
1287
  const spec = specPath ? localBehaviorSpecFileSchema.parse(
1672
- JSON.parse(await readFile2(specPath, "utf8"))
1288
+ JSON.parse(await readFile(specPath, "utf8"))
1673
1289
  ) : void 0;
1674
1290
  if (spec && isFoundationSpecFile(spec)) {
1675
1291
  throw new Error("Foundation specs have no Hugging Face base model. Use `tt serve foundation --checkpoint <model-dir> --tokenizer <tokenizer.json>`.");
@@ -1720,7 +1336,7 @@ async function serveModelTargetFromCli(args) {
1720
1336
  if (specPath && hasFlag(args.argv, "--no-spec-prompt")) {
1721
1337
  throw new Error("Use only one of --spec or --no-spec-prompt.");
1722
1338
  }
1723
- const spec = specPath ? localBehaviorSpecFileSchema.parse(JSON.parse(await readFile2(resolve3(specPath), "utf8"))) : void 0;
1339
+ const spec = specPath ? localBehaviorSpecFileSchema.parse(JSON.parse(await readFile(resolve2(specPath), "utf8"))) : void 0;
1724
1340
  if (spec && !isFoundationSpecFile(spec)) throw new Error("Foundation serving requires a foundation spec.");
1725
1341
  const launch = buildFoundationModelServerLaunch({
1726
1342
  checkpoint,
@@ -1799,7 +1415,7 @@ async function main(argv) {
1799
1415
  return;
1800
1416
  }
1801
1417
  if (command === "doctor") {
1802
- const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1418
+ const inputPath = resolve2(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1803
1419
  const configSelection = await configSelectionFromArgv(argv, inputPath);
1804
1420
  const hasDefaultSpec = cli.positionals[0] ? true : Boolean((await stat(inputPath).catch(() => null))?.isFile());
1805
1421
  let request;
@@ -1845,7 +1461,7 @@ async function main(argv) {
1845
1461
  return;
1846
1462
  }
1847
1463
  if (command === "init") {
1848
- const outputPath = resolve3(readOption(argv, "--output") ?? DEFAULT_LOCAL_SPEC_PATH);
1464
+ const outputPath = resolve2(readOption(argv, "--output") ?? DEFAULT_LOCAL_SPEC_PATH);
1849
1465
  const profile = readOption(argv, "--profile");
1850
1466
  if (profile !== void 0 && profile !== "spark") {
1851
1467
  throw new Error(`--profile must be spark, got: ${profile}`);
@@ -1878,7 +1494,7 @@ async function main(argv) {
1878
1494
  return;
1879
1495
  }
1880
1496
  if (command === "validate") {
1881
- const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1497
+ const inputPath = resolve2(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1882
1498
  const loaded = await loadLocalRunInput(inputPath);
1883
1499
  if (loaded.kind === "foundation-spec") {
1884
1500
  assertFoundationSpecReady(loaded.spec);
@@ -1953,7 +1569,7 @@ ${validation.errors.join("\n")}`);
1953
1569
  return;
1954
1570
  }
1955
1571
  if (command === "run") {
1956
- const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1572
+ const inputPath = resolve2(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1957
1573
  const input = await loadCliBehaviorSpec(inputPath);
1958
1574
  const configSelection = await configSelectionFromArgv(argv, inputPath, input);
1959
1575
  const configInput = configSelection.config;
@@ -1991,7 +1607,7 @@ ${validation.errors.join("\n")}`);
1991
1607
  });
1992
1608
  }
1993
1609
  if (!config.dryRun) await enforceSpecLock({ specPath: input.path, request, config, reporter });
1994
- const specFile = /^\..+\.tt-local-/.test(basename(input.path)) ? void 0 : { path: input.path, sha256: specHash(await readFile2(input.path, "utf8")) };
1610
+ const specFile = /^\..+\.tt-local-/.test(basename(input.path)) ? void 0 : { path: input.path, sha256: specHash(await readFile(input.path, "utf8")) };
1995
1611
  if (input.spec.pipeline) {
1996
1612
  const result2 = await runLocalPipeline({ request, config, reporter, pipeline: pipelineForRunInput(input), projectSpec: input.spec, specFile });
1997
1613
  printJson(result2);
@@ -2012,6 +1628,7 @@ ${validation.errors.join("\n")}`);
2012
1628
  baseline_eval: result.report.artifact_uris.baseline_eval,
2013
1629
  candidate_eval: result.report.artifact_uris.candidate_eval,
2014
1630
  comparison: result.report.comparison,
1631
+ task_quality: result.report.task_quality,
2015
1632
  general_regression: result.report.general_regression
2016
1633
  });
2017
1634
  return;
@@ -2083,7 +1700,7 @@ ${validation.errors.join("\n")}`);
2083
1700
  });
2084
1701
  return printJson(hasFlag(argv, "--dry-run") ? prepared.preview : await executeDatasetSplit(cwd(), prepared));
2085
1702
  }
2086
- const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
1703
+ const inputPath = resolve2(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
2087
1704
  const config = readOption(argv, "--repo") ? await resolveDownloadConfig(inputPath, readOption(argv, "--config"), (message) => console.error(message)) : await configFromArgv(argv, inputPath);
2088
1705
  if (subcommand !== "prefetch" && subcommand !== "verify") throw new Error(`Unknown datasets command: ${subcommand}`);
2089
1706
  const reporter = createConsoleReporter({
@@ -2133,7 +1750,7 @@ ${validation.errors.join("\n")}`);
2133
1750
  }
2134
1751
  if (command === "models") {
2135
1752
  const subcommand = cli.subcommand;
2136
- const modelInputPath = subcommand === "prefetch" || subcommand === "verify-base" ? resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH) : void 0;
1753
+ const modelInputPath = subcommand === "prefetch" || subcommand === "verify-base" ? resolve2(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH) : void 0;
2137
1754
  const config = subcommand === "prefetch" && readOption(argv, "--repo") ? await resolveDownloadConfig(modelInputPath, readOption(argv, "--config"), (message) => console.error(message)) : await configFromArgv(argv, modelInputPath);
2138
1755
  const store = createLocalStore(config.storeRoot);
2139
1756
  if (subcommand === "list") return printJson(await store.listModels());
@@ -2151,7 +1768,7 @@ ${validation.errors.join("\n")}`);
2151
1768
  if (subcommand === "verify") {
2152
1769
  const id = cli.positionals[0];
2153
1770
  if (!id) throw new Error("models verify requires <model-id-or-artifact-path>");
2154
- if (await stat(resolve3(id)).then(() => true, () => false)) {
1771
+ if (await stat(resolve2(id)).then(() => true, () => false)) {
2155
1772
  return printJson({ ok: true, model: null, ...await verifyModelArtifactPath(id, config) });
2156
1773
  }
2157
1774
  const model = await store.getModel(id);