omnius 1.0.465 → 1.0.466

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
@@ -566840,7 +566840,9 @@ function loadIgnoreFile(path12) {
566840
566840
  return [];
566841
566841
  }
566842
566842
  }
566843
- function shouldIgnore(relPath, base3, patterns) {
566843
+ function shouldIgnore(relPath, base3, absPath, patterns) {
566844
+ if (existsSync92(join103(absPath, "pyvenv.cfg")))
566845
+ return true;
566844
566846
  for (const p2 of patterns) {
566845
566847
  if (!p2)
566846
566848
  continue;
@@ -566873,16 +566875,32 @@ function scanWorkspace(opts) {
566873
566875
  let dirsVisited = 0;
566874
566876
  const stack = [root];
566875
566877
  const visited = /* @__PURE__ */ new Set();
566876
- while (stack.length > 0) {
566877
- if (files.length >= maxFiles) {
566878
- truncated = true;
566879
- break;
566878
+ const considerFile = (file) => {
566879
+ totalBytes += file.bytes;
566880
+ if (files.length < maxFiles) {
566881
+ files.push(file);
566882
+ return;
566883
+ }
566884
+ truncated = true;
566885
+ let oldestIndex = 0;
566886
+ for (let i2 = 1; i2 < files.length; i2++) {
566887
+ if (files[i2].mtimeMs < files[oldestIndex].mtimeMs)
566888
+ oldestIndex = i2;
566880
566889
  }
566890
+ if (file.mtimeMs > files[oldestIndex].mtimeMs) {
566891
+ files[oldestIndex] = file;
566892
+ }
566893
+ };
566894
+ while (stack.length > 0) {
566881
566895
  const dir = stack.pop();
566882
566896
  if (visited.has(dir))
566883
566897
  continue;
566884
566898
  visited.add(dir);
566885
566899
  dirsVisited++;
566900
+ if (dirsVisited > maxDirs) {
566901
+ truncated = true;
566902
+ break;
566903
+ }
566886
566904
  if (dirs.length < maxDirs) {
566887
566905
  try {
566888
566906
  const st = statSync32(dir);
@@ -566901,15 +566919,12 @@ function scanWorkspace(opts) {
566901
566919
  continue;
566902
566920
  }
566903
566921
  entries.sort();
566922
+ const dirsToVisit = [];
566904
566923
  for (const entry of entries) {
566905
- if (files.length >= maxFiles) {
566906
- truncated = true;
566907
- break;
566908
- }
566909
566924
  const abs = join103(dir, entry);
566910
566925
  const rel = relative8(root, abs);
566911
566926
  const base3 = basename22(abs);
566912
- if (shouldIgnore(rel, base3, patterns))
566927
+ if (shouldIgnore(rel, base3, abs, patterns))
566913
566928
  continue;
566914
566929
  let st;
566915
566930
  try {
@@ -566918,13 +566933,15 @@ function scanWorkspace(opts) {
566918
566933
  continue;
566919
566934
  }
566920
566935
  if (st.isDirectory()) {
566921
- stack.push(abs);
566936
+ dirsToVisit.push(abs);
566922
566937
  continue;
566923
566938
  }
566924
566939
  if (!st.isFile())
566925
566940
  continue;
566926
- files.push({ abs, rel, bytes: st.size, mtimeMs: st.mtimeMs });
566927
- totalBytes += st.size;
566941
+ considerFile({ abs, rel, bytes: st.size, mtimeMs: st.mtimeMs });
566942
+ }
566943
+ for (let i2 = dirsToVisit.length - 1; i2 >= 0; i2--) {
566944
+ stack.push(dirsToVisit[i2]);
566928
566945
  }
566929
566946
  }
566930
566947
  files.sort((a2, b) => a2.rel.localeCompare(b.rel));
@@ -566955,6 +566972,7 @@ function ensureTreeNode(root, rel) {
566955
566972
  function renderWorkspaceTree(scan, opts = {}) {
566956
566973
  const maxLines = Math.max(10, Math.min(2e3, opts.maxLines ?? 120));
566957
566974
  const includeFileSizes = opts.includeFileSizes !== false;
566975
+ const sortBy = opts.sortBy ?? "path";
566958
566976
  const root = {
566959
566977
  name: ".",
566960
566978
  children: /* @__PURE__ */ new Map(),
@@ -566975,10 +566993,38 @@ function renderWorkspaceTree(scan, opts = {}) {
566975
566993
  directory: false
566976
566994
  });
566977
566995
  }
566996
+ const annotate = (node) => {
566997
+ if (!node.directory && node.file) {
566998
+ node.latestMtimeMs = node.file.mtimeMs;
566999
+ node.selectedFileCount = 1;
567000
+ return { latest: node.file.mtimeMs, files: 1 };
567001
+ }
567002
+ let latest = 0;
567003
+ let files = 0;
567004
+ for (const child of node.children.values()) {
567005
+ const stats = annotate(child);
567006
+ latest = Math.max(latest, stats.latest);
567007
+ files += stats.files;
567008
+ }
567009
+ node.latestMtimeMs = latest;
567010
+ node.selectedFileCount = files;
567011
+ return { latest, files };
567012
+ };
567013
+ annotate(root);
566978
567014
  const lines = ["./"];
566979
567015
  let truncated = false;
566980
567016
  const walk2 = (node, depth) => {
566981
567017
  const children2 = [...node.children.values()].sort((a2, b) => {
567018
+ if (sortBy === "recent") {
567019
+ const aFiles = a2.selectedFileCount ?? 0;
567020
+ const bFiles = b.selectedFileCount ?? 0;
567021
+ if (aFiles > 0 !== bFiles > 0)
567022
+ return aFiles > 0 ? -1 : 1;
567023
+ const aMtime = a2.latestMtimeMs ?? 0;
567024
+ const bMtime = b.latestMtimeMs ?? 0;
567025
+ if (aMtime !== bMtime)
567026
+ return bMtime - aMtime;
567027
+ }
566982
567028
  if (a2.directory !== b.directory)
566983
567029
  return a2.directory ? -1 : 1;
566984
567030
  return a2.name.localeCompare(b.name);
@@ -567057,12 +567103,23 @@ var init_world_state_disk_scan = __esm({
567057
567103
  ".venv",
567058
567104
  "venv",
567059
567105
  "env",
567106
+ "site-packages",
567107
+ ".eggs",
567108
+ "__pypackages__",
567109
+ // Embedded/device and package-manager dependency/build caches
567110
+ ".pio",
567111
+ ".platformio",
567112
+ "libdeps",
567060
567113
  // Rust / Go test / build outputs are caught by "target"/"build"
567061
567114
  // Editor swap / lock-only files — case-by-case skip, see file filter below
567062
567115
  // Omnius's own state dirs
567063
567116
  ".omnius",
567064
567117
  ".aiwg",
567065
567118
  ".ralph",
567119
+ ".claude",
567120
+ ".codex",
567121
+ ".factory",
567122
+ ".warp",
567066
567123
  // Next/Vite/etc. caches (broadly cross-framework — every JS bundler has one)
567067
567124
  ".next",
567068
567125
  ".nuxt",
@@ -575515,7 +575572,7 @@ var init_focusSupervisor = __esm({
575515
575572
  prior.ignoredCount++;
575516
575573
  this.ignoredDirectiveStreak++;
575517
575574
  this.lastIgnoredDirectiveTurn = input.turn;
575518
- if ((prior.requiredNextAction === "read_authoritative_target" || prior.requiredNextAction === "use_cached_evidence") && input.cachedResult && (input.duplicateHitCount ?? 0) >= Math.max(1, this.repeatGateMax - 1)) {
575575
+ if (prior.requiredNextAction === "read_authoritative_target" && input.cachedResult && (input.duplicateHitCount ?? 0) >= Math.max(1, this.repeatGateMax - 1)) {
575519
575576
  const deadlockDirective = this.setDirective({
575520
575577
  turn: input.turn,
575521
575578
  state: "terminal_incomplete",
@@ -578528,7 +578585,7 @@ function classifyThinkOutcome(raw) {
578528
578585
  }
578529
578586
  return null;
578530
578587
  }
578531
- var TOOL_SUBSETS, TOOL_AUTO_DEMOTE_TURNS, TOOL_ACTION_REASON_KEYS, TOOL_ACTION_REASON_SCOPES, READ_ONLY_ACTION_REASON_OPTIONAL_TOOLS, TOOL_ACTION_REASON_SCHEMA, SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, OllamaAgenticBackend;
578588
+ var TOOL_SUBSETS, TOOL_AUTO_DEMOTE_TURNS, TOOL_ACTION_REASON_KEYS, TOOL_ACTION_REASON_SCOPES, READ_ONLY_ACTION_REASON_OPTIONAL_TOOLS, STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS, TOOL_ACTION_REASON_SCHEMA, SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, OllamaAgenticBackend;
578532
578589
  var init_agenticRunner = __esm({
578533
578590
  "packages/orchestrator/dist/agenticRunner.js"() {
578534
578591
  "use strict";
@@ -578652,6 +578709,9 @@ var init_agenticRunner = __esm({
578652
578709
  "web_fetch",
578653
578710
  "tool_search"
578654
578711
  ]);
578712
+ STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS = /* @__PURE__ */ new Set([
578713
+ "todo_write"
578714
+ ]);
578655
578715
  TOOL_ACTION_REASON_SCHEMA = {
578656
578716
  type: "object",
578657
578717
  description: "Compact public action contract for this exact tool call. Do not include hidden chain-of-thought; use concise task-state facts.",
@@ -580012,10 +580072,13 @@ ${parts.join("\n")}
580012
580072
  }
580013
580073
  _maybeMarkFocusTerminalIncomplete(input) {
580014
580074
  if (input.decision.kind === "pass")
580015
- return;
580075
+ return null;
580016
580076
  const directive = input.decision.directive;
580017
580077
  if (directive.state !== "terminal_incomplete" || directive.requiredNextAction !== "report_incomplete") {
580018
- return;
580078
+ return null;
580079
+ }
580080
+ if (this._completionIncompleteVerification) {
580081
+ return this._completionIncompleteVerification.summary;
580019
580082
  }
580020
580083
  const reason = directive.reason;
580021
580084
  const blocked = input.blockedTool ? `Blocked tool: ${input.blockedTool}.` : "";
@@ -580033,6 +580096,10 @@ ${parts.join("\n")}
580033
580096
  "Next action:",
580034
580097
  'Call task_complete with status="incomplete" or status="blocked", or provide the missing evidence if a valid recovery action remains.'
580035
580098
  ].filter((line) => line.length > 0).join("\n");
580099
+ this._completionIncompleteVerification = {
580100
+ reason: "focus_supervisor_terminal",
580101
+ summary: focusTerminalSummary
580102
+ };
580036
580103
  this.emit({
580037
580104
  type: "status",
580038
580105
  content: `Focus supervisor terminal directive: ${reason.slice(0, 220)}`,
@@ -580051,6 +580118,7 @@ ${parts.join("\n")}
580051
580118
  this._saveCompletionLedgerSafe();
580052
580119
  this._focusTerminalLedgerRecorded = true;
580053
580120
  }
580121
+ return focusTerminalSummary;
580054
580122
  }
580055
580123
  _buildFocusContextSnapshot() {
580056
580124
  const last2 = this._lastFocusContextSnapshot;
@@ -583722,22 +583790,24 @@ ${latest.output || ""}`.trim();
583722
583790
  const artifactLines = intEnv("OMNIUS_CONTEXT_TREE_ARTIFACT_LINES", 1800, 100, 4e3);
583723
583791
  try {
583724
583792
  const scan = scanWorkspace({ root, maxFiles, maxDirs });
583725
- const compactTree = renderWorkspaceTree(scan, { maxLines: contextLines });
583726
- const fullTree = renderWorkspaceTree(scan, { maxLines: artifactLines });
583793
+ const compactTree = renderWorkspaceTree(scan, { maxLines: contextLines, sortBy: "recent" });
583794
+ const fullTree = renderWorkspaceTree(scan, { maxLines: artifactLines, sortBy: "recent" });
583727
583795
  const totalBytes = scan.files.reduce((sum, file) => sum + file.bytes, 0);
583728
583796
  const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
583729
583797
  const focusSnapshot = this._focusSupervisor?.snapshot();
583730
- const recentActions = this._adversaryToolOutcomes.slice(-12).map((item) => ({
583798
+ const recentActions = this._recentToolActionsForWorldState().slice(-12).map((item) => ({
583731
583799
  turn: item.turn,
583732
583800
  tool: item.tool,
583733
583801
  success: item.succeeded,
583734
583802
  path: item.path,
583735
583803
  stateVersion: item.stateVersion,
583736
- preview: item.preview.slice(0, 240)
583804
+ preview: item.preview.slice(0, 240),
583805
+ actionReason: item.actionReason ?? void 0
583737
583806
  }));
583738
583807
  const recentActionLines = recentActions.slice(-6).map((item) => {
583739
583808
  const path12 = item.path ? ` path=${item.path}` : "";
583740
- return `- turn=${item.turn} ${item.tool} ${item.success ? "ok" : "err"}${path12}: ${item.preview.replace(/\s+/g, " ").slice(0, 160)}`;
583809
+ const reason = item.actionReason ? ` reason=${[item.actionReason.scope, item.actionReason.intent].filter(Boolean).join(":").replace(/\s+/g, " ").slice(0, 120)}` : "";
583810
+ return `- turn=${item.turn} ${item.tool} ${item.success ? "ok" : "err"}${path12}${reason}: ${item.preview.replace(/\s+/g, " ").slice(0, 160)}`;
583741
583811
  });
583742
583812
  const treeDir = _pathJoin(this.omniusStateDir(), "world-state", "tree");
583743
583813
  const turnName = `turn-${String(turn).padStart(4, "0")}`;
@@ -589780,6 +589850,14 @@ Respond with EXACTLY this structure before your next tool call:
589780
589850
  const realFileMutation = this._isRealProjectMutation(tc.name, result);
589781
589851
  const observedStateMutation = realFileMutation || shellFilesystemMutation || result.success === true && result.mutated === true;
589782
589852
  const realMutationPaths = realFileMutation ? this._extractToolTargetPaths(tc.name, tc.arguments, result) : [];
589853
+ this._recordRecentToolOutcomeForWorldState({
589854
+ turn,
589855
+ toolName: resolvedTool?.name ?? tc.name,
589856
+ toolCallId: tc.id,
589857
+ args: tc.arguments,
589858
+ result,
589859
+ actionReason: toolActionReason
589860
+ });
589783
589861
  if (observedStateMutation) {
589784
589862
  this._markAdversaryObservedStateMutation();
589785
589863
  }
@@ -591549,6 +591627,8 @@ ${sr.result.output}`;
591549
591627
  }
591550
591628
  }
591551
591629
  const results = await executeBatch(batch2, async (call) => {
591630
+ if (this._completionIncompleteVerification)
591631
+ return null;
591552
591632
  const originalTc = rawToolCalls.find((tc) => tc.id === call.id);
591553
591633
  const fp = buildBatchFp(call);
591554
591634
  const firstId = batchFingerprintFirstId.get(fp);
@@ -593926,10 +594006,32 @@ ${marker}` : marker);
593926
594006
  const explicit = this._extractToolActionReason(args);
593927
594007
  if (explicit)
593928
594008
  return explicit;
594009
+ if (this._shouldSynthesizeMissingToolActionReason(toolName, args)) {
594010
+ return this._synthesizeStateUpdateToolActionReason(toolName, args);
594011
+ }
593929
594012
  if (this._toolActionReasonPolicy(toolName, args) !== "optional")
593930
594013
  return null;
593931
594014
  return this._synthesizeReadOnlyToolActionReason(toolName, args);
593932
594015
  }
594016
+ _shouldSynthesizeMissingToolActionReason(toolName, _args) {
594017
+ if (this._toolActionReasonPolicy(toolName, _args) === "disabled") {
594018
+ return false;
594019
+ }
594020
+ const canonical = this.lookupRegisteredTool(toolName)?.name ?? toolName;
594021
+ return STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS.has(canonical);
594022
+ }
594023
+ _synthesizeStateUpdateToolActionReason(toolName, args) {
594024
+ const canonical = this.lookupRegisteredTool(toolName)?.name ?? toolName;
594025
+ const goal = this._taskState.currentStep || this._taskState.nextAction || this._taskState.goal || this._taskState.originalGoal || "current task";
594026
+ const todoCount = Array.isArray(args["todos"]) ? args["todos"].length : null;
594027
+ return {
594028
+ task_anchor: String(goal).replace(/\s+/g, " ").trim().slice(0, 160),
594029
+ intent: `Update visible task state with ${canonical}.`,
594030
+ evidence: todoCount === null ? "Model omitted public action_reason; runtime synthesized bookkeeping metadata without authorizing project mutation." : `Model supplied ${todoCount} todo item(s); runtime synthesized bookkeeping metadata without authorizing project mutation.`,
594031
+ expected_result: "Session checklist reflects the current task state.",
594032
+ scope: "state_update"
594033
+ };
594034
+ }
593933
594035
  _synthesizeReadOnlyToolActionReason(toolName, args) {
593934
594036
  const canonical = this.lookupRegisteredTool(toolName)?.name ?? toolName;
593935
594037
  const goal = this._taskState.currentStep || this._taskState.nextAction || this._taskState.goal || this._taskState.originalGoal || "current task";
@@ -593951,6 +594053,9 @@ ${marker}` : marker);
593951
594053
  if (!raw || typeof raw === "string" && !raw.trim()) {
593952
594054
  if (policy === "optional")
593953
594055
  return null;
594056
+ if (this._shouldSynthesizeMissingToolActionReason(toolName, args)) {
594057
+ return null;
594058
+ }
593954
594059
  return [
593955
594060
  "[TOOL ACTION REASON CONTRACT]",
593956
594061
  `This side-effectful tool call must include action_reason: { task_anchor, intent, evidence, expected_result, scope }.`,
@@ -595798,6 +595903,10 @@ ${trimmedNew}`;
595798
595903
  // we add a second analysis path that catches mismatches in real-time.
595799
595904
  /** Track recent tool outcomes for the adversary */
595800
595905
  _adversaryToolOutcomes = [];
595906
+ /** Execution-time action ledger used by world-state artifacts. Unlike the
595907
+ * adversary buffer, this is populated directly after tool execution and does
595908
+ * not depend on raw tool messages surviving compaction. */
595909
+ _recentToolOutcomes = [];
595801
595910
  /** Monotonic counter for observed local state changes.
595802
595911
  * Redundant-action classification is only valid within the same state
595803
595912
  * version; a repeated verifier after an edit is fresh evidence. */
@@ -595902,6 +596011,38 @@ ${trimmedNew}`;
595902
596011
  }
595903
596012
  return { preview: snippet || content.slice(0, 160) };
595904
596013
  }
596014
+ _recordRecentToolOutcomeForWorldState(input) {
596015
+ const content = input.result.success === true ? String(input.result.output ?? "") : String(input.result.error ?? input.result.output ?? "");
596016
+ const outcomeEvidence = this.buildAdversaryToolOutcomeEvidence(input.toolName, input.args, content, input.result.success === true);
596017
+ const fingerprint = input.args ? this._buildToolFingerprint(input.toolName, input.args) : void 0;
596018
+ const alreadySeen = this._recentToolOutcomes.some((outcome) => {
596019
+ if (input.toolCallId && outcome.toolCallId === input.toolCallId) {
596020
+ return true;
596021
+ }
596022
+ return outcome.turn === input.turn && outcome.tool === input.toolName && outcome.fingerprint === fingerprint;
596023
+ });
596024
+ if (alreadySeen)
596025
+ return;
596026
+ this._recentToolOutcomes.push({
596027
+ turn: input.turn,
596028
+ tool: input.toolName,
596029
+ toolCallId: input.toolCallId,
596030
+ argsKey: input.args ? this._buildExactArgsKey(input.args) : void 0,
596031
+ fingerprint,
596032
+ stateVersion: this._adversaryStateVersion,
596033
+ succeeded: input.result.success === true,
596034
+ actionReason: input.actionReason,
596035
+ ...outcomeEvidence
596036
+ });
596037
+ while (this._recentToolOutcomes.length > 40) {
596038
+ this._recentToolOutcomes.shift();
596039
+ }
596040
+ }
596041
+ _recentToolActionsForWorldState() {
596042
+ if (this._recentToolOutcomes.length > 0)
596043
+ return this._recentToolOutcomes;
596044
+ return this._adversaryToolOutcomes;
596045
+ }
595905
596046
  /**
595906
596047
  * Adversary: post-turn meta-analysis.
595907
596048
  *
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.465",
3
+ "version": "1.0.466",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.465",
9
+ "version": "1.0.466",
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.465",
3
+ "version": "1.0.466",
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",