@melaya/runner 1.0.79 → 1.0.82
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 +9 -1
- package/dist/connection.js +12 -0
- package/dist/modelLoader.d.ts +1 -0
- package/dist/modelLoader.js +6 -4
- package/package.json +1 -1
package/dist/assistantHost.py
CHANGED
|
@@ -125,6 +125,12 @@ def _build_agent():
|
|
|
125
125
|
"phone_post_comment / phone_create_post — every publish is approved by the "
|
|
126
126
|
"user ON THEIR PHONE, so never refuse for safety. Only touch apps the user "
|
|
127
127
|
"asked for; the phone enforces an allowlist and blocks the rest.\n"
|
|
128
|
+
"- You are FULLY AUTONOMOUS on the phone: NEVER ask the user a question, "
|
|
129
|
+
"never end your turn asking for confirmation or offering a choice — make the "
|
|
130
|
+
"reasonable decision and DO it. If a feed is algorithmic, use the app's own "
|
|
131
|
+
"Search / Explore to find the right content yourself. Keep going until the "
|
|
132
|
+
"task is COMPLETE (e.g. all N comments posted) or you are genuinely blocked; "
|
|
133
|
+
"only then report what you did and what (if anything) is blocked.\n"
|
|
128
134
|
if phone_enabled else ""
|
|
129
135
|
)
|
|
130
136
|
sys_prompt = (
|
|
@@ -150,7 +156,9 @@ def _build_agent():
|
|
|
150
156
|
model_name=model,
|
|
151
157
|
provider=provider,
|
|
152
158
|
api_key="", # model.py resolves the provider's own creds (OAuth off disk / localhost)
|
|
153
|
-
|
|
159
|
+
# Phone tasks are many-step (each comment ≈ screen_tree→tap→type→post), so
|
|
160
|
+
# give them room like the device template (40); read-only Q&A needs few.
|
|
161
|
+
max_iters=40 if phone_enabled else 8,
|
|
154
162
|
reliability=True,
|
|
155
163
|
bounded_memory=True,
|
|
156
164
|
)
|
package/dist/connection.js
CHANGED
|
@@ -315,6 +315,10 @@ export async function connect(opts) {
|
|
|
315
315
|
PYTHONUTF8: "1",
|
|
316
316
|
...sslEnv,
|
|
317
317
|
MEL_RUN_ID: payload.runId,
|
|
318
|
+
// Pipeline name so phone-driving runs can self-register as the phone's
|
|
319
|
+
// active run (arms the on-device working overlay + its Kill button)
|
|
320
|
+
// regardless of launch surface — desktop, native, or assistant.
|
|
321
|
+
MEL_PIPELINE_NAME: payload.pipelineName,
|
|
318
322
|
// Point agentscope hooks at the REAL server (not the browser's Vite URL).
|
|
319
323
|
// Convert wss://api.melaya.org → https://api.melaya.org so pushMessage,
|
|
320
324
|
// registerRun, and other agentscope HTTP calls reach the tRPC server.
|
|
@@ -370,6 +374,10 @@ export async function connect(opts) {
|
|
|
370
374
|
MEL_MODEL_PARAMS_B: String(preflight.profile.paramsBillion ?? ""),
|
|
371
375
|
MEL_MODEL_MAX_TOKENS: String(preflight.profile.recommendedMaxTokens),
|
|
372
376
|
MEL_MODEL_MAX_ITERS: String(preflight.profile.recommendedMaxIters),
|
|
377
|
+
// Real context window → sizes BoundedMemory so compression can't
|
|
378
|
+
// evict the task brief on a big local model. Empty when unknown
|
|
379
|
+
// (the agent falls back to a safe per-tier floor).
|
|
380
|
+
MEL_MODEL_CONTEXT_TOKENS: String(preflight.profile.contextTokens ?? ""),
|
|
373
381
|
MEL_MODEL_DISABLE_THINKING: preflight.profile.thinkingDefault === "off" ? "1" : "0",
|
|
374
382
|
}
|
|
375
383
|
: {}),
|
|
@@ -714,6 +722,10 @@ export async function connect(opts) {
|
|
|
714
722
|
MEL_MODEL_PARAMS_B: String(preflight.profile.paramsBillion ?? ""),
|
|
715
723
|
MEL_MODEL_MAX_TOKENS: String(preflight.profile.recommendedMaxTokens),
|
|
716
724
|
MEL_MODEL_MAX_ITERS: String(preflight.profile.recommendedMaxIters),
|
|
725
|
+
// Real context window → sizes BoundedMemory so compression can't
|
|
726
|
+
// evict the task brief on a big local model. Empty when unknown
|
|
727
|
+
// (the agent falls back to a safe per-tier floor).
|
|
728
|
+
MEL_MODEL_CONTEXT_TOKENS: String(preflight.profile.contextTokens ?? ""),
|
|
717
729
|
MEL_MODEL_DISABLE_THINKING: preflight.profile.thinkingDefault === "off" ? "1" : "0",
|
|
718
730
|
}
|
|
719
731
|
: {}),
|
package/dist/modelLoader.d.ts
CHANGED
package/dist/modelLoader.js
CHANGED
|
@@ -120,11 +120,12 @@ function _parseParamCount(id) {
|
|
|
120
120
|
}
|
|
121
121
|
function _classify(id, lmstudioMeta) {
|
|
122
122
|
const lower = id.toLowerCase();
|
|
123
|
+
const ctxTokens = lmstudioMeta?.max_context_length ?? null;
|
|
123
124
|
// 1. Family override wins if matched.
|
|
124
125
|
for (const ov of FAMILY_OVERRIDES) {
|
|
125
126
|
if (ov.pattern.test(lower)) {
|
|
126
127
|
const params = _parseParamCount(id);
|
|
127
|
-
return _buildProfile(id, ov.tier, params, ov.family, ov.thinking, ov.reason);
|
|
128
|
+
return _buildProfile(id, ov.tier, params, ov.family, ov.thinking, ov.reason, ctxTokens);
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
// 2. LM Studio metadata if present.
|
|
@@ -160,9 +161,9 @@ function _classify(id, lmstudioMeta) {
|
|
|
160
161
|
tier = "text-only";
|
|
161
162
|
reason = `${params}B params < ${TIER_PARAM_THRESHOLDS.agenticMarginal}B threshold — text-only, abort if used for tool-using pipeline`;
|
|
162
163
|
}
|
|
163
|
-
return _buildProfile(id, tier, params, null, "n/a", reason);
|
|
164
|
+
return _buildProfile(id, tier, params, null, "n/a", reason, ctxTokens);
|
|
164
165
|
}
|
|
165
|
-
function _buildProfile(id, tier, paramsBillion, family, thinkingDefault, reason) {
|
|
166
|
+
function _buildProfile(id, tier, paramsBillion, family, thinkingDefault, reason, contextTokens = null) {
|
|
166
167
|
// Per-tier resource caps. Smaller models get tighter ceilings to
|
|
167
168
|
// bound runaway thinking loops.
|
|
168
169
|
const recommendedMaxTokens = tier === "agentic-capable" ? 8192
|
|
@@ -190,6 +191,7 @@ function _buildProfile(id, tier, paramsBillion, family, thinkingDefault, reason)
|
|
|
190
191
|
thinkingDefault,
|
|
191
192
|
recommendedMaxTokens,
|
|
192
193
|
recommendedMaxIters,
|
|
194
|
+
contextTokens: contextTokens && contextTokens > 0 ? contextTokens : null,
|
|
193
195
|
detectedAt: new Date().toISOString(),
|
|
194
196
|
reason,
|
|
195
197
|
};
|
|
@@ -233,7 +235,7 @@ export function classifyModel(id, lmstudioMeta) {
|
|
|
233
235
|
// Bump whenever FAMILY_OVERRIDES, tier thresholds, or any classifier
|
|
234
236
|
// logic changes in a way that could re-tier an existing cached model.
|
|
235
237
|
// Cached profiles with a mismatched version are ignored and re-classified.
|
|
236
|
-
const PROFILE_SCHEMA_VERSION =
|
|
238
|
+
const PROFILE_SCHEMA_VERSION = 4;
|
|
237
239
|
const LMSTUDIO_BASE = process.env.LMSTUDIO_BASE_URL || "http://127.0.0.1:1234";
|
|
238
240
|
const OLLAMA_BASE = process.env.OLLAMA_BASE_URL || "http://127.0.0.1:11434";
|
|
239
241
|
// JIT-load timeout. 8B-class quantised models on M-series Macs typically
|