omnius 1.0.305 → 1.0.306

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
@@ -23695,6 +23695,12 @@ function findCanonicalEntry(entries, valueHash, key) {
23695
23695
  }
23696
23696
  return null;
23697
23697
  }
23698
+ function getEntryArtifactId(entry) {
23699
+ if (!entry || typeof entry !== "object")
23700
+ return null;
23701
+ const artifactId = entry["artifactId"];
23702
+ return typeof artifactId === "string" && artifactId.length > 0 ? artifactId : null;
23703
+ }
23698
23704
  var _writeLocks, MemoryWriteTool;
23699
23705
  var init_memory_write = __esm({
23700
23706
  "packages/execution/dist/tools/memory-write.js"() {
@@ -23742,6 +23748,9 @@ var init_memory_write = __esm({
23742
23748
  }
23743
23749
  const omniusMemDir = resolve12(this.workingDir, ".omnius", "memory");
23744
23750
  const legacyMemDir = resolve12(this.workingDir, ".omnius", "memory");
23751
+ let wroteMemory = false;
23752
+ let storedArtifactId = null;
23753
+ let existingArtifactId = null;
23745
23754
  for (const memoryDir of [.../* @__PURE__ */ new Set([omniusMemDir, legacyMemDir])]) {
23746
23755
  await mkdir3(memoryDir, { recursive: true });
23747
23756
  const topicFile = join22(memoryDir, `${topic}.json`);
@@ -23752,7 +23761,13 @@ var init_memory_write = __esm({
23752
23761
  entries = JSON.parse(raw);
23753
23762
  } catch {
23754
23763
  }
23764
+ const existingEntry = entries[key];
23765
+ if (existingEntry && typeof existingEntry === "object" && existingEntry["valueHash"] === normalizedValue.valueHash) {
23766
+ existingArtifactId = getEntryArtifactId(existingEntry);
23767
+ return;
23768
+ }
23755
23769
  const artifactId = `mem-${randomBytes5(6).toString("hex")}`;
23770
+ storedArtifactId = artifactId;
23756
23771
  const canonicalKey = findCanonicalEntry(entries, normalizedValue.valueHash, key);
23757
23772
  entries[key] = canonicalKey ? {
23758
23773
  value: `(duplicate of ${canonicalKey})`,
@@ -23772,8 +23787,20 @@ var init_memory_write = __esm({
23772
23787
  const tempFile = `${topicFile}.tmp-${randomBytes5(4).toString("hex")}`;
23773
23788
  await writeFile4(tempFile, JSON.stringify(entries, null, 2), "utf-8");
23774
23789
  await rename2(tempFile, topicFile);
23790
+ wroteMemory = true;
23775
23791
  });
23776
23792
  }
23793
+ if (!wroteMemory) {
23794
+ const artifactSuffix = existingArtifactId ? ` [artifact: ${existingArtifactId}]` : "";
23795
+ const output = `Memory already stored: ${topic}.${key}${artifactSuffix}. No new memory was written; continue with the next step or call task_complete if this was the final bookkeeping step.`;
23796
+ return {
23797
+ success: true,
23798
+ output,
23799
+ llmContent: output,
23800
+ noop: true,
23801
+ durationMs: performance.now() - start2
23802
+ };
23803
+ }
23777
23804
  const provenanceDir = resolve12(this.workingDir, ".omnius", "provenance");
23778
23805
  try {
23779
23806
  await mkdir3(provenanceDir, { recursive: true });
@@ -23781,7 +23808,7 @@ var init_memory_write = __esm({
23781
23808
  type: "memory_write",
23782
23809
  topic,
23783
23810
  key,
23784
- artifactId: `mem-${randomBytes5(6).toString("hex")}`,
23811
+ artifactId: storedArtifactId,
23785
23812
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23786
23813
  source: "agent"
23787
23814
  };
@@ -23792,7 +23819,7 @@ var init_memory_write = __esm({
23792
23819
  await this.writeUnifiedMemory(topic, key, normalizedValue.value);
23793
23820
  return {
23794
23821
  success: true,
23795
- output: `Stored memory: ${topic}.${key} [artifact: mem-${Date.now().toString(36)}]`,
23822
+ output: `Stored memory: ${topic}.${key} [artifact: ${storedArtifactId ?? "mem-unknown"}]`,
23796
23823
  durationMs: performance.now() - start2
23797
23824
  };
23798
23825
  } catch (error) {
@@ -558490,7 +558517,7 @@ function evaluate2(inputs) {
558490
558517
  compacted: cached?.compacted
558491
558518
  };
558492
558519
  }
558493
- const cacheEligible = isReadLike || proposedCall.tool === "shell";
558520
+ const cacheEligible = isReadLike || proposedCall.tool === "shell" || proposedCall.tool === "memory_write";
558494
558521
  if (cacheEligible) {
558495
558522
  const cached = recentToolResults.get(fingerprint);
558496
558523
  if (cached !== void 0) {
@@ -569562,11 +569589,11 @@ ${latest.output || ""}`.trim();
569562
569589
  `[REPEAT GATE] Exact repeat #${hits} of ${toolName}(${argPreview}).`,
569563
569590
  `You ALREADY have this result — re-reading identical arguments cannot produce new information, so this call was NOT executed.`,
569564
569591
  ``,
569565
- `You are looping because progress tracking has drifted. Before any further read/list/search calls you MUST:`,
569592
+ `You are looping because progress tracking has drifted. Before any further redundant calls you MUST:`,
569566
569593
  ` 1. Call todo_write — decompose the remaining work into concrete, verifiable steps, mark the current step in_progress, and mark anything already done as completed.`,
569567
569594
  ` 2. Then take a CONCRETE action on the evidence you already have: edit/write the implicated file, run a verification command, or call task_complete with evidence.`,
569568
569595
  ``,
569569
- `Do NOT repeat this exact call. If you believe the file changed on disk, make the change first, then read.`
569596
+ `Do NOT repeat this exact call. If you believe state changed, perform the concrete change first, then retry with distinct evidence.`
569570
569597
  ].join("\n");
569571
569598
  }
569572
569599
  _renderKnowledgeBlock(recentToolResults) {
@@ -571640,6 +571667,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
571640
571667
  let lastShellPivotTurn = -1;
571641
571668
  const recentToolResults = /* @__PURE__ */ new Map();
571642
571669
  const dedupHitCount = /* @__PURE__ */ new Map();
571670
+ const noopedMemoryWriteFingerprints = /* @__PURE__ */ new Set();
571643
571671
  const DEDUP_ESCALATION_THRESHOLD = 3;
571644
571672
  const toolCallBudget = /* @__PURE__ */ new Map();
571645
571673
  const loopTier = this.options.modelTier ?? "large";
@@ -574002,6 +574030,36 @@ Corrective action: try a different approach first: read relevant files, adjust a
574002
574030
  toolCallBudget.set(tc.name, budgetRemaining - 1);
574003
574031
  }
574004
574032
  const toolFingerprint = this._buildToolFingerprint(tc.name, tc.arguments ?? {});
574033
+ if (tc.name === "memory_write" && noopedMemoryWriteFingerprints.has(toolFingerprint)) {
574034
+ this.emit({
574035
+ type: "tool_call",
574036
+ toolName: tc.name,
574037
+ toolArgs: tc.arguments,
574038
+ turn,
574039
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
574040
+ });
574041
+ const repeatNoopMsg = `[MEMORY WRITE NO-OP REPEAT BLOCK] Exact repeat of memory_write(${JSON.stringify(tc.arguments ?? {}).slice(0, 200)}).
574042
+ This same topic/key/value was already confirmed stored, so the call was not executed again.
574043
+ Use the saved fact to continue the promised synthesis or next concrete step, or call task_complete if this bookkeeping was the final step.`;
574044
+ this.emit({
574045
+ type: "tool_result",
574046
+ toolName: tc.name,
574047
+ success: false,
574048
+ content: repeatNoopMsg.slice(0, 120),
574049
+ turn,
574050
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
574051
+ });
574052
+ this._tagSyntheticFailure({
574053
+ mode: "step_repetition",
574054
+ rationale: "memory_write retried after an exact no-op was observed"
574055
+ });
574056
+ return {
574057
+ tc,
574058
+ output: repeatNoopMsg,
574059
+ success: false,
574060
+ systemGuidance: repeatNoopMsg
574061
+ };
574062
+ }
574005
574063
  const baseIsReadLike = ![
574006
574064
  "file_write",
574007
574065
  "file_edit",
@@ -574108,7 +574166,8 @@ Corrective action: try a different approach first: read relevant files, adjust a
574108
574166
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
574109
574167
  });
574110
574168
  const _repeatGateMax = this._resolveRepeatGateMax();
574111
- if (isReadLike && _existingFp !== void 0 && _repeatGateMax > 0) {
574169
+ const repeatGateEligible = isReadLike || tc.name === "memory_write";
574170
+ if (repeatGateEligible && _existingFp !== void 0 && _repeatGateMax > 0) {
574112
574171
  if (criticDecision.hitNumber >= _repeatGateMax) {
574113
574172
  repeatShortCircuit = {
574114
574173
  success: false,
@@ -574966,7 +575025,8 @@ Respond with EXACTLY this structure before your next tool call:
574966
575025
  }
574967
575026
  }
574968
575027
  }
574969
- if (isReadLike && result.success || tc.name === "shell") {
575028
+ const cacheableMemoryNoop = tc.name === "memory_write" && result.success && result.noop;
575029
+ if (isReadLike && result.success || tc.name === "shell" || cacheableMemoryNoop) {
574970
575030
  recentToolResults.set(toolFingerprint, {
574971
575031
  result: tc.name === "shell" ? this._buildShellCacheResult(tc.arguments, result) : (result.output ?? "").slice(0, 2e3),
574972
575032
  compacted: false
@@ -574978,6 +575038,13 @@ Respond with EXACTLY this structure before your next tool call:
574978
575038
  dedupHitCount.delete(firstKey);
574979
575039
  }
574980
575040
  }
575041
+ if (cacheableMemoryNoop) {
575042
+ noopedMemoryWriteFingerprints.add(toolFingerprint);
575043
+ const repeatGateSeed = Math.max(0, this._resolveRepeatGateMax() - 1);
575044
+ if (repeatGateSeed > 0) {
575045
+ dedupHitCount.set(toolFingerprint, Math.max(dedupHitCount.get(toolFingerprint) ?? 0, repeatGateSeed));
575046
+ }
575047
+ }
574981
575048
  }
574982
575049
  const isFileMutation = realFileMutation;
574983
575050
  if (isFileMutation) {
@@ -575155,6 +575222,19 @@ Respond with EXACTLY this structure before your next tool call:
575155
575222
  output += `
575156
575223
 
575157
575224
  ${criticGuidance}`;
575225
+ }
575226
+ if (tc.name === "memory_write" && result.success && result.noop) {
575227
+ const topic = String(tc.arguments?.["topic"] ?? "<missing topic>");
575228
+ const key = String(tc.arguments?.["key"] ?? "<missing key>");
575229
+ const bookkeepingGuidance = `[BOOKKEEPING ALREADY DONE]
575230
+ memory_write reported that ${topic}.${key} already contains this exact value; no new memory was written.
575231
+ Do not call memory_write again for this same topic/key/value. Continue with the promised synthesis or next concrete task step, or call task_complete if the memory write was the final bookkeeping step.`;
575232
+ output += `
575233
+
575234
+ ${bookkeepingGuidance}`;
575235
+ runtimeSystemGuidance = runtimeSystemGuidance ? `${runtimeSystemGuidance}
575236
+
575237
+ ${bookkeepingGuidance}` : bookkeepingGuidance;
575158
575238
  }
575159
575239
  if (!result.success && (this.options.modelTier === "small" || this.options.modelTier === "medium")) {
575160
575240
  const recovery = this.buildRecoveryGuidance(tc.name, result.error ?? "", tc.arguments);
@@ -575395,6 +575475,10 @@ Do NOT retry ${tc.name} with similar arguments.`);
575395
575475
  this._taskState.completedSteps.push(`${tc.name}: \`${filePath}\``);
575396
575476
  } else if ((tc.name === "shell" || tc.name === "background_run") && /PASS|passed|success|✓/i.test(result.output)) {
575397
575477
  this._taskState.completedSteps.push(`Test passed: \`${String(tc.arguments?.command ?? "").slice(0, 80)}\``);
575478
+ } else if (tc.name === "memory_write" && !result.noop) {
575479
+ const topic = String(tc.arguments?.["topic"] ?? "<missing topic>");
575480
+ const key = String(tc.arguments?.["key"] ?? "<missing key>");
575481
+ this._taskState.completedSteps.push(`Memory stored: ${topic}.${key}`);
575398
575482
  }
575399
575483
  }
575400
575484
  if (result.output.length > 500 && result.success) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.305",
3
+ "version": "1.0.306",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.305",
9
+ "version": "1.0.306",
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.305",
3
+ "version": "1.0.306",
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",