omnius 1.0.4 → 1.0.5

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
@@ -526549,6 +526549,14 @@ var init_app_state = __esm({
526549
526549
  });
526550
526550
 
526551
526551
  // packages/orchestrator/dist/streaming-executor.js
526552
+ function stableValueKey(value2) {
526553
+ if (value2 === null || typeof value2 !== "object")
526554
+ return JSON.stringify(value2);
526555
+ if (Array.isArray(value2))
526556
+ return `[${value2.map(stableValueKey).join(",")}]`;
526557
+ const record = value2;
526558
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableValueKey(record[key])}`).join(",")}}`;
526559
+ }
526552
526560
  var StreamingToolExecutor;
526553
526561
  var init_streaming_executor = __esm({
526554
526562
  "packages/orchestrator/dist/streaming-executor.js"() {
@@ -526700,6 +526708,62 @@ var init_streaming_executor = __esm({
526700
526708
  return true;
526701
526709
  return false;
526702
526710
  }
526711
+ entryFingerprint(entry) {
526712
+ return `${entry.name}:${stableValueKey(entry.args)}`;
526713
+ }
526714
+ findPriorEquivalent(entry) {
526715
+ const entryIdx = this.insertionOrder.indexOf(entry.id);
526716
+ if (entryIdx <= 0 || !entry.finalized)
526717
+ return null;
526718
+ const fp = this.entryFingerprint(entry);
526719
+ for (let i2 = 0; i2 < entryIdx; i2++) {
526720
+ const prior = this.tools.get(this.insertionOrder[i2]);
526721
+ if (!prior || !prior.finalized)
526722
+ continue;
526723
+ if (this.entryFingerprint(prior) === fp)
526724
+ return prior;
526725
+ }
526726
+ return null;
526727
+ }
526728
+ cloneDuplicateResult(prior) {
526729
+ if (!prior.result)
526730
+ return null;
526731
+ const prefix = `[DUPLICATE STREAM TOOL CALL — reused result from ${prior.id}]
526732
+ `;
526733
+ return {
526734
+ success: prior.result.success,
526735
+ output: prior.result.output ? `${prefix}${prior.result.output}` : prior.result.output,
526736
+ error: prior.result.error
526737
+ };
526738
+ }
526739
+ mirrorPriorEquivalent(entry) {
526740
+ const prior = this.findPriorEquivalent(entry);
526741
+ if (!prior)
526742
+ return false;
526743
+ if ((prior.state === "completed" || prior.state === "failed" || prior.state === "yielded") && prior.result) {
526744
+ entry.state = prior.result.success ? "completed" : "failed";
526745
+ entry.result = this.cloneDuplicateResult(prior) ?? prior.result;
526746
+ entry.startedAt = prior.startedAt;
526747
+ entry.completedAt = prior.completedAt ?? Date.now();
526748
+ return true;
526749
+ }
526750
+ if (prior.state === "executing" && prior.promise) {
526751
+ entry.state = "executing";
526752
+ entry.startedAt = prior.startedAt ?? Date.now();
526753
+ entry.promise = prior.promise.then(() => {
526754
+ entry.result = this.cloneDuplicateResult(prior) ?? {
526755
+ success: false,
526756
+ output: "",
526757
+ error: "Duplicate streaming tool call could not reuse prior result"
526758
+ };
526759
+ entry.state = entry.result.success ? "completed" : "failed";
526760
+ entry.completedAt = Date.now();
526761
+ this.processQueue();
526762
+ });
526763
+ return true;
526764
+ }
526765
+ return false;
526766
+ }
526703
526767
  /**
526704
526768
  * Process the queue in insertion order.
526705
526769
  * Starts tools that can execute, stops at first exclusive tool that must wait.
@@ -526709,6 +526773,8 @@ var init_streaming_executor = __esm({
526709
526773
  const entry = this.tools.get(id);
526710
526774
  if (!entry || entry.state !== "queued")
526711
526775
  continue;
526776
+ if (this.mirrorPriorEquivalent(entry))
526777
+ continue;
526712
526778
  if (this.canExecute(entry)) {
526713
526779
  this.startExecution(entry);
526714
526780
  } else if (!entry.concurrencySafe) {
@@ -535466,6 +535532,7 @@ ${sr.result.output}`;
535466
535532
  this.emit({
535467
535533
  type: "assistant_text",
535468
535534
  content: summary,
535535
+ source: "task_complete_summary",
535469
535536
  turn,
535470
535537
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
535471
535538
  });
@@ -535506,6 +535573,7 @@ ${sr.result.output}`;
535506
535573
  this.emit({
535507
535574
  type: "assistant_text",
535508
535575
  content: summary,
535576
+ source: "task_complete_summary",
535509
535577
  turn,
535510
535578
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
535511
535579
  });
@@ -535581,6 +535649,7 @@ ${sr.result.output}`;
535581
535649
  this.emit({
535582
535650
  type: "assistant_text",
535583
535651
  content: summary,
535652
+ source: "task_complete_summary",
535584
535653
  turn,
535585
535654
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
535586
535655
  });
@@ -536306,6 +536375,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
536306
536375
  this.emit({
536307
536376
  type: "assistant_text",
536308
536377
  content: summary,
536378
+ source: "task_complete_summary",
536309
536379
  turn,
536310
536380
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
536311
536381
  });
@@ -540152,6 +540222,7 @@ ${description}`
540152
540222
  this.emit({
540153
540223
  type: "assistant_text",
540154
540224
  content: cleanContent,
540225
+ source: "model_visible_text",
540155
540226
  turn,
540156
540227
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
540157
540228
  });
@@ -593564,7 +593635,8 @@ function selectTelegramFinalResponse(args) {
593564
593635
  (best, current) => current.length > best.length ? current : best
593565
593636
  );
593566
593637
  }
593567
- return cleanTelegramVisibleReply(args.summary || "");
593638
+ void args.summary;
593639
+ return "";
593568
593640
  }
593569
593641
  function formatTelegramProgressEvent(event) {
593570
593642
  if (event.type === "tool_call" && event.toolName === "task_complete") return null;
@@ -594222,6 +594294,8 @@ Telegram response contract:
594222
594294
  groupSkipLogAt = /* @__PURE__ */ new Map();
594223
594295
  /** Telegram interaction routing profile */
594224
594296
  interactionMode = "auto";
594297
+ /** Actual model context window discovered by the main TUI. */
594298
+ contextWindowSize = 0;
594225
594299
  /** Event handler for forwarding sub-agent events to parent TUI */
594226
594300
  onSubAgentEvent = null;
594227
594301
  /** Tool policy config — user overrides from config */
@@ -594272,6 +594346,9 @@ Telegram response contract:
594272
594346
  getInteractionMode() {
594273
594347
  return this.interactionMode;
594274
594348
  }
594349
+ setContextWindowSize(size) {
594350
+ this.contextWindowSize = Number.isFinite(size) && size > 0 ? Math.trunc(size) : 0;
594351
+ }
594275
594352
  /** Update tool policy config at runtime (e.g., from /disable command) */
594276
594353
  setToolPolicyConfig(config) {
594277
594354
  this.toolPolicyConfig = config;
@@ -594773,6 +594850,7 @@ ${lines.join("\n")}`);
594773
594850
  return sections.join("\n\n");
594774
594851
  }
594775
594852
  maybeLogTelegramGroupSkip(msg, reason) {
594853
+ if (process.env["OMNIUS_TELEGRAM_DEBUG_SKIPS"] !== "1") return;
594776
594854
  const sessionKey = this.sessionKeyForMessage(msg);
594777
594855
  const now = Date.now();
594778
594856
  const last2 = this.groupSkipLogAt.get(sessionKey) ?? 0;
@@ -594840,7 +594918,7 @@ ${msg.text}`
594840
594918
  tools: [],
594841
594919
  temperature: 0,
594842
594920
  maxTokens: 220,
594843
- timeoutMs: Math.min(config.timeoutMs ?? 3e4, 15e3),
594921
+ timeoutMs: Math.min(Math.max(config.timeoutMs ?? 3e4, 5e3), 15e3),
594844
594922
  think: false
594845
594923
  });
594846
594924
  const text = result.choices[0]?.message?.content ?? "";
@@ -594868,6 +594946,19 @@ ${msg.text}`
594868
594946
  return `Workspace context unavailable: ${reason}`;
594869
594947
  }
594870
594948
  }
594949
+ telegramFallbackCompactionThreshold(modelTier) {
594950
+ if (modelTier === "small") return 12e3;
594951
+ if (modelTier === "medium") return 24e3;
594952
+ return 4e4;
594953
+ }
594954
+ telegramWorkspaceBudget(profile) {
594955
+ if (this.contextWindowSize > 0) {
594956
+ const ratio = profile === "chat" ? 0.08 : 0.12;
594957
+ const floor = profile === "chat" ? 16e3 : 24e3;
594958
+ return Math.max(floor, Math.floor(this.contextWindowSize * ratio));
594959
+ }
594960
+ return profile === "chat" ? 16e3 : 24e3;
594961
+ }
594871
594962
  buildPrimaryTuiSessionContext(telegramSessionId) {
594872
594963
  const primarySessionId = process.env["OMNIUS_SESSION_ID"] || process.env["OMNIUS_TUI_SESSION_ID"] || "";
594873
594964
  if (!primarySessionId || primarySessionId === telegramSessionId) return "";
@@ -594925,7 +595016,7 @@ ${ADMIN_CHAT_PROFILE_PROMPT}`);
594925
595016
  if (primarySessionContext) sections.push(`## Primary TUI Session State
594926
595017
 
594927
595018
  ${primarySessionContext}`);
594928
- const workspaceContext = this.buildTelegramWorkspaceContext(modelTier, profile === "chat" ? 16e3 : 24e3);
595019
+ const workspaceContext = this.buildTelegramWorkspaceContext(modelTier, this.telegramWorkspaceBudget(profile));
594929
595020
  if (workspaceContext) sections.push(`## Workspace Context
594930
595021
 
594931
595022
  ${workspaceContext}`);
@@ -595684,6 +595775,7 @@ ${mediaContext}` : ""}`
595684
595775
  const isGroup = msg.chatType !== "private";
595685
595776
  const creativeWorkspace = subAgent.creativeWorkspaceRoot ? formatTelegramCreativeWorkspacePrompt(subAgent.creativeWorkspaceRoot) : "";
595686
595777
  const sessionContext = this.buildTelegramSessionContext(msg, ctx3, profile, modelTier);
595778
+ const contextWindowSize = this.contextWindowSize;
595687
595779
  const backend = new OllamaAgenticBackend(
595688
595780
  config.backendUrl,
595689
595781
  config.model,
@@ -595695,7 +595787,8 @@ ${mediaContext}` : ""}`
595695
595787
  temperature: 0.3,
595696
595788
  requestTimeoutMs: config.timeoutMs,
595697
595789
  taskTimeoutMs: isAdminDM ? config.timeoutMs * 3 : config.timeoutMs,
595698
- compactionThreshold: modelTier === "small" ? 8e3 : 16e3,
595790
+ compactionThreshold: this.telegramFallbackCompactionThreshold(modelTier),
595791
+ contextWindowSize,
595699
595792
  modelTier,
595700
595793
  streamEnabled: true,
595701
595794
  dynamicContext: sessionContext.context,
@@ -595728,7 +595821,7 @@ ${mediaContext}` : ""}`
595728
595821
  }
595729
595822
  } else if (event.type === "status" && event.content) {
595730
595823
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `status: ${event.content}`);
595731
- } else if (event.type === "assistant_text" && event.content) {
595824
+ } else if (event.type === "assistant_text" && event.content && event.source !== "task_complete_summary") {
595732
595825
  subAgent.assistantText = event.content;
595733
595826
  } else if (event.type === "stream_end" && event.content) {
595734
595827
  subAgent.streamText = event.content;
@@ -595939,6 +596032,13 @@ ${creativeWorkspace}` : ""}`;
595939
596032
  fullSubAgentTool
595940
596033
  ];
595941
596034
  const allTools = context2 === "telegram-admin-dm" ? adminTools : sharedReadMemoryWebTools;
596035
+ if (this.contextWindowSize > 0) {
596036
+ for (const tool of allTools) {
596037
+ if ("setContextWindowSize" in tool && typeof tool.setContextWindowSize === "function") {
596038
+ tool.setContextWindowSize(this.contextWindowSize);
596039
+ }
596040
+ }
596041
+ }
595942
596042
  let adaptedTools = allTools.map((tool) => adaptTool5(tool, todoSessionId));
595943
596043
  adaptedTools = applyToolPolicy(adaptedTools, context2, this.toolPolicyConfig);
595944
596044
  if (context2 !== "telegram-admin-dm") {
@@ -624211,6 +624311,7 @@ ${result.summary}`
624211
624311
  resolvedContextWindowSize = ctxSize;
624212
624312
  statusBar.setContextWindowSize(ctxSize);
624213
624313
  setActiveTaskContextWindowSize(ctxSize);
624314
+ telegramBridge?.setContextWindowSize(ctxSize);
624214
624315
  }
624215
624316
  }).catch(() => {
624216
624317
  });
@@ -626139,6 +626240,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
626139
626240
  currentConfig,
626140
626241
  repoRoot
626141
626242
  );
626243
+ if (resolvedContextWindowSize > 0) {
626244
+ telegramBridge.setContextWindowSize(resolvedContextWindowSize);
626245
+ }
626142
626246
  telegramBridge.setInteractionMode(savedSettings.telegramMode ?? "auto");
626143
626247
  if (adminId) {
626144
626248
  telegramBridge.setAdmin(adminId);
@@ -626180,7 +626284,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
626180
626284
  }
626181
626285
  });
626182
626286
  telegramBridge.setOnSubAgentEvent((chatId, username, event) => {
626183
- if (event.type === "tool_call" && event.toolName) {
626287
+ if (event.type === "tool_call" && event.toolName && event.toolName !== "task_complete") {
626184
626288
  const argsPreview = event.toolArgs ? JSON.stringify(event.toolArgs).slice(0, 60) : "";
626185
626289
  writeContent(
626186
626290
  () => renderTelegramSubAgentToolCall(
@@ -626189,7 +626293,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
626189
626293
  argsPreview
626190
626294
  )
626191
626295
  );
626192
- } else if (event.type === "status" && event.content) {
626296
+ } else if (event.type === "status" && event.content && process.env["OMNIUS_TELEGRAM_DEBUG_STATUS"] === "1") {
626193
626297
  writeContent(
626194
626298
  () => renderTelegramSubAgentEvent(username, event.content)
626195
626299
  );
@@ -627207,6 +627311,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
627207
627311
  setContextWindowSize: (size) => {
627208
627312
  resolvedContextWindowSize = size;
627209
627313
  statusBar.setContextWindowSize(size);
627314
+ telegramBridge?.setContextWindowSize(size);
627210
627315
  },
627211
627316
  setCapabilities: (caps) => {
627212
627317
  resolvedCaps = caps;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.4",
9
+ "version": "1.0.5",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",