@nodii/dev 0.6.48 → 0.6.49
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/core.js +1 -1
- package/dist/doctor.js +8 -1
- package/dist/gather.js +14 -2
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.49";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/doctor.js
CHANGED
|
@@ -5,7 +5,7 @@ import { devRequest, encode, isOAuthConfig, query, setAuthProvider } from "./cor
|
|
|
5
5
|
import { OAuthAuthProvider, decodeClaims, loadRefreshToken } from "./oauth.js";
|
|
6
6
|
import { inferGitContext, repoName } from "./lanes.js";
|
|
7
7
|
import { figmaFileKey, figmaLockCheck, holdsSet, notRegisteredHint, scopeText } from "./figma.js";
|
|
8
|
-
import { PICKER_MODEL, PICKER_MODEL_DIGEST, STALE_PIN_HINT, inspectOllama } from "./gather.js";
|
|
8
|
+
import { PICKER_CONTEXT, PICKER_MODEL, PICKER_MODEL_DIGEST, STALE_PIN_HINT, inspectOllama } from "./gather.js";
|
|
9
9
|
import { hookDiagnostics } from "./hook-doctor.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -275,9 +275,16 @@ export async function doctorCommand(deps = {}) {
|
|
|
275
275
|
}));
|
|
276
276
|
else if (!picker.modelInstalled) checks.push(missing("picker_model", `${PICKER_MODEL} is not installed`, "nodii-dev setup --yes", { model: PICKER_MODEL }));
|
|
277
277
|
else checks.push(missing("picker_model", `${PICKER_MODEL} digest is ${picker.digest ?? "unknown"}; this CLI pins ${PICKER_MODEL_DIGEST}; ${STALE_PIN_HINT}`, "nodii-dev setup --yes", { model: PICKER_MODEL, digest: picker.digest ?? null, requiredDigest: PICKER_MODEL_DIGEST }));
|
|
278
|
+
// Gather loads the picker at an explicit num_ctx; a copy resident at another
|
|
279
|
+
// context (Ollama's default is the model's full window) holds far more memory.
|
|
280
|
+
const context = picker.loadedContext ?? null;
|
|
281
|
+
if (context === null) checks.push(ok("picker_context", `${PICKER_MODEL} not loaded; Gather loads it with num_ctx ${PICKER_CONTEXT}`, { model: PICKER_MODEL, context: null, requiredContext: PICKER_CONTEXT }));
|
|
282
|
+
else if (context === PICKER_CONTEXT) checks.push(ok("picker_context", `${PICKER_MODEL} loaded with num_ctx ${PICKER_CONTEXT}`, { model: PICKER_MODEL, context, requiredContext: PICKER_CONTEXT }));
|
|
283
|
+
else checks.push(missing("picker_context", `${PICKER_MODEL} is loaded with context ${context}, not ${PICKER_CONTEXT}; the next lane gather reloads it`, `ollama stop ${PICKER_MODEL}`, { model: PICKER_MODEL, context, requiredContext: PICKER_CONTEXT }));
|
|
278
284
|
} catch (error) {
|
|
279
285
|
checks.push(missing("ollama", error?.message ?? "Ollama is unavailable", "nodii-dev setup --yes", { code: error?.code ?? null }));
|
|
280
286
|
checks.push(cannot("picker_model", `needs local Ollama; expected ${PICKER_MODEL}`, { model: PICKER_MODEL }));
|
|
287
|
+
checks.push(cannot("picker_context", `needs local Ollama; expected num_ctx ${PICKER_CONTEXT}`, { model: PICKER_MODEL, requiredContext: PICKER_CONTEXT }));
|
|
281
288
|
}
|
|
282
289
|
|
|
283
290
|
// 10. Runtime hooks: present, accepted by that runtime, and observed firing.
|
package/dist/gather.js
CHANGED
|
@@ -113,12 +113,14 @@ const bareDigest = (digest) => typeof digest === "string" ? digest.replace(/^sha
|
|
|
113
113
|
|
|
114
114
|
export async function inspectOllama(options = {}) {
|
|
115
115
|
const pin = options.model ?? PINNED;
|
|
116
|
-
const [version, tags] = await Promise.all([
|
|
116
|
+
const [version, tags, ps] = await Promise.all([
|
|
117
117
|
jsonRequest("/api/version", options),
|
|
118
118
|
jsonRequest("/api/tags", options),
|
|
119
|
+
jsonRequest("/api/ps", options),
|
|
119
120
|
]);
|
|
120
121
|
const model = (tags.models ?? []).find((x) => x?.name === pin.name || x?.model === pin.name) ?? null;
|
|
121
122
|
return {
|
|
123
|
+
loadedContext: residentContext(ps, pin.name),
|
|
122
124
|
available: true,
|
|
123
125
|
version: String(version.version ?? "unknown"),
|
|
124
126
|
model: pin.name,
|
|
@@ -148,8 +150,12 @@ export async function requirePicker(options = {}) {
|
|
|
148
150
|
*/
|
|
149
151
|
export async function warmPicker(options = {}) {
|
|
150
152
|
const status = await requirePicker(options);
|
|
153
|
+
const model = (options.model ?? PINNED).name;
|
|
154
|
+
// Ollama keeps the context a model was loaded with; a later num_ctx does not
|
|
155
|
+
// reload it (hub-58: resident at 262144). Unload a wrong-context copy first.
|
|
156
|
+
if (status.loadedContext !== null && status.loadedContext !== PICKER_CONTEXT) await unloadPicker(model, options);
|
|
151
157
|
const started = Date.now();
|
|
152
|
-
const payload = await jsonRequest("/api/generate", { ...options, timeoutMs: options.timeoutMs ?? PICKER_WARM_TIMEOUT_MS, body: { model
|
|
158
|
+
const payload = await jsonRequest("/api/generate", { ...options, timeoutMs: options.timeoutMs ?? PICKER_WARM_TIMEOUT_MS, body: { model, prompt: "", stream: false, options: { num_ctx: PICKER_CONTEXT } } });
|
|
153
159
|
return { ...status, latency: pickLatency(payload, Date.now() - started) };
|
|
154
160
|
}
|
|
155
161
|
|
|
@@ -506,6 +512,12 @@ export async function modelLoaded(model, options = {}) {
|
|
|
506
512
|
return (ps.models ?? []).some((x) => x?.name === model || x?.model === model);
|
|
507
513
|
}
|
|
508
514
|
|
|
515
|
+
/** The context length Ollama holds the model at (/api/ps), or null when it is not resident. */
|
|
516
|
+
function residentContext(ps, model) {
|
|
517
|
+
const loaded = (ps.models ?? []).find((x) => x?.name === model || x?.model === model);
|
|
518
|
+
return loaded ? (loaded.context_length ?? 0) : null;
|
|
519
|
+
}
|
|
520
|
+
|
|
509
521
|
const tags = (clause) => {
|
|
510
522
|
const repos = clause.repos ?? [];
|
|
511
523
|
const steps = clause.steps ?? [];
|