omnius 1.0.941 → 1.0.942
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 +2 -2
- package/dist/library.js +23 -21
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/index.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 41431117 bytes
|
|
4
|
+
sha256: 74e4513a79da2da97ec198f59b4e8bd94a021539f5abc3fafb2291420fc4aab6
|
package/dist/library.js
CHANGED
|
@@ -402082,39 +402082,39 @@ function reopenTaskEffectStateEvidence(input2) {
|
|
|
402082
402082
|
import { createHash as createHash124 } from "node:crypto";
|
|
402083
402083
|
var LOOP_TRIAGE_STREAK = 3;
|
|
402084
402084
|
var LOOP_TRIAGE_REVIEW_HEADER = "[OMNIUS RUN REVIEW — independent second opinion on this run from the Omnius triage reviewer; this is the harness, not the user]";
|
|
402085
|
-
function
|
|
402085
|
+
function toolTurns(messages4) {
|
|
402086
402086
|
const results = /* @__PURE__ */ new Map();
|
|
402087
402087
|
for (const message3 of messages4) {
|
|
402088
402088
|
if (message3.role === "tool" && message3.tool_call_id) {
|
|
402089
402089
|
results.set(message3.tool_call_id, typeof message3.content === "string" ? message3.content : "");
|
|
402090
402090
|
}
|
|
402091
402091
|
}
|
|
402092
|
-
const
|
|
402092
|
+
const turns = [];
|
|
402093
402093
|
for (const message3 of messages4) {
|
|
402094
402094
|
if (message3.role !== "assistant" || !message3.tool_calls?.length)
|
|
402095
402095
|
continue;
|
|
402096
|
-
|
|
402096
|
+
turns.push(message3.tool_calls.map((call3) => {
|
|
402097
402097
|
const raw = call3.function.arguments;
|
|
402098
402098
|
const args = typeof raw === "string" ? raw : JSON.stringify(raw ?? {});
|
|
402099
|
-
|
|
402100
|
-
}
|
|
402099
|
+
return { tool: call3.function.name, args, result: results.get(call3.id) ?? "" };
|
|
402100
|
+
}));
|
|
402101
402101
|
}
|
|
402102
|
-
return
|
|
402102
|
+
return turns;
|
|
402103
|
+
}
|
|
402104
|
+
function turnIdentity(turn) {
|
|
402105
|
+
return turn.map((pair) => `${pair.tool}\0${pair.args}`).sort().join("");
|
|
402103
402106
|
}
|
|
402104
402107
|
function repeatedCallStreak(messages4, threshold = LOOP_TRIAGE_STREAK) {
|
|
402105
|
-
const
|
|
402106
|
-
const last =
|
|
402107
|
-
if (
|
|
402108
|
+
const identities2 = toolTurns(messages4).map(turnIdentity);
|
|
402109
|
+
const last = identities2.at(-1);
|
|
402110
|
+
if (last === void 0)
|
|
402108
402111
|
return null;
|
|
402109
402112
|
let count8 = 0;
|
|
402110
|
-
for (let index =
|
|
402111
|
-
if (pairs[index].tool !== last.tool || pairs[index].args !== last.args)
|
|
402112
|
-
break;
|
|
402113
|
+
for (let index = identities2.length - 1; index >= 0 && identities2[index] === last; index--)
|
|
402113
402114
|
count8++;
|
|
402114
|
-
}
|
|
402115
402115
|
if (count8 < threshold)
|
|
402116
402116
|
return null;
|
|
402117
|
-
const key = createHash124("sha256").update(
|
|
402117
|
+
const key = createHash124("sha256").update(last).digest("hex").slice(0, 16);
|
|
402118
402118
|
return { key, count: count8 };
|
|
402119
402119
|
}
|
|
402120
402120
|
function oneLine(value, limit2) {
|
|
@@ -402122,20 +402122,22 @@ function oneLine(value, limit2) {
|
|
|
402122
402122
|
}
|
|
402123
402123
|
function collapsedTrajectory(messages4, maxLines = 40) {
|
|
402124
402124
|
const lines = [];
|
|
402125
|
-
let previousIdentity = "",
|
|
402125
|
+
let previousIdentity = "", previousLines = [], repeats = 0;
|
|
402126
402126
|
const flush = () => {
|
|
402127
|
-
if (
|
|
402128
|
-
|
|
402127
|
+
if (!previousLines.length)
|
|
402128
|
+
return;
|
|
402129
|
+
const suffix = repeats <= 1 ? "" : previousLines.length === 1 ? ` (x${repeats}, same call each time)` : ` (this batch of ${previousLines.length} calls x${repeats}, same calls each time)`;
|
|
402130
|
+
lines.push(...previousLines.slice(0, -1), previousLines.at(-1) + suffix);
|
|
402129
402131
|
};
|
|
402130
|
-
for (const
|
|
402131
|
-
const identity9 =
|
|
402132
|
+
for (const turn of toolTurns(messages4)) {
|
|
402133
|
+
const identity9 = turnIdentity(turn);
|
|
402132
402134
|
if (identity9 === previousIdentity) {
|
|
402133
402135
|
repeats++;
|
|
402134
402136
|
continue;
|
|
402135
402137
|
}
|
|
402136
402138
|
flush();
|
|
402137
402139
|
previousIdentity = identity9;
|
|
402138
|
-
|
|
402140
|
+
previousLines = turn.map((pair) => `- ${pair.tool}: ${oneLine(pair.args, 220)} -> ${oneLine(pair.result.slice(-400), 160)}`);
|
|
402139
402141
|
repeats = 1;
|
|
402140
402142
|
}
|
|
402141
402143
|
flush();
|
|
@@ -441533,7 +441535,7 @@ ${trimmedNew}`;
|
|
|
441533
441535
|
visibility: "telemetry",
|
|
441534
441536
|
turn,
|
|
441535
441537
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
441536
|
-
content: message3 ? `Loop triage: second opinion recorded after ${streak.count} identical
|
|
441538
|
+
content: message3 ? `Loop triage: second opinion recorded after ${streak.count} identical tool turns` : `Loop triage: reviewer returned no assessment after ${streak.count} identical tool turns`
|
|
441537
441539
|
});
|
|
441538
441540
|
} catch (error) {
|
|
441539
441541
|
this.emit({
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.942",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.942",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED