omnius 1.0.366 → 1.0.367
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 +121 -23
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -567594,6 +567594,9 @@ function adversarySystemPrompt() {
|
|
|
567594
567594
|
" • started ≠ running — a PID or a log line is not a liveness probe.",
|
|
567595
567595
|
" • exit code 0 / 'build complete' ≠ success — the specific artifact must exist.",
|
|
567596
567596
|
" • an edit ≠ a fix — the failing command must be re-run and pass.",
|
|
567597
|
+
" • file_write/file_read tool outcomes ARE first-class evidence for narrow file existence/content claims.",
|
|
567598
|
+
" Do not demand shell/cat proof when a successful file_write is followed by file_read evidence for the same path.",
|
|
567599
|
+
" • If a shell integrity check is truly needed, demand a newline-safe command such as: printf '\n---sha256---\n'; sha256sum <path>. Do not use brittle cat <path> && sha256sum <path> as the default.",
|
|
567597
567600
|
" • simulation / mock / placeholder ≠ real.",
|
|
567598
567601
|
" • partial progress ≠ done.",
|
|
567599
567602
|
"Mixed results are the norm: do NOT let one success excuse an unproven completion claim.",
|
|
@@ -567614,7 +567617,11 @@ function adversarySystemPrompt() {
|
|
|
567614
567617
|
].join("\n");
|
|
567615
567618
|
}
|
|
567616
567619
|
function buildObservationPrompt(obs, recentLedger) {
|
|
567617
|
-
const outcomes = obs.recentToolOutcomes.slice(-8).map((o2) =>
|
|
567620
|
+
const outcomes = obs.recentToolOutcomes.slice(-8).map((o2) => {
|
|
567621
|
+
const target = o2.path ? ` path=${o2.path}` : "";
|
|
567622
|
+
const evidence = o2.evidence ? ` | evidence: ${o2.evidence.slice(0, 220)}` : "";
|
|
567623
|
+
return ` - ${o2.tool}: ${o2.succeeded ? "OK" : "FAIL"}${target} — ${o2.preview.slice(0, 160)}${evidence}`;
|
|
567624
|
+
}).join("\n");
|
|
567618
567625
|
const priorDoubts = recentLedger.slice(-3).filter((e2) => e2.verdict !== "ok").map((e2) => ` - turn ${e2.turn}: ${e2.verdict} — demanded: ${e2.demand}`).join("\n");
|
|
567619
567626
|
if (obs.loopSignal) {
|
|
567620
567627
|
const ls2 = obs.loopSignal;
|
|
@@ -567669,6 +567676,47 @@ ${priorDoubts}` : "",
|
|
|
567669
567676
|
"Audit this. Return ONLY the JSON object."
|
|
567670
567677
|
].join("\n");
|
|
567671
567678
|
}
|
|
567679
|
+
function deterministicFileProofPaths(obs) {
|
|
567680
|
+
const writes = /* @__PURE__ */ new Set();
|
|
567681
|
+
const reads = /* @__PURE__ */ new Set();
|
|
567682
|
+
for (const outcome of obs.recentToolOutcomes) {
|
|
567683
|
+
if (!outcome.succeeded || !outcome.path)
|
|
567684
|
+
continue;
|
|
567685
|
+
if (/^(file_write|file_edit|file_patch|batch_edit)$/.test(outcome.tool)) {
|
|
567686
|
+
writes.add(outcome.path);
|
|
567687
|
+
}
|
|
567688
|
+
if (outcome.tool === "file_read")
|
|
567689
|
+
reads.add(outcome.path);
|
|
567690
|
+
}
|
|
567691
|
+
const proven = /* @__PURE__ */ new Set();
|
|
567692
|
+
for (const path12 of writes)
|
|
567693
|
+
if (reads.has(path12))
|
|
567694
|
+
proven.add(path12);
|
|
567695
|
+
return proven;
|
|
567696
|
+
}
|
|
567697
|
+
function hasRecentNonFileFailure(obs) {
|
|
567698
|
+
return obs.recentToolOutcomes.some((outcome) => !outcome.succeeded && !/^(file_write|file_edit|file_patch|batch_edit|file_read|task_complete)$/.test(outcome.tool));
|
|
567699
|
+
}
|
|
567700
|
+
function isNarrowFileCompletionClaim(text2) {
|
|
567701
|
+
return /\b(file|path|created|wrote|written|exists|content|reads?back|verified by read|single line)\b/i.test(text2);
|
|
567702
|
+
}
|
|
567703
|
+
function critiqueContradictedByFileProof(obs, critique2) {
|
|
567704
|
+
if (!obs.claimsCompletion)
|
|
567705
|
+
return false;
|
|
567706
|
+
if (hasRecentNonFileFailure(obs))
|
|
567707
|
+
return false;
|
|
567708
|
+
if (!isNarrowFileCompletionClaim(obs.assistantText))
|
|
567709
|
+
return false;
|
|
567710
|
+
if (deterministicFileProofPaths(obs).size === 0)
|
|
567711
|
+
return false;
|
|
567712
|
+
if (critique2.class === "ok")
|
|
567713
|
+
return false;
|
|
567714
|
+
const text2 = critique2.shortText + "\n" + critique2.details + "\n" + critique2.demand;
|
|
567715
|
+
return /no tool output|tool output|file creation|file exists|file content|cat\b|sha256|hash|unverified|unproven|readback|read back/i.test(text2);
|
|
567716
|
+
}
|
|
567717
|
+
function hasDeterministicFileCompletionProof(obs) {
|
|
567718
|
+
return obs.claimsCompletion && !hasRecentNonFileFailure(obs) && isNarrowFileCompletionClaim(obs.assistantText) && deterministicFileProofPaths(obs).size > 0;
|
|
567719
|
+
}
|
|
567672
567720
|
function parseAdversaryCritique(raw) {
|
|
567673
567721
|
if (!raw)
|
|
567674
567722
|
return null;
|
|
@@ -567739,7 +567787,7 @@ var init_adversaryStream = __esm({
|
|
|
567739
567787
|
*/
|
|
567740
567788
|
shouldAudit(obs) {
|
|
567741
567789
|
if (obs.claimsCompletion)
|
|
567742
|
-
return
|
|
567790
|
+
return !hasDeterministicFileCompletionProof(obs);
|
|
567743
567791
|
if (obs.loopSignal)
|
|
567744
567792
|
return true;
|
|
567745
567793
|
if (obs.failingApproach)
|
|
@@ -567787,6 +567835,15 @@ var init_adversaryStream = __esm({
|
|
|
567787
567835
|
}
|
|
567788
567836
|
if (!critique2)
|
|
567789
567837
|
return null;
|
|
567838
|
+
if (critiqueContradictedByFileProof(obs, critique2)) {
|
|
567839
|
+
critique2 = {
|
|
567840
|
+
class: "ok",
|
|
567841
|
+
shortText: "file proof present",
|
|
567842
|
+
confidence: 0.05,
|
|
567843
|
+
details: "The recent file_write/file_read outcomes provide deterministic evidence for this narrow file existence/content claim.",
|
|
567844
|
+
demand: ""
|
|
567845
|
+
};
|
|
567846
|
+
}
|
|
567790
567847
|
this.ledger.push({
|
|
567791
567848
|
ts: Date.now(),
|
|
567792
567849
|
turn: obs.turn,
|
|
@@ -576216,6 +576273,9 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
576216
576273
|
backend: this._auxInferenceBackend(),
|
|
576217
576274
|
persistPath,
|
|
576218
576275
|
onCritique: (critique2, sourceTurn) => {
|
|
576276
|
+
if (completed || this._completionIncompleteVerification || this.aborted) {
|
|
576277
|
+
return;
|
|
576278
|
+
}
|
|
576219
576279
|
if (this._adversaryMode === "skillcoach" || this._adversaryMode === "both") {
|
|
576220
576280
|
this.pendingUserMessages.push(AdversaryStream.formatInjection(critique2));
|
|
576221
576281
|
}
|
|
@@ -578872,7 +578932,9 @@ Use the saved fact to continue the promised synthesis or next concrete step, or
|
|
|
578872
578932
|
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
578873
578933
|
tool: o2.tool,
|
|
578874
578934
|
succeeded: o2.succeeded,
|
|
578875
|
-
preview: o2.preview
|
|
578935
|
+
preview: o2.preview,
|
|
578936
|
+
path: o2.path,
|
|
578937
|
+
evidence: o2.evidence
|
|
578876
578938
|
})),
|
|
578877
578939
|
claimsCompletion: false,
|
|
578878
578940
|
loopSignal: {
|
|
@@ -584050,6 +584112,39 @@ ${trimmedNew}`;
|
|
|
584050
584112
|
* Generates typed self-reflections on task failure and injects them
|
|
584051
584113
|
* into the next attempt's context for active learning. */
|
|
584052
584114
|
_reflectionBuffer = null;
|
|
584115
|
+
buildAdversaryToolOutcomeEvidence(toolName, toolArgs, content, succeeded) {
|
|
584116
|
+
const pathValue = toolArgs?.["path"] ?? toolArgs?.["file"] ?? toolArgs?.["filePath"] ?? toolArgs?.["file_path"];
|
|
584117
|
+
const path12 = typeof pathValue === "string" && pathValue.trim() ? pathValue.trim() : void 0;
|
|
584118
|
+
const compact3 = content.replace(/\s+/g, " ").trim();
|
|
584119
|
+
const snippet = compact3.slice(0, 160);
|
|
584120
|
+
const digest3 = _createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
584121
|
+
const lineCount = content.length > 0 ? content.split("\n").length : 0;
|
|
584122
|
+
if (toolName === "file_read") {
|
|
584123
|
+
const evidence = path12 ? `file_read confirmed path=${path12}; lines=${lineCount}; sha256=${digest3}` : `file_read confirmed content; lines=${lineCount}; sha256=${digest3}`;
|
|
584124
|
+
return {
|
|
584125
|
+
path: path12,
|
|
584126
|
+
evidence,
|
|
584127
|
+
preview: `${evidence}; content="${snippet}"`
|
|
584128
|
+
};
|
|
584129
|
+
}
|
|
584130
|
+
if (/^(file_write|file_edit|file_patch|batch_edit)$/.test(toolName)) {
|
|
584131
|
+
const evidence = path12 ? `${toolName} succeeded for path=${path12}; output_sha256=${digest3}` : `${toolName} succeeded; output_sha256=${digest3}`;
|
|
584132
|
+
return {
|
|
584133
|
+
path: path12,
|
|
584134
|
+
evidence,
|
|
584135
|
+
preview: `${evidence}; output="${snippet}"`
|
|
584136
|
+
};
|
|
584137
|
+
}
|
|
584138
|
+
if (toolName === "shell") {
|
|
584139
|
+
const command = typeof toolArgs?.["command"] === "string" ? String(toolArgs["command"]) : void 0;
|
|
584140
|
+
return {
|
|
584141
|
+
path: command,
|
|
584142
|
+
evidence: succeeded ? `shell exited successfully; stdout_sha256=${digest3}` : `shell failed; output_sha256=${digest3}`,
|
|
584143
|
+
preview: snippet || content.slice(0, 160)
|
|
584144
|
+
};
|
|
584145
|
+
}
|
|
584146
|
+
return { preview: snippet || content.slice(0, 160) };
|
|
584147
|
+
}
|
|
584053
584148
|
/**
|
|
584054
584149
|
* Adversary: post-turn meta-analysis.
|
|
584055
584150
|
*
|
|
@@ -584063,29 +584158,10 @@ ${trimmedNew}`;
|
|
|
584063
584158
|
*/
|
|
584064
584159
|
adversaryObserve(messages2, turn) {
|
|
584065
584160
|
const recent = messages2.slice(-6);
|
|
584066
|
-
if (this._adversaryStream) {
|
|
584067
|
-
const lastAssistantMsg = [...recent].reverse().find((m2) => m2.role === "assistant" && typeof m2.content === "string");
|
|
584068
|
-
const assistantText = typeof lastAssistantMsg?.content === "string" ? lastAssistantMsg.content.replace(/<think>[\s\S]*?<\/think>/g, "").trim() : "";
|
|
584069
|
-
if (assistantText) {
|
|
584070
|
-
this._adversaryStream.observe({
|
|
584071
|
-
turn,
|
|
584072
|
-
assistantText,
|
|
584073
|
-
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
584074
|
-
tool: o2.tool,
|
|
584075
|
-
succeeded: o2.succeeded,
|
|
584076
|
-
preview: o2.preview
|
|
584077
|
-
})),
|
|
584078
|
-
claimsCompletion: /task.?complete|all tests pass|\bdone\b|\bcomplete(d)?\b/i.test(assistantText)
|
|
584079
|
-
});
|
|
584080
|
-
void this._adversaryStream.tick().catch(() => {
|
|
584081
|
-
});
|
|
584082
|
-
}
|
|
584083
|
-
}
|
|
584084
584161
|
for (const msg of recent) {
|
|
584085
584162
|
if (msg.role === "tool" && typeof msg.content === "string") {
|
|
584086
584163
|
const isError2 = msg.content.startsWith("Error:") || /^(FAIL|ERR!|TypeError)/i.test(msg.content);
|
|
584087
584164
|
const succeeded = !isError2;
|
|
584088
|
-
const preview = msg.content.slice(0, 80);
|
|
584089
584165
|
let toolName = "unknown";
|
|
584090
584166
|
let toolArgs;
|
|
584091
584167
|
if (msg.tool_call_id) {
|
|
@@ -584112,6 +584188,7 @@ ${trimmedNew}`;
|
|
|
584112
584188
|
return o2.turn === turn && o2.tool === toolName && o2.fingerprint === fingerprint;
|
|
584113
584189
|
});
|
|
584114
584190
|
if (!alreadySeen) {
|
|
584191
|
+
const outcomeEvidence = this.buildAdversaryToolOutcomeEvidence(toolName, toolArgs, msg.content, succeeded);
|
|
584115
584192
|
this._adversaryToolOutcomes.push({
|
|
584116
584193
|
turn,
|
|
584117
584194
|
tool: toolName,
|
|
@@ -584119,13 +584196,34 @@ ${trimmedNew}`;
|
|
|
584119
584196
|
argsKey,
|
|
584120
584197
|
fingerprint,
|
|
584121
584198
|
succeeded,
|
|
584122
|
-
|
|
584199
|
+
...outcomeEvidence
|
|
584123
584200
|
});
|
|
584124
584201
|
}
|
|
584125
584202
|
}
|
|
584126
584203
|
}
|
|
584127
584204
|
while (this._adversaryToolOutcomes.length > 20)
|
|
584128
584205
|
this._adversaryToolOutcomes.shift();
|
|
584206
|
+
if (this._adversaryStream && !this._completionIncompleteVerification) {
|
|
584207
|
+
const lastAssistantMsg = [...recent].reverse().find((m2) => m2.role === "assistant" && typeof m2.content === "string");
|
|
584208
|
+
const assistantText = typeof lastAssistantMsg?.content === "string" ? lastAssistantMsg.content.replace(/<think>[\s\S]*?<\/think>/g, "").trim() : "";
|
|
584209
|
+
if (assistantText) {
|
|
584210
|
+
const claimsCompletion = /task.?complete|all tests pass|\bdone\b|\bcomplete(d)?\b/i.test(assistantText);
|
|
584211
|
+
this._adversaryStream.observe({
|
|
584212
|
+
turn,
|
|
584213
|
+
assistantText,
|
|
584214
|
+
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
584215
|
+
tool: o2.tool,
|
|
584216
|
+
succeeded: o2.succeeded,
|
|
584217
|
+
preview: o2.preview,
|
|
584218
|
+
path: o2.path,
|
|
584219
|
+
evidence: o2.evidence
|
|
584220
|
+
})),
|
|
584221
|
+
claimsCompletion
|
|
584222
|
+
});
|
|
584223
|
+
void this._adversaryStream.tick().catch(() => {
|
|
584224
|
+
});
|
|
584225
|
+
}
|
|
584226
|
+
}
|
|
584129
584227
|
for (const [key, val] of this._adversaryRecentFlags) {
|
|
584130
584228
|
if (turn - val.lastTurn > _AgenticRunner.ADVERSARY_FLAG_TTL)
|
|
584131
584229
|
this._adversaryRecentFlags.delete(key);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.367",
|
|
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.367",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED