omnius 1.0.364 → 1.0.365

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
@@ -17802,15 +17802,23 @@ function relationAllowed(edge, options2) {
17802
17802
  return false;
17803
17803
  return true;
17804
17804
  }
17805
+ function edgeAllowed(edge, options2, allowedSourceIds) {
17806
+ if (!relationAllowed(edge, options2))
17807
+ return false;
17808
+ if (!allowedSourceIds)
17809
+ return true;
17810
+ return !!edge.sourceEpisodeId && allowedSourceIds.has(edge.sourceEpisodeId);
17811
+ }
17805
17812
  function selectInnerGraphCandidates(graph, candidates, options2 = {}) {
17806
17813
  const minDegree = Math.max(1, Math.floor(options2.minDegree ?? 2));
17807
17814
  const candidateEpisodeIds = [...new Set(candidates.map((candidate) => candidate.episode.id).filter(Boolean))];
17815
+ const allowedSourceIds = options2.allowedSourceEpisodeIds?.length ? new Set(options2.allowedSourceEpisodeIds) : void 0;
17808
17816
  const candidateScore = new Map(candidates.map((candidate) => [candidate.episode.id, candidate.score ?? 0]));
17809
17817
  const candidateTimestamp = new Map(candidates.map((candidate) => [candidate.episode.id, candidate.episode.timestamp]));
17810
17818
  const sourceEdges = graph.currentEdgesForSourceEpisodes(candidateEpisodeIds, Math.max(1e3, candidateEpisodeIds.length * 20));
17811
17819
  const byNode = /* @__PURE__ */ new Map();
17812
17820
  for (const edge of sourceEdges) {
17813
- if (!relationAllowed(edge, options2))
17821
+ if (!edgeAllowed(edge, options2, allowedSourceIds))
17814
17822
  continue;
17815
17823
  const episodeId = edge.sourceEpisodeId;
17816
17824
  if (!episodeId || !candidateEpisodeIds.includes(episodeId))
@@ -17828,7 +17836,7 @@ function selectInnerGraphCandidates(graph, candidates, options2 = {}) {
17828
17836
  const now2 = Date.now();
17829
17837
  const results = [];
17830
17838
  for (const entry of byNode.values()) {
17831
- const allEdges = graph.currentEdges(entry.node.id).filter((edge) => relationAllowed(edge, options2));
17839
+ const allEdges = graph.currentEdges(entry.node.id).filter((edge) => edgeAllowed(edge, options2, allowedSourceIds));
17832
17840
  const degree = allEdges.length;
17833
17841
  if (degree < minDegree)
17834
17842
  continue;
@@ -17864,6 +17872,7 @@ function walkGraphFromSeed(graph, seed, options2 = {}) {
17864
17872
  const maxVisitedNodes = Math.max(1, Math.floor(options2.maxVisitedNodes ?? 64));
17865
17873
  const maxTraversedEdges = Math.max(1, Math.floor(options2.maxTraversedEdges ?? 160));
17866
17874
  const maxSourceEpisodes = Math.max(1, Math.floor(options2.maxSourceEpisodes ?? 80));
17875
+ const allowedSourceIds = options2.allowedSourceEpisodeIds?.length ? new Set(options2.allowedSourceEpisodeIds) : void 0;
17867
17876
  const visited = /* @__PURE__ */ new Map();
17868
17877
  const depthByNodeId = {};
17869
17878
  const traversed = /* @__PURE__ */ new Map();
@@ -17882,7 +17891,7 @@ function walkGraphFromSeed(graph, seed, options2 = {}) {
17882
17891
  const item = queue.shift();
17883
17892
  if (item.depth >= maxDepth)
17884
17893
  continue;
17885
- const neighbors2 = graph.neighbors(item.node.id).filter(({ edge }) => relationAllowed(edge, options2)).sort((a2, b) => b.edge.confidence - a2.edge.confidence || b.node.mentionCount - a2.node.mentionCount);
17894
+ const neighbors2 = graph.neighbors(item.node.id).filter(({ edge }) => edgeAllowed(edge, options2, allowedSourceIds)).sort((a2, b) => b.edge.confidence - a2.edge.confidence || b.node.mentionCount - a2.node.mentionCount);
17886
17895
  for (const { node, edge } of neighbors2) {
17887
17896
  if (traversed.size >= maxTraversedEdges)
17888
17897
  break;
@@ -561348,7 +561357,7 @@ function sanitizeMessagesForCheckpoint(messages2) {
561348
561357
  deduped.push(m2);
561349
561358
  continue;
561350
561359
  }
561351
- if (i2 === lastFrameIdx) {
561360
+ if (content.startsWith(CONTEXT_FRAME_MARKER)) {
561352
561361
  deduped.push(m2);
561353
561362
  continue;
561354
561363
  }
@@ -561363,6 +561372,10 @@ function sanitizeMessagesForCheckpoint(messages2) {
561363
561372
  for (const m2 of deduped) {
561364
561373
  if (m2.role === "system") {
561365
561374
  const content = typeof m2.content === "string" ? m2.content : "";
561375
+ if (content.startsWith(CONTEXT_FRAME_MARKER)) {
561376
+ capped.push(m2);
561377
+ continue;
561378
+ }
561366
561379
  if (sysChars + content.length > MAX_CHECKPOINT_SYSTEM_CHARS) {
561367
561380
  continue;
561368
561381
  }
@@ -570682,8 +570695,9 @@ ${parts.join("\n")}
570682
570695
  }
570683
570696
  _initializeCompletionContract(task, context2, actualUserGoal) {
570684
570697
  const goalText = actualUserGoal || task;
570685
- this._completionContractSeedText = [goalText, context2 ?? ""].map((text2) => String(text2 || "").trim()).filter(Boolean).join("\n\n");
570686
- this._completionContract = inferCompletionContractFromTexts([this._completionContractSeedText], task);
570698
+ const seedTexts = actualUserGoal ? [goalText] : [goalText, context2 ?? ""];
570699
+ this._completionContractSeedText = seedTexts.map((text2) => String(text2 || "").trim()).filter(Boolean).join("\n\n");
570700
+ this._completionContract = inferCompletionContractFromTexts([this._completionContractSeedText], goalText);
570687
570701
  this._persistCompletionContract(this._completionContract);
570688
570702
  return this._completionContract;
570689
570703
  }
@@ -575537,7 +575551,8 @@ Respond with your assessment, then take action.`;
575537
575551
  this._loadResolutionMemory();
575538
575552
  this._pauseResolve = null;
575539
575553
  this.pendingUserMessages.length = 0;
575540
- const userGoal = (actualUserGoal || cleanedTask).slice(0, 500);
575554
+ const persistentTaskGoal = cleanForStorage(actualUserGoal || "") || cleanedTask;
575555
+ const userGoal = persistentTaskGoal.slice(0, 500);
575541
575556
  this._taskState = {
575542
575557
  goal: userGoal,
575543
575558
  originalGoal: userGoal,
@@ -575737,8 +575752,8 @@ ${_notes}`;
575737
575752
  }
575738
575753
  try {
575739
575754
  if (!this.options.subAgent) {
575740
- const _imp = Math.min(9, Math.max(3, 3 + Math.floor((task?.length || 0) / 250)));
575741
- const _kw = String(task || "").toLowerCase().match(/[a-z][a-z0-9_-]{3,}/g)?.filter((w) => ![
575755
+ const _imp = Math.min(9, Math.max(3, 3 + Math.floor((persistentTaskGoal.length || 0) / 250)));
575756
+ const _kw = String(persistentTaskGoal || "").toLowerCase().match(/[a-z][a-z0-9_-]{3,}/g)?.filter((w) => ![
575742
575757
  "this",
575743
575758
  "that",
575744
575759
  "with",
@@ -575750,14 +575765,14 @@ ${_notes}`;
575750
575765
  "please"
575751
575766
  ].includes(w)).slice(0, 6) ?? [];
575752
575767
  noteAfterTask({
575753
- summary: `Task: ${String(task).slice(0, 200)}`,
575768
+ summary: `Task: ${persistentTaskGoal.slice(0, 200)}`,
575754
575769
  importance: _imp,
575755
575770
  keywords: _kw
575756
575771
  });
575757
575772
  }
575758
575773
  } catch {
575759
575774
  }
575760
- this._contextTree = new ContextTree(`sys-${systemPrompt.length}`, cleanedTask.slice(0, 200));
575775
+ this._contextTree = new ContextTree(`sys-${systemPrompt.length}`, persistentTaskGoal.slice(0, 200));
575761
575776
  this.emit({
575762
575777
  type: "status",
575763
575778
  content: `Context assembled: ${contextComposition.sections.map((s2) => `${s2.label}(${s2.tokenEstimate}t)`).join(" + ")} = ~${contextComposition.totalTokenEstimate}t`,
@@ -575780,7 +575795,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575780
575795
  contextFrame: {
575781
575796
  kind: "system_prompt",
575782
575797
  capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
575783
- taskPreview: cleanedTask.slice(0, 240),
575798
+ taskPreview: persistentTaskGoal.slice(0, 240),
575784
575799
  assembledCharCount: systemPrompt.length,
575785
575800
  totalTokenEstimate: contextComposition.totalTokenEstimate,
575786
575801
  sections: contextComposition.sections.map((section, order) => ({
@@ -575801,13 +575816,13 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575801
575816
  }
575802
575817
  });
575803
575818
  }
575804
- const missionCompletionContract = this.buildMissionCompletionContract(cleanedTask, context2);
575819
+ const missionCompletionContract = this.buildMissionCompletionContract(persistentTaskGoal, context2);
575805
575820
  const messages2 = [
575806
575821
  { role: "system", content: systemPrompt },
575807
575822
  ...missionCompletionContract ? [{ role: "system", content: missionCompletionContract }] : [],
575808
575823
  { role: "user", content: userContent }
575809
575824
  ];
575810
- const preflightMemoryRecall = this._buildPreflightTaskMemoryRecall(cleanedTask);
575825
+ const preflightMemoryRecall = this._buildPreflightTaskMemoryRecall(persistentTaskGoal);
575811
575826
  if (preflightMemoryRecall) {
575812
575827
  messages2.splice(messages2.length - 1, 0, {
575813
575828
  role: "system",
@@ -575871,7 +575886,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575871
575886
  throw "skip-handoff-fresh";
575872
575887
  const omniusDir = this._workingDirectory ? _pathJoin(this._workingDirectory, ".omnius") : _pathJoin(process.cwd(), ".omnius");
575873
575888
  const chainPairs = loadMessagePairsFromLog(omniusDir, {
575874
- currentTask: cleanedTask
575889
+ currentTask: persistentTaskGoal
575875
575890
  });
575876
575891
  if (chainPairs.length > 0) {
575877
575892
  messages2.splice(1, 0, ...chainPairs);
@@ -575883,7 +575898,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575883
575898
  } else {
575884
575899
  const prior = readTaskHandoff(omniusDir, {
575885
575900
  currentSessionId: this._sessionId,
575886
- currentTask: cleanedTask
575901
+ currentTask: persistentTaskGoal
575887
575902
  });
575888
575903
  if (prior) {
575889
575904
  const handoffPair = buildHandoffMessagePair(prior);
@@ -575906,7 +575921,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575906
575921
  }
575907
575922
  }
575908
575923
  if (this._reflectionBuffer) {
575909
- const reflections = this._reflectionBuffer.getRelevantReflections(cleanedTask, 3);
575924
+ const reflections = this._reflectionBuffer.getRelevantReflections(persistentTaskGoal, 3);
575910
575925
  if (reflections.length > 0) {
575911
575926
  const reflectionCtx = this._reflectionBuffer.formatForContext(reflections);
575912
575927
  messages2.push({ role: "system", content: reflectionCtx });
@@ -575922,7 +575937,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
575922
575937
  if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1") {
575923
575938
  try {
575924
575939
  const failureHandoff = buildFailureModeHandoff({
575925
- taskGoal: cleanedTask,
575940
+ taskGoal: persistentTaskGoal,
575926
575941
  errorPatterns: this._errorPatterns,
575927
575942
  toolCallLog,
575928
575943
  taskState: this._taskState,
@@ -576127,7 +576142,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
576127
576142
  })();
576128
576143
  const gate = this._evaluateCompletionProvenanceGate({
576129
576144
  summary: proposedSummary,
576130
- taskGoal: cleanedTask,
576145
+ taskGoal: persistentTaskGoal,
576131
576146
  toolCallLog,
576132
576147
  answerText: lastAssistantText
576133
576148
  });
@@ -580158,7 +580173,7 @@ Then use file_read on individual FILES inside it.`);
580158
580173
  }
580159
580174
  if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1" && !result.success && turn - lastFailureHandoffTurn >= 4) {
580160
580175
  const runtimeHandoff = buildFailureModeHandoff({
580161
- taskGoal: cleanedTask,
580176
+ taskGoal: persistentTaskGoal,
580162
580177
  errorPatterns: this._errorPatterns,
580163
580178
  toolCallLog,
580164
580179
  taskState: this._taskState,
@@ -581540,7 +581555,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581540
581555
  };
581541
581556
  const consolidation = {
581542
581557
  sessionId: this._sessionId,
581543
- task: cleanedTask.slice(0, 500),
581558
+ task: persistentTaskGoal.slice(0, 500),
581544
581559
  outcome: completed ? "success" : this.aborted ? "aborted" : runStatus === "incomplete_verification" ? "incomplete_verification" : "timeout",
581545
581560
  turns: messages2.filter((m2) => m2.role === "assistant").length,
581546
581561
  toolsUsed: [...new Set(toolCallLog.map((tc) => tc.name))],
@@ -581565,7 +581580,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581565
581580
  fs11.mkdirSync(provenanceDir, { recursive: true });
581566
581581
  const provenanceGraph = {
581567
581582
  sessionId: this._sessionId,
581568
- task: cleanedTask.slice(0, 500),
581583
+ task: persistentTaskGoal.slice(0, 500),
581569
581584
  outcome: consolidation.outcome,
581570
581585
  timestamp: consolidation.timestamp,
581571
581586
  // Full action trace — every tool call with sequence ordering
@@ -581615,7 +581630,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581615
581630
  });
581616
581631
  if (completed && this.tools.has("memory_write")) {
581617
581632
  const memTool = this.tools.get("memory_write");
581618
- const lessonContent = `Task "${cleanedTask.slice(0, 100)}" completed successfully. Tools: ${consolidation.toolsUsed.join(", ")}. Files: ${consolidation.filesModified.slice(0, 3).join(", ")}. Duration: ${Math.round(durationMs / 1e3)}s, ${consolidation.turns} turns.`;
581633
+ const lessonContent = `Task "${persistentTaskGoal.slice(0, 100)}" completed successfully. Tools: ${consolidation.toolsUsed.join(", ")}. Files: ${consolidation.filesModified.slice(0, 3).join(", ")}. Duration: ${Math.round(durationMs / 1e3)}s, ${consolidation.turns} turns.`;
581619
581634
  try {
581620
581635
  await memTool.execute({
581621
581636
  topic: "task_lessons",
@@ -581633,7 +581648,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581633
581648
  const transcriptPath = _pathJoin(omniusDir, "consolidations", `${this._sessionId}.json`);
581634
581649
  const handoff = buildTaskHandoff({
581635
581650
  sessionId: this._sessionId,
581636
- goal: cleanedTask,
581651
+ goal: persistentTaskGoal,
581637
581652
  outcome,
581638
581653
  summary,
581639
581654
  filesModified: consolidation.filesModified,
@@ -581657,7 +581672,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581657
581672
  if (this._reflectionBuffer && !completed) {
581658
581673
  try {
581659
581674
  const reflection = this._reflectionBuffer.addReflection({
581660
- taskGoal: cleanedTask,
581675
+ taskGoal: persistentTaskGoal,
581661
581676
  sessionId: this._sessionId,
581662
581677
  turnsSpent: this._taskState.toolCallCount,
581663
581678
  failedApproaches: this._taskState.failedApproaches,
@@ -581679,7 +581694,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581679
581694
  }
581680
581695
  if (this._episodeStore) {
581681
581696
  try {
581682
- const taskSummaryContent = `Task "${cleanedTask.slice(0, 200)}" ${completed ? "completed" : "ended"}: ${cleanForStorage(summary).slice(0, 300)}`;
581697
+ const taskSummaryContent = `Task "${persistentTaskGoal.slice(0, 200)}" ${completed ? "completed" : "ended"}: ${cleanForStorage(summary).slice(0, 300)}`;
581683
581698
  if (this._crlMemoryStore) {
581684
581699
  this._crlMemoryStore.storeCRL({
581685
581700
  content: taskSummaryContent,
@@ -581908,7 +581923,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581908
581923
  await this.processPendingEmbeddings();
581909
581924
  }
581910
581925
  this.stopEmbeddingPipeline();
581911
- const gist = compressAndStore(this._episodeStore, this._sessionId, task, 10);
581926
+ const gist = compressAndStore(this._episodeStore, this._sessionId, persistentTaskGoal, 10);
581912
581927
  if (gist) {
581913
581928
  this.emit({
581914
581929
  type: "status",
@@ -581934,7 +581949,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581934
581949
  this._taskMemoryStore.insert({
581935
581950
  sessionId: this._sessionId,
581936
581951
  repoRoot: process.cwd(),
581937
- goal: task.slice(0, 500),
581952
+ goal: persistentTaskGoal.slice(0, 500),
581938
581953
  constraints: [],
581939
581954
  filesTouched: [],
581940
581955
  patches: [],
@@ -581961,7 +581976,7 @@ ${this._completionCaveat}` : this._completionCaveat;
581961
581976
  }
581962
581977
  if (this._proceduralMemoryStore && completed) {
581963
581978
  try {
581964
- const strategy = `Task "${task.slice(0, 100)}" completed using tools: ${(this._toolSequence || []).slice(0, 5).join(" → ")}`;
581979
+ const strategy = `Task "${persistentTaskGoal.slice(0, 100)}" completed using tools: ${(this._toolSequence || []).slice(0, 5).join(" → ")}`;
581965
581980
  this._proceduralMemoryStore.create({
581966
581981
  content: strategy,
581967
581982
  category: "strategy"
@@ -582117,7 +582132,7 @@ ${this._completionCaveat}` : this._completionCaveat;
582117
582132
  // CLEAN task — this file is the prerequisite for ALL future RL/RFT
582118
582133
  // training. Storing the scaffolded version would teach future models
582119
582134
  // to reproduce signpost text as part of their task understanding.
582120
- task: cleanedTask.slice(0, 1e3),
582135
+ task: persistentTaskGoal.slice(0, 1e3),
582121
582136
  outcome: completed ? "pass" : this.aborted ? "aborted" : runStatus === "incomplete_verification" ? "incomplete_verification" : "timeout",
582122
582137
  model: this.backend.model ?? "unknown",
582123
582138
  modelTier: this.options.modelTier ?? "large",
@@ -661267,6 +661282,38 @@ ${artifact.personaContext.slice(0, 3e3)}
661267
661282
  ""
661268
661283
  ].join("\n");
661269
661284
  }
661285
+ function daydreamExtractionFailed(artifact) {
661286
+ const hasStructuredExtraction = artifact.tagging.length > 0 || artifact.summation.length > 0 || artifact.titling.length > 0 || artifact.extraction.length > 0 || artifact.linking.length > 0 || artifact.extractionFollowups.length > 0;
661287
+ if (hasStructuredExtraction) return false;
661288
+ return artifact.corpus.fallbacks.some(
661289
+ (fallback) => /structured extraction unavailable|timeout|no valid json|backend unavailable/i.test(
661290
+ fallback
661291
+ )
661292
+ );
661293
+ }
661294
+ function formatTelegramChannelDaydreamMetadataMarkdown(artifact) {
661295
+ return [
661296
+ `# Telegram Channel Daydream ${artifact.id}`,
661297
+ "",
661298
+ `Generated: ${artifact.generatedAt}`,
661299
+ `Session: ${artifact.sessionKey}`,
661300
+ `Chat: ${artifact.chatTitle || artifact.chatId} (${artifact.chatType})`,
661301
+ "Mode: metadata-only; structured extraction did not complete.",
661302
+ "",
661303
+ "## Reflection Corpus",
661304
+ artifact.corpus.stats ? [
661305
+ `- retained messages: ${artifact.corpus.stats.retainedMessages}`,
661306
+ `- candidate episodes: ${artifact.corpus.stats.candidateEpisodes}`,
661307
+ `- selected episodes: ${artifact.corpus.stats.selectedEpisodes}`,
661308
+ `- graph walk: ${artifact.corpus.stats.graphNodesVisited} node(s), ${artifact.corpus.stats.graphEdgesTraversed} edge(s)`
661309
+ ].join("\n") : "- Not available",
661310
+ artifact.corpus.fallbacks.length ? `- fallbacks: ${artifact.corpus.fallbacks.join("; ")}` : "- fallbacks: none",
661311
+ "",
661312
+ "## Context Notes",
661313
+ artifact.contextEngineeringNotes.length ? artifact.contextEngineeringNotes.map((line) => `- ${line}`).join("\n") : "- None",
661314
+ ""
661315
+ ].join("\n");
661316
+ }
661270
661317
  function pruneTelegramChannelDaydreams(repoRoot, sessionKey, keep = DAYDREAM_ARTIFACT_RETENTION_LIMIT) {
661271
661318
  const dir = sessionDir(repoRoot, sessionKey);
661272
661319
  if (!existsSync144(dir)) return 0;
@@ -661292,7 +661339,7 @@ function writeTelegramChannelDaydream(repoRoot, artifact) {
661292
661339
  writeFileSync76(jsonPath, JSON.stringify(artifact, null, 2) + "\n", "utf8");
661293
661340
  writeFileSync76(
661294
661341
  markdownPath,
661295
- formatTelegramChannelDaydreamMarkdown(artifact),
661342
+ daydreamExtractionFailed(artifact) ? formatTelegramChannelDaydreamMetadataMarkdown(artifact) : formatTelegramChannelDaydreamMarkdown(artifact),
661296
661343
  "utf8"
661297
661344
  );
661298
661345
  pruneTelegramChannelDaydreams(repoRoot, artifact.sessionKey);
@@ -661659,7 +661706,8 @@ async function buildTelegramReflectionCorpus(options2) {
661659
661706
  maxDepth: 2,
661660
661707
  maxVisitedNodes: 72,
661661
661708
  maxTraversedEdges: 180,
661662
- maxSourceEpisodes: 100
661709
+ maxSourceEpisodes: 100,
661710
+ allowedSourceEpisodeIds: candidateEpisodes.map((episode) => episode.id)
661663
661711
  }
661664
661712
  );
661665
661713
  if (graphWalk.seed) {
@@ -661673,7 +661721,8 @@ async function buildTelegramReflectionCorpus(options2) {
661673
661721
  maxDepth: 3,
661674
661722
  maxVisitedNodes: 96,
661675
661723
  maxTraversedEdges: 240,
661676
- maxSourceEpisodes: 120
661724
+ maxSourceEpisodes: 120,
661725
+ allowedSourceEpisodeIds: candidateEpisodes.map((episode) => episode.id)
661677
661726
  }
661678
661727
  );
661679
661728
  if (deeper.seed && deeper.sourceEpisodeIds.length >= graphWalk.sourceEpisodeIds.length) graphWalk = deeper;
@@ -663173,6 +663222,20 @@ function formatModelBytes(bytes) {
663173
663222
  }
663174
663223
  return `${value2 >= 10 || unit === 0 ? value2.toFixed(0) : value2.toFixed(1)} ${units[unit]}`;
663175
663224
  }
663225
+ function telegramMediaContextEvidenceTools(mediaContext) {
663226
+ const tools = [];
663227
+ if (/\[Vision analysis of image|Moondream|auxiliary_vision|vision model/i.test(
663228
+ mediaContext
663229
+ ))
663230
+ tools.push("vision_ingress");
663231
+ if (/\[OCR Text from image|ocr_image_advanced|Advanced text extraction|OCR:/i.test(
663232
+ mediaContext
663233
+ ))
663234
+ tools.push("ocr_ingress");
663235
+ if (/voice message transcribed|transcription/i.test(mediaContext))
663236
+ tools.push("transcribe_ingress");
663237
+ return tools;
663238
+ }
663176
663239
  function cleanTelegramDecisionNote(value2, maxLength = 260) {
663177
663240
  if (typeof value2 !== "string") return void 0;
663178
663241
  const clean5 = stripTelegramHiddenThinking(value2).replace(/\s+/g, " ").trim();
@@ -667351,7 +667414,7 @@ ${message2}`)
667351
667414
  if (isGroup) {
667352
667415
  this.markLastTelegramUserMessageMode(msg, "steering");
667353
667416
  } else {
667354
- this.recordTelegramUserMessage(msg, "steering", context2);
667417
+ this.recordTelegramUserMessage(msg, "steering");
667355
667418
  }
667356
667419
  this.enqueueTelegramSubAgentContext(
667357
667420
  sessionKey,
@@ -670123,7 +670186,11 @@ ${mediaContext}` : ""
670123
670186
  recordTelegramUserMessage(msg, mode, textOverride) {
670124
670187
  const sessionKey = this.sessionKeyForMessage(msg);
670125
670188
  const mediaSummary = summarizeTelegramMessageAttachments(msg);
670126
- const text2 = normalizeTelegramOutboundLinks((textOverride ?? msg.text ?? "").trim()) || mediaSummary || "[non-text Telegram message]";
670189
+ const overrideText = (textOverride ?? "").trim();
670190
+ const useOverride = textOverride !== void 0 && !_TelegramBridge.isSyntheticMemoryText(overrideText);
670191
+ const text2 = normalizeTelegramOutboundLinks(
670192
+ (useOverride ? overrideText : msg.text ?? "").trim()
670193
+ ) || mediaSummary || "[non-text Telegram message]";
670127
670194
  this.ensureTelegramConversationLoaded(sessionKey);
670128
670195
  const history = this.chatHistory.get(sessionKey) ?? [];
670129
670196
  const existing = Number.isFinite(msg.messageId) ? history.find(
@@ -670132,7 +670199,7 @@ ${mediaContext}` : ""
670132
670199
  if (existing) {
670133
670200
  if (existing.mode === "ambient" || mode !== "ambient")
670134
670201
  existing.mode = mode;
670135
- if (textOverride !== void 0 || !existing.text || existing.text === "[non-text Telegram message]") {
670202
+ if (useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
670136
670203
  existing.text = text2;
670137
670204
  }
670138
670205
  existing.speaker = existing.speaker || telegramSpeakerLabel(msg);
@@ -670544,6 +670611,8 @@ ${mediaContext}` : ""
670544
670611
  this.chatParticipants.set(sessionKey, participants);
670545
670612
  }
670546
670613
  updateTelegramAssociativeMemory(sessionKey, entry) {
670614
+ const cleanText2 = stripTelegramHiddenThinking(entry.text || "").replace(/\s+/g, " ").trim();
670615
+ if (!cleanText2 || _TelegramBridge.isSyntheticMemoryText(cleanText2)) return;
670547
670616
  const memory = this.telegramAssociativeMemoryForSession(sessionKey);
670548
670617
  const now2 = entry.ts ?? Date.now();
670549
670618
  memory.updatedAt = now2;
@@ -670760,11 +670829,14 @@ ${mediaContext}` : ""
670760
670829
  /Telegram response contract/,
670761
670830
  /Telegram link integrity contract/
670762
670831
  ];
670832
+ static isSyntheticMemoryText(text2) {
670833
+ const clean5 = String(text2 || "").replace(/\s+/g, " ").trim();
670834
+ return _TelegramBridge.SYNTHETIC_MEMORY_PATTERNS.some((p2) => p2.test(clean5));
670835
+ }
670763
670836
  updateTelegramMemoryCards(sessionKey, entry) {
670764
670837
  const text2 = stripTelegramHiddenThinking(entry.text || "").replace(/\s+/g, " ").trim();
670765
670838
  if (!text2 || text2.length < 3) return;
670766
- if (_TelegramBridge.SYNTHETIC_MEMORY_PATTERNS.some((p2) => p2.test(text2)))
670767
- return;
670839
+ if (_TelegramBridge.isSyntheticMemoryText(text2)) return;
670768
670840
  if (entry.role === "assistant" && entry.mode && !["chat", "action"].includes(entry.mode))
670769
670841
  return;
670770
670842
  const speaker = telegramHistorySpeaker(entry);
@@ -676627,7 +676699,7 @@ ${creativeWorkspace}` : ""}`;
676627
676699
  if (result.status === "incomplete_verification") {
676628
676700
  subAgent.completionBoundarySeen = false;
676629
676701
  }
676630
- return selectTelegramFinalResponse({
676702
+ const finalResponse = selectTelegramFinalResponse({
676631
676703
  visibleReplyText: subAgent.visibleReplyText,
676632
676704
  assistantText: subAgent.assistantText,
676633
676705
  streamText: subAgent.streamText,
@@ -676635,6 +676707,26 @@ ${creativeWorkspace}` : ""}`;
676635
676707
  summary: result.summary,
676636
676708
  completionBoundarySeen: subAgent.completionBoundarySeen
676637
676709
  });
676710
+ const scrutinyText = [finalResponse, result.summary].filter(Boolean).join("\n");
676711
+ const violations = auditPerceptionClaims(scrutinyText, {
676712
+ toolsUsed: [
676713
+ ...subAgent.successfulToolNamesThisRun,
676714
+ ...telegramMediaContextEvidenceTools(mediaContext)
676715
+ ]
676716
+ });
676717
+ if (violations.length > 0) {
676718
+ this.subAgentViewCallbacks?.onWrite(
676719
+ subAgent.viewId,
676720
+ confabulationDirective(violations)
676721
+ );
676722
+ const needed = [...new Set(violations.map((v) => v.requiredTool))].join(
676723
+ "; "
676724
+ );
676725
+ return finalResponse ? `${finalResponse}
676726
+
676727
+ Verification note: I have not actually run ${needed} for the unsupported action claim above.` : `I have not actually run ${needed} yet, so I cannot verify that claim.`;
676728
+ }
676729
+ return finalResponse;
676638
676730
  }
676639
676731
  telegramScopedMemoryPrefix(chatId) {
676640
676732
  const raw = chatId === void 0 ? "unknown" : String(chatId);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.364",
3
+ "version": "1.0.365",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.364",
9
+ "version": "1.0.365",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
@@ -508,9 +508,9 @@
508
508
  "license": "Apache-2.0 OR MIT"
509
509
  },
510
510
  "node_modules/@ipshipyard/libp2p-auto-tls": {
511
- "version": "2.0.1",
512
- "resolved": "https://registry.npmjs.org/@ipshipyard/libp2p-auto-tls/-/libp2p-auto-tls-2.0.1.tgz",
513
- "integrity": "sha512-zpDXVMY1ZgB6o30zFocXUzrD9+tz1bbEdgewFoBf4olDh5/CwjDi/k9v2RrJqujWKYWyRuHRg6Q+VRpvtGrpuw==",
511
+ "version": "2.0.2",
512
+ "resolved": "https://registry.npmjs.org/@ipshipyard/libp2p-auto-tls/-/libp2p-auto-tls-2.0.2.tgz",
513
+ "integrity": "sha512-jnGqf/eif9GpjH03PaenekRWRvlJgoVZ1JsAawW0dJxcIW8qHiSMIbVh49xOjUGTK8vUbN26bsO+Rustg0n72A==",
514
514
  "license": "Apache-2.0 OR MIT",
515
515
  "dependencies": {
516
516
  "@chainsafe/is-ip": "^2.0.2",
@@ -522,25 +522,49 @@
522
522
  "@libp2p/utils": "^7.0.4",
523
523
  "@multiformats/multiaddr": "^13.0.1",
524
524
  "@multiformats/multiaddr-matcher": "^3.0.1",
525
- "@peculiar/x509": "^1.12.3",
525
+ "@peculiar/x509": "^2.0.0",
526
526
  "acme-client": "^5.4.0",
527
527
  "any-signal": "^4.1.1",
528
- "delay": "^6.0.0",
529
- "interface-datastore": "^9.0.2",
530
- "multiformats": "^13.3.1",
531
- "uint8arrays": "^5.1.0"
528
+ "delay": "^7.0.0",
529
+ "interface-datastore": "^10.0.1",
530
+ "multiformats": "^14.0.2",
531
+ "reflect-metadata": "^0.2.2",
532
+ "uint8arrays": "^6.1.1"
532
533
  }
533
534
  },
534
- "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/delay": {
535
- "version": "6.0.0",
536
- "resolved": "https://registry.npmjs.org/delay/-/delay-6.0.0.tgz",
537
- "integrity": "sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw==",
538
- "license": "MIT",
539
- "engines": {
540
- "node": ">=16"
541
- },
542
- "funding": {
543
- "url": "https://github.com/sponsors/sindresorhus"
535
+ "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/interface-datastore": {
536
+ "version": "10.0.1",
537
+ "resolved": "https://registry.npmjs.org/interface-datastore/-/interface-datastore-10.0.1.tgz",
538
+ "integrity": "sha512-DYMj/Og5Cz1Qwkx6/x5KRvR8SYEX7rVAv3KKCm2NzTwWSfpNAC4PahjcYbHyoZBP6zPWrhQv5n5wE+vaDdgSAg==",
539
+ "license": "Apache-2.0 OR MIT",
540
+ "dependencies": {
541
+ "abort-error": "^1.0.2",
542
+ "interface-store": "^8.0.0",
543
+ "uint8arrays": "^6.1.1"
544
+ }
545
+ },
546
+ "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/interface-store": {
547
+ "version": "8.0.0",
548
+ "resolved": "https://registry.npmjs.org/interface-store/-/interface-store-8.0.0.tgz",
549
+ "integrity": "sha512-e2+s3EEROzM+Wlas4hU3zveTUscvVMf1BOvdsJfpzFm19SoEXLVadpACjWOnM491HqGpvtfFnevyiaN8W+I6Eg==",
550
+ "license": "Apache-2.0 OR MIT",
551
+ "dependencies": {
552
+ "abort-error": "^1.0.2"
553
+ }
554
+ },
555
+ "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/multiformats": {
556
+ "version": "14.0.2",
557
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.2.tgz",
558
+ "integrity": "sha512-sF7F3gBKCyehzIhDwVuTRf79TZ8qWRz5NXwWYBX+4a+n22KcFqqcDYJvZr7tySrI0MhuTBXVOlo3qMTiAHC78g==",
559
+ "license": "Apache-2.0 OR MIT"
560
+ },
561
+ "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/uint8arrays": {
562
+ "version": "6.1.1",
563
+ "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-6.1.1.tgz",
564
+ "integrity": "sha512-iz7JN0XCSZYA111lhFG2Ui9EhFvTNekqSRHw3lvMHq+dzwWy1OQftxFQREEh4rffU0oSoXdQHsk2TiHKVm4fsA==",
565
+ "license": "Apache-2.0 OR MIT",
566
+ "dependencies": {
567
+ "multiformats": "^14.0.0"
544
568
  }
545
569
  },
546
570
  "node_modules/@leichtgewicht/ip-codec": {
@@ -1213,6 +1237,28 @@
1213
1237
  "uint8arrays": "^5.1.0"
1214
1238
  }
1215
1239
  },
1240
+ "node_modules/@libp2p/tls/node_modules/@peculiar/x509": {
1241
+ "version": "1.14.3",
1242
+ "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
1243
+ "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
1244
+ "license": "MIT",
1245
+ "dependencies": {
1246
+ "@peculiar/asn1-cms": "^2.6.0",
1247
+ "@peculiar/asn1-csr": "^2.6.0",
1248
+ "@peculiar/asn1-ecc": "^2.6.0",
1249
+ "@peculiar/asn1-pkcs9": "^2.6.0",
1250
+ "@peculiar/asn1-rsa": "^2.6.0",
1251
+ "@peculiar/asn1-schema": "^2.6.0",
1252
+ "@peculiar/asn1-x509": "^2.6.0",
1253
+ "pvtsutils": "^1.3.6",
1254
+ "reflect-metadata": "^0.2.2",
1255
+ "tslib": "^2.8.1",
1256
+ "tsyringe": "^4.10.0"
1257
+ },
1258
+ "engines": {
1259
+ "node": ">=20.0.0"
1260
+ }
1261
+ },
1216
1262
  "node_modules/@libp2p/upnp-nat": {
1217
1263
  "version": "4.0.13",
1218
1264
  "resolved": "https://registry.npmjs.org/@libp2p/upnp-nat/-/upnp-nat-4.0.13.tgz",
@@ -1303,27 +1349,6 @@
1303
1349
  "uint8arrays": "^6.1.1"
1304
1350
  }
1305
1351
  },
1306
- "node_modules/@libp2p/webrtc/node_modules/@peculiar/x509": {
1307
- "version": "2.0.0",
1308
- "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-2.0.0.tgz",
1309
- "integrity": "sha512-r10lkuy6BNfRmyYdRAfgu6dq0HOmyIV2OLhXWE3gDEPBdX1b8miztJVyX/UxWhLwemNyDP3CLZHpDxDwSY0xaA==",
1310
- "license": "MIT",
1311
- "dependencies": {
1312
- "@peculiar/asn1-cms": "^2.6.0",
1313
- "@peculiar/asn1-csr": "^2.6.0",
1314
- "@peculiar/asn1-ecc": "^2.6.0",
1315
- "@peculiar/asn1-pkcs9": "^2.6.0",
1316
- "@peculiar/asn1-rsa": "^2.6.0",
1317
- "@peculiar/asn1-schema": "^2.6.0",
1318
- "@peculiar/asn1-x509": "^2.6.0",
1319
- "pvtsutils": "^1.3.6",
1320
- "tslib": "^2.8.1",
1321
- "tsyringe": "^4.10.0"
1322
- },
1323
- "engines": {
1324
- "node": ">=20.0.0"
1325
- }
1326
- },
1327
1352
  "node_modules/@libp2p/webrtc/node_modules/interface-datastore": {
1328
1353
  "version": "10.0.1",
1329
1354
  "resolved": "https://registry.npmjs.org/interface-datastore/-/interface-datastore-10.0.1.tgz",
@@ -1911,9 +1936,9 @@
1911
1936
  }
1912
1937
  },
1913
1938
  "node_modules/@peculiar/x509": {
1914
- "version": "1.14.3",
1915
- "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
1916
- "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
1939
+ "version": "2.0.0",
1940
+ "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-2.0.0.tgz",
1941
+ "integrity": "sha512-r10lkuy6BNfRmyYdRAfgu6dq0HOmyIV2OLhXWE3gDEPBdX1b8miztJVyX/UxWhLwemNyDP3CLZHpDxDwSY0xaA==",
1917
1942
  "license": "MIT",
1918
1943
  "dependencies": {
1919
1944
  "@peculiar/asn1-cms": "^2.6.0",
@@ -1924,7 +1949,6 @@
1924
1949
  "@peculiar/asn1-schema": "^2.6.0",
1925
1950
  "@peculiar/asn1-x509": "^2.6.0",
1926
1951
  "pvtsutils": "^1.3.6",
1927
- "reflect-metadata": "^0.2.2",
1928
1952
  "tslib": "^2.8.1",
1929
1953
  "tsyringe": "^4.10.0"
1930
1954
  },
@@ -2207,6 +2231,28 @@
2207
2231
  "node": ">= 16"
2208
2232
  }
2209
2233
  },
2234
+ "node_modules/acme-client/node_modules/@peculiar/x509": {
2235
+ "version": "1.14.3",
2236
+ "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
2237
+ "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
2238
+ "license": "MIT",
2239
+ "dependencies": {
2240
+ "@peculiar/asn1-cms": "^2.6.0",
2241
+ "@peculiar/asn1-csr": "^2.6.0",
2242
+ "@peculiar/asn1-ecc": "^2.6.0",
2243
+ "@peculiar/asn1-pkcs9": "^2.6.0",
2244
+ "@peculiar/asn1-rsa": "^2.6.0",
2245
+ "@peculiar/asn1-schema": "^2.6.0",
2246
+ "@peculiar/asn1-x509": "^2.6.0",
2247
+ "pvtsutils": "^1.3.6",
2248
+ "reflect-metadata": "^0.2.2",
2249
+ "tslib": "^2.8.1",
2250
+ "tsyringe": "^4.10.0"
2251
+ },
2252
+ "engines": {
2253
+ "node": ">=20.0.0"
2254
+ }
2255
+ },
2210
2256
  "node_modules/agent-base": {
2211
2257
  "version": "6.0.2",
2212
2258
  "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -3532,9 +3578,9 @@
3532
3578
  }
3533
3579
  },
3534
3580
  "node_modules/fast-uri": {
3535
- "version": "3.1.2",
3536
- "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz",
3537
- "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==",
3581
+ "version": "3.1.3",
3582
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.3.tgz",
3583
+ "integrity": "sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==",
3538
3584
  "funding": [
3539
3585
  {
3540
3586
  "type": "github",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.364",
3
+ "version": "1.0.365",
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",