omnius 1.0.520 → 1.0.521
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/index.js +93 -12
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -566866,6 +566866,9 @@ var init_ollama_pool = __esm({
|
|
|
566866
566866
|
return this.buildSlot(pick, resolvedAgentId);
|
|
566867
566867
|
}
|
|
566868
566868
|
if (placementMode === "constrained") {
|
|
566869
|
+
if (optsWithAgent.queuePolicy === "skip") {
|
|
566870
|
+
throw new Error("No GPU slot immediately available. All slots occupied.");
|
|
566871
|
+
}
|
|
566869
566872
|
return this.acquireQueued(optsWithAgent, resolvedAgentId);
|
|
566870
566873
|
}
|
|
566871
566874
|
const spawned = placementMode === "elastic" ? await this.maybeSpawnInstance(optsWithAgent.model) : null;
|
|
@@ -566875,6 +566878,9 @@ var init_ollama_pool = __esm({
|
|
|
566875
566878
|
this.recordAffinity(resolvedAgentId, spawned.state.id);
|
|
566876
566879
|
return this.buildSlot(spawned, resolvedAgentId);
|
|
566877
566880
|
}
|
|
566881
|
+
if (optsWithAgent.queuePolicy === "skip") {
|
|
566882
|
+
throw new Error("No GPU slot immediately available. All slots occupied.");
|
|
566883
|
+
}
|
|
566878
566884
|
return this.acquireQueued(optsWithAgent, resolvedAgentId);
|
|
566879
566885
|
}
|
|
566880
566886
|
/** Synchronous routing decision; returns the instance or null if every one is saturated. */
|
|
@@ -566936,7 +566942,8 @@ var init_ollama_pool = __esm({
|
|
|
566936
566942
|
return this.buildSlot(pick, agentId);
|
|
566937
566943
|
}
|
|
566938
566944
|
await new Promise((resolve79, reject) => {
|
|
566939
|
-
const
|
|
566945
|
+
const timeoutMs = Number.isFinite(opts.queueTimeoutMs) && (opts.queueTimeoutMs ?? 0) > 0 ? Math.floor(opts.queueTimeoutMs) : 3e4;
|
|
566946
|
+
const timer = setTimeout(() => reject(new Error(`No GPU slot available after ${(timeoutMs / 1e3).toFixed(0)}s. All slots occupied.`)), timeoutMs);
|
|
566940
566947
|
this.slotWaiters.push(() => {
|
|
566941
566948
|
clearTimeout(timer);
|
|
566942
566949
|
resolve79();
|
|
@@ -603790,7 +603797,9 @@ ${description}`
|
|
|
603790
603797
|
body["num_ctx"] = reqNumCtx;
|
|
603791
603798
|
}
|
|
603792
603799
|
let poolSlot = shouldUseOllamaPoolForBaseUrl(this.baseUrl) ? await getOllamaPool({ baseInstanceUrl: this.baseUrl }).acquire({
|
|
603793
|
-
model: this.model
|
|
603800
|
+
model: this.model,
|
|
603801
|
+
queuePolicy: request.poolQueuePolicy,
|
|
603802
|
+
queueTimeoutMs: request.poolQueueTimeoutMs
|
|
603794
603803
|
}) : null;
|
|
603795
603804
|
let requestBaseUrl = poolSlot?.baseUrl ?? this.baseUrl;
|
|
603796
603805
|
let poolSuccess = false;
|
|
@@ -604185,7 +604194,9 @@ ${description}`
|
|
|
604185
604194
|
body["num_ctx"] = reqNumCtx;
|
|
604186
604195
|
}
|
|
604187
604196
|
let poolSlot = shouldUseOllamaPoolForBaseUrl(this.baseUrl) ? await getOllamaPool({ baseInstanceUrl: this.baseUrl }).acquire({
|
|
604188
|
-
model: this.model
|
|
604197
|
+
model: this.model,
|
|
604198
|
+
queuePolicy: request.poolQueuePolicy,
|
|
604199
|
+
queueTimeoutMs: request.poolQueueTimeoutMs
|
|
604189
604200
|
}) : null;
|
|
604190
604201
|
let requestBaseUrl = poolSlot?.baseUrl ?? this.baseUrl;
|
|
604191
604202
|
let poolSuccess = false;
|
|
@@ -686381,13 +686392,70 @@ var init_emotion_engine = __esm({
|
|
|
686381
686392
|
this.state.arousal = BASELINE_AROUSAL + (this.state.arousal - BASELINE_AROUSAL) * decayFactor;
|
|
686382
686393
|
this.state.updatedAt = Date.now();
|
|
686383
686394
|
}
|
|
686395
|
+
emotionModelInferencePolicy() {
|
|
686396
|
+
const raw = process.env["OMNIUS_EMOTION_MODEL_INFERENCE"] ?? process.env["OMNIUS_EMOTION_LLM"] ?? this.config.modelInference ?? "auto";
|
|
686397
|
+
const value2 = String(raw).trim().toLowerCase();
|
|
686398
|
+
if (["0", "false", "off", "no", "disabled"].includes(value2)) {
|
|
686399
|
+
return "off";
|
|
686400
|
+
}
|
|
686401
|
+
if (["1", "true", "on", "yes", "enabled"].includes(value2)) {
|
|
686402
|
+
return "on";
|
|
686403
|
+
}
|
|
686404
|
+
return "auto";
|
|
686405
|
+
}
|
|
686406
|
+
async admitInternalInference() {
|
|
686407
|
+
const policy = this.emotionModelInferencePolicy();
|
|
686408
|
+
if (policy === "off") {
|
|
686409
|
+
return { allowed: false, reason: "emotion_model_inference_disabled" };
|
|
686410
|
+
}
|
|
686411
|
+
if (policy === "on") return { allowed: true };
|
|
686412
|
+
if (!shouldUseOllamaPoolForBaseUrl(this.config.backendUrl)) {
|
|
686413
|
+
return { allowed: true };
|
|
686414
|
+
}
|
|
686415
|
+
try {
|
|
686416
|
+
const status = await getOllamaPool({
|
|
686417
|
+
baseInstanceUrl: this.config.backendUrl
|
|
686418
|
+
}).status();
|
|
686419
|
+
const gpuCount = status.hardware.gpus.length;
|
|
686420
|
+
if (status.placement.mode === "constrained") {
|
|
686421
|
+
return {
|
|
686422
|
+
allowed: false,
|
|
686423
|
+
reason: `local_ollama_constrained_placement:${gpuCount}gpu`
|
|
686424
|
+
};
|
|
686425
|
+
}
|
|
686426
|
+
const hasImmediateSlot = status.instances.some((inst) => {
|
|
686427
|
+
const maxParallel = Math.max(1, inst.maxParallel);
|
|
686428
|
+
return inst.inflight < maxParallel;
|
|
686429
|
+
});
|
|
686430
|
+
if (!hasImmediateSlot) {
|
|
686431
|
+
return {
|
|
686432
|
+
allowed: false,
|
|
686433
|
+
reason: "local_ollama_no_immediate_background_slot"
|
|
686434
|
+
};
|
|
686435
|
+
}
|
|
686436
|
+
} catch (err) {
|
|
686437
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
686438
|
+
return {
|
|
686439
|
+
allowed: false,
|
|
686440
|
+
reason: `local_ollama_pool_status_unavailable:${detail.slice(0, 160)}`
|
|
686441
|
+
};
|
|
686442
|
+
}
|
|
686443
|
+
return { allowed: true };
|
|
686444
|
+
}
|
|
686384
686445
|
async runDirectInternalInference(opts) {
|
|
686385
|
-
const
|
|
686386
|
-
|
|
686387
|
-
|
|
686388
|
-
|
|
686389
|
-
|
|
686390
|
-
|
|
686446
|
+
const cwd4 = resolve68(process.cwd());
|
|
686447
|
+
const startedAt2 = Date.now();
|
|
686448
|
+
const admission = await this.admitInternalInference();
|
|
686449
|
+
if (!admission.allowed) {
|
|
686450
|
+
this.recordInternalDecision({
|
|
686451
|
+
stage: opts.stage,
|
|
686452
|
+
status: "skipped",
|
|
686453
|
+
elapsedMs: Date.now() - startedAt2,
|
|
686454
|
+
skipReason: admission.reason,
|
|
686455
|
+
promptChars: opts.system.length + opts.user.length
|
|
686456
|
+
});
|
|
686457
|
+
return null;
|
|
686458
|
+
}
|
|
686391
686459
|
const request = {
|
|
686392
686460
|
messages: [
|
|
686393
686461
|
{ role: "system", content: opts.system },
|
|
@@ -686398,10 +686466,10 @@ var init_emotion_engine = __esm({
|
|
|
686398
686466
|
maxTokens: opts.maxTokens,
|
|
686399
686467
|
timeoutMs: opts.timeoutMs,
|
|
686400
686468
|
think: false,
|
|
686401
|
-
disableEmptyContentRecovery: true
|
|
686469
|
+
disableEmptyContentRecovery: true,
|
|
686470
|
+
poolQueuePolicy: "skip",
|
|
686471
|
+
poolQueueTimeoutMs: 1
|
|
686402
686472
|
};
|
|
686403
|
-
const cwd4 = resolve68(process.cwd());
|
|
686404
|
-
const startedAt2 = Date.now();
|
|
686405
686473
|
recordContextWindowDump({
|
|
686406
686474
|
source: "emotionEngine",
|
|
686407
686475
|
stage: opts.stage,
|
|
@@ -686416,6 +686484,12 @@ var init_emotion_engine = __esm({
|
|
|
686416
686484
|
request
|
|
686417
686485
|
});
|
|
686418
686486
|
try {
|
|
686487
|
+
const backend = new OllamaAgenticBackend(
|
|
686488
|
+
this.config.backendUrl,
|
|
686489
|
+
this.config.model,
|
|
686490
|
+
this.config.apiKey,
|
|
686491
|
+
false
|
|
686492
|
+
);
|
|
686419
686493
|
const result = await backend.chatCompletion(request);
|
|
686420
686494
|
const output = String(
|
|
686421
686495
|
result.choices?.[0]?.message?.content ?? ""
|
|
@@ -686478,6 +686552,12 @@ var init_emotion_engine = __esm({
|
|
|
686478
686552
|
timeoutMs: 1e4,
|
|
686479
686553
|
note: "best-effort emotion label refresh"
|
|
686480
686554
|
});
|
|
686555
|
+
if (output === null) {
|
|
686556
|
+
this.lastLabelUpdate = Date.now();
|
|
686557
|
+
this.lastLabelValence = this.state.valence;
|
|
686558
|
+
this.lastLabelArousal = this.state.arousal;
|
|
686559
|
+
return;
|
|
686560
|
+
}
|
|
686481
686561
|
const match = output.match(new RegExp("^(\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F?)\\s+(\\S+)", "u"));
|
|
686482
686562
|
if (match) {
|
|
686483
686563
|
this.state.emoji = match[1];
|
|
@@ -686552,6 +686632,7 @@ var init_emotion_engine = __esm({
|
|
|
686552
686632
|
timeoutMs: 2e4,
|
|
686553
686633
|
note: "best-effort Telegram admin outreach gate"
|
|
686554
686634
|
});
|
|
686635
|
+
if (output === null) return;
|
|
686555
686636
|
const message2 = this.normalizeReflectionDecision(output);
|
|
686556
686637
|
if (message2) outreach(message2);
|
|
686557
686638
|
} catch {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.521",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.521",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED