omnius 1.0.16 → 1.0.17

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
@@ -597044,6 +597044,12 @@ function telegramSessionIdFromKey(sessionKey) {
597044
597044
  return `telegram-${createHash19("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
597045
597045
  }
597046
597046
  function selectTelegramFinalResponse(args) {
597047
+ const committedVisibleReply = cleanTelegramVisibleReply(args.visibleReplyText || "");
597048
+ if (committedVisibleReply) return committedVisibleReply;
597049
+ if (args.completionBoundarySeen) {
597050
+ void args.summary;
597051
+ return "";
597052
+ }
597047
597053
  const visibleCandidates = [
597048
597054
  args.streamText,
597049
597055
  args.accumulated,
@@ -598961,6 +598967,9 @@ ${mediaContext}`;
598961
598967
  accumulated: "",
598962
598968
  assistantText: "",
598963
598969
  streamText: "",
598970
+ visibleReplyText: "",
598971
+ currentStreamToolNames: /* @__PURE__ */ new Set(),
598972
+ completionBoundarySeen: false,
598964
598973
  intermediateLines: [],
598965
598974
  lastEditMs: 0,
598966
598975
  aborted: false,
@@ -599059,6 +599068,9 @@ ${mediaContext}`;
599059
599068
  accumulated: "",
599060
599069
  assistantText: "",
599061
599070
  streamText: "",
599071
+ visibleReplyText: "",
599072
+ currentStreamToolNames: /* @__PURE__ */ new Set(),
599073
+ completionBoundarySeen: false,
599062
599074
  intermediateLines: [],
599063
599075
  lastEditMs: 0,
599064
599076
  aborted: false,
@@ -599334,6 +599346,22 @@ ${mediaContext}` : ""}`
599334
599346
  }
599335
599347
  return stripTelegramHiddenThinking(accumulated).trim();
599336
599348
  }
599349
+ retainTelegramVisibleReplyDraft(subAgent, draft, streamToolNames = subAgent.currentStreamToolNames) {
599350
+ if (subAgent.visibleReplyText) return;
599351
+ const clean3 = cleanTelegramVisibleReply(draft);
599352
+ if (!clean3) return;
599353
+ const toolNames = [...streamToolNames];
599354
+ const hasNonCompletionTool = toolNames.some((name10) => name10 !== "task_complete");
599355
+ if (hasNonCompletionTool) return;
599356
+ subAgent.visibleReplyText = clean3;
599357
+ }
599358
+ retainTelegramVisibleReplyFromCompletedStream(subAgent) {
599359
+ this.retainTelegramVisibleReplyDraft(
599360
+ subAgent,
599361
+ subAgent.streamText || subAgent.accumulated,
599362
+ subAgent.currentStreamToolNames
599363
+ );
599364
+ }
599337
599365
  /** Run a sub-agent for a Telegram message */
599338
599366
  async runSubAgent(msg, subAgent, mediaContext = "", profile = "action") {
599339
599367
  const config = this.agentConfig;
@@ -599379,6 +599407,16 @@ ${mediaContext}` : ""}`
599379
599407
  if (subAgent.aborted) return;
599380
599408
  let suppressExternalEvent = false;
599381
599409
  if (event.type === "tool_call" && event.toolName) {
599410
+ if (event.toolName === "task_complete") {
599411
+ subAgent.completionBoundarySeen = true;
599412
+ const toolNamesAtCompletion = new Set(subAgent.currentStreamToolNames);
599413
+ toolNamesAtCompletion.add("task_complete");
599414
+ this.retainTelegramVisibleReplyDraft(
599415
+ subAgent,
599416
+ subAgent.accumulated || subAgent.streamText,
599417
+ toolNamesAtCompletion
599418
+ );
599419
+ }
599382
599420
  const fp = `${event.toolName}:${stableTelegramValueKey(event.toolArgs ?? {})}`;
599383
599421
  if (subAgent.surfacedToolCallFingerprints.has(fp)) {
599384
599422
  suppressExternalEvent = true;
@@ -599390,6 +599428,7 @@ ${mediaContext}` : ""}`
599390
599428
  this.onSubAgentEvent?.(msg.chatId, msg.username, event);
599391
599429
  }
599392
599430
  if (event.type === "tool_call" && event.toolName) {
599431
+ subAgent.currentStreamToolNames.add(event.toolName);
599393
599432
  if (suppressExternalEvent) return;
599394
599433
  const argsPreview = event.toolArgs ? JSON.stringify(event.toolArgs).slice(0, 100) : "";
599395
599434
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `tool: ${event.toolName}(${argsPreview})`);
@@ -599406,8 +599445,10 @@ ${mediaContext}` : ""}`
599406
599445
  } else if (event.type === "assistant_text" && event.content && event.source !== "task_complete_summary") {
599407
599446
  subAgent.assistantText = event.content;
599408
599447
  } else if (event.type === "stream_start") {
599448
+ this.retainTelegramVisibleReplyFromCompletedStream(subAgent);
599409
599449
  subAgent.accumulated = "";
599410
599450
  subAgent.streamText = "";
599451
+ subAgent.currentStreamToolNames.clear();
599411
599452
  } else if (event.type === "stream_end" && event.content) {
599412
599453
  subAgent.streamText = event.content;
599413
599454
  }
@@ -599419,7 +599460,10 @@ ${mediaContext}` : ""}`
599419
599460
  subAgent.intermediateLines.push(intermediateLine);
599420
599461
  }
599421
599462
  if (!msg.guestQueryId) {
599422
- const html = renderTelegramLiveProgressHTML(subAgent.intermediateLines, subAgent.accumulated);
599463
+ const html = renderTelegramLiveProgressHTML(
599464
+ subAgent.intermediateLines,
599465
+ subAgent.visibleReplyText || subAgent.accumulated
599466
+ );
599423
599467
  if (!html.trim()) return;
599424
599468
  const now = Date.now();
599425
599469
  if (subAgent.liveMessageId) {
@@ -599500,10 +599544,12 @@ Todo/session id: ${sessionContext.sessionId}` : `Telegram ${isGroup ? "group" :
599500
599544
  ${creativeWorkspace}` : ""}`;
599501
599545
  const result = await runner.run(userPrompt, systemCtx);
599502
599546
  return selectTelegramFinalResponse({
599547
+ visibleReplyText: subAgent.visibleReplyText,
599503
599548
  assistantText: subAgent.assistantText,
599504
599549
  streamText: subAgent.streamText,
599505
599550
  accumulated: subAgent.accumulated,
599506
- summary: result.summary
599551
+ summary: result.summary,
599552
+ completionBoundarySeen: subAgent.completionBoundarySeen
599507
599553
  });
599508
599554
  }
599509
599555
  telegramScopedMemoryPrefix(chatId) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.16",
9
+ "version": "1.0.17",
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.16",
3
+ "version": "1.0.17",
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",