omnius 1.0.178 → 1.0.179
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 +73 -32
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -562571,6 +562571,12 @@ ${description}`
|
|
|
562571
562571
|
if (responseFormat !== void 0 && shouldRetryThinkGuard && !shouldRecoverFromEmpty) {
|
|
562572
562572
|
retryBody["response_format"] = responseFormat;
|
|
562573
562573
|
}
|
|
562574
|
+
if (Number.isFinite(reqNumCtx) && (reqNumCtx ?? 0) > 0) {
|
|
562575
|
+
const retryOptsBody = retryBody["options"] ?? {};
|
|
562576
|
+
retryOptsBody["num_ctx"] = reqNumCtx;
|
|
562577
|
+
retryBody["options"] = retryOptsBody;
|
|
562578
|
+
retryBody["num_ctx"] = reqNumCtx;
|
|
562579
|
+
}
|
|
562574
562580
|
try {
|
|
562575
562581
|
const retryOpts = {
|
|
562576
562582
|
method: "POST",
|
|
@@ -627890,15 +627896,17 @@ function isLikelyTruncatedRouterJson(text) {
|
|
|
627890
627896
|
const hits = (stripped.includes('"route"') ? 1 : 0) + (stripped.includes('"should_reply"') ? 1 : 0) + (stripped.includes('"confidence"') ? 1 : 0) + (stripped.includes('"reason"') ? 1 : 0) + (stripped.includes('"silent_disposition"') ? 1 : 0) + (stripped.includes('"mental_note"') ? 1 : 0);
|
|
627891
627897
|
return hits >= 3;
|
|
627892
627898
|
}
|
|
627893
|
-
function telegramRouterTimeoutMs(configTimeoutMs,
|
|
627894
|
-
|
|
627895
|
-
|
|
627896
|
-
|
|
627897
|
-
|
|
627898
|
-
|
|
627899
|
-
|
|
627900
|
-
|
|
627901
|
-
|
|
627899
|
+
function telegramRouterTimeoutMs(configTimeoutMs, minMs = 1e4, maxMs) {
|
|
627900
|
+
const envRaw = Number.parseInt(
|
|
627901
|
+
process.env["OMNIUS_TG_ROUTER_LIVENESS_MS"] ?? process.env["OMNIUS_TG_INFERENCE_LIVENESS_MS"] ?? "",
|
|
627902
|
+
10
|
|
627903
|
+
);
|
|
627904
|
+
const floor = Number.isFinite(minMs) && minMs > 0 ? minMs : 1e4;
|
|
627905
|
+
const configuredCap = Number.isFinite(envRaw) && envRaw >= floor ? envRaw : 9e4;
|
|
627906
|
+
const callerCap = Number.isFinite(maxMs) && (maxMs ?? 0) >= floor ? maxMs : configuredCap;
|
|
627907
|
+
const cap = Math.max(floor, Math.min(configuredCap, callerCap));
|
|
627908
|
+
const requested = Number.isFinite(configTimeoutMs) && (configTimeoutMs ?? 0) > 0 ? configTimeoutMs : cap;
|
|
627909
|
+
return Math.max(floor, Math.min(requested, cap));
|
|
627902
627910
|
}
|
|
627903
627911
|
function telegramThinkSuppressedRequest(request) {
|
|
627904
627912
|
const messages2 = Array.isArray(request.messages) ? request.messages.slice() : [];
|
|
@@ -628642,6 +628650,9 @@ function previewTelegramAdminArgs(args, maxLength = 220) {
|
|
|
628642
628650
|
return sanitizeTelegramProgressText(String(args), maxLength);
|
|
628643
628651
|
}
|
|
628644
628652
|
}
|
|
628653
|
+
function telegramAdminLivePanelIntakeText(requestPreview) {
|
|
628654
|
+
return requestPreview ? "I'm here. Reading this message in context and checking the live workspace state before answering." : "I'm here. Reading the current Telegram context and live workspace state before answering.";
|
|
628655
|
+
}
|
|
628645
628656
|
function createTelegramAdminLivePanelState(args) {
|
|
628646
628657
|
const now = args.now ?? Date.now();
|
|
628647
628658
|
const requestPreview = sanitizeTelegramProgressText(args.requestText, 180);
|
|
@@ -628655,7 +628666,7 @@ function createTelegramAdminLivePanelState(args) {
|
|
|
628655
628666
|
dirtyPages: { response: false, tools: false, logs: false },
|
|
628656
628667
|
status: "running",
|
|
628657
628668
|
requestPreview,
|
|
628658
|
-
intakeText: requestPreview
|
|
628669
|
+
intakeText: telegramAdminLivePanelIntakeText(requestPreview),
|
|
628659
628670
|
responseText: "",
|
|
628660
628671
|
toolLines: [],
|
|
628661
628672
|
mutationLines: [],
|
|
@@ -628719,7 +628730,7 @@ function applyTelegramAdminLivePanelEvent(state, event) {
|
|
|
628719
628730
|
function renderTelegramAdminLivePanelPayload(state) {
|
|
628720
628731
|
state.dirtyPages[state.activePage] = false;
|
|
628721
628732
|
const header = [
|
|
628722
|
-
`<b>Admin run
|
|
628733
|
+
`<b>Admin run:</b> <code>${escapeTelegramHTML(state.status)}</code>`,
|
|
628723
628734
|
state.requestPreview ? `<i>${escapeTelegramHTML(state.requestPreview)}</i>` : ""
|
|
628724
628735
|
].filter(Boolean).join("\n");
|
|
628725
628736
|
let body;
|
|
@@ -630740,18 +630751,39 @@ No scoped reflection artifact exists yet for this chat. Use <code>/reflect</code
|
|
|
630740
630751
|
this.refreshActiveTelegramInteractionCount();
|
|
630741
630752
|
return queued;
|
|
630742
630753
|
}
|
|
630743
|
-
|
|
630754
|
+
shouldFailOpenTelegramRouterUnavailable(msg, toolContext) {
|
|
630755
|
+
if (msg.isBot) return false;
|
|
630756
|
+
return toolContext === "telegram-admin-dm" || msg.chatType === "private";
|
|
630757
|
+
}
|
|
630758
|
+
buildTelegramRouterUnavailableDecision(msg, toolContext, params) {
|
|
630744
630759
|
const forcedRoute = this.interactionMode === "chat" || this.interactionMode === "action" ? this.interactionMode : null;
|
|
630745
|
-
const
|
|
630760
|
+
const route = forcedRoute ?? (msg.chatType === "private" ? "chat" : "action");
|
|
630761
|
+
const failOpen = this.shouldFailOpenTelegramRouterUnavailable(msg, toolContext);
|
|
630746
630762
|
return {
|
|
630747
|
-
route
|
|
630748
|
-
shouldReply:
|
|
630749
|
-
confidence: 0,
|
|
630750
|
-
reason:
|
|
630763
|
+
route,
|
|
630764
|
+
shouldReply: failOpen,
|
|
630765
|
+
confidence: failOpen ? 0.55 : 0,
|
|
630766
|
+
reason: failOpen ? `${params.reason}; direct private/admin delivery uses degraded visible reply instead of silent halt` : params.reason,
|
|
630751
630767
|
source: "inference-unavailable",
|
|
630768
|
+
silentDisposition: failOpen ? "router unavailable; attempting a visible degraded reply for a direct private/admin message" : params.silentDisposition ?? "retained as context without replying because the router decision could not be derived",
|
|
630769
|
+
diagnosticNote: params.diagnosticNote,
|
|
630770
|
+
raw: params.raw
|
|
630771
|
+
};
|
|
630772
|
+
}
|
|
630773
|
+
telegramRouterHadNoRecoverableVisibleOutput(diagnostics, rawOutput) {
|
|
630774
|
+
if (telegramRouterRawPreview(rawOutput)) return false;
|
|
630775
|
+
const jsonEmpty = diagnostics.jsonModeStatus === "empty-after-strip";
|
|
630776
|
+
const plainEmpty = diagnostics.plainStatus === "empty-after-strip";
|
|
630777
|
+
const jsonFailed = jsonEmpty || diagnostics.jsonModeStatus === "threw";
|
|
630778
|
+
return jsonFailed && plainEmpty;
|
|
630779
|
+
}
|
|
630780
|
+
fallbackTelegramRouterDecision(msg, toolContext, err) {
|
|
630781
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
630782
|
+
return this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
|
|
630783
|
+
reason: `router unavailable after queue admission (${errMsg.slice(0, 160)})`,
|
|
630752
630784
|
silentDisposition: "retained as context without replying because the router did not settle",
|
|
630753
630785
|
diagnosticNote: `router failure after queue admission: ${errMsg.slice(0, 240)}; tool_context=${toolContext}`
|
|
630754
|
-
};
|
|
630786
|
+
});
|
|
630755
630787
|
}
|
|
630756
630788
|
canUseChatActions(msg) {
|
|
630757
630789
|
return !msg.guestQueryId && (typeof msg.chatId === "number" || String(msg.chatId).startsWith("@"));
|
|
@@ -634877,6 +634909,23 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
634877
634909
|
if (parsed) {
|
|
634878
634910
|
return withRouterTelemetry(this.applyTelegramSilentReflectionNotes(parsed, reflectionNotes));
|
|
634879
634911
|
}
|
|
634912
|
+
if (this.shouldFailOpenTelegramRouterUnavailable(msg, toolContext) && this.telegramRouterHadNoRecoverableVisibleOutput(diagnostics, text)) {
|
|
634913
|
+
const failureNarrative2 = this.summarizeTelegramRouterFailure(diagnostics);
|
|
634914
|
+
const degraded = this.applyTelegramSilentReflectionNotes(
|
|
634915
|
+
this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
|
|
634916
|
+
reason: "router returned no visible decision content in JSON or plain mode",
|
|
634917
|
+
silentDisposition: reflectionNotes.silentDisposition,
|
|
634918
|
+
diagnosticNote: this.composeTelegramRouterDiagnosticNote(
|
|
634919
|
+
void 0,
|
|
634920
|
+
failureNarrative2,
|
|
634921
|
+
"router produced no visible attention decision content; repair/strict retry skipped for direct private/admin fail-open"
|
|
634922
|
+
),
|
|
634923
|
+
raw: text
|
|
634924
|
+
}),
|
|
634925
|
+
reflectionNotes
|
|
634926
|
+
);
|
|
634927
|
+
return withRouterTelemetry(degraded);
|
|
634928
|
+
}
|
|
634880
634929
|
if (isLikelyTruncatedRouterJson(text)) {
|
|
634881
634930
|
if (diagnostics) diagnostics.repairStatus = "skipped-truncation-rerun";
|
|
634882
634931
|
try {
|
|
@@ -634929,37 +634978,29 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
634929
634978
|
}
|
|
634930
634979
|
const invalidRouterPreview = telegramRouterRawPreview(text);
|
|
634931
634980
|
const failureNarrative = this.summarizeTelegramRouterFailure(diagnostics);
|
|
634932
|
-
const fallback = this.applyTelegramSilentReflectionNotes({
|
|
634933
|
-
route: forcedRoute ?? (isGroup ? "action" : "chat"),
|
|
634934
|
-
shouldReply: false,
|
|
634935
|
-
confidence: 0,
|
|
634981
|
+
const fallback = this.applyTelegramSilentReflectionNotes(this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
|
|
634936
634982
|
reason: "router output was not valid decision JSON after repair/retry; no model-derived reply decision",
|
|
634937
|
-
|
|
634938
|
-
silentDisposition: reflectionNotes.silentDisposition ?? "retained as context without replying because the router decision could not be parsed",
|
|
634983
|
+
silentDisposition: reflectionNotes.silentDisposition,
|
|
634939
634984
|
diagnosticNote: this.composeTelegramRouterDiagnosticNote(
|
|
634940
634985
|
invalidRouterPreview,
|
|
634941
634986
|
failureNarrative,
|
|
634942
634987
|
invalidRouterPreview ? "router produced an invalid attention decision payload; repair and strict retry did not recover it" : "router produced an empty attention decision payload; strict retry did not recover it"
|
|
634943
634988
|
),
|
|
634944
634989
|
raw: text
|
|
634945
|
-
}, reflectionNotes);
|
|
634990
|
+
}), reflectionNotes);
|
|
634946
634991
|
return withRouterTelemetry(fallback);
|
|
634947
634992
|
} catch (err) {
|
|
634948
634993
|
const failureNarrative = this.summarizeTelegramRouterFailure(diagnostics);
|
|
634949
634994
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
634950
|
-
const fallback = this.applyTelegramSilentReflectionNotes({
|
|
634951
|
-
route: forcedRoute ?? (isGroup ? "action" : "chat"),
|
|
634952
|
-
shouldReply: false,
|
|
634953
|
-
confidence: 0,
|
|
634995
|
+
const fallback = this.applyTelegramSilentReflectionNotes(this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
|
|
634954
634996
|
reason: `router inference failed; no model-derived reply decision (${errMsg.slice(0, 160)})`,
|
|
634955
|
-
|
|
634956
|
-
silentDisposition: reflectionNotes.silentDisposition ?? "retained as context without replying",
|
|
634997
|
+
silentDisposition: reflectionNotes.silentDisposition,
|
|
634957
634998
|
diagnosticNote: this.composeTelegramRouterDiagnosticNote(
|
|
634958
634999
|
void 0,
|
|
634959
635000
|
failureNarrative,
|
|
634960
635001
|
`router failed before live notes were generated: ${errMsg.slice(0, 160)}`
|
|
634961
635002
|
)
|
|
634962
|
-
}, reflectionNotes);
|
|
635003
|
+
}), reflectionNotes);
|
|
634963
635004
|
return withRouterTelemetry(fallback);
|
|
634964
635005
|
}
|
|
634965
635006
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.179",
|
|
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.179",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED