omnius 1.0.77 → 1.0.78
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 +86 -5
- 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,16 @@ ${lines.join("\n")}`);
|
|
|
615346
615356
|
nextAnalysisAfterMs: decision.nextCheckAfterMs
|
|
615347
615357
|
});
|
|
615348
615358
|
}
|
|
615359
|
+
async telegramRouterJsonCompletion(backend, request) {
|
|
615360
|
+
try {
|
|
615361
|
+
return await backend.chatCompletion({
|
|
615362
|
+
...request,
|
|
615363
|
+
responseFormat: TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT
|
|
615364
|
+
});
|
|
615365
|
+
} catch {
|
|
615366
|
+
return backend.chatCompletion(request);
|
|
615367
|
+
}
|
|
615368
|
+
}
|
|
615349
615369
|
async repairTelegramInteractionDecision(backend, rawOutput, forcedRoute, timeoutMs) {
|
|
615350
615370
|
const rawPreview = telegramRouterRawPreview(rawOutput, 4e3);
|
|
615351
615371
|
if (!rawPreview || telegramDecisionOutputHasDanglingJson(rawOutput)) return null;
|
|
@@ -615363,7 +615383,7 @@ ${lines.join("\n")}`);
|
|
|
615363
615383
|
rawPreview
|
|
615364
615384
|
].join("\n");
|
|
615365
615385
|
try {
|
|
615366
|
-
const result = await
|
|
615386
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615367
615387
|
messages: [
|
|
615368
615388
|
{
|
|
615369
615389
|
role: "system",
|
|
@@ -615397,6 +615417,56 @@ ${repairedText}`,
|
|
|
615397
615417
|
return null;
|
|
615398
615418
|
}
|
|
615399
615419
|
}
|
|
615420
|
+
async retryTelegramInteractionDecisionStrict(backend, userPrompt, rawOutput, forcedRoute, timeoutMs) {
|
|
615421
|
+
const invalidPreview = telegramRouterRawPreview(rawOutput, 1200) ?? "(empty assistant content)";
|
|
615422
|
+
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.`;
|
|
615423
|
+
const retryPrompt = [
|
|
615424
|
+
`The previous Telegram attention-router response was not usable JSON.`,
|
|
615425
|
+
`Make a fresh model-derived attention decision from the full context below. Do not use hard-coded mention or keyword triggers.`,
|
|
615426
|
+
`Return exactly one JSON object and no prose.`,
|
|
615427
|
+
routeInstruction,
|
|
615428
|
+
``,
|
|
615429
|
+
`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"}`,
|
|
615430
|
+
``,
|
|
615431
|
+
`Invalid previous output, for diagnostics only:`,
|
|
615432
|
+
invalidPreview,
|
|
615433
|
+
``,
|
|
615434
|
+
`Full router context:`,
|
|
615435
|
+
userPrompt
|
|
615436
|
+
].join("\n");
|
|
615437
|
+
try {
|
|
615438
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615439
|
+
messages: [
|
|
615440
|
+
{
|
|
615441
|
+
role: "system",
|
|
615442
|
+
content: "You are a strict JSON Telegram attention router. Output one valid JSON object only."
|
|
615443
|
+
},
|
|
615444
|
+
{ role: "user", content: retryPrompt }
|
|
615445
|
+
],
|
|
615446
|
+
tools: [],
|
|
615447
|
+
temperature: 0,
|
|
615448
|
+
maxTokens: 1200,
|
|
615449
|
+
timeoutMs: Math.min(Math.max(timeoutMs, 5e3), 15e3),
|
|
615450
|
+
think: false
|
|
615451
|
+
});
|
|
615452
|
+
const retryText = result.choices[0]?.message?.content ?? "";
|
|
615453
|
+
const parsed = parseTelegramInteractionDecision(retryText, forcedRoute, {
|
|
615454
|
+
defaultShouldReply: false
|
|
615455
|
+
});
|
|
615456
|
+
if (!parsed) return null;
|
|
615457
|
+
return {
|
|
615458
|
+
...parsed,
|
|
615459
|
+
reason: `strict router retry: ${parsed.reason}`.slice(0, 240),
|
|
615460
|
+
raw: `${rawOutput}
|
|
615461
|
+
|
|
615462
|
+
[strict router retry]
|
|
615463
|
+
${retryText}`,
|
|
615464
|
+
mentalNote: parsed.mentalNote ?? "strict router retry produced a valid attention decision"
|
|
615465
|
+
};
|
|
615466
|
+
} catch {
|
|
615467
|
+
return null;
|
|
615468
|
+
}
|
|
615469
|
+
}
|
|
615400
615470
|
async inferTelegramInteractionDecision(msg, toolContext) {
|
|
615401
615471
|
const config = this.agentConfig;
|
|
615402
615472
|
const forcedRoute = this.interactionMode === "chat" || this.interactionMode === "action" ? this.interactionMode : null;
|
|
@@ -615480,7 +615550,7 @@ ${stimulationProbe.context}`,
|
|
|
615480
615550
|
${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
615481
615551
|
].filter(Boolean).join("\n");
|
|
615482
615552
|
try {
|
|
615483
|
-
const result = await
|
|
615553
|
+
const result = await this.telegramRouterJsonCompletion(backend, {
|
|
615484
615554
|
messages: [
|
|
615485
615555
|
{
|
|
615486
615556
|
role: "system",
|
|
@@ -615512,15 +615582,26 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
615512
615582
|
this.applyTelegramStimulationDecision(sessionKey, repaired);
|
|
615513
615583
|
return repaired;
|
|
615514
615584
|
}
|
|
615585
|
+
const strictRetry = await this.retryTelegramInteractionDecisionStrict(
|
|
615586
|
+
backend,
|
|
615587
|
+
userPrompt,
|
|
615588
|
+
text,
|
|
615589
|
+
forcedRoute,
|
|
615590
|
+
config.timeoutMs ?? 3e4
|
|
615591
|
+
);
|
|
615592
|
+
if (strictRetry) {
|
|
615593
|
+
this.applyTelegramStimulationDecision(sessionKey, strictRetry);
|
|
615594
|
+
return strictRetry;
|
|
615595
|
+
}
|
|
615515
615596
|
const invalidRouterPreview = telegramRouterRawPreview(text);
|
|
615516
615597
|
const fallback2 = {
|
|
615517
615598
|
route: forcedRoute ?? (isGroup ? "action" : "chat"),
|
|
615518
615599
|
shouldReply: false,
|
|
615519
615600
|
confidence: 0,
|
|
615520
|
-
reason: "router output was not valid decision JSON; no model-derived reply decision",
|
|
615601
|
+
reason: "router output was not valid decision JSON after repair/retry; no model-derived reply decision",
|
|
615521
615602
|
source: "inference-unavailable",
|
|
615522
615603
|
silentDisposition: "retained as context without replying because the router decision could not be parsed",
|
|
615523
|
-
mentalNote: "router produced an invalid attention decision payload",
|
|
615604
|
+
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
615605
|
memoryNote: invalidRouterPreview ? `invalid router output preview: ${invalidRouterPreview}` : void 0,
|
|
615525
615606
|
raw: text
|
|
615526
615607
|
};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.78",
|
|
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.78",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED