athanor 1.0.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 (230) hide show
  1. package/AGENTS.md +201 -0
  2. package/LICENSE +201 -0
  3. package/README.md +627 -0
  4. package/bin/athanor +2 -0
  5. package/dist/adapters/__fixtures.d.ts +4 -0
  6. package/dist/adapters/__fixtures.d.ts.map +1 -0
  7. package/dist/adapters/__fixtures.js +29 -0
  8. package/dist/adapters/__fixtures.js.map +1 -0
  9. package/dist/adapters/health.d.ts +9 -0
  10. package/dist/adapters/health.d.ts.map +1 -0
  11. package/dist/adapters/health.js +44 -0
  12. package/dist/adapters/health.js.map +1 -0
  13. package/dist/adapters/index.d.ts +13 -0
  14. package/dist/adapters/index.d.ts.map +1 -0
  15. package/dist/adapters/index.js +59 -0
  16. package/dist/adapters/index.js.map +1 -0
  17. package/dist/adapters/llama.d.ts +10 -0
  18. package/dist/adapters/llama.d.ts.map +1 -0
  19. package/dist/adapters/llama.js +28 -0
  20. package/dist/adapters/llama.js.map +1 -0
  21. package/dist/adapters/mlx.d.ts +11 -0
  22. package/dist/adapters/mlx.d.ts.map +1 -0
  23. package/dist/adapters/mlx.js +54 -0
  24. package/dist/adapters/mlx.js.map +1 -0
  25. package/dist/app/models.d.ts +22 -0
  26. package/dist/app/models.d.ts.map +1 -0
  27. package/dist/app/models.js +81 -0
  28. package/dist/app/models.js.map +1 -0
  29. package/dist/cli/commands.d.ts +6 -0
  30. package/dist/cli/commands.d.ts.map +1 -0
  31. package/dist/cli/commands.js +50 -0
  32. package/dist/cli/commands.js.map +1 -0
  33. package/dist/cli/doctor.d.ts +2 -0
  34. package/dist/cli/doctor.d.ts.map +1 -0
  35. package/dist/cli/doctor.js +16 -0
  36. package/dist/cli/doctor.js.map +1 -0
  37. package/dist/cli/format.d.ts +6 -0
  38. package/dist/cli/format.d.ts.map +1 -0
  39. package/dist/cli/format.js +59 -0
  40. package/dist/cli/format.js.map +1 -0
  41. package/dist/cli/index.d.ts +2 -0
  42. package/dist/cli/index.d.ts.map +1 -0
  43. package/dist/cli/index.js +214 -0
  44. package/dist/cli/index.js.map +1 -0
  45. package/dist/cli/model-commands.d.ts +13 -0
  46. package/dist/cli/model-commands.d.ts.map +1 -0
  47. package/dist/cli/model-commands.js +201 -0
  48. package/dist/cli/model-commands.js.map +1 -0
  49. package/dist/cli/preset-commands.d.ts +7 -0
  50. package/dist/cli/preset-commands.d.ts.map +1 -0
  51. package/dist/cli/preset-commands.js +78 -0
  52. package/dist/cli/preset-commands.js.map +1 -0
  53. package/dist/cli/pull-renderer.d.ts +7 -0
  54. package/dist/cli/pull-renderer.d.ts.map +1 -0
  55. package/dist/cli/pull-renderer.js +109 -0
  56. package/dist/cli/pull-renderer.js.map +1 -0
  57. package/dist/cli/shared.d.ts +6 -0
  58. package/dist/cli/shared.d.ts.map +1 -0
  59. package/dist/cli/shared.js +7 -0
  60. package/dist/cli/shared.js.map +1 -0
  61. package/dist/cli/style.d.ts +29 -0
  62. package/dist/cli/style.d.ts.map +1 -0
  63. package/dist/cli/style.js +63 -0
  64. package/dist/cli/style.js.map +1 -0
  65. package/dist/cli/system-commands.d.ts +16 -0
  66. package/dist/cli/system-commands.d.ts.map +1 -0
  67. package/dist/cli/system-commands.js +109 -0
  68. package/dist/cli/system-commands.js.map +1 -0
  69. package/dist/config/index.d.ts +52 -0
  70. package/dist/config/index.d.ts.map +1 -0
  71. package/dist/config/index.js +223 -0
  72. package/dist/config/index.js.map +1 -0
  73. package/dist/control/server.d.ts +4 -0
  74. package/dist/control/server.d.ts.map +1 -0
  75. package/dist/control/server.js +84 -0
  76. package/dist/control/server.js.map +1 -0
  77. package/dist/discovery/ingest.d.ts +8 -0
  78. package/dist/discovery/ingest.d.ts.map +1 -0
  79. package/dist/discovery/ingest.js +18 -0
  80. package/dist/discovery/ingest.js.map +1 -0
  81. package/dist/discovery/scanner.d.ts +8 -0
  82. package/dist/discovery/scanner.d.ts.map +1 -0
  83. package/dist/discovery/scanner.js +261 -0
  84. package/dist/discovery/scanner.js.map +1 -0
  85. package/dist/discovery/watcher.d.ts +15 -0
  86. package/dist/discovery/watcher.d.ts.map +1 -0
  87. package/dist/discovery/watcher.js +71 -0
  88. package/dist/discovery/watcher.js.map +1 -0
  89. package/dist/index.d.ts +3 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +67 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/presets/edit.d.ts +14 -0
  94. package/dist/presets/edit.d.ts.map +1 -0
  95. package/dist/presets/edit.js +105 -0
  96. package/dist/presets/edit.js.map +1 -0
  97. package/dist/presets/recipes.d.ts +12 -0
  98. package/dist/presets/recipes.d.ts.map +1 -0
  99. package/dist/presets/recipes.js +91 -0
  100. package/dist/presets/recipes.js.map +1 -0
  101. package/dist/pull/api.d.ts +14 -0
  102. package/dist/pull/api.d.ts.map +1 -0
  103. package/dist/pull/api.js +29 -0
  104. package/dist/pull/api.js.map +1 -0
  105. package/dist/pull/download.d.ts +46 -0
  106. package/dist/pull/download.d.ts.map +1 -0
  107. package/dist/pull/download.js +133 -0
  108. package/dist/pull/download.js.map +1 -0
  109. package/dist/pull/hf.d.ts +16 -0
  110. package/dist/pull/hf.d.ts.map +1 -0
  111. package/dist/pull/hf.js +50 -0
  112. package/dist/pull/hf.js.map +1 -0
  113. package/dist/pull/hf_pull.py +137 -0
  114. package/dist/pull/resolve-python.d.ts +11 -0
  115. package/dist/pull/resolve-python.d.ts.map +1 -0
  116. package/dist/pull/resolve-python.js +81 -0
  117. package/dist/pull/resolve-python.js.map +1 -0
  118. package/dist/pull/suggestions.d.ts +11 -0
  119. package/dist/pull/suggestions.d.ts.map +1 -0
  120. package/dist/pull/suggestions.js +24 -0
  121. package/dist/pull/suggestions.js.map +1 -0
  122. package/dist/registry/index.d.ts +28 -0
  123. package/dist/registry/index.d.ts.map +1 -0
  124. package/dist/registry/index.js +125 -0
  125. package/dist/registry/index.js.map +1 -0
  126. package/dist/registry/materialize.d.ts +19 -0
  127. package/dist/registry/materialize.d.ts.map +1 -0
  128. package/dist/registry/materialize.js +96 -0
  129. package/dist/registry/materialize.js.map +1 -0
  130. package/dist/registry/sort.d.ts +4 -0
  131. package/dist/registry/sort.d.ts.map +1 -0
  132. package/dist/registry/sort.js +20 -0
  133. package/dist/registry/sort.js.map +1 -0
  134. package/dist/router/server.d.ts +10 -0
  135. package/dist/router/server.d.ts.map +1 -0
  136. package/dist/router/server.js +158 -0
  137. package/dist/router/server.js.map +1 -0
  138. package/dist/search/format.d.ts +6 -0
  139. package/dist/search/format.d.ts.map +1 -0
  140. package/dist/search/format.js +62 -0
  141. package/dist/search/format.js.map +1 -0
  142. package/dist/search/hf.d.ts +39 -0
  143. package/dist/search/hf.d.ts.map +1 -0
  144. package/dist/search/hf.js +242 -0
  145. package/dist/search/hf.js.map +1 -0
  146. package/dist/supervisor/index.d.ts +18 -0
  147. package/dist/supervisor/index.d.ts.map +1 -0
  148. package/dist/supervisor/index.js +149 -0
  149. package/dist/supervisor/index.js.map +1 -0
  150. package/dist/supervisor/inflight.d.ts +6 -0
  151. package/dist/supervisor/inflight.d.ts.map +1 -0
  152. package/dist/supervisor/inflight.js +66 -0
  153. package/dist/supervisor/inflight.js.map +1 -0
  154. package/dist/supervisor/logs.d.ts +7 -0
  155. package/dist/supervisor/logs.d.ts.map +1 -0
  156. package/dist/supervisor/logs.js +31 -0
  157. package/dist/supervisor/logs.js.map +1 -0
  158. package/dist/supervisor/metrics.d.ts +26 -0
  159. package/dist/supervisor/metrics.d.ts.map +1 -0
  160. package/dist/supervisor/metrics.js +156 -0
  161. package/dist/supervisor/metrics.js.map +1 -0
  162. package/dist/supervisor/policies.d.ts +6 -0
  163. package/dist/supervisor/policies.d.ts.map +1 -0
  164. package/dist/supervisor/policies.js +17 -0
  165. package/dist/supervisor/policies.js.map +1 -0
  166. package/dist/supervisor/state.d.ts +5 -0
  167. package/dist/supervisor/state.d.ts.map +1 -0
  168. package/dist/supervisor/state.js +34 -0
  169. package/dist/supervisor/state.js.map +1 -0
  170. package/dist/sync/pi.d.ts +15 -0
  171. package/dist/sync/pi.d.ts.map +1 -0
  172. package/dist/sync/pi.js +228 -0
  173. package/dist/sync/pi.js.map +1 -0
  174. package/dist/types/index.d.ts +87 -0
  175. package/dist/types/index.d.ts.map +1 -0
  176. package/dist/types/index.js +2 -0
  177. package/dist/types/index.js.map +1 -0
  178. package/dist/ui/App.d.ts +7 -0
  179. package/dist/ui/App.d.ts.map +1 -0
  180. package/dist/ui/App.js +218 -0
  181. package/dist/ui/App.js.map +1 -0
  182. package/dist/ui/Banner.d.ts +9 -0
  183. package/dist/ui/Banner.d.ts.map +1 -0
  184. package/dist/ui/Banner.js +58 -0
  185. package/dist/ui/Banner.js.map +1 -0
  186. package/dist/ui/LogFocus.d.ts +13 -0
  187. package/dist/ui/LogFocus.d.ts.map +1 -0
  188. package/dist/ui/LogFocus.js +92 -0
  189. package/dist/ui/LogFocus.js.map +1 -0
  190. package/dist/ui/LogTail.d.ts +7 -0
  191. package/dist/ui/LogTail.d.ts.map +1 -0
  192. package/dist/ui/LogTail.js +22 -0
  193. package/dist/ui/LogTail.js.map +1 -0
  194. package/dist/ui/ModelList.d.ts +16 -0
  195. package/dist/ui/ModelList.d.ts.map +1 -0
  196. package/dist/ui/ModelList.js +91 -0
  197. package/dist/ui/ModelList.js.map +1 -0
  198. package/dist/ui/PresetEditor.d.ts +7 -0
  199. package/dist/ui/PresetEditor.d.ts.map +1 -0
  200. package/dist/ui/PresetEditor.js +149 -0
  201. package/dist/ui/PresetEditor.js.map +1 -0
  202. package/dist/ui/PullModal.d.ts +9 -0
  203. package/dist/ui/PullModal.d.ts.map +1 -0
  204. package/dist/ui/PullModal.js +139 -0
  205. package/dist/ui/PullModal.js.map +1 -0
  206. package/dist/ui/SearchBrowser.d.ts +11 -0
  207. package/dist/ui/SearchBrowser.d.ts.map +1 -0
  208. package/dist/ui/SearchBrowser.js +433 -0
  209. package/dist/ui/SearchBrowser.js.map +1 -0
  210. package/dist/ui/Suggestions.d.ts +6 -0
  211. package/dist/ui/Suggestions.d.ts.map +1 -0
  212. package/dist/ui/Suggestions.js +10 -0
  213. package/dist/ui/Suggestions.js.map +1 -0
  214. package/dist/ui/useAppData.d.ts +17 -0
  215. package/dist/ui/useAppData.d.ts.map +1 -0
  216. package/dist/ui/useAppData.js +47 -0
  217. package/dist/ui/useAppData.js.map +1 -0
  218. package/dist/ui/useAppInput.d.ts +33 -0
  219. package/dist/ui/useAppInput.d.ts.map +1 -0
  220. package/dist/ui/useAppInput.js +128 -0
  221. package/dist/ui/useAppInput.js.map +1 -0
  222. package/dist/ui/useModelActions.d.ts +18 -0
  223. package/dist/ui/useModelActions.d.ts.map +1 -0
  224. package/dist/ui/useModelActions.js +78 -0
  225. package/dist/ui/useModelActions.js.map +1 -0
  226. package/dist/ui/useMouseWheel.d.ts +19 -0
  227. package/dist/ui/useMouseWheel.d.ts.map +1 -0
  228. package/dist/ui/useMouseWheel.js +92 -0
  229. package/dist/ui/useMouseWheel.js.map +1 -0
  230. package/package.json +53 -0
@@ -0,0 +1,133 @@
1
+ import { spawn } from "child_process";
2
+ import * as fs from "fs";
3
+ import * as path from "path";
4
+ import { fileURLToPath } from "url";
5
+ import { resolvePythonForHf } from "./resolve-python.js";
6
+ export class PullAbortedError extends Error {
7
+ constructor() {
8
+ super("pull aborted");
9
+ this.name = "PullAbortedError";
10
+ }
11
+ }
12
+ // Kept for stderr parsing. huggingface_hub occasionally writes
13
+ // tqdm-style warning lines to stderr even with a custom tqdm_class;
14
+ // split on \r or \n and drop empties so each frame surfaces once.
15
+ export function splitHfChunks(text) {
16
+ return text.split(/[\r\n]+/).map(l => l.trim()).filter(l => l.length > 0);
17
+ }
18
+ function resolveSidecarScript() {
19
+ // Same layout in dev (src/pull/*.ts executed via tsx) and prod
20
+ // (dist/pull/*.js after tsc + postbuild copy). hf_pull.py lives
21
+ // next to this module in both cases.
22
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "hf_pull.py");
23
+ }
24
+ export function runHfDownload(opts) {
25
+ return new Promise((resolve, reject) => {
26
+ if (opts.signal?.aborted) {
27
+ reject(new PullAbortedError());
28
+ return;
29
+ }
30
+ fs.mkdirSync(opts.localDir, { recursive: true });
31
+ const python = resolvePythonForHf();
32
+ if (!python) {
33
+ reject(new Error("no Python interpreter found. Install huggingface_hub with: " +
34
+ "uv tool install huggingface_hub (or pipx install huggingface_hub)"));
35
+ return;
36
+ }
37
+ const payload = JSON.stringify({
38
+ repo: opts.repo,
39
+ revision: opts.revision ?? null,
40
+ file: opts.file ?? null,
41
+ // snapshot_download writes to local_dir when set, otherwise
42
+ // into ~/.cache/huggingface/hub. MLX pulls keep the classic
43
+ // cache layout so scanner + external hf tools stay consistent;
44
+ // GGUF pulls use local_dir for a flat file.
45
+ local_dir: opts.file ? opts.localDir : null
46
+ });
47
+ const proc = spawn(python, [resolveSidecarScript(), payload], {
48
+ stdio: ["ignore", "pipe", "pipe"]
49
+ });
50
+ // NDJSON on stdout: buffer by line, JSON-parse, deliver to
51
+ // onEvent. Anything that fails to parse falls through to onLine
52
+ // so it isn't silently dropped.
53
+ let stdoutBuf = "";
54
+ let lastError = null;
55
+ proc.stdout?.on("data", (b) => {
56
+ stdoutBuf += b.toString();
57
+ for (;;) {
58
+ const nl = stdoutBuf.indexOf("\n");
59
+ if (nl < 0)
60
+ break;
61
+ const line = stdoutBuf.slice(0, nl).trim();
62
+ stdoutBuf = stdoutBuf.slice(nl + 1);
63
+ if (!line)
64
+ continue;
65
+ try {
66
+ const ev = JSON.parse(line);
67
+ if (ev.type === "error")
68
+ lastError = ev.message;
69
+ opts.onEvent?.(ev);
70
+ }
71
+ catch {
72
+ opts.onLine?.(line);
73
+ }
74
+ }
75
+ });
76
+ proc.stderr?.on("data", (b) => {
77
+ for (const l of splitHfChunks(b.toString()))
78
+ opts.onLine?.(l);
79
+ });
80
+ let aborted = false;
81
+ let killTimer = null;
82
+ const onAbort = () => {
83
+ if (aborted)
84
+ return;
85
+ aborted = true;
86
+ try {
87
+ proc.kill("SIGTERM");
88
+ }
89
+ catch { /* already dead */ }
90
+ killTimer = setTimeout(() => {
91
+ try {
92
+ proc.kill("SIGKILL");
93
+ }
94
+ catch { /* already dead */ }
95
+ }, 3000);
96
+ killTimer.unref();
97
+ };
98
+ if (opts.signal)
99
+ opts.signal.addEventListener("abort", onAbort, { once: true });
100
+ proc.on("error", err => {
101
+ if (killTimer)
102
+ clearTimeout(killTimer);
103
+ opts.signal?.removeEventListener("abort", onAbort);
104
+ reject(err);
105
+ });
106
+ proc.on("exit", code => {
107
+ if (killTimer)
108
+ clearTimeout(killTimer);
109
+ opts.signal?.removeEventListener("abort", onAbort);
110
+ if (aborted)
111
+ reject(new PullAbortedError());
112
+ else if (code === 0)
113
+ resolve();
114
+ else
115
+ reject(new Error(lastError ?? `hf_pull exited with code ${code}`));
116
+ });
117
+ });
118
+ }
119
+ export function resolveMlxSnapshot(hubDir, repo) {
120
+ const modelDir = path.join(hubDir, `models--${repo.replace("/", "--")}`);
121
+ const refsMain = path.join(modelDir, "refs", "main");
122
+ try {
123
+ if (fs.existsSync(refsMain)) {
124
+ const hash = fs.readFileSync(refsMain, "utf8").trim();
125
+ const candidate = path.join(modelDir, "snapshots", hash);
126
+ if (fs.existsSync(candidate))
127
+ return candidate;
128
+ }
129
+ }
130
+ catch { /* fall through */ }
131
+ return null;
132
+ }
133
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/pull/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AA4BxD,MAAM,OAA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AAC,CAAC,kBAAkB,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ModelEntry } from "../types/index.js";
2
+ import { type ProgressEvent } from "./download.js";
3
+ export { fetchRepoInfo, inferRuntimeFromRepo, listGgufFiles } from "./api.js";
4
+ export interface PullOptions {
5
+ repo: string;
6
+ file?: string;
7
+ revision?: string;
8
+ onLine?: (line: string) => void;
9
+ onEvent?: (event: ProgressEvent) => void;
10
+ signal?: AbortSignal;
11
+ }
12
+ export interface PullResult {
13
+ entry: ModelEntry;
14
+ }
15
+ export declare function pull(opts: PullOptions): Promise<PullResult>;
16
+ //# sourceMappingURL=hf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hf.d.ts","sourceRoot":"","sources":["../../src/pull/hf.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,mBAAmB,CAAA;AAWhE,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAGrF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAM7E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAG/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAIxC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAgDjE"}
@@ -0,0 +1,50 @@
1
+ import * as os from "os";
2
+ import * as path from "path";
3
+ import { materializeRegistryEntry, pullToMaterializeInput } from "../registry/materialize.js";
4
+ import { getModelDirs } from "../config/index.js";
5
+ import { fetchRepoInfo, inferRuntimeFromRepo, listGgufFiles } from "./api.js";
6
+ import { runHfDownload, resolveMlxSnapshot } from "./download.js";
7
+ import { detectMlxCapabilities } from "../discovery/scanner.js";
8
+ export { fetchRepoInfo, inferRuntimeFromRepo, listGgufFiles } from "./api.js";
9
+ function expandHome(p) {
10
+ return p.replace(/^~/, os.homedir());
11
+ }
12
+ export async function pull(opts) {
13
+ const info = await fetchRepoInfo(opts.repo, opts.revision);
14
+ const runtime = inferRuntimeFromRepo(info);
15
+ if (!runtime) {
16
+ throw new Error(`Could not infer runtime for ${opts.repo}; specify --file <name.gguf> for llama.cpp`);
17
+ }
18
+ let file = opts.file;
19
+ if (runtime === "llama.cpp" && !file) {
20
+ const ggufs = listGgufFiles(info);
21
+ if (ggufs.length === 1)
22
+ file = ggufs[0].rfilename;
23
+ else {
24
+ throw new Error(`Multiple GGUF files in ${opts.repo}; specify --file <name.gguf>. Available: ${ggufs.map(g => g.rfilename).join(", ")}`);
25
+ }
26
+ }
27
+ const dirs = getModelDirs();
28
+ const localDir = runtime === "mlx"
29
+ ? expandHome(dirs.mlx)
30
+ : path.join(expandHome(dirs.llama), opts.repo.replace("/", "--"));
31
+ await runHfDownload({
32
+ repo: opts.repo,
33
+ localDir,
34
+ file,
35
+ revision: opts.revision,
36
+ onLine: opts.onLine,
37
+ onEvent: opts.onEvent,
38
+ signal: opts.signal
39
+ });
40
+ const resolvedPath = runtime === "llama.cpp"
41
+ ? path.join(localDir, file)
42
+ : resolveMlxSnapshot(localDir, opts.repo) ?? localDir;
43
+ // resolvedPath for MLX points at snapshots/<hash>/ — that's where
44
+ // config.json lives and what detectMlxCapabilities expects.
45
+ const mlxCapabilities = runtime === "mlx" ? detectMlxCapabilities(resolvedPath) : undefined;
46
+ return {
47
+ entry: materializeRegistryEntry(pullToMaterializeInput(opts.repo, file, opts.revision, runtime, resolvedPath, ml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EAAE,wBAAwB,CAC7B,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,CAAC,CAC/F,CAAC,KAAK;KACR,CAAA;AACH,CAAC"}
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env python3
2
+ # athanor pull sidecar.
3
+ #
4
+ # Drives huggingface_hub.snapshot_download (or hf_hub_download for the
5
+ # single-file GGUF case) and emits structured NDJSON progress events
6
+ # on stdout instead of tqdm bars. The parent Node process parses the
7
+ # NDJSON and renders its own UI (Ink TUI or CLI carriage-return bar).
8
+ #
9
+ # Stdout is reserved for NDJSON. Any free-form output from
10
+ # huggingface_hub goes to stderr and the parent surfaces it as log
11
+ # lines. Exit 0 on success, 1 on download error, 2 on import error.
12
+ import json
13
+ import sys
14
+
15
+
16
+ def emit(**kw):
17
+ sys.stdout.write(json.dumps(kw) + "\n")
18
+ sys.stdout.flush()
19
+
20
+
21
+ def _install_tqdm_class():
22
+ from tqdm import tqdm as std_tqdm
23
+
24
+ class NDJSONTqdm(std_tqdm):
25
+ # huggingface_hub constructs one tqdm per file with unit="B",
26
+ # plus (sometimes) an outer tqdm over files with unit="files".
27
+ # We emit both; the parent filters on `unit` to decide what to
28
+ # render.
29
+ def __init__(self, *a, **kw):
30
+ super().__init__(*a, **kw)
31
+ emit(
32
+ type="begin",
33
+ file=self.desc or "",
34
+ total=self.total,
35
+ unit=self.unit,
36
+ )
37
+
38
+ def update(self, n=1):
39
+ super().update(n)
40
+ self._emit_progress()
41
+
42
+ def refresh(self, *a, **kw):
43
+ super().refresh(*a, **kw)
44
+ self._emit_progress()
45
+
46
+ def _emit_progress(self):
47
+ fd = self.format_dict
48
+ emit(
49
+ type="progress",
50
+ file=self.desc or "",
51
+ done=self.n,
52
+ total=self.total,
53
+ rate=fd.get("rate"),
54
+ elapsed=fd.get("elapsed"),
55
+ unit=self.unit,
56
+ )
57
+
58
+ def close(self):
59
+ if not self.disable:
60
+ emit(
61
+ type="end",
62
+ file=self.desc or "",
63
+ total=self.total,
64
+ done=self.n,
65
+ unit=self.unit,
66
+ )
67
+ super().close()
68
+
69
+ # Suppress the actual bar render. We own the UI.
70
+ def display(self, *a, **kw):
71
+ return
72
+
73
+ return NDJSONTqdm
74
+
75
+
76
+ def main():
77
+ if len(sys.argv) < 2:
78
+ emit(type="error", message="missing payload argument")
79
+ sys.exit(2)
80
+ try:
81
+ args = json.loads(sys.argv[1])
82
+ except json.JSONDecodeError as e:
83
+ emit(type="error", message=f"invalid payload json: {e}")
84
+ sys.exit(2)
85
+
86
+ try:
87
+ from huggingface_hub import snapshot_download
88
+ except ImportError as e:
89
+ emit(
90
+ type="error",
91
+ message=(
92
+ f"huggingface_hub not importable from {sys.executable}: {e}. "
93
+ "Install with: uv tool install huggingface_hub"
94
+ ),
95
+ )
96
+ sys.exit(2)
97
+
98
+ NDJSONTqdm = _install_tqdm_class()
99
+
100
+ repo = args.get("repo")
101
+ revision = args.get("revision")
102
+ local_dir = args.get("local_dir")
103
+ one_file = args.get("file")
104
+ allow_patterns = args.get("allow_patterns")
105
+
106
+ # Single-file pull (GGUF): use snapshot_download with a restrictive
107
+ # allow_patterns so it only fetches the one file we asked for,
108
+ # writing into local_dir directly. This avoids needing a separate
109
+ # code path for hf_hub_download and keeps the tqdm_class wiring
110
+ # uniform.
111
+ if one_file:
112
+ allow_patterns = [one_file]
113
+
114
+ try:
115
+ emit(type="resolving", repo=repo, revision=revision)
116
+ kwargs = {
117
+ "repo_id": repo,
118
+ "tqdm_class": NDJSONTqdm,
119
+ }
120
+ if revision:
121
+ kwargs["revision"] = revision
122
+ if local_dir:
123
+ kwargs["local_dir"] = local_dir
124
+ if allow_patterns:
125
+ kwargs["allow_patterns"] = allow_patterns
126
+ path = snapshot_download(**kwargs)
127
+ emit(type="done", path=path)
128
+ except KeyboardInterrupt:
129
+ emit(type="error", message="interrupted")
130
+ sys.exit(130)
131
+ except Exception as e:
132
+ emit(type="error", message=f"{type(e).__name__}: {e}")
133
+ sys.exit(1)
134
+
135
+
136
+ if __name__ == "__main__":
137
+ main()
@@ -0,0 +1,11 @@
1
+ export declare function parseShebang(firstLine: string): {
2
+ kind: "abs";
3
+ interpreter: string;
4
+ } | {
5
+ kind: "env";
6
+ name: string;
7
+ } | null;
8
+ export declare function resolvePythonFromShim(shimPath: string): string | null;
9
+ export declare function resolvePythonForHf(): string | null;
10
+ export declare function _resetResolvePythonCache(): void;
11
+ //# sourceMappingURL=resolve-python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-python.d.ts","sourceRoot":"","sources":["../../src/pull/resolve-python.ts"],"names":[],"mappings":"AAwBA,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAc3H;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAerE;AAED,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAgBlD;AAGD,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
@@ -0,0 +1,81 @@
1
+ import { spawnSync } from "child_process";
2
+ import { existsSync, readFileSync } from "fs";
3
+ // Finds a Python interpreter that has huggingface_hub importable,
4
+ // by reading the shebang of the `hf` console-script shim and
5
+ // extracting the interpreter it was installed against. This works
6
+ // uniformly across uv tool install, pipx, and pip -- all of them
7
+ // produce a shim whose first line points at their venv's python.
8
+ //
9
+ // Falls back to `python3` on PATH if the shebang is `#!/usr/bin/env
10
+ // python3`-style (the interpreter is resolved through env) or if we
11
+ // can't read the shim for any reason. The caller is still
12
+ // responsible for handling "no huggingface_hub available" -- we
13
+ // return null only when no interpreter is resolvable at all.
14
+ let cached = undefined;
15
+ function which(name) {
16
+ const res = spawnSync("/usr/bin/env", ["which", name], { encoding: "utf8" });
17
+ if (res.status !== 0)
18
+ return null;
19
+ const line = res.stdout.trim().split("\n")[0];
20
+ return line && existsSync(line) ? line : null;
21
+ }
22
+ export function parseShebang(firstLine) {
23
+ if (!firstLine.startsWith("#!"))
24
+ return null;
25
+ const body = firstLine.slice(2).trim();
26
+ if (!body)
27
+ return null;
28
+ const parts = body.split(/\s+/);
29
+ const head = parts[0];
30
+ if (!head)
31
+ return null;
32
+ // `#!/usr/bin/env python3` — follow the env indirection.
33
+ if (head === "/usr/bin/env" || head.endsWith("/env")) {
34
+ const name = parts[1];
35
+ if (!name)
36
+ return null;
37
+ return { kind: "env", name };
38
+ }
39
+ return { kind: "abs", interpreter: head };
40
+ }
41
+ export function resolvePythonFromShim(shimPath) {
42
+ let first;
43
+ try {
44
+ // Read just enough for the shebang; shim files are text on unix,
45
+ // binaries on Windows (not our target). A few KB is plenty.
46
+ first = readFileSync(shimPath, { encoding: "utf8" }).split("\n")[0] ?? "";
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ const parsed = parseShebang(first);
52
+ if (!parsed)
53
+ return null;
54
+ if (parsed.kind === "abs") {
55
+ return existsSync(parsed.interpreter) ? parsed.interpreter : null;
56
+ }
57
+ return which(parsed.name);
58
+ }
59
+ export function resolvePythonForHf() {
60
+ if (cached !== undefined)
61
+ return cached;
62
+ const hfShim = which("hf");
63
+ if (hfShim) {
64
+ const py = resolvePythonFromShim(hfShim);
65
+ if (py) {
66
+ cached = py;
67
+ return py;
68
+ }
69
+ }
70
+ // Last-resort fallback: whatever python3 is on PATH. The caller
71
+ // will get a clean "huggingface_hub not importable" error from the
72
+ // sidecar if this interpreter doesn't actually have it installed.
73
+ const py3 = which("python3");
74
+ cached = py3;
75
+ return py3;
76
+ }
77
+ // For tests.
78
+ export function _resetResolvePythonCache() {
79
+ cached = undefined;
80
+ }
81
+ //# sourceMappingURL=resolve-python.js.map
@@ -0,0 +1 @@
1
+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,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,GAAG,EAAE,CAAA;YACX,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IACD,gEAAgE;IAChE,mEAAmE;IACnE,kEAAkE;IAClE,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;IAC5B,MAAM,GAAG,GAAG,CAAA;IACZ,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,aAAa;AACb,MAAM,UAAU,wBAAwB;IACtC,MAAM,GAAG,SAAS,CAAA;AACpB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { RuntimeType } from "../types/index.js";
2
+ export interface Suggestion {
3
+ repo: string;
4
+ file?: string;
5
+ runtime: RuntimeType;
6
+ label: string;
7
+ sizeLabel: string;
8
+ note: string;
9
+ }
10
+ export declare const SUGGESTIONS: readonly Suggestion[];
11
+ //# sourceMappingURL=suggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../src/pull/suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAUpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,WAAW,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,UAAU,EAsB5C,CAAA"}
@@ -0,0 +1,24 @@
1
+ export const SUGGESTIONS = [
2
+ {
3
+ repo: "mlx-community/Qwen3-4B-Instruct-2507-4bit",
4
+ runtime: "mlx",
5
+ label: "Qwen3-4B-Instruct (4bit)",
6
+ sizeLabel: "~2.3 GB",
7
+ note: "small & fast — fits on 8 GB Macs"
8
+ },
9
+ {
10
+ repo: "mlx-community/Qwen3.5-9B-MLX-4bit",
11
+ runtime: "mlx",
12
+ label: "Qwen3.5-9B (4bit)",
13
+ sizeLabel: "~5.6 GB",
14
+ note: "solid general-purpose default — 16 GB+ memory"
15
+ },
16
+ {
17
+ repo: "mlx-community/Qwen3.5-27B-4bit",
18
+ runtime: "mlx",
19
+ label: "Qwen3.5-27B (4bit)",
20
+ sizeLabel: "~15 GB",
21
+ note: "larger & smarter — needs 32 GB+ unified memory"
22
+ }
23
+ ];
24
+ //# sourceMappingURL=suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.js","sourceRoot":"","sources":["../../src/pull/suggestions.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,WAAW,GAA0B;IAChD;QACE,IAAI,EAAE,2CAA2C;QACjD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,0BAA0B;QACjC,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,kCAAkC;KACzC;IACD;QACE,IAAI,EAAE,mCAAmC;QACzC,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,mBAAmB;QAC1B,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,+CAA+C;KACtD;IACD;QACE,IAAI,EAAE,gCAAgC;QACtC,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,oBAAoB;QAC3B,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,gDAAgD;KACvD;CACF,CAAA"}
@@ -0,0 +1,28 @@
1
+ import type { ModelEntry, Registry, RuntimeType } from "../types/index.js";
2
+ export declare function loadRegistry(): Registry;
3
+ export declare function saveRegistry(registry: Registry): void;
4
+ export declare function listModels(): ModelEntry[];
5
+ export declare function getModel(idOrSlug: string): ModelEntry | undefined;
6
+ export declare function upsertModel(entry: ModelEntry): ModelEntry;
7
+ export declare function updateModel(idOrSlug: string, patch: Partial<ModelEntry>): ModelEntry | undefined;
8
+ export declare function setModelPublish(idOrSlug: string, publish: boolean): ModelEntry | undefined;
9
+ export declare function setModelFlavor(idOrSlug: string, mlxFlavor: ModelEntry["mlxFlavor"]): ModelEntry | undefined;
10
+ export declare function setModelPreset(idOrSlug: string, preset: ModelEntry["preset"]): ModelEntry | undefined;
11
+ export declare function touchModelLastUsed(idOrSlug: string, at?: number): ModelEntry | undefined;
12
+ export declare function removeModel(idOrSlug: string): boolean;
13
+ export declare function slugify(input: string): string;
14
+ export declare function uniqueSlug(desired: string, taken: Set<string>): string;
15
+ export declare function allocatePort(taken: Set<number>, range?: {
16
+ min: number;
17
+ max: number;
18
+ }): number;
19
+ export interface RegistrySnapshot {
20
+ ids: Set<string>;
21
+ slugs: Set<string>;
22
+ ports: Set<number>;
23
+ paths: Set<string>;
24
+ }
25
+ export declare function snapshot(reg?: Registry): RegistrySnapshot;
26
+ export declare function defaultPiAlias(slug: string): string;
27
+ export declare function makeId(runtime: RuntimeType, source: ModelEntry["source"], path: string): string;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAa1B,wBAAgB,YAAY,IAAI,QAAQ,CAWvC;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAGrD;AAED,wBAAgB,UAAU,IAAI,UAAU,EAAE,CAEzC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAGjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAUzD;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,GACzB,UAAU,GAAG,SAAS,CAUxB;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,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