omnius 1.0.209 → 1.0.210

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 CHANGED
@@ -284705,6 +284705,7 @@ async function launchService() {
284705
284705
  SCRAPE_REQUIRE_AUTH: "0"
284706
284706
  }
284707
284707
  });
284708
+ serviceProcess.unref();
284708
284709
  const cleanupService = () => {
284709
284710
  if (serviceProcess && serviceProcess.pid && !serviceProcess.killed) {
284710
284711
  try {
@@ -284958,6 +284959,7 @@ var init_browser_action = __esm({
284958
284959
  await apiCall("/session/close");
284959
284960
  } catch {
284960
284961
  }
284962
+ killBrowserActionServicePort();
284961
284963
  activeSessionId = null;
284962
284964
  activeSessionHeadless = null;
284963
284965
  activeSessionUrl = null;
@@ -641965,7 +641967,7 @@ function renderTelegramSubAgentError(username, error) {
641965
641967
  process.stdout.write(` ${c3.dim("│")} ${c3.magenta("✘")} @${username}: ${c3.dim(preview)}
641966
641968
  `);
641967
641969
  }
641968
- 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_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_INTERACTION_DECISION_REPAIR_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TELEGRAM_SPACED_URL_RE, TELEGRAM_HTTP_URL_RE, 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_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_ADMIN_LIVE_PANEL_PAGES, TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS, TELEGRAM_PUBLIC_HELP_COMMANDS2, 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_DEFAULT_LONG_POLL_TIMEOUT_SECONDS, TELEGRAM_DEFAULT_ROUTER_MODEL_CANDIDATES, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
641970
+ 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_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_INTERACTION_DECISION_REPAIR_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TELEGRAM_SPACED_URL_RE, TELEGRAM_HTTP_URL_RE, 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_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_ADMIN_LIVE_PANEL_PAGES, TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS, TELEGRAM_PUBLIC_HELP_COMMANDS2, 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_DEFAULT_LONG_POLL_TIMEOUT_SECONDS, TELEGRAM_ROUTER_AUTO_MIN_PARAMETERS_B, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
641969
641971
  var init_telegram_bridge = __esm({
641970
641972
  "packages/cli/src/tui/telegram-bridge.ts"() {
641971
641973
  "use strict";
@@ -642428,20 +642430,7 @@ Telegram link integrity contract:
642428
642430
  TELEGRAM_CHANNEL_DMN_MIN_MESSAGES = 4;
642429
642431
  TELEGRAM_ALLOWED_UPDATES = ["message", "guest_message", "callback_query", "poll", "message_reaction", "message_reaction_count"];
642430
642432
  TELEGRAM_DEFAULT_LONG_POLL_TIMEOUT_SECONDS = 50;
642431
- TELEGRAM_DEFAULT_ROUTER_MODEL_CANDIDATES = [
642432
- "qwen2.5:3b",
642433
- "qwen2.5:7b",
642434
- "llama3.2:1b",
642435
- "llama3.2:3b",
642436
- "gemma3:1b",
642437
- "gemma3:4b",
642438
- "phi3:mini",
642439
- "phi4-mini:latest",
642440
- "qwen3:0.6b",
642441
- "qwen3:1.7b",
642442
- "qwen3:4b",
642443
- "qwen3:8b"
642444
- ];
642433
+ TELEGRAM_ROUTER_AUTO_MIN_PARAMETERS_B = 8;
642445
642434
  TELEGRAM_PUBLIC_TOOL_QUOTAS = {
642446
642435
  web: { limit: 20, windowMs: 60 * 6e4 },
642447
642436
  media: { limit: 30, windowMs: 60 * 6e4 },
@@ -648028,11 +648017,11 @@ ${retryText}`,
648028
648017
  }
648029
648018
  telegramRouterAutoModelEnabled() {
648030
648019
  const raw = (process.env["OMNIUS_TG_ROUTER_AUTO_MODEL"] ?? "").trim().toLowerCase();
648031
- return raw !== "0" && raw !== "false" && raw !== "off";
648020
+ return raw === "1" || raw === "true" || raw === "on";
648032
648021
  }
648033
648022
  telegramRouterCandidateModels() {
648034
648023
  const raw = (process.env["OMNIUS_TG_ROUTER_MODEL_CANDIDATES"] ?? "").trim();
648035
- const candidates = raw ? raw.split(/[,\s]+/).map((part) => part.trim()).filter(Boolean) : TELEGRAM_DEFAULT_ROUTER_MODEL_CANDIDATES;
648024
+ const candidates = raw ? raw.split(/[,\s]+/).map((part) => part.trim()).filter(Boolean) : [];
648036
648025
  return Array.from(new Set(candidates));
648037
648026
  }
648038
648027
  telegramRouterAllowThinkHeavyAutoModels() {
@@ -648042,16 +648031,10 @@ ${retryText}`,
648042
648031
  telegramRouterModelLooksThinkHeavy(name10) {
648043
648032
  return /\b(?:qwen3|qwq|deepseek-r1|r1-|reasoning)\b/i.test(name10);
648044
648033
  }
648045
- orderTelegramRouterCandidates(candidates) {
648046
- if (this.telegramRouterAllowThinkHeavyAutoModels()) return candidates;
648047
- const stable = candidates.filter((candidate) => !this.telegramRouterModelLooksThinkHeavy(candidate));
648048
- const thinkHeavy = candidates.filter((candidate) => this.telegramRouterModelLooksThinkHeavy(candidate));
648049
- return [...stable, ...thinkHeavy];
648050
- }
648051
648034
  normalizeOllamaModelNameForMatch(name10) {
648052
648035
  return name10.trim().toLowerCase().replace(/:latest$/, "");
648053
648036
  }
648054
- async fetchOllamaInstalledModelNames(baseUrl) {
648037
+ async fetchOllamaInstalledModels(baseUrl) {
648055
648038
  const url = `${baseUrl.replace(/\/+$/, "")}/api/tags`;
648056
648039
  const timeoutFn = AbortSignal.timeout;
648057
648040
  const res = await fetch(url, {
@@ -648059,7 +648042,43 @@ ${retryText}`,
648059
648042
  });
648060
648043
  if (!res.ok) throw new Error(`ollama /api/tags returned HTTP ${res.status}`);
648061
648044
  const data = await res.json();
648062
- return Array.isArray(data.models) ? data.models.map((model) => typeof model.name === "string" ? model.name : "").filter(Boolean) : [];
648045
+ return Array.isArray(data.models) ? data.models.map((model) => ({
648046
+ name: typeof model.name === "string" ? model.name : "",
648047
+ sizeBytes: typeof model.size === "number" ? model.size : void 0,
648048
+ parameterSize: typeof model.details?.parameter_size === "string" ? model.details.parameter_size : void 0
648049
+ })).filter((model) => Boolean(model.name)) : [];
648050
+ }
648051
+ telegramModelParameterBillions(model) {
648052
+ const haystack = `${model.name} ${model.parameterSize ?? ""}`.toLowerCase();
648053
+ const billion = haystack.match(/(\d+(?:\.\d+)?)\s*(?:b|bn)\b/);
648054
+ if (billion) return Number(billion[1]);
648055
+ const million = haystack.match(/(\d+(?:\.\d+)?)\s*m\b/);
648056
+ if (million) return Number(million[1]) / 1e3;
648057
+ return null;
648058
+ }
648059
+ scoreTelegramInstalledRouterModel(model) {
648060
+ const name10 = model.name.toLowerCase();
648061
+ if (/(?:embed|embedding|nomic|bge|e5-|clip|rerank|moondream|llava|vision|vl\b|minicpm|whisper|tts|sdxl|diffusion)/i.test(name10)) {
648062
+ return Number.NEGATIVE_INFINITY;
648063
+ }
648064
+ const paramsB = this.telegramModelParameterBillions(model);
648065
+ if (paramsB !== null && paramsB < TELEGRAM_ROUTER_AUTO_MIN_PARAMETERS_B) {
648066
+ return Number.NEGATIVE_INFINITY;
648067
+ }
648068
+ if (paramsB === null && (model.sizeBytes ?? 0) < 5e9) {
648069
+ return Number.NEGATIVE_INFINITY;
648070
+ }
648071
+ let score = 0;
648072
+ if (paramsB !== null) score += paramsB * 10;
648073
+ else score += Math.min(80, (model.sizeBytes ?? 0) / 1e9);
648074
+ if (/qwen|huihui|qwq/i.test(name10)) score += 80;
648075
+ else if (/deepseek|nemotron|llama|mistral|mixtral|command-r|devstral/i.test(name10)) score += 50;
648076
+ else if (/gemma/i.test(name10)) score += 20;
648077
+ if (/:latest$/i.test(model.name)) score += 1;
648078
+ if (this.telegramRouterModelLooksThinkHeavy(model.name) && !this.telegramRouterAllowThinkHeavyAutoModels()) {
648079
+ score -= 15;
648080
+ }
648081
+ return score;
648063
648082
  }
648064
648083
  async resolveTelegramRouterBackend(config) {
648065
648084
  const explicit = (process.env["OMNIUS_TG_ROUTER_MODEL"] ?? "").trim();
@@ -648071,17 +648090,20 @@ ${retryText}`,
648071
648090
  detail: "OMNIUS_TG_ROUTER_MODEL"
648072
648091
  };
648073
648092
  }
648074
- if (config.backendType !== "ollama" || !this.telegramRouterAutoModelEnabled()) {
648093
+ if (config.backendType !== "ollama") {
648075
648094
  return {
648076
648095
  backend: new OllamaAgenticBackend(config.backendUrl, config.model, config.apiKey),
648077
648096
  model: config.model,
648078
648097
  source: "main"
648079
648098
  };
648080
648099
  }
648081
- const candidates = this.orderTelegramRouterCandidates(this.telegramRouterCandidateModels());
648100
+ const autoModelEnabled = this.telegramRouterAutoModelEnabled();
648101
+ const candidateFilter = this.telegramRouterCandidateModels();
648102
+ const candidates = new Set(candidateFilter.map((candidate) => this.normalizeOllamaModelNameForMatch(candidate)));
648082
648103
  const cacheKey = `${config.backendUrl}
648083
648104
  ${config.model}
648084
- ${candidates.join(",")}`;
648105
+ auto=${autoModelEnabled ? "1" : "0"}
648106
+ ${candidateFilter.join(",")}`;
648085
648107
  const now = Date.now();
648086
648108
  if (this.telegramRouterModelCache && this.telegramRouterModelCache.cacheKey === cacheKey && now - this.telegramRouterModelCache.atMs < 6e4) {
648087
648109
  const cached = this.telegramRouterModelCache;
@@ -648092,30 +648114,65 @@ ${candidates.join(",")}`;
648092
648114
  detail: cached.detail
648093
648115
  };
648094
648116
  }
648117
+ if (!autoModelEnabled) {
648118
+ const detail2 = "Telegram router auto-model selection is disabled by default; using main model";
648119
+ this.telegramRouterModelCache = {
648120
+ cacheKey,
648121
+ atMs: now,
648122
+ model: config.model,
648123
+ source: "main",
648124
+ detail: detail2
648125
+ };
648126
+ return {
648127
+ backend: new OllamaAgenticBackend(config.backendUrl, config.model, config.apiKey),
648128
+ model: config.model,
648129
+ source: "main",
648130
+ detail: detail2
648131
+ };
648132
+ }
648095
648133
  try {
648096
- const installed = await this.fetchOllamaInstalledModelNames(config.backendUrl);
648134
+ const installed = await this.fetchOllamaInstalledModels(config.backendUrl);
648097
648135
  const installedByNormalized = /* @__PURE__ */ new Map();
648098
- for (const name10 of installed) {
648099
- installedByNormalized.set(this.normalizeOllamaModelNameForMatch(name10), name10);
648136
+ for (const model of installed) {
648137
+ installedByNormalized.set(this.normalizeOllamaModelNameForMatch(model.name), model);
648100
648138
  }
648101
- for (const candidate of candidates) {
648102
- const selected = installedByNormalized.get(this.normalizeOllamaModelNameForMatch(candidate));
648103
- if (!selected) continue;
648139
+ const installedMain = installedByNormalized.get(this.normalizeOllamaModelNameForMatch(config.model));
648140
+ if (installedMain) {
648104
648141
  const resolved = {
648105
648142
  cacheKey,
648106
648143
  atMs: now,
648107
- model: selected,
648108
- source: "auto-small",
648109
- detail: "selected first installed Telegram router candidate from Ollama /api/tags; think-heavy models are tried last unless OMNIUS_TG_ROUTER_ALLOW_THINK_MODELS=1"
648144
+ model: installedMain.name,
648145
+ source: "main",
648146
+ detail: "main Telegram router model is installed in Ollama /api/tags; using main model by policy"
648110
648147
  };
648111
648148
  this.telegramRouterModelCache = resolved;
648112
648149
  return {
648113
- backend: new OllamaAgenticBackend(config.backendUrl, selected, config.apiKey),
648114
- model: selected,
648115
- source: "auto-small",
648150
+ backend: new OllamaAgenticBackend(config.backendUrl, installedMain.name, config.apiKey),
648151
+ model: installedMain.name,
648152
+ source: "main",
648116
648153
  detail: resolved.detail
648117
648154
  };
648118
648155
  }
648156
+ if (autoModelEnabled) {
648157
+ const pool3 = candidateFilter.length > 0 ? installed.filter((model) => candidates.has(this.normalizeOllamaModelNameForMatch(model.name))) : installed;
648158
+ const selected = pool3.map((model) => ({ model, score: this.scoreTelegramInstalledRouterModel(model) })).filter((entry) => Number.isFinite(entry.score)).sort((a2, b) => b.score - a2.score)[0]?.model;
648159
+ if (selected) {
648160
+ const resolved = {
648161
+ cacheKey,
648162
+ atMs: now,
648163
+ model: selected.name,
648164
+ source: "auto-installed",
648165
+ detail: `main Telegram router model ${JSON.stringify(config.model)} was not found in Ollama /api/tags; selected best installed capable router model dynamically (minimum ${TELEGRAM_ROUTER_AUTO_MIN_PARAMETERS_B}B, excludes embeddings/vision/tiny models)`
648166
+ };
648167
+ this.telegramRouterModelCache = resolved;
648168
+ return {
648169
+ backend: new OllamaAgenticBackend(config.backendUrl, selected.name, config.apiKey),
648170
+ model: selected.name,
648171
+ source: "auto-installed",
648172
+ detail: resolved.detail
648173
+ };
648174
+ }
648175
+ }
648119
648176
  } catch (err) {
648120
648177
  const detail2 = `router model auto-detect failed: ${err instanceof Error ? err.message : String(err)}`;
648121
648178
  this.telegramRouterModelCache = {
@@ -648132,7 +648189,7 @@ ${candidates.join(",")}`;
648132
648189
  detail: detail2
648133
648190
  };
648134
648191
  }
648135
- const detail = "no configured small router model was installed; using main model";
648192
+ const detail = `no installed capable Telegram router model met the dynamic minimum (${TELEGRAM_ROUTER_AUTO_MIN_PARAMETERS_B}B); using main model`;
648136
648193
  this.telegramRouterModelCache = {
648137
648194
  cacheKey,
648138
648195
  atMs: now,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.209",
3
+ "version": "1.0.210",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.209",
9
+ "version": "1.0.210",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.209",
3
+ "version": "1.0.210",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",