@melaya/runner 1.1.82 → 1.1.83
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/assistantHost.py +2455 -2262
- package/dist/browserAuthz.js +48 -48
- package/dist/browserBridge.js +48 -48
- package/dist/codeWorker.js +68 -68
- package/dist/connection.js +23 -1
- package/dist/localDbProbe.py +286 -286
- package/dist/localVault.py +745 -745
- package/dist/modelLoader.d.ts +12 -0
- package/dist/modelLoader.js +51 -0
- package/dist/turnSummary.d.ts +9 -0
- package/dist/turnSummary.js +29 -0
- package/localDbProbe.py +286 -286
- package/localVault.py +745 -745
- package/package.json +1 -1
- package/dist/linkedinProxy.d.ts +0 -51
- package/dist/linkedinProxy.js +0 -216
- package/dist/linkedinSetup.d.ts +0 -13
- package/dist/linkedinSetup.js +0 -111
package/dist/modelLoader.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ interface LMStudioModelInfo {
|
|
|
35
35
|
arch?: string;
|
|
36
36
|
params?: string | number;
|
|
37
37
|
max_context_length?: number;
|
|
38
|
+
loaded_context_length?: number;
|
|
38
39
|
}
|
|
39
40
|
export type ModelTier = "agentic-capable" | "agentic-marginal" | "text-only";
|
|
40
41
|
export interface ModelProfile {
|
|
@@ -60,6 +61,17 @@ export interface ModelPreflightResult {
|
|
|
60
61
|
}
|
|
61
62
|
export declare function preflightLmStudio(modelName: string, onProgress?: (msg: string) => void): Promise<ModelPreflightResult>;
|
|
62
63
|
export declare function preflightOllama(modelName: string, onProgress?: (msg: string) => void): Promise<ModelPreflightResult>;
|
|
64
|
+
/**
|
|
65
|
+
* MEL_MODEL_* env for a runner-hosted Assistant session on ollama / lmstudio.
|
|
66
|
+
* Pipeline runs get theirs from preflightModel; the Assistant host had none, so
|
|
67
|
+
* it ran with no output cap, no sampling and the 12K "unknown local" memory
|
|
68
|
+
* budget on a 256K model (2026-11-09, conv ab3933f3: runaway generation and a
|
|
69
|
+
* compaction every few rounds). Never loads a model and never throws: an
|
|
70
|
+
* unreachable app or unknown model returns {} and model.py's own defaults
|
|
71
|
+
* apply. No MEL_MODEL_MAX_ITERS (the Assistant sets its round budget per turn
|
|
72
|
+
* type) and thinking stays the model's default.
|
|
73
|
+
*/
|
|
74
|
+
export declare function assistantModelEnv(provider: string, modelName: string): Promise<Record<string, string>>;
|
|
63
75
|
/**
|
|
64
76
|
* Top-level preflight — resolves the provider/model from the pipeline
|
|
65
77
|
* config and dispatches to the right helper. Returns immediately for
|
package/dist/modelLoader.js
CHANGED
|
@@ -411,6 +411,57 @@ export async function preflightOllama(modelName, onProgress = () => { }) {
|
|
|
411
411
|
return { ok: false, reason: "ollama_error", hint: e.message };
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
+
// Per-response output cap for a capable local model in the Assistant: room for
|
|
415
|
+
// a reasoning pass plus the tool call or answer (the pipeline tier cap, 8192,
|
|
416
|
+
// cuts a thinking model's tool call short). model.py falls back to the same.
|
|
417
|
+
const ASSISTANT_LOCAL_MAX_TOKENS = 16384;
|
|
418
|
+
/**
|
|
419
|
+
* MEL_MODEL_* env for a runner-hosted Assistant session on ollama / lmstudio.
|
|
420
|
+
* Pipeline runs get theirs from preflightModel; the Assistant host had none, so
|
|
421
|
+
* it ran with no output cap, no sampling and the 12K "unknown local" memory
|
|
422
|
+
* budget on a 256K model (2026-11-09, conv ab3933f3: runaway generation and a
|
|
423
|
+
* compaction every few rounds). Never loads a model and never throws: an
|
|
424
|
+
* unreachable app or unknown model returns {} and model.py's own defaults
|
|
425
|
+
* apply. No MEL_MODEL_MAX_ITERS (the Assistant sets its round budget per turn
|
|
426
|
+
* type) and thinking stays the model's default.
|
|
427
|
+
*/
|
|
428
|
+
export async function assistantModelEnv(provider, modelName) {
|
|
429
|
+
const p = (provider || "").toLowerCase();
|
|
430
|
+
if (!modelName || (p !== "lmstudio" && p !== "ollama"))
|
|
431
|
+
return {};
|
|
432
|
+
try {
|
|
433
|
+
let profile;
|
|
434
|
+
let contextTokens = null;
|
|
435
|
+
if (p === "lmstudio") {
|
|
436
|
+
const models = (await listLmStudioModels()) ?? [];
|
|
437
|
+
const match = models.find((m) => m.id === modelName)
|
|
438
|
+
?? models.find((m) => m.id.endsWith(`/${modelName}`) || m.id.endsWith(`:${modelName}`));
|
|
439
|
+
profile = classifyModel(match?.id ?? modelName, match);
|
|
440
|
+
// Read fresh, never from the cached profile: the user can reload the
|
|
441
|
+
// model with another context length at any time.
|
|
442
|
+
if (match?.state === "loaded" && (match.loaded_context_length ?? 0) > 0)
|
|
443
|
+
contextTokens = match.loaded_context_length;
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
// model.py reads Ollama's loaded (/api/ps) and trained (/api/show) context itself.
|
|
447
|
+
profile = classifyModel(modelName);
|
|
448
|
+
}
|
|
449
|
+
const maxTokens = profile.tier === "agentic-capable"
|
|
450
|
+
? Math.max(profile.recommendedMaxTokens, ASSISTANT_LOCAL_MAX_TOKENS)
|
|
451
|
+
: profile.recommendedMaxTokens;
|
|
452
|
+
return {
|
|
453
|
+
MEL_MODEL_TIER: profile.tier,
|
|
454
|
+
MEL_MODEL_FAMILY: profile.family ?? "",
|
|
455
|
+
MEL_MODEL_PARAMS_B: String(profile.paramsBillion ?? ""),
|
|
456
|
+
MEL_MODEL_MAX_TOKENS: String(maxTokens),
|
|
457
|
+
...(contextTokens ? { MEL_MODEL_CONTEXT_TOKENS: String(contextTokens) } : {}),
|
|
458
|
+
MEL_MODEL_DISABLE_THINKING: "0",
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
catch {
|
|
462
|
+
return {};
|
|
463
|
+
}
|
|
464
|
+
}
|
|
414
465
|
/**
|
|
415
466
|
* Top-level preflight — resolves the provider/model from the pipeline
|
|
416
467
|
* config and dispatches to the right helper. Returns immediately for
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The per-turn line the runner logs for an Assistant turn, from the `summary`
|
|
2
|
+
// the host puts on its `done` frame (assistantHost.py `_turn_summary`), e.g.
|
|
3
|
+
// done in 12.4s: stop=repeat_guard finish=tool_calls, 7 tool calls (activate_tool×7), context 21K/157K
|
|
4
|
+
const kTok = (n) => (n >= 1000 ? `${Math.round(n / 1000)}K` : String(n));
|
|
5
|
+
export function formatTurnSummary(s) {
|
|
6
|
+
const parts = [];
|
|
7
|
+
const secs = Number(s.seconds);
|
|
8
|
+
const head = Number.isFinite(secs) ? `done in ${secs}s:` : "done:";
|
|
9
|
+
parts.push(`stop=${String(s.stop ?? "?")}${s.finish ? ` finish=${String(s.finish)}` : ""}`);
|
|
10
|
+
const tools = s.tools && typeof s.tools === "object" ? Object.entries(s.tools) : [];
|
|
11
|
+
const calls = tools.reduce((n, [, c]) => n + (Number(c) || 0), 0);
|
|
12
|
+
if (calls > 0) {
|
|
13
|
+
const top = tools
|
|
14
|
+
.map(([name, c]) => [name, Number(c) || 0])
|
|
15
|
+
.sort((a, b) => b[1] - a[1])
|
|
16
|
+
.slice(0, 4)
|
|
17
|
+
.map(([name, c]) => (c > 1 ? `${name}×${c}` : name))
|
|
18
|
+
.join(", ");
|
|
19
|
+
parts.push(`${calls} tool call${calls === 1 ? "" : "s"} (${top}${tools.length > 4 ? ", …" : ""})`);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
parts.push("no tool calls");
|
|
23
|
+
}
|
|
24
|
+
const used = Number(s.ctxUsed) || 0;
|
|
25
|
+
const budget = Number(s.ctxBudget) || 0;
|
|
26
|
+
if (budget > 0)
|
|
27
|
+
parts.push(`context ${kTok(used)}/${kTok(budget)}`);
|
|
28
|
+
return `${head} ${parts.join(", ")}`;
|
|
29
|
+
}
|