create-op-node 0.10.13 → 0.10.15
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/cli.js +17 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -646,7 +646,6 @@ async function discoverRunId(input, budgets, deps) {
|
|
|
646
646
|
deps.onProgress?.("discovery");
|
|
647
647
|
const discoveryStart = deps.now();
|
|
648
648
|
while (deps.now() - discoveryStart < budgets.discoveryMs) {
|
|
649
|
-
await deps.sleep(budgets.pollMs);
|
|
650
649
|
const ws = await safePoll(
|
|
651
650
|
() => deps.findWorkspace({
|
|
652
651
|
token: input.token,
|
|
@@ -656,6 +655,7 @@ async function discoverRunId(input, budgets, deps) {
|
|
|
656
655
|
() => deps.onProgress?.("retry")
|
|
657
656
|
);
|
|
658
657
|
if (ws?.currentRunId) return ws.currentRunId;
|
|
658
|
+
await deps.sleep(budgets.pollMs);
|
|
659
659
|
}
|
|
660
660
|
return null;
|
|
661
661
|
}
|
|
@@ -1960,6 +1960,8 @@ function assessAllRunning(snapshots) {
|
|
|
1960
1960
|
|
|
1961
1961
|
// src/lib/ollama.ts
|
|
1962
1962
|
var OLLAMA_URL = "http://localhost:11434";
|
|
1963
|
+
var OLLAMA_HEALTH_TIMEOUT_MS = 5e3;
|
|
1964
|
+
var OLLAMA_WARM_TIMEOUT_MS = 12e4;
|
|
1963
1965
|
var DEFAULT_LLM_MODEL = "qwen3.5:9b";
|
|
1964
1966
|
var DEFAULT_EMBEDDING_MODEL = "nomic-embed-text";
|
|
1965
1967
|
var PROBE_ALPINE_TAG = "3.20";
|
|
@@ -1975,14 +1977,18 @@ async function startOllamaService() {
|
|
|
1975
1977
|
return { ok: true };
|
|
1976
1978
|
}
|
|
1977
1979
|
async function checkOllamaHealth(url = OLLAMA_URL) {
|
|
1980
|
+
const ctrl = new AbortController();
|
|
1981
|
+
const timer = setTimeout(() => ctrl.abort(), OLLAMA_HEALTH_TIMEOUT_MS);
|
|
1978
1982
|
try {
|
|
1979
|
-
const res = await fetch(`${url}/api/tags
|
|
1983
|
+
const res = await fetch(`${url}/api/tags`, { signal: ctrl.signal });
|
|
1980
1984
|
if (!res.ok) return { reachable: false, models: [] };
|
|
1981
1985
|
const body = await res.json();
|
|
1982
1986
|
const models = (body.models ?? []).map((m) => m.name ?? "").filter((n) => n.length > 0);
|
|
1983
1987
|
return { reachable: true, models };
|
|
1984
1988
|
} catch {
|
|
1985
1989
|
return { reachable: false, models: [] };
|
|
1990
|
+
} finally {
|
|
1991
|
+
clearTimeout(timer);
|
|
1986
1992
|
}
|
|
1987
1993
|
}
|
|
1988
1994
|
async function pullModel(name) {
|
|
@@ -1997,11 +2003,14 @@ async function pullModel(name) {
|
|
|
1997
2003
|
return { ok: true };
|
|
1998
2004
|
}
|
|
1999
2005
|
async function warmModel(name, url = OLLAMA_URL) {
|
|
2006
|
+
const ctrl = new AbortController();
|
|
2007
|
+
const timer = setTimeout(() => ctrl.abort(), OLLAMA_WARM_TIMEOUT_MS);
|
|
2000
2008
|
try {
|
|
2001
2009
|
const res = await fetch(`${url}/api/generate`, {
|
|
2002
2010
|
method: "POST",
|
|
2003
2011
|
headers: { "Content-Type": "application/json" },
|
|
2004
|
-
body: JSON.stringify({ model: name, prompt: "hi", stream: false })
|
|
2012
|
+
body: JSON.stringify({ model: name, prompt: "hi", stream: false }),
|
|
2013
|
+
signal: ctrl.signal
|
|
2005
2014
|
});
|
|
2006
2015
|
if (!res.ok) {
|
|
2007
2016
|
const text6 = await res.text().catch(() => "");
|
|
@@ -2013,10 +2022,10 @@ async function warmModel(name, url = OLLAMA_URL) {
|
|
|
2013
2022
|
await res.text();
|
|
2014
2023
|
return { ok: true };
|
|
2015
2024
|
} catch (err) {
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2025
|
+
const reason = err.name === "AbortError" ? `warm ${name} timed out after ${OLLAMA_WARM_TIMEOUT_MS / 1e3}s` : `warm ${name} failed: ${err.message}`;
|
|
2026
|
+
return { ok: false, reason };
|
|
2027
|
+
} finally {
|
|
2028
|
+
clearTimeout(timer);
|
|
2020
2029
|
}
|
|
2021
2030
|
}
|
|
2022
2031
|
async function probeHostDockerInternal() {
|
|
@@ -4851,7 +4860,7 @@ async function looksLikeRegionsRepo(dir) {
|
|
|
4851
4860
|
}
|
|
4852
4861
|
|
|
4853
4862
|
// src/cli.ts
|
|
4854
|
-
var VERSION = "0.10.
|
|
4863
|
+
var VERSION = "0.10.15";
|
|
4855
4864
|
var program = new Command();
|
|
4856
4865
|
program.name("create-op-node").description(
|
|
4857
4866
|
"Interactive bootstrap for an Opus Populi federation node.\nCloudflare infrastructure \u2192 Mac Studio \u2192 live public API."
|