omnius 1.0.77 → 1.0.79
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 +108 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -551418,6 +551418,7 @@ ${description}`
|
|
|
551418
551418
|
if (effectiveThink === true && (effectiveMaxTokens ?? 0) < 4096) {
|
|
551419
551419
|
effectiveMaxTokens = 4096;
|
|
551420
551420
|
}
|
|
551421
|
+
const responseFormat = request.responseFormat ?? request.response_format;
|
|
551421
551422
|
const body = {
|
|
551422
551423
|
model: this.model,
|
|
551423
551424
|
messages: cleanedMessages,
|
|
@@ -551426,6 +551427,9 @@ ${description}`
|
|
|
551426
551427
|
max_tokens: effectiveMaxTokens,
|
|
551427
551428
|
think: effectiveThink
|
|
551428
551429
|
};
|
|
551430
|
+
if (responseFormat !== void 0) {
|
|
551431
|
+
body["response_format"] = responseFormat;
|
|
551432
|
+
}
|
|
551429
551433
|
const poolSlot = shouldUseOllamaPoolForBaseUrl(this.baseUrl) ? await getOllamaPool({ baseInstanceUrl: this.baseUrl }).acquire({
|
|
551430
551434
|
model: this.model
|
|
551431
551435
|
}) : null;
|
|
@@ -551463,6 +551467,9 @@ ${description}`
|
|
|
551463
551467
|
max_tokens: request.maxTokens,
|
|
551464
551468
|
think: false
|
|
551465
551469
|
};
|
|
551470
|
+
if (responseFormat !== void 0) {
|
|
551471
|
+
retryBody["response_format"] = responseFormat;
|
|
551472
|
+
}
|
|
551466
551473
|
try {
|
|
551467
551474
|
const retryOpts = {
|
|
551468
551475
|
method: "POST",
|
|
@@ -611753,7 +611760,7 @@ function renderTelegramSubAgentError(username, error) {
|
|
|
611753
611760
|
process.stdout.write(` ${c3.dim("│")} ${c3.red("✘")} @${username}: ${c3.dim(preview)}
|
|
611754
611761
|
`);
|
|
611755
611762
|
}
|
|
611756
|
-
var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_PUBLIC_HELP_COMMANDS, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
|
|
611763
|
+
var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_PUBLIC_HELP_COMMANDS, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
|
|
611757
611764
|
var init_telegram_bridge = __esm({
|
|
611758
611765
|
"packages/cli/src/tui/telegram-bridge.ts"() {
|
|
611759
611766
|
"use strict";
|
|
@@ -612010,6 +612017,9 @@ External acquisition contract:
|
|
|
612010
612017
|
- The browser tool is for interactive web work; it does not save arbitrary rendered files to disk. For file acquisition, use the download/file tool and verify content-type + size before reporting success.
|
|
612011
612018
|
- Report the exact blocker concisely and offer lawful alternatives (library hold, official store, summary/discussion if the user supplies an authorized copy).
|
|
612012
612019
|
`.trim();
|
|
612020
|
+
TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT = {
|
|
612021
|
+
type: "json_object"
|
|
612022
|
+
};
|
|
612013
612023
|
TELEGRAM_STUCK_SELF_TALK_PREFIXES = [
|
|
612014
612024
|
/^i'?ve been stuck for\b/i,
|
|
612015
612025
|
/^i am (still |currently )?stuck\b/i,
|
|
@@ -615346,6 +615356,20 @@ ${lines.join("\n")}`);
|
|
|
615346
615356
|
nextAnalysisAfterMs: decision.nextCheckAfterMs
|
|
615347
615357
|
});
|
|
615348
615358
|
}
|
|
615359
|
+
async telegramRouterJsonCompletion(backend, request) {
|
|
615360
|
+
try {
|
|
615361
|
+
const result = await backend.chatCompletion({
|
|
615362
|
+
...request,
|
|
615363
|
+
responseFormat: TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT
|
|
615364
|
+
});
|
|
615365
|
+
const visible = result.choices.some(
|
|
615366
|
+
(choice) => stripTelegramHiddenThinking(choice.message.content ?? "").trim().length > 0
|
|
615367
|
+
);
|
|
615368
|
+
if (visible) return result;
|
|
615369
|
+
} catch {
|
|
615370
|
+
}
|
|
615371
|
+
return backend.chatCompletion(request);
|
|
615372
|
+
}
|
|
615349
615373
|
async repairTelegramInteractionDecision(backend, rawOutput, forcedRoute, timeoutMs) {
|
|
615350
615374
|
const rawPreview = telegramRouterRawPreview(rawOutput, 4e3);
|
|
615351
615375
|
if (!rawPreview || telegramDecisionOutputHasDanglingJson(rawOutput)) return null;
|
|
@@ -615363,7 +615387,7 @@ ${lines.join("\n")}`);
|
|
|
615363
615387
|
rawPreview
|
|
615364
615388
|
].join("\n");
|
|
615365
615389
|
try {
|
|
615366
|
-
const result = await
|
|
615390
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615367
615391
|
messages: [
|
|
615368
615392
|
{
|
|
615369
615393
|
role: "system",
|
|
@@ -615397,6 +615421,56 @@ ${repairedText}`,
|
|
|
615397
615421
|
return null;
|
|
615398
615422
|
}
|
|
615399
615423
|
}
|
|
615424
|
+
async retryTelegramInteractionDecisionStrict(backend, userPrompt, rawOutput, forcedRoute, timeoutMs) {
|
|
615425
|
+
const invalidPreview = telegramRouterRawPreview(rawOutput, 1200) ?? "(empty assistant content)";
|
|
615426
|
+
const routeInstruction = forcedRoute ? `The operator selected Telegram mode "${forcedRoute}". The route field must be "${forcedRoute}", but should_reply must still be inferred from context.` : `Infer route live from context.`;
|
|
615427
|
+
const retryPrompt = [
|
|
615428
|
+
`The previous Telegram attention-router response was not usable JSON.`,
|
|
615429
|
+
`Make a fresh model-derived attention decision from the full context below. Do not use hard-coded mention or keyword triggers.`,
|
|
615430
|
+
`Return exactly one JSON object and no prose.`,
|
|
615431
|
+
routeInstruction,
|
|
615432
|
+
``,
|
|
615433
|
+
`Required schema: {"route":"chat"|"action","should_reply":true|false,"confidence":0.0-1.0,"reason":"short reason","attention_state":"idle"|"observing"|"engaged"|"cooldown","attention_delta":-1.0..1.0,"next_check_after_messages":1..12,"silent_disposition":"short outcome-level disposition","mental_note":"short outcome-level observation","memory_note":"short memory/summary update","relationship_note":"short relationship/thread note"}`,
|
|
615434
|
+
``,
|
|
615435
|
+
`Invalid previous output, for diagnostics only:`,
|
|
615436
|
+
invalidPreview,
|
|
615437
|
+
``,
|
|
615438
|
+
`Full router context:`,
|
|
615439
|
+
userPrompt
|
|
615440
|
+
].join("\n");
|
|
615441
|
+
try {
|
|
615442
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615443
|
+
messages: [
|
|
615444
|
+
{
|
|
615445
|
+
role: "system",
|
|
615446
|
+
content: "You are a strict JSON Telegram attention router. Output one valid JSON object only."
|
|
615447
|
+
},
|
|
615448
|
+
{ role: "user", content: retryPrompt }
|
|
615449
|
+
],
|
|
615450
|
+
tools: [],
|
|
615451
|
+
temperature: 0,
|
|
615452
|
+
maxTokens: 1200,
|
|
615453
|
+
timeoutMs: Math.min(Math.max(timeoutMs, 5e3), 15e3),
|
|
615454
|
+
think: false
|
|
615455
|
+
});
|
|
615456
|
+
const retryText = result.choices[0]?.message?.content ?? "";
|
|
615457
|
+
const parsed = parseTelegramInteractionDecision(retryText, forcedRoute, {
|
|
615458
|
+
defaultShouldReply: false
|
|
615459
|
+
});
|
|
615460
|
+
if (!parsed) return null;
|
|
615461
|
+
return {
|
|
615462
|
+
...parsed,
|
|
615463
|
+
reason: `strict router retry: ${parsed.reason}`.slice(0, 240),
|
|
615464
|
+
raw: `${rawOutput}
|
|
615465
|
+
|
|
615466
|
+
[strict router retry]
|
|
615467
|
+
${retryText}`,
|
|
615468
|
+
mentalNote: parsed.mentalNote ?? "strict router retry produced a valid attention decision"
|
|
615469
|
+
};
|
|
615470
|
+
} catch {
|
|
615471
|
+
return null;
|
|
615472
|
+
}
|
|
615473
|
+
}
|
|
615400
615474
|
async inferTelegramInteractionDecision(msg, toolContext) {
|
|
615401
615475
|
const config = this.agentConfig;
|
|
615402
615476
|
const forcedRoute = this.interactionMode === "chat" || this.interactionMode === "action" ? this.interactionMode : null;
|
|
@@ -615480,7 +615554,7 @@ ${stimulationProbe.context}`,
|
|
|
615480
615554
|
${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
615481
615555
|
].filter(Boolean).join("\n");
|
|
615482
615556
|
try {
|
|
615483
|
-
const result = await
|
|
615557
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615484
615558
|
messages: [
|
|
615485
615559
|
{
|
|
615486
615560
|
role: "system",
|
|
@@ -615512,15 +615586,26 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
615512
615586
|
this.applyTelegramStimulationDecision(sessionKey, repaired);
|
|
615513
615587
|
return repaired;
|
|
615514
615588
|
}
|
|
615589
|
+
const strictRetry = await this.retryTelegramInteractionDecisionStrict(
|
|
615590
|
+
backend,
|
|
615591
|
+
userPrompt,
|
|
615592
|
+
text,
|
|
615593
|
+
forcedRoute,
|
|
615594
|
+
config.timeoutMs ?? 3e4
|
|
615595
|
+
);
|
|
615596
|
+
if (strictRetry) {
|
|
615597
|
+
this.applyTelegramStimulationDecision(sessionKey, strictRetry);
|
|
615598
|
+
return strictRetry;
|
|
615599
|
+
}
|
|
615515
615600
|
const invalidRouterPreview = telegramRouterRawPreview(text);
|
|
615516
615601
|
const fallback2 = {
|
|
615517
615602
|
route: forcedRoute ?? (isGroup ? "action" : "chat"),
|
|
615518
615603
|
shouldReply: false,
|
|
615519
615604
|
confidence: 0,
|
|
615520
|
-
reason: "router output was not valid decision JSON; no model-derived reply decision",
|
|
615605
|
+
reason: "router output was not valid decision JSON after repair/retry; no model-derived reply decision",
|
|
615521
615606
|
source: "inference-unavailable",
|
|
615522
615607
|
silentDisposition: "retained as context without replying because the router decision could not be parsed",
|
|
615523
|
-
mentalNote: "router produced an invalid attention decision payload",
|
|
615608
|
+
mentalNote: 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",
|
|
615524
615609
|
memoryNote: invalidRouterPreview ? `invalid router output preview: ${invalidRouterPreview}` : void 0,
|
|
615525
615610
|
raw: text
|
|
615526
615611
|
};
|
|
@@ -637714,6 +637799,7 @@ async function directChatBackend(opts) {
|
|
|
637714
637799
|
if (typeof ef["presence_penalty"] === "number") ollamaOpts["presence_penalty"] = ef["presence_penalty"];
|
|
637715
637800
|
if (Array.isArray(ef["stop"]) || typeof ef["stop"] === "string") ollamaOpts["stop"] = ef["stop"];
|
|
637716
637801
|
const hasTools = Array.isArray(ef["tools"]) && ef["tools"].length > 0;
|
|
637802
|
+
const ollamaFormat = ollamaFormatFromOpenAIResponseFormat(ef["response_format"]);
|
|
637717
637803
|
const reqBody = JSON.stringify({
|
|
637718
637804
|
model: cleanModel,
|
|
637719
637805
|
messages: messages2,
|
|
@@ -637723,7 +637809,7 @@ async function directChatBackend(opts) {
|
|
|
637723
637809
|
...hasTools ? {} : { think: false },
|
|
637724
637810
|
...hasTools ? { tools: ef["tools"] } : {},
|
|
637725
637811
|
...ef["tool_choice"] !== void 0 ? { tool_choice: ef["tool_choice"] } : {},
|
|
637726
|
-
...
|
|
637812
|
+
...ollamaFormat !== void 0 ? { format: ollamaFormat } : {},
|
|
637727
637813
|
options: ollamaOpts
|
|
637728
637814
|
});
|
|
637729
637815
|
if (stream) {
|
|
@@ -637826,6 +637912,22 @@ async function directChatBackend(opts) {
|
|
|
637826
637912
|
}
|
|
637827
637913
|
}
|
|
637828
637914
|
}
|
|
637915
|
+
function ollamaFormatFromOpenAIResponseFormat(value2) {
|
|
637916
|
+
if (typeof value2 === "string") return value2;
|
|
637917
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return void 0;
|
|
637918
|
+
const record = value2;
|
|
637919
|
+
if (record["type"] === "json_object") return "json";
|
|
637920
|
+
if (record["type"] === "json_schema") {
|
|
637921
|
+
const jsonSchema = record["json_schema"];
|
|
637922
|
+
if (jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)) {
|
|
637923
|
+
const schemaRecord = jsonSchema;
|
|
637924
|
+
return schemaRecord["schema"] ?? jsonSchema;
|
|
637925
|
+
}
|
|
637926
|
+
return "json";
|
|
637927
|
+
}
|
|
637928
|
+
if (record["type"] === "object" || record["properties"] !== void 0) return record;
|
|
637929
|
+
return void 0;
|
|
637930
|
+
}
|
|
637829
637931
|
function backendAuthHeaders(endpoint) {
|
|
637830
637932
|
const key = endpoint?.authKey ?? loadConfig().apiKey;
|
|
637831
637933
|
if (key) return { Authorization: `Bearer ${key}` };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.79",
|
|
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.79",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED