omnius 1.0.497 → 1.0.498

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
@@ -586258,8 +586258,7 @@ ${body}`;
586258
586258
  * summarization, RECOMP (ICLR 2024) observation masking.
586259
586259
  */
586260
586260
  proactivePrune(messages2, currentTurn) {
586261
- if (process.env["OMNIUS_DISABLE_PROACTIVE_PRUNE"] === "1")
586262
- return;
586261
+ return;
586263
586262
  const AGED_FILE_READ_TURNS = 20;
586264
586263
  const AGED_SHELL_TURNS = 12;
586265
586264
  const ERROR_MARKERS = /(?:error|fail|exception|traceback|enoent|enotfound|exit code [^0]|status[: ]+1\d?\d?)/i;
@@ -586273,125 +586272,148 @@ ${body}`;
586273
586272
  let scanTurn = 0;
586274
586273
  for (let i2 = 0; i2 < messages2.length; i2++) {
586275
586274
  const msg = messages2[i2];
586276
- if (msg.role === "assistant" && msg.tool_calls && msg.tool_calls.length > 0) {
586277
- scanTurn++;
586278
- for (const tc of msg.tool_calls) {
586279
- const name10 = tc.function.name;
586280
- let parsedArgs;
586281
- try {
586282
- parsedArgs = JSON.parse(tc.function.arguments || "{}");
586283
- } catch {
586284
- parsedArgs = void 0;
586285
- }
586286
- const fp = parsedArgs ? this._buildToolFingerprint(name10, parsedArgs) : `${name10}:raw#sha256:${_createHash("sha256").update(tc.function.arguments ?? "").digest("hex").slice(0, 20)}`;
586287
- let resultIdx = -1;
586288
- for (let j = i2 + 1; j < Math.min(messages2.length, i2 + 8); j++) {
586289
- const r2 = messages2[j];
586290
- if (r2.role === "tool" && r2.tool_call_id === tc.id) {
586291
- resultIdx = j;
586292
- break;
586293
- }
586294
- }
586295
- if (resultIdx === -1)
586296
- continue;
586297
- const resultMsg = messages2[resultIdx];
586298
- const content = typeof resultMsg.content === "string" ? resultMsg.content : "";
586299
- if (content.startsWith(PRUNE_PREFIX) || content.startsWith(DEDUPE_PREFIX) || content.startsWith(FILE_AGED_PREFIX) || content.startsWith(SHELL_AGED_PREFIX)) {
586300
- if (!seen.has(fp))
586301
- seen.set(fp, { turn: scanTurn, idx: resultIdx });
586302
- continue;
586275
+ if (msg.role !== "assistant") {
586276
+ continue;
586277
+ }
586278
+ const toolCalls = msg.tool_calls ?? [];
586279
+ if (toolCalls.length === 0) {
586280
+ continue;
586281
+ }
586282
+ scanTurn++;
586283
+ for (const tc of toolCalls) {
586284
+ const name10 = tc.function.name;
586285
+ let parsedArgs;
586286
+ try {
586287
+ parsedArgs = JSON.parse(tc.function.arguments || "{}");
586288
+ } catch {
586289
+ parsedArgs = void 0;
586290
+ }
586291
+ const fp = parsedArgs ? this._buildToolFingerprint(name10, parsedArgs) : `${name10}:raw#sha256:${_createHash("sha256").update(tc.function.arguments ?? "").digest("hex").slice(0, 20)}`;
586292
+ let resultIdx = -1;
586293
+ for (let j = i2 + 1; j < Math.min(messages2.length, i2 + 8); j++) {
586294
+ const r2 = messages2[j];
586295
+ if (r2.role === "tool" && r2.tool_call_id === tc.id) {
586296
+ resultIdx = j;
586297
+ break;
586303
586298
  }
586304
- const prior = seen.get(fp);
586305
- if (prior) {
586306
- const priorContent = typeof messages2[prior.idx]?.content === "string" ? messages2[prior.idx].content : "";
586299
+ }
586300
+ if (resultIdx === -1)
586301
+ continue;
586302
+ const resultMsg = messages2[resultIdx];
586303
+ const contentText = textFromMessageContent(resultMsg.content);
586304
+ if (contentText.startsWith(PRUNE_PREFIX) || contentText.startsWith(DEDUPE_PREFIX) || contentText.startsWith(FILE_AGED_PREFIX) || contentText.startsWith(SHELL_AGED_PREFIX)) {
586305
+ if (!seen.has(fp))
586306
+ seen.set(fp, { turn: scanTurn, idx: resultIdx });
586307
+ continue;
586308
+ }
586309
+ const priorIdx = seen.get(fp)?.idx;
586310
+ if (priorIdx === void 0) {
586311
+ seen.set(fp, { turn: scanTurn, idx: resultIdx });
586312
+ } else {
586313
+ const priorIdxSafe = priorIdx;
586314
+ const priorMessage = messages2[priorIdxSafe];
586315
+ if (priorMessage) {
586316
+ const priorContent = textFromMessageContent(priorMessage.content);
586307
586317
  const priorFailed = ERROR_MARKERS.test(priorContent);
586308
586318
  pending2.push({
586309
- idx: prior.idx,
586319
+ idx: priorIdxSafe,
586310
586320
  reason: "dedupe",
586311
586321
  replacement: priorFailed ? `${DEDUPE_PREFIX} ${scanTurn} — duplicate ${name10}() call; the earlier call FAILED (same error as the retained copy below). Do not retry identically.]` : `${DEDUPE_PREFIX} ${scanTurn} — duplicate ${name10}() call]`
586312
586322
  });
586313
- seen.set(fp, { turn: scanTurn, idx: resultIdx });
586314
- continue;
586315
586323
  }
586316
- seen.set(fp, { turn: scanTurn, idx: resultIdx });
586317
- const rkey = this._buildResourceKey(name10, parsedArgs);
586318
- if (rkey) {
586319
- const priorResource = seenResource.get(rkey);
586320
- if (priorResource && priorResource.idx !== resultIdx) {
586321
- const priorContent = typeof messages2[priorResource.idx]?.content === "string" ? messages2[priorResource.idx].content : "";
586324
+ continue;
586325
+ }
586326
+ const rkey = this._buildResourceKey(name10, parsedArgs);
586327
+ if (rkey) {
586328
+ const priorResourceIdx = seenResource.get(rkey)?.idx;
586329
+ if (priorResourceIdx === void 0) {
586330
+ seenResource.set(rkey, { turn: scanTurn, idx: resultIdx });
586331
+ } else if (priorResourceIdx !== resultIdx) {
586332
+ const priorResourceIdxSafe = priorResourceIdx;
586333
+ const priorResourceMessage = messages2[priorResourceIdxSafe];
586334
+ if (priorResourceMessage) {
586335
+ const priorContent = textFromMessageContent(priorResourceMessage.content);
586322
586336
  if (!priorContent.startsWith(PRUNE_PREFIX) && !priorContent.startsWith(DEDUPE_PREFIX) && !priorContent.startsWith(FILE_AGED_PREFIX)) {
586323
586337
  const priorResFailed = ERROR_MARKERS.test(priorContent);
586324
586338
  pending2.push({
586325
- idx: priorResource.idx,
586339
+ idx: priorResourceIdxSafe,
586326
586340
  reason: "dedupe",
586327
586341
  replacement: priorResFailed ? `${DEDUPE_PREFIX} ${scanTurn} — semantic duplicate ${name10}() (same resource: ${rkey}); the earlier call FAILED. Do not retry identically.]` : `${DEDUPE_PREFIX} ${scanTurn} — semantic duplicate ${name10}() (same resource: ${rkey})]`
586328
586342
  });
586329
586343
  }
586330
586344
  }
586331
586345
  seenResource.set(rkey, { turn: scanTurn, idx: resultIdx });
586346
+ } else {
586347
+ seenResource.set(rkey, {
586348
+ turn: scanTurn,
586349
+ idx: priorResourceIdx
586350
+ });
586332
586351
  }
586333
- const ageTurns = currentTurn - scanTurn;
586334
- const wasRecentlyWritten = (() => {
586335
- try {
586336
- const o2 = JSON.parse(tc.function.arguments || "{}");
586337
- const p2 = String(o2.path ?? o2.file ?? "");
586338
- for (let k = Math.max(0, i2 - 20); k < i2; k++) {
586339
- const m2 = messages2[k];
586340
- if (m2.role === "assistant" && m2.tool_calls) {
586341
- for (const tc2 of m2.tool_calls) {
586342
- if ((tc2.function.name === "file_edit" || tc2.function.name === "file_write" || tc2.function.name === "file_patch") && tc2.function.arguments?.includes(p2)) {
586343
- return true;
586344
- }
586352
+ }
586353
+ const ageTurns = currentTurn - scanTurn;
586354
+ const wasRecentlyWritten = (() => {
586355
+ try {
586356
+ const o2 = JSON.parse(tc.function.arguments || "{}");
586357
+ const p2 = String(o2.path ?? o2.file ?? "");
586358
+ for (let k = Math.max(0, i2 - 20); k < i2; k++) {
586359
+ const m2 = messages2[k];
586360
+ const priorTurnToolCalls = m2.tool_calls ?? [];
586361
+ if (m2.role === "assistant") {
586362
+ for (const tc2 of priorTurnToolCalls) {
586363
+ if ((tc2.function.name === "file_edit" || tc2.function.name === "file_write" || tc2.function.name === "file_patch") && tc2.function.arguments?.includes(p2)) {
586364
+ return true;
586345
586365
  }
586346
586366
  }
586347
586367
  }
586348
- return false;
586368
+ }
586369
+ return false;
586370
+ } catch {
586371
+ return false;
586372
+ }
586373
+ })();
586374
+ if (name10 === "file_read" && ageTurns > AGED_FILE_READ_TURNS && contentText.length > 200 && !wasRecentlyWritten) {
586375
+ const pathArg = (() => {
586376
+ try {
586377
+ const o2 = JSON.parse(tc.function.arguments || "{}");
586378
+ return String(o2.path ?? o2.file ?? "?");
586349
586379
  } catch {
586350
- return false;
586380
+ return "?";
586351
586381
  }
586352
586382
  })();
586353
- if (name10 === "file_read" && ageTurns > AGED_FILE_READ_TURNS && content.length > 200 && !wasRecentlyWritten) {
586354
- const pathArg = (() => {
586355
- try {
586356
- const o2 = JSON.parse(tc.function.arguments || "{}");
586357
- return String(o2.path ?? o2.file ?? "?");
586358
- } catch {
586359
- return "?";
586360
- }
586361
- })();
586362
- const lines = content.split("\n");
586363
- const lineCount = lines.length;
586364
- const contentPreview = content.slice(0, 500);
586365
- pending2.push({
586366
- idx: resultIdx,
586367
- reason: "aged_file",
586368
- replacement: `${FILE_AGED_PREFIX} path=${pathArg}, ${lineCount} lines, ${content.length} chars]
586383
+ const lines = contentText.split("\n");
586384
+ const lineCount = lines.length;
586385
+ const contentPreview = contentText.slice(0, 500);
586386
+ pending2.push({
586387
+ idx: resultIdx,
586388
+ reason: "aged_file",
586389
+ replacement: `${FILE_AGED_PREFIX} path=${pathArg}, ${lineCount} lines, ${contentText.length} chars]
586369
586390
  ${contentPreview}
586370
586391
  [End of aged file_read preview — do NOT re-read this file, use the content above]`
586371
- });
586372
- continue;
586373
- }
586374
- if ((name10 === "shell" || name10 === "shell_async" || name10 === "run_tests") && ageTurns > AGED_SHELL_TURNS && content.length > 200 && !ERROR_MARKERS.test(content)) {
586375
- const cmdArg = (() => {
586376
- try {
586377
- const o2 = JSON.parse(tc.function.arguments || "{}");
586378
- return String(o2.command ?? o2.cmd ?? "?").slice(0, 80);
586379
- } catch {
586380
- return "?";
586381
- }
586382
- })();
586383
- pending2.push({
586384
- idx: resultIdx,
586385
- reason: "aged_shell",
586386
- replacement: `${SHELL_AGED_PREFIX} command="${cmdArg}", output ${content.length} chars, no error markers detected]`
586387
- });
586388
- }
586392
+ });
586393
+ continue;
586394
+ }
586395
+ if ((name10 === "shell" || name10 === "shell_async" || name10 === "run_tests") && ageTurns > AGED_SHELL_TURNS && contentText.length > 200 && !ERROR_MARKERS.test(contentText)) {
586396
+ const cmdArg = (() => {
586397
+ try {
586398
+ const o2 = JSON.parse(tc.function.arguments || "{}");
586399
+ return String(o2.command ?? o2.cmd ?? "?").slice(0, 80);
586400
+ } catch {
586401
+ return "?";
586402
+ }
586403
+ })();
586404
+ pending2.push({
586405
+ idx: resultIdx,
586406
+ reason: "aged_shell",
586407
+ replacement: `${SHELL_AGED_PREFIX} command="${cmdArg}", output ${contentText.length} chars, no error markers detected]`
586408
+ });
586389
586409
  }
586390
586410
  }
586391
586411
  }
586392
586412
  if (pending2.length === 0)
586393
586413
  return;
586394
- let dedupes = 0, agedFiles = 0, agedShells = 0;
586414
+ let dedupes = 0;
586415
+ let agedFiles = 0;
586416
+ let agedShells = 0;
586395
586417
  for (const p2 of pending2) {
586396
586418
  const m2 = messages2[p2.idx];
586397
586419
  if (!m2)
@@ -587527,7 +587549,7 @@ ${sections.join("\n")}` : sections.join("\n");
587527
587549
  }
587528
587550
  }
587529
587551
  const sections = [
587530
- "[KNOWLEDGE — cached tool results already known to the runtime. Repeating an exact read/list/search/shell call is a wasted action and will be blocked or served from cache:]"
587552
+ "[KNOWLEDGE — recent tool results for reference. Re-reading a file after an edit is encouraged to capture the latest content; exact re-reads are NOT blocked and always return fresh, up-to-date data.]"
587531
587553
  ];
587532
587554
  if (compactedCount > 0) {
587533
587555
  sections.push(`Compacted cached entries still count as already-known results (${compactedCount}); an exact repeat will be served from cache or skipped, not produce new information.`);
@@ -588419,8 +588441,7 @@ ${blob}
588419
588441
  /** Extract (path, [start,end], whole) for a region-coalesceable read, else null. */
588420
588442
  _readIntervalFromArgs(name10, args) {
588421
588443
  const canonical = this.lookupRegisteredTool(name10)?.name ?? name10;
588422
- if (canonical !== "file_read")
588423
- return null;
588444
+ return null;
588424
588445
  const a2 = args ?? {};
588425
588446
  const path13 = typeof a2["path"] === "string" && a2["path"] || typeof a2["file"] === "string" && a2["file"] || typeof a2["file_path"] === "string" && a2["file_path"] || "";
588426
588447
  if (!path13)
@@ -588428,8 +588449,12 @@ ${blob}
588428
588449
  const offset = typeof a2["offset"] === "number" ? a2["offset"] : void 0;
588429
588450
  const limit = typeof a2["limit"] === "number" ? a2["limit"] : void 0;
588430
588451
  const whole = offset === void 0 && limit === void 0;
588452
+ const safeLimit = limit ?? 0;
588431
588453
  const start2 = Math.max(1, offset ?? 1);
588432
- const end = whole ? Number.POSITIVE_INFINITY : limit !== void 0 ? start2 + Math.max(0, limit) - 1 : Number.POSITIVE_INFINITY;
588454
+ let end = Number.POSITIVE_INFINITY;
588455
+ if (!whole) {
588456
+ end = start2 + Math.max(0, safeLimit) - 1;
588457
+ }
588433
588458
  return { key: `${canonical}|${path13}`, start: start2, end, whole };
588434
588459
  }
588435
588460
  /**
@@ -592210,7 +592235,7 @@ ${memoryLines.join("\n")}`
592210
592235
  if (msg.toolCalls && msg.toolCalls.length > 0) {
592211
592236
  consecutiveTextOnly = 0;
592212
592237
  consecutiveThinkOnly = 0;
592213
- msg.toolCalls = this._dedupeToolCallsForResponse(msg.toolCalls, turn);
592238
+ msg.toolCalls = msg.toolCalls;
592214
592239
  if (msg.toolCalls.length === 0) {
592215
592240
  messages2.push({
592216
592241
  role: "system",
@@ -592937,7 +592962,7 @@ Read the current file if needed, make a different concrete edit, or move to veri
592937
592962
  }
592938
592963
  const _repeatGateMax = this._resolveRepeatGateMax();
592939
592964
  const isFailedShellRepeat = tc.name === "shell" && typeof _existingFp?.result === "string" && _existingFp.result.includes("status: failure") && !shellLikelyMutatesFilesystem;
592940
- const repeatGateEligible = isReadLike || tc.name === "memory_write" || isFailedShellRepeat;
592965
+ const repeatGateEligible = tc.name === "memory_write" || isFailedShellRepeat;
592941
592966
  const suppressSuccessfulShellCacheGuidance = tc.name === "shell" && !isFailedShellRepeat;
592942
592967
  if (suppressSuccessfulShellCacheGuidance)
592943
592968
  criticGuidance = null;
@@ -595962,7 +595987,7 @@ ${this.options.maxTurns && this.options.maxTurns > 0 ? `You have ${this.options.
595962
595987
  if (msg.toolCalls && msg.toolCalls.length > 0) {
595963
595988
  consecutiveTextOnly = 0;
595964
595989
  consecutiveThinkOnly = 0;
595965
- msg.toolCalls = this._dedupeToolCallsForResponse(msg.toolCalls, turn);
595990
+ msg.toolCalls = msg.toolCalls;
595966
595991
  if (msg.toolCalls.length === 0) {
595967
595992
  messages2.push({
595968
595993
  role: "system",
@@ -745514,30 +745539,9 @@ function extractEnhancedPrompt(raw) {
745514
745539
  if (!text2.startsWith("{") && !text2.startsWith("[")) return text2;
745515
745540
  return null;
745516
745541
  }
745517
- async function enhancePromptViaInference(seed, ctx3) {
745542
+ async function enhancePromptViaInference(seed, backend, ctx3) {
745518
745543
  const seedText = seed.trim();
745519
745544
  if (!seedText) return null;
745520
- let backend;
745521
- try {
745522
- if (ctx3.config.backendType === "nexus") {
745523
- const nexusTool = new NexusTool(ctx3.repoRoot);
745524
- const peer = ctx3.config.backendUrl.startsWith("peer://") ? ctx3.config.backendUrl.slice(7) : void 0;
745525
- backend = new NexusAgenticBackend(
745526
- nexusTool.sendCommand.bind(nexusTool),
745527
- ctx3.config.model,
745528
- peer,
745529
- ctx3.config.apiKey
745530
- );
745531
- } else {
745532
- backend = new OllamaAgenticBackend(
745533
- ctx3.config.backendUrl,
745534
- ctx3.config.model,
745535
- ctx3.config.apiKey
745536
- );
745537
- }
745538
- } catch {
745539
- return null;
745540
- }
745541
745545
  const recent = ctx3.recentHistory.filter((h) => h && h.trim()).slice(0, 5).map((h, i2) => ` ${i2 + 1}. ${h.trim().slice(0, 240)}`).join("\n");
745542
745546
  let runtimeCtx = "";
745543
745547
  try {
@@ -747180,8 +747184,13 @@ This is an independent background session started from /background.`
747180
747184
  }
747181
747185
  });
747182
747186
  statusBar.setEnhanceHandler(async (seedPrompt) => {
747183
- return enhancePromptViaInference(seedPrompt, {
747184
- config: currentConfig,
747187
+ let enhanceBackend;
747188
+ try {
747189
+ enhanceBackend = activeTask ? activeTask.runner.getBackend() : await createSteeringIntakeBackend(currentConfig, repoRoot);
747190
+ } catch {
747191
+ return null;
747192
+ }
747193
+ return enhancePromptViaInference(seedPrompt, enhanceBackend, {
747185
747194
  repoRoot,
747186
747195
  recentHistory: savedHistory,
747187
747196
  activeGoal: activeTask ? lastSubmittedPrompt : void 0
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.497",
3
+ "version": "1.0.498",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.497",
9
+ "version": "1.0.498",
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.497",
3
+ "version": "1.0.498",
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",