omnius 1.0.268 → 1.0.270
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 +400 -100
- package/docs/operations/delay-fix-review.md +153 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -554725,7 +554725,7 @@ var init_verifierRunner = __esm({
|
|
|
554725
554725
|
continue;
|
|
554726
554726
|
const { stdout, stderr } = await execFileAsync5(bin, args, {
|
|
554727
554727
|
cwd: workDir,
|
|
554728
|
-
timeout:
|
|
554728
|
+
timeout: 15e3,
|
|
554729
554729
|
maxBuffer: 1024 * 1024
|
|
554730
554730
|
});
|
|
554731
554731
|
outputs.push(`$ ${cmd}
|
|
@@ -557139,6 +557139,23 @@ var init_ollama_pool = __esm({
|
|
|
557139
557139
|
scored.sort((a2, b) => b.score - a2.score);
|
|
557140
557140
|
return scored[0].inst;
|
|
557141
557141
|
}
|
|
557142
|
+
_lastEagerCleanup = 0;
|
|
557143
|
+
triggerEagerCleanup() {
|
|
557144
|
+
if (process.env["NODE_ENV"] === "test" || process.env["VITEST"])
|
|
557145
|
+
return;
|
|
557146
|
+
const now2 = Date.now();
|
|
557147
|
+
if (now2 - this._lastEagerCleanup < 5e3)
|
|
557148
|
+
return;
|
|
557149
|
+
this._lastEagerCleanup = now2;
|
|
557150
|
+
Promise.resolve().then(() => (init_ollama_pool_cleanup(), ollama_pool_cleanup_exports)).then((mod3) => mod3.cleanupStaleOllamaProcesses({
|
|
557151
|
+
dryRun: false,
|
|
557152
|
+
useInference: "auto",
|
|
557153
|
+
baseInstanceUrl: this.config.baseInstanceUrl,
|
|
557154
|
+
poolPortStart: this.config.spawnPortStart,
|
|
557155
|
+
poolStatus: null
|
|
557156
|
+
})).catch(() => {
|
|
557157
|
+
});
|
|
557158
|
+
}
|
|
557142
557159
|
buildSlot(inst, agentId) {
|
|
557143
557160
|
return {
|
|
557144
557161
|
instanceId: inst.state.id,
|
|
@@ -557151,6 +557168,7 @@ var init_ollama_pool = __esm({
|
|
|
557151
557168
|
release: (success) => {
|
|
557152
557169
|
inst.release(success);
|
|
557153
557170
|
this.wakeNextSlotWaiter();
|
|
557171
|
+
this.triggerEagerCleanup();
|
|
557154
557172
|
}
|
|
557155
557173
|
};
|
|
557156
557174
|
}
|
|
@@ -557163,7 +557181,13 @@ var init_ollama_pool = __esm({
|
|
|
557163
557181
|
this.recordAffinity(agentId, pick.state.id);
|
|
557164
557182
|
return this.buildSlot(pick, agentId);
|
|
557165
557183
|
}
|
|
557166
|
-
await new Promise((resolve70) =>
|
|
557184
|
+
await new Promise((resolve70, reject) => {
|
|
557185
|
+
const timer = setTimeout(() => reject(new Error("No GPU slot available after 30s. All slots occupied.")), 3e4);
|
|
557186
|
+
this.slotWaiters.push(() => {
|
|
557187
|
+
clearTimeout(timer);
|
|
557188
|
+
resolve70();
|
|
557189
|
+
});
|
|
557190
|
+
});
|
|
557167
557191
|
}
|
|
557168
557192
|
}
|
|
557169
557193
|
wakeNextSlotWaiter() {
|
|
@@ -561875,7 +561899,7 @@ function partitionToolCalls(calls, readOnlyHints) {
|
|
|
561875
561899
|
}
|
|
561876
561900
|
return batches;
|
|
561877
561901
|
}
|
|
561878
|
-
async function withConcurrencyLimit(fns, limit =
|
|
561902
|
+
async function withConcurrencyLimit(fns, limit = 8) {
|
|
561879
561903
|
const results = new Array(fns.length);
|
|
561880
561904
|
let nextIdx = 0;
|
|
561881
561905
|
async function runNext() {
|
|
@@ -561888,7 +561912,7 @@ async function withConcurrencyLimit(fns, limit = 5) {
|
|
|
561888
561912
|
await Promise.all(workers);
|
|
561889
561913
|
return results;
|
|
561890
561914
|
}
|
|
561891
|
-
async function executeBatch(batch2, executeFn, concurrencyLimit =
|
|
561915
|
+
async function executeBatch(batch2, executeFn, concurrencyLimit = 8) {
|
|
561892
561916
|
if (!batch2.concurrent || batch2.calls.length === 1) {
|
|
561893
561917
|
const results = [];
|
|
561894
561918
|
for (const call of batch2.calls) {
|
|
@@ -562501,8 +562525,18 @@ var init_app_state = __esm({
|
|
|
562501
562525
|
function stableValueKey(value2) {
|
|
562502
562526
|
if (value2 === null || typeof value2 !== "object")
|
|
562503
562527
|
return JSON.stringify(value2);
|
|
562504
|
-
if (Array.isArray(value2))
|
|
562528
|
+
if (Array.isArray(value2)) {
|
|
562529
|
+
if (value2.length > 256)
|
|
562530
|
+
return `[${value2.length}items]`;
|
|
562505
562531
|
return `[${value2.map(stableValueKey).join(",")}]`;
|
|
562532
|
+
}
|
|
562533
|
+
const raw = JSON.stringify(value2);
|
|
562534
|
+
if (raw.length > 10240) {
|
|
562535
|
+
let hash = 5381;
|
|
562536
|
+
for (let i2 = 0; i2 < raw.length; i2++)
|
|
562537
|
+
hash = (hash << 5) + hash + raw.charCodeAt(i2) | 0;
|
|
562538
|
+
return `{size:${raw.length},hash:${Math.abs(hash).toString(36)}}`;
|
|
562539
|
+
}
|
|
562506
562540
|
const record = value2;
|
|
562507
562541
|
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableValueKey(record[key])}`).join(",")}}`;
|
|
562508
562542
|
}
|
|
@@ -565415,7 +565449,7 @@ var init_agenticRunner = __esm({
|
|
|
565415
565449
|
"repl_exec",
|
|
565416
565450
|
"notebook_edit"
|
|
565417
565451
|
]);
|
|
565418
|
-
AgenticRunner = class {
|
|
565452
|
+
AgenticRunner = class _AgenticRunner {
|
|
565419
565453
|
backend;
|
|
565420
565454
|
tools = /* @__PURE__ */ new Map();
|
|
565421
565455
|
options;
|
|
@@ -570622,6 +570656,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
570622
570656
|
this._worldFacts = { files: /* @__PURE__ */ new Map(), lastTest: {}, lastLists: /* @__PURE__ */ new Map() };
|
|
570623
570657
|
this._argCohorts.clear();
|
|
570624
570658
|
this._adversaryRedundantSignals.clear();
|
|
570659
|
+
this._adversaryRecentFlags.clear();
|
|
570625
570660
|
this._lastTodoWriteTurn = -1;
|
|
570626
570661
|
this._lastTodoReminderTurn = -1;
|
|
570627
570662
|
let pendingConstraintWarnings = [];
|
|
@@ -574769,7 +574804,6 @@ ${sr.result.output}`;
|
|
|
574769
574804
|
}
|
|
574770
574805
|
if (completed || this._completionIncompleteVerification)
|
|
574771
574806
|
break;
|
|
574772
|
-
this.adversaryObserve(messages2, turn);
|
|
574773
574807
|
const currentRepScore = this.detectRepetition(toolCallLog);
|
|
574774
574808
|
if (currentRepScore > 0.4 && toolCallLog.length >= 4) {
|
|
574775
574809
|
const { repetitionWindow } = this.contextLimits();
|
|
@@ -577862,6 +577896,13 @@ ${trimmedNew}`;
|
|
|
577862
577896
|
/** WO-FIX-C: Tool fingerprints the adversary has flagged as redundant.
|
|
577863
577897
|
* Checked in executeSingle to attach advisory guidance before dispatch. */
|
|
577864
577898
|
_adversaryRedundantSignals = /* @__PURE__ */ new Set();
|
|
577899
|
+
/** Tracks recent adversary detection flags for deduplication and escalation.
|
|
577900
|
+
* Key: "detectionType:fingerprint"
|
|
577901
|
+
* Value: { count: number; lastTurn: number }
|
|
577902
|
+
* When count >= ESCALATE_THRESHOLD, the critique is promoted to system-role. */
|
|
577903
|
+
_adversaryRecentFlags = /* @__PURE__ */ new Map();
|
|
577904
|
+
static ADVERSARY_ESCALATE_THRESHOLD = 3;
|
|
577905
|
+
static ADVERSARY_FLAG_TTL = 5;
|
|
577865
577906
|
/** Reflexion pattern: task-local failure-indexed reflection buffer.
|
|
577866
577907
|
* Generates typed self-reflections on task failure and injects them
|
|
577867
577908
|
* into the next attempt's context for active learning. */
|
|
@@ -577924,6 +577965,23 @@ ${trimmedNew}`;
|
|
|
577924
577965
|
}
|
|
577925
577966
|
while (this._adversaryToolOutcomes.length > 20)
|
|
577926
577967
|
this._adversaryToolOutcomes.shift();
|
|
577968
|
+
for (const [key, val] of this._adversaryRecentFlags) {
|
|
577969
|
+
if (turn - val.lastTurn > _AgenticRunner.ADVERSARY_FLAG_TTL)
|
|
577970
|
+
this._adversaryRecentFlags.delete(key);
|
|
577971
|
+
}
|
|
577972
|
+
const adversaryFlag = (flagKey, messages3) => {
|
|
577973
|
+
const existing = this._adversaryRecentFlags.get(flagKey);
|
|
577974
|
+
if (existing) {
|
|
577975
|
+
existing.count++;
|
|
577976
|
+
existing.lastTurn = turn;
|
|
577977
|
+
if (existing.count >= _AgenticRunner.ADVERSARY_ESCALATE_THRESHOLD) {
|
|
577978
|
+
return "escalate";
|
|
577979
|
+
}
|
|
577980
|
+
return "suppress";
|
|
577981
|
+
}
|
|
577982
|
+
this._adversaryRecentFlags.set(flagKey, { count: 1, lastTurn: turn });
|
|
577983
|
+
return "proceed";
|
|
577984
|
+
};
|
|
577927
577985
|
const emitReaction = (cls, shortText, confidence2, details2) => {
|
|
577928
577986
|
this.emit({
|
|
577929
577987
|
type: "adversary_reaction",
|
|
@@ -577951,9 +578009,9 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
577951
578009
|
const successes = recentOutcomes.filter((o2) => o2.succeeded);
|
|
577952
578010
|
if (successes.length >= 1) {
|
|
577953
578011
|
const successList = successes.map((o2) => `${o2.tool}: ${o2.preview.slice(0, 60)}`).join("; ");
|
|
577954
|
-
|
|
577955
|
-
if (
|
|
577956
|
-
|
|
578012
|
+
const ffFlag = adversaryFlag("false_failure", messages2);
|
|
578013
|
+
if (ffFlag !== "suppress") {
|
|
578014
|
+
const critiqueText = buildAdversaryCritique({
|
|
577957
578015
|
evidence: `Recent tools succeeded: ${successList}.`,
|
|
577958
578016
|
hypothesis: "The main loop is interpreting uncertainty or partial progress as failure and may be about to discard usable evidence.",
|
|
577959
578017
|
correctiveAction: "Use the successful results to advance the task, then verify the next concrete step.",
|
|
@@ -577962,13 +578020,24 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
577962
578020
|
"Read a different targeted file if the successful result exposed a new path or symbol.",
|
|
577963
578021
|
"Complete only if the successful output is sufficient evidence for the user's request."
|
|
577964
578022
|
]
|
|
577965
|
-
})
|
|
578023
|
+
});
|
|
578024
|
+
emitReaction("false_failure", `Claimed failure, but recent tools succeeded (${successes.length})`, 0.9, successList);
|
|
578025
|
+
if (this._adversaryMode === "skillcoach" || this._adversaryMode === "both") {
|
|
578026
|
+
if (ffFlag === "escalate") {
|
|
578027
|
+
messages2.push({
|
|
578028
|
+
role: "system",
|
|
578029
|
+
content: critiqueText + "\n[ESCALATED: This warning was previously issued without effect.]"
|
|
578030
|
+
});
|
|
578031
|
+
} else {
|
|
578032
|
+
this.pendingUserMessages.push(critiqueText);
|
|
578033
|
+
}
|
|
578034
|
+
}
|
|
578035
|
+
this.emit({
|
|
578036
|
+
type: "status",
|
|
578037
|
+
content: `\x1B[38;5;178m⚠ Corrected false failure claim (${successes.length} tools succeeded)\x1B[0m`,
|
|
578038
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578039
|
+
});
|
|
577966
578040
|
}
|
|
577967
|
-
this.emit({
|
|
577968
|
-
type: "status",
|
|
577969
|
-
content: `\x1B[38;5;178m⚠ Corrected false failure claim (${successes.length} tools succeeded)\x1B[0m`,
|
|
577970
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
577971
|
-
});
|
|
577972
578041
|
}
|
|
577973
578042
|
}
|
|
577974
578043
|
}
|
|
@@ -577981,9 +578050,9 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
577981
578050
|
const successes = recentOutcomes.filter((o2) => o2.succeeded);
|
|
577982
578051
|
if (failures.length > 0 && successes.length === 0) {
|
|
577983
578052
|
const failList = failures.map((o2) => `${o2.tool}: ${o2.preview.slice(0, 60)}`).join("; ");
|
|
577984
|
-
|
|
577985
|
-
if (
|
|
577986
|
-
|
|
578053
|
+
const fsFlag = adversaryFlag("false_success", messages2);
|
|
578054
|
+
if (fsFlag !== "suppress") {
|
|
578055
|
+
const critiqueText = buildAdversaryCritique({
|
|
577987
578056
|
evidence: `Recent tools show errors (${failures.length}): ${failList}.`,
|
|
577988
578057
|
hypothesis: "The main loop is prematurely compressing intent into success language before the verifier produced evidence.",
|
|
577989
578058
|
correctiveAction: "Inspect the failed output, identify the implicated path/symbol/command, and run one focused corrective step before claiming success.",
|
|
@@ -577992,7 +578061,18 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
577992
578061
|
"Patch the implicated code or configuration.",
|
|
577993
578062
|
"Run the same verifier only after a state-changing fix."
|
|
577994
578063
|
]
|
|
577995
|
-
})
|
|
578064
|
+
});
|
|
578065
|
+
emitReaction("false_success", `Claimed success, but recent tools failed (${failures.length})`, 0.9, failList);
|
|
578066
|
+
if (this._adversaryMode === "skillcoach" || this._adversaryMode === "both") {
|
|
578067
|
+
if (fsFlag === "escalate") {
|
|
578068
|
+
messages2.push({
|
|
578069
|
+
role: "system",
|
|
578070
|
+
content: critiqueText + "\n[ESCALATED: This warning was previously issued without effect.]"
|
|
578071
|
+
});
|
|
578072
|
+
} else {
|
|
578073
|
+
this.pendingUserMessages.push(critiqueText);
|
|
578074
|
+
}
|
|
578075
|
+
}
|
|
577996
578076
|
}
|
|
577997
578077
|
}
|
|
577998
578078
|
}
|
|
@@ -578014,9 +578094,9 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
578014
578094
|
const prior = this._adversaryToolOutcomes.find((o2) => o2.succeeded && o2.tool === name10 && o2.fingerprint === fingerprint && o2.turn < turn);
|
|
578015
578095
|
if (prior) {
|
|
578016
578096
|
this._adversaryRedundantSignals.add(fingerprint);
|
|
578017
|
-
|
|
578018
|
-
if (
|
|
578019
|
-
|
|
578097
|
+
const raFlag = adversaryFlag(`redundant_action:${fingerprint}`, messages2);
|
|
578098
|
+
if (raFlag !== "suppress") {
|
|
578099
|
+
const critiqueText = buildAdversaryCritique({
|
|
578020
578100
|
evidence: `${name10} already succeeded on turn ${prior.turn} with exact arguments (${argsKey.slice(0, 120)}). Prior preview: ${prior.preview}`,
|
|
578021
578101
|
hypothesis: "The main loop may have lost track of previously observed evidence because of context pressure, path confusion, or repeated discovery.",
|
|
578022
578102
|
correctiveAction: "Let this duplicate run execute if needed, but treat the prior result as evidence and pivot afterward unless state has changed.",
|
|
@@ -578025,13 +578105,24 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
578025
578105
|
"Read a different specific file or selector if the current evidence is insufficient.",
|
|
578026
578106
|
"Repeat exact arguments only when filesystem, browser, or page state changed."
|
|
578027
578107
|
]
|
|
578028
|
-
})
|
|
578108
|
+
});
|
|
578109
|
+
emitReaction("redundant_action", `Already ran ${name10} successfully on turn ${prior.turn}`, 0.8, prior.preview);
|
|
578110
|
+
if (this._adversaryMode === "skillcoach" || this._adversaryMode === "both") {
|
|
578111
|
+
if (raFlag === "escalate") {
|
|
578112
|
+
messages2.push({
|
|
578113
|
+
role: "system",
|
|
578114
|
+
content: critiqueText + "\n[ESCALATED: This redundant-action warning was issued 3+ times as a user message without effect.]"
|
|
578115
|
+
});
|
|
578116
|
+
} else {
|
|
578117
|
+
this.pendingUserMessages.push(critiqueText);
|
|
578118
|
+
}
|
|
578119
|
+
}
|
|
578120
|
+
this.emit({
|
|
578121
|
+
type: "status",
|
|
578122
|
+
content: `\x1B[38;5;178m⚠ Adversary noted redundant ${name10} call (succeeded on turn ${prior.turn}); action remains allowed\x1B[0m`,
|
|
578123
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578124
|
+
});
|
|
578029
578125
|
}
|
|
578030
|
-
this.emit({
|
|
578031
|
-
type: "status",
|
|
578032
|
-
content: `\x1B[38;5;178m⚠ Adversary noted redundant ${name10} call (succeeded on turn ${prior.turn}); action remains allowed\x1B[0m`,
|
|
578033
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578034
|
-
});
|
|
578035
578126
|
break;
|
|
578036
578127
|
}
|
|
578037
578128
|
}
|
|
@@ -578049,9 +578140,9 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
578049
578140
|
}
|
|
578050
578141
|
}
|
|
578051
578142
|
if (consecutiveShortResults >= 3) {
|
|
578052
|
-
|
|
578053
|
-
if (
|
|
578054
|
-
|
|
578143
|
+
const itFlag = adversaryFlag("idle_think", messages2);
|
|
578144
|
+
if (itFlag !== "suppress") {
|
|
578145
|
+
const critiqueText = buildAdversaryCritique({
|
|
578055
578146
|
evidence: `${consecutiveShortResults} consecutive output-like calls occurred without an input-like observation.`,
|
|
578056
578147
|
hypothesis: "The loop may be acting from stale state instead of re-observing the environment.",
|
|
578057
578148
|
correctiveAction: "Take one input/observation step before another output step.",
|
|
@@ -578060,13 +578151,24 @@ ${input.alternatives.map((item) => `- ${item}`).join("\n")}` : "";
|
|
|
578060
578151
|
"Read the current UI/page state before clicking or typing again.",
|
|
578061
578152
|
"If the task is already complete, finish with the concrete evidence already observed."
|
|
578062
578153
|
]
|
|
578063
|
-
})
|
|
578154
|
+
});
|
|
578155
|
+
emitReaction("idle_think", `Consecutive output without input: ${consecutiveShortResults}`, 0.7);
|
|
578156
|
+
if (this._adversaryMode === "skillcoach" || this._adversaryMode === "both") {
|
|
578157
|
+
if (itFlag === "escalate") {
|
|
578158
|
+
messages2.push({
|
|
578159
|
+
role: "system",
|
|
578160
|
+
content: critiqueText + "\n[ESCALATED: This warning was previously issued without effect.]"
|
|
578161
|
+
});
|
|
578162
|
+
} else {
|
|
578163
|
+
this.pendingUserMessages.push(critiqueText);
|
|
578164
|
+
}
|
|
578165
|
+
}
|
|
578166
|
+
this.emit({
|
|
578167
|
+
type: "status",
|
|
578168
|
+
content: `\x1B[38;5;178m⚠ Adversary flagged runaway-output risk (${consecutiveShortResults} consecutive sends without receive); action remains allowed\x1B[0m`,
|
|
578169
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578170
|
+
});
|
|
578064
578171
|
}
|
|
578065
|
-
this.emit({
|
|
578066
|
-
type: "status",
|
|
578067
|
-
content: `\x1B[38;5;178m⚠ Adversary flagged runaway-output risk (${consecutiveShortResults} consecutive sends without receive); action remains allowed\x1B[0m`,
|
|
578068
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578069
|
-
});
|
|
578070
578172
|
}
|
|
578071
578173
|
}
|
|
578072
578174
|
}
|
|
@@ -595676,6 +595778,20 @@ function buildToolDivider(width, colorCode) {
|
|
|
595676
595778
|
const border = toolColorSeq(colorCode);
|
|
595677
595779
|
return `${border}${BOX_TJ_L2}${BOX_H2.repeat(Math.max(0, width - 2))}${BOX_TJ_R2}${toolResetSeq()}`;
|
|
595678
595780
|
}
|
|
595781
|
+
function buildRoutingHeader(title, _metrics, width, colorCode, _metricsColorCode = 222) {
|
|
595782
|
+
const border = toolColorSeq(colorCode);
|
|
595783
|
+
const titleColor = toolColorSeq(colorCode, true);
|
|
595784
|
+
const reset = toolResetSeq();
|
|
595785
|
+
const w = Math.max(40, width);
|
|
595786
|
+
const titleVisible = stripAnsi(title);
|
|
595787
|
+
const titleChip = ` ${titleVisible} `;
|
|
595788
|
+
const shortBoxWidth = titleChip.length + 7;
|
|
595789
|
+
const line1 = `${border}${BOX_TL2}${BOX_H2}${border}${BOX_TJ_L2}${titleColor}${titleChip}${reset}${border}${BOX_TJ_R2}${BOX_H2}${BOX_H2}${BOX_TR2}${reset}`;
|
|
595790
|
+
const gap = Math.max(0, shortBoxWidth - 1);
|
|
595791
|
+
const dashCount = Math.max(0, w - shortBoxWidth - 2);
|
|
595792
|
+
const line2 = `${border}${BOX_TJ_L2}${reset}` + " ".repeat(gap) + `${border}╰${BOX_H2.repeat(dashCount)}${BOX_TJ_R2}${reset}`;
|
|
595793
|
+
return [line1, line2];
|
|
595794
|
+
}
|
|
595679
595795
|
function buildToolBottom(width, colorCode) {
|
|
595680
595796
|
const border = toolColorSeq(colorCode);
|
|
595681
595797
|
return `${border}${BOX_BL2}${BOX_H2.repeat(Math.max(0, width - 2))}${BOX_BR2}${toolResetSeq()}`;
|
|
@@ -595821,26 +595937,38 @@ function buildCombinedToolBoxLines(toolName, callArgs, success, output, opts, wi
|
|
|
595821
595937
|
{ label: "Provenance", items: provenance }
|
|
595822
595938
|
];
|
|
595823
595939
|
const colorCode = success ? toolColorCode(toolName) : TOOL_ERROR_COLOR_CODE;
|
|
595824
|
-
const
|
|
595825
|
-
|
|
595940
|
+
const triggerTexts = formatToolArgsForBox(toolName, callArgs, opts.verbose);
|
|
595941
|
+
const lines = [];
|
|
595942
|
+
if (triggerTexts.length === 0) {
|
|
595943
|
+
const [r1, r2] = buildRoutingHeader(
|
|
595826
595944
|
`${status} ${label}`,
|
|
595827
595945
|
metrics2,
|
|
595828
595946
|
w,
|
|
595829
595947
|
colorCode,
|
|
595830
595948
|
success ? void 0 : TOOL_ERROR_COLOR_CODE
|
|
595831
|
-
)
|
|
595832
|
-
|
|
595833
|
-
|
|
595834
|
-
|
|
595835
|
-
|
|
595836
|
-
|
|
595837
|
-
|
|
595838
|
-
|
|
595839
|
-
|
|
595840
|
-
|
|
595949
|
+
);
|
|
595950
|
+
lines.push(r1, r2);
|
|
595951
|
+
} else {
|
|
595952
|
+
lines.push(
|
|
595953
|
+
buildToolTopBorder(
|
|
595954
|
+
`${status} ${label}`,
|
|
595955
|
+
metrics2,
|
|
595956
|
+
w,
|
|
595957
|
+
colorCode,
|
|
595958
|
+
success ? void 0 : TOOL_ERROR_COLOR_CODE
|
|
595959
|
+
)
|
|
595960
|
+
);
|
|
595961
|
+
for (const text2 of triggerTexts) {
|
|
595962
|
+
const pipe3 = " ";
|
|
595963
|
+
const chunks = wrapToolTextLine(text2, innerWidth, pipe3);
|
|
595964
|
+
for (const chunk of chunks) {
|
|
595965
|
+
lines.push(
|
|
595966
|
+
buildToolContentRow(formatToolBoxLine(chunk, "tool"), w, colorCode)
|
|
595967
|
+
);
|
|
595968
|
+
}
|
|
595841
595969
|
}
|
|
595970
|
+
lines.push(buildToolDivider(w, colorCode));
|
|
595842
595971
|
}
|
|
595843
|
-
lines.push(buildToolDivider(w, colorCode));
|
|
595844
595972
|
if (resultBody.length > 0) {
|
|
595845
595973
|
for (const bodyLine of resultBody) {
|
|
595846
595974
|
const text2 = sanitizeToolBoxContent(bodyLine.text);
|
|
@@ -596212,11 +596340,22 @@ function buildToolResultBody(toolName, success, output, verbose) {
|
|
|
596212
596340
|
}
|
|
596213
596341
|
if (toolName === "task_complete") {
|
|
596214
596342
|
const summary = output && output.trim() ? output : "Done";
|
|
596215
|
-
|
|
596343
|
+
const maxLines2 = resolveToolOutputMaxLines(verbose);
|
|
596344
|
+
const lines = summary.split("\n");
|
|
596345
|
+
const body = lines.slice(0, maxLines2).map((line) => ({
|
|
596216
596346
|
text: line,
|
|
596217
596347
|
mode: "wrap",
|
|
596218
596348
|
kind: "markdown"
|
|
596219
596349
|
}));
|
|
596350
|
+
const remaining = lines.length - maxLines2;
|
|
596351
|
+
if (remaining > 0) {
|
|
596352
|
+
body.push({
|
|
596353
|
+
text: `... ${remaining} more lines`,
|
|
596354
|
+
mode: "wrap",
|
|
596355
|
+
kind: "dim"
|
|
596356
|
+
});
|
|
596357
|
+
}
|
|
596358
|
+
return body;
|
|
596220
596359
|
}
|
|
596221
596360
|
const filtered = output.split("\n").map(sanitizeToolBoxContent).map((line) => debug ? line : stripTrustTierWrapperForTui(line)).filter((line) => {
|
|
596222
596361
|
const trimmed = line.trim();
|
|
@@ -608526,6 +608665,8 @@ ${CONTENT_BG_SEQ}`);
|
|
|
608526
608665
|
this._trueStdoutWrite.call(process.stdout, `\x1B[${scrollEnd};1H`);
|
|
608527
608666
|
this.renderFooterAndPositionInput();
|
|
608528
608667
|
this._trueStdoutWrite.call(process.stdout, `\x1B[${scrollEnd};1H`);
|
|
608668
|
+
this._trueStdoutWrite.call(process.stdout, `
|
|
608669
|
+
`);
|
|
608529
608670
|
this.termWrite("\x1B[?2026l");
|
|
608530
608671
|
this._bufferContent = true;
|
|
608531
608672
|
}
|
|
@@ -608895,7 +609036,18 @@ ${CONTENT_BG_SEQ}`);
|
|
|
608895
609036
|
const text2 = stripped.join("\n");
|
|
608896
609037
|
if (text2.length === 0) return;
|
|
608897
609038
|
const ok3 = copyText(text2);
|
|
608898
|
-
|
|
609039
|
+
const pos = this.rowPositions(termRows());
|
|
609040
|
+
const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
|
|
609041
|
+
if (ok3) {
|
|
609042
|
+
if (pos.metricsRow > 0) {
|
|
609043
|
+
writer(
|
|
609044
|
+
`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;${TEXT_PRIMARY}m ✓ Copied session to clipboard\x1B[0m`
|
|
609045
|
+
);
|
|
609046
|
+
}
|
|
609047
|
+
setTimeout(() => {
|
|
609048
|
+
if (this.active) this.renderFooterAndPositionInput();
|
|
609049
|
+
}, 1200);
|
|
609050
|
+
} else {
|
|
608899
609051
|
try {
|
|
608900
609052
|
const fs11 = __require("fs");
|
|
608901
609053
|
const os9 = __require("os");
|
|
@@ -608904,16 +609056,21 @@ ${CONTENT_BG_SEQ}`);
|
|
|
608904
609056
|
"omnius-session-copy.txt"
|
|
608905
609057
|
);
|
|
608906
609058
|
fs11.writeFileSync(tmpPath, text2, "utf-8");
|
|
608907
|
-
|
|
608908
|
-
|
|
608909
|
-
`
|
|
608910
|
-
|
|
609059
|
+
if (pos.metricsRow > 0) {
|
|
609060
|
+
writer(
|
|
609061
|
+
`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;208mSession saved to temp file\x1B[0m`
|
|
609062
|
+
);
|
|
609063
|
+
}
|
|
608911
609064
|
} catch {
|
|
608912
|
-
|
|
608913
|
-
|
|
608914
|
-
`
|
|
608915
|
-
|
|
609065
|
+
if (pos.metricsRow > 0) {
|
|
609066
|
+
writer(
|
|
609067
|
+
`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;196mFailed to copy session\x1B[0m`
|
|
609068
|
+
);
|
|
609069
|
+
}
|
|
608916
609070
|
}
|
|
609071
|
+
setTimeout(() => {
|
|
609072
|
+
if (this.active) this.renderFooterAndPositionInput();
|
|
609073
|
+
}, 3e3);
|
|
608917
609074
|
}
|
|
608918
609075
|
}
|
|
608919
609076
|
/**
|
|
@@ -645422,6 +645579,23 @@ function italicText(text2) {
|
|
|
645422
645579
|
function dimItalic(text2) {
|
|
645423
645580
|
return isTTY8 ? `\x1B[3m\x1B[38;5;${tuiTextDim()}m${text2}\x1B[0m` : text2;
|
|
645424
645581
|
}
|
|
645582
|
+
function thinkingBoxTop(width) {
|
|
645583
|
+
const inner = Math.max(4, width);
|
|
645584
|
+
const title = " Processing ";
|
|
645585
|
+
return `╭─┤${title}├${"─".repeat(Math.max(0, inner - 6 - title.length))}╮`;
|
|
645586
|
+
}
|
|
645587
|
+
function thinkingBoxRow(text2, width) {
|
|
645588
|
+
const inner = Math.max(1, width - 4);
|
|
645589
|
+
const plain = stripAnsi(text2);
|
|
645590
|
+
const truncated = plain.length > inner ? plain.slice(0, Math.max(1, inner - 1)) + "…" : text2;
|
|
645591
|
+
const plainLen = stripAnsi(truncated).length;
|
|
645592
|
+
const padding = " ".repeat(Math.max(0, inner - plainLen));
|
|
645593
|
+
return `│ ${truncated}${padding} │`;
|
|
645594
|
+
}
|
|
645595
|
+
function thinkingBoxBottom(width) {
|
|
645596
|
+
const inner = Math.max(4, width);
|
|
645597
|
+
return `╰${"─".repeat(inner - 2)}╯`;
|
|
645598
|
+
}
|
|
645425
645599
|
function boldText(text2) {
|
|
645426
645600
|
return isTTY8 ? `\x1B[1m${text2}\x1B[0m` : text2;
|
|
645427
645601
|
}
|
|
@@ -645547,6 +645721,9 @@ var init_stream_renderer = __esm({
|
|
|
645547
645721
|
thinkingIndicatorShown = false;
|
|
645548
645722
|
thinkingTokenCount = 0;
|
|
645549
645723
|
thinkingCache = "";
|
|
645724
|
+
/** Thinking box — compact bordered box for the thinking indicator */
|
|
645725
|
+
thinkingBoxOpen = false;
|
|
645726
|
+
thinkingBoxRowCount = 0;
|
|
645550
645727
|
write(token, kind) {
|
|
645551
645728
|
if (!this.enabled) return;
|
|
645552
645729
|
this.tokenCount++;
|
|
@@ -645554,6 +645731,9 @@ var init_stream_renderer = __esm({
|
|
|
645554
645731
|
this.thinkingTokenCount++;
|
|
645555
645732
|
if (token && !this.showThinking) this.thinkingCache += token;
|
|
645556
645733
|
if (this.showThinking) {
|
|
645734
|
+
if (this.thinkingBoxOpen) {
|
|
645735
|
+
this.closeThinkingBox(`buffered ${this.thinkingTokenCount} tokens`);
|
|
645736
|
+
}
|
|
645557
645737
|
for (const char of token) {
|
|
645558
645738
|
this.lineBuffer += char;
|
|
645559
645739
|
if (char === "\n") this.flushLine("thinking");
|
|
@@ -645561,23 +645741,26 @@ var init_stream_renderer = __esm({
|
|
|
645561
645741
|
this.scheduleFlush("thinking");
|
|
645562
645742
|
return;
|
|
645563
645743
|
} else {
|
|
645564
|
-
|
|
645565
|
-
|
|
645566
|
-
this.
|
|
645744
|
+
const w = termCols();
|
|
645745
|
+
if (!this.thinkingBoxOpen) {
|
|
645746
|
+
this.thinkingBoxOpen = true;
|
|
645747
|
+
this.thinkingBoxRowCount = 2;
|
|
645748
|
+
this.writeRaw(thinkingBoxTop(w) + "\n");
|
|
645749
|
+
this.writeRaw(thinkingBoxRow(dimItalic("processing..."), w) + "\n");
|
|
645567
645750
|
this.lineStarted = false;
|
|
645568
645751
|
}
|
|
645569
645752
|
if (this.thinkingTokenCount % 500 === 0) {
|
|
645570
|
-
this.
|
|
645571
|
-
|
|
645753
|
+
this.updateThinkingBox(
|
|
645754
|
+
`processing... (${this.thinkingTokenCount} tokens)`,
|
|
645755
|
+
w
|
|
645756
|
+
);
|
|
645572
645757
|
}
|
|
645573
645758
|
return;
|
|
645574
645759
|
}
|
|
645575
645760
|
}
|
|
645576
|
-
if (this.
|
|
645577
|
-
this.
|
|
645578
|
-
this.writeRaw(dimText(" │ ") + dimItalic(`thought for ${this.thinkingTokenCount} tokens`) + "\n");
|
|
645761
|
+
if (this.thinkingBoxOpen && kind === "content") {
|
|
645762
|
+
this.closeThinkingBox(`thought for ${this.thinkingTokenCount} tokens`);
|
|
645579
645763
|
this.thinkingTokenCount = 0;
|
|
645580
|
-
this.lineStarted = false;
|
|
645581
645764
|
}
|
|
645582
645765
|
if (kind === "tool_args" && !this.inToolArgs) {
|
|
645583
645766
|
this.flushPartial(kind);
|
|
@@ -645603,6 +645786,9 @@ var init_stream_renderer = __esm({
|
|
|
645603
645786
|
this.writeHighlighted(this.lineBuffer, kind);
|
|
645604
645787
|
this.lineBuffer = "";
|
|
645605
645788
|
}
|
|
645789
|
+
if (this.thinkingBoxOpen) {
|
|
645790
|
+
this.closeThinkingBox(`processed ${this.thinkingTokenCount} tokens`);
|
|
645791
|
+
}
|
|
645606
645792
|
if (this.lineStarted) {
|
|
645607
645793
|
process.stdout.write("\n");
|
|
645608
645794
|
this.lineStarted = false;
|
|
@@ -645636,7 +645822,11 @@ var init_stream_renderer = __esm({
|
|
|
645636
645822
|
if (line.includes("<think>")) {
|
|
645637
645823
|
this.inThinkBlock = true;
|
|
645638
645824
|
const after = line.replace(/<think>/g, "");
|
|
645639
|
-
if (after.trim())
|
|
645825
|
+
if (after.trim())
|
|
645826
|
+
this.writeHighlighted(
|
|
645827
|
+
after,
|
|
645828
|
+
this.showThinking ? "thinking" : "content"
|
|
645829
|
+
);
|
|
645640
645830
|
return;
|
|
645641
645831
|
}
|
|
645642
645832
|
if (line.includes("</think>")) {
|
|
@@ -645723,7 +645913,9 @@ var init_stream_renderer = __esm({
|
|
|
645723
645913
|
const isLast = i2 === lines.length - 1;
|
|
645724
645914
|
const lp = isFirst ? usePrefix : " ";
|
|
645725
645915
|
const needsNewline = !isLast || trailingNewline;
|
|
645726
|
-
this.writeRaw(
|
|
645916
|
+
this.writeRaw(
|
|
645917
|
+
dimText(lp) + highlight(lines[i2]) + (needsNewline ? "\n" : "")
|
|
645918
|
+
);
|
|
645727
645919
|
}
|
|
645728
645920
|
this.lineStarted = !trailingNewline;
|
|
645729
645921
|
};
|
|
@@ -645767,10 +645959,33 @@ var init_stream_renderer = __esm({
|
|
|
645767
645959
|
this.writeRaw(dimText(prefix) + rendered + (hasNewline ? "\n" : ""));
|
|
645768
645960
|
this.lineStarted = !hasNewline;
|
|
645769
645961
|
}
|
|
645962
|
+
/** In-place update of the compact thinking box content row (cursor-up + rewrite) */
|
|
645963
|
+
updateThinkingBox(text2, width) {
|
|
645964
|
+
if (!this.thinkingBoxOpen) return;
|
|
645965
|
+
const update2 = `\x1B[${this.thinkingBoxRowCount}A` + thinkingBoxTop(width) + "\n" + thinkingBoxRow(dimItalic(text2), width) + "\n";
|
|
645966
|
+
this.writeRaw(update2);
|
|
645967
|
+
this.lineStarted = false;
|
|
645968
|
+
}
|
|
645969
|
+
/** Close the compact thinking box (cursor-up, rewrite with summary + bottom border) */
|
|
645970
|
+
closeThinkingBox(summary) {
|
|
645971
|
+
if (!this.thinkingBoxOpen) return;
|
|
645972
|
+
const w = termCols();
|
|
645973
|
+
const text2 = `\x1B[${this.thinkingBoxRowCount}A` + thinkingBoxTop(w) + "\n" + thinkingBoxRow(dimItalic(summary), w) + "\n" + thinkingBoxBottom(w) + "\n";
|
|
645974
|
+
this.writeRaw(text2);
|
|
645975
|
+
this.thinkingBoxOpen = false;
|
|
645976
|
+
this.thinkingBoxRowCount = 0;
|
|
645977
|
+
this.lineStarted = false;
|
|
645978
|
+
this.thinkingIndicatorShown = false;
|
|
645979
|
+
}
|
|
645770
645980
|
/** Toggle visibility of full thinking content */
|
|
645771
645981
|
setThinkingVisible(visible) {
|
|
645772
645982
|
this.showThinking = visible;
|
|
645773
|
-
if (visible)
|
|
645983
|
+
if (visible) {
|
|
645984
|
+
if (this.thinkingBoxOpen) {
|
|
645985
|
+
this.closeThinkingBox(`buffered ${this.thinkingTokenCount} tokens`);
|
|
645986
|
+
}
|
|
645987
|
+
this.thinkingCache = "";
|
|
645988
|
+
}
|
|
645774
645989
|
}
|
|
645775
645990
|
/** Emit the cached (pre-toggle) thinking content to stdout as dim italic
|
|
645776
645991
|
* lines. Uses writeRaw so _cursorCol / lineStarted tracking stays in sync
|
|
@@ -645875,7 +646090,8 @@ var init_stream_renderer = __esm({
|
|
|
645875
646090
|
looksLikeJsonBlob(text2) {
|
|
645876
646091
|
if (/\\u[0-9a-fA-F]{4}/.test(text2)) return true;
|
|
645877
646092
|
if (/^\s*\{?"content"\s*:/.test(text2)) return true;
|
|
645878
|
-
if (text2.includes("\\n") && this.looksLikeJson(text2) && text2.length > 100)
|
|
646093
|
+
if (text2.includes("\\n") && this.looksLikeJson(text2) && text2.length > 100)
|
|
646094
|
+
return true;
|
|
645879
646095
|
return false;
|
|
645880
646096
|
}
|
|
645881
646097
|
/**
|
|
@@ -645886,12 +646102,30 @@ var init_stream_renderer = __esm({
|
|
|
645886
646102
|
const colorKey = dim ? PASTEL.toolArg : PASTEL.key;
|
|
645887
646103
|
const colorStr = dim ? PASTEL.toolArg : PASTEL.string;
|
|
645888
646104
|
let result = line;
|
|
645889
|
-
result = result.replace(
|
|
645890
|
-
|
|
645891
|
-
|
|
645892
|
-
|
|
645893
|
-
result = result.replace(
|
|
645894
|
-
|
|
646105
|
+
result = result.replace(
|
|
646106
|
+
/"([^"]*)"(\s*:)/g,
|
|
646107
|
+
(_m, key, colon) => fg2564(colorKey, `"${key}"`) + fg2564(PASTEL.colon, colon)
|
|
646108
|
+
);
|
|
646109
|
+
result = result.replace(
|
|
646110
|
+
/(:\s*)"([^"]*)"/g,
|
|
646111
|
+
(_m, prefix, val) => fg2564(PASTEL.colon, prefix) + fg2564(colorStr, `"${val}"`)
|
|
646112
|
+
);
|
|
646113
|
+
result = result.replace(
|
|
646114
|
+
/(:\s*)(\d+\.?\d*)/g,
|
|
646115
|
+
(_m, prefix, num2) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.number, num2)
|
|
646116
|
+
);
|
|
646117
|
+
result = result.replace(
|
|
646118
|
+
/(:\s*)(true|false)/g,
|
|
646119
|
+
(_m, prefix, bool) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.boolean, bool)
|
|
646120
|
+
);
|
|
646121
|
+
result = result.replace(
|
|
646122
|
+
/(:\s*)(null)/g,
|
|
646123
|
+
(_m, prefix, n2) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.null, n2)
|
|
646124
|
+
);
|
|
646125
|
+
result = result.replace(
|
|
646126
|
+
/([{}[\]])/g,
|
|
646127
|
+
(_m, b) => fg2564(PASTEL.bracket, b)
|
|
646128
|
+
);
|
|
645895
646129
|
return dim ? dimText(result) : result;
|
|
645896
646130
|
}
|
|
645897
646131
|
/**
|
|
@@ -645899,16 +646133,34 @@ var init_stream_renderer = __esm({
|
|
|
645899
646133
|
*/
|
|
645900
646134
|
highlightCode(line) {
|
|
645901
646135
|
let result = line;
|
|
645902
|
-
result = result.replace(
|
|
645903
|
-
|
|
645904
|
-
|
|
645905
|
-
|
|
646136
|
+
result = result.replace(
|
|
646137
|
+
/"([^"]*)"/g,
|
|
646138
|
+
(_m, s2) => fg2564(PASTEL.string, `"${s2}"`)
|
|
646139
|
+
);
|
|
646140
|
+
result = result.replace(
|
|
646141
|
+
/'([^']*)'/g,
|
|
646142
|
+
(_m, s2) => fg2564(PASTEL.string, `'${s2}'`)
|
|
646143
|
+
);
|
|
646144
|
+
result = result.replace(
|
|
646145
|
+
/\b(\d+\.?\d*)\b/g,
|
|
646146
|
+
(_m, n2) => fg2564(PASTEL.number, n2)
|
|
646147
|
+
);
|
|
646148
|
+
result = result.replace(
|
|
646149
|
+
/\b(true|false|null|undefined|None|True|False)\b/g,
|
|
646150
|
+
(_m, kw) => fg2564(PASTEL.boolean, kw)
|
|
646151
|
+
);
|
|
645906
646152
|
result = result.replace(
|
|
645907
646153
|
/\b(function|const|let|var|return|if|else|for|while|import|export|from|class|async|await|def|self|try|catch|finally|throw|new|typeof|instanceof|type|interface|enum|struct|impl|fn|pub|mod|use|match|trait|where|mut|ref|move|yield|switch|case|default|break|continue|do|in|of|extends|implements|super|this|static|abstract|override|readonly|declare|namespace|package|func|go|chan|select|defer|range|map)\b/g,
|
|
645908
646154
|
(_m, kw) => fg2564(PASTEL.keyword, kw)
|
|
645909
646155
|
);
|
|
645910
|
-
result = result.replace(
|
|
645911
|
-
|
|
646156
|
+
result = result.replace(
|
|
646157
|
+
/:\s*([A-Z]\w*)/g,
|
|
646158
|
+
(_m, t2) => ": " + fg2564(147, t2)
|
|
646159
|
+
);
|
|
646160
|
+
result = result.replace(
|
|
646161
|
+
/(\/\/.*$|#.*$)/gm,
|
|
646162
|
+
(_m, cm) => fg2564(PASTEL.comment, cm)
|
|
646163
|
+
);
|
|
645912
646164
|
return result;
|
|
645913
646165
|
}
|
|
645914
646166
|
// -------------------------------------------------------------------------
|
|
@@ -645956,16 +646208,34 @@ var init_stream_renderer = __esm({
|
|
|
645956
646208
|
return fg2564(PASTEL.comment, line);
|
|
645957
646209
|
}
|
|
645958
646210
|
let result = line;
|
|
645959
|
-
result = result.replace(
|
|
645960
|
-
|
|
645961
|
-
|
|
645962
|
-
|
|
645963
|
-
result = result.replace(
|
|
646211
|
+
result = result.replace(
|
|
646212
|
+
/"([^"]*)"/g,
|
|
646213
|
+
(_m, s2) => fg2564(PASTEL.string, `"${s2}"`)
|
|
646214
|
+
);
|
|
646215
|
+
result = result.replace(
|
|
646216
|
+
/'([^']*)'/g,
|
|
646217
|
+
(_m, s2) => fg2564(PASTEL.string, `'${s2}'`)
|
|
646218
|
+
);
|
|
646219
|
+
result = result.replace(
|
|
646220
|
+
/(\$\{[^}]+\}|\$[A-Za-z_]\w*|\$[0-9?@#*!$-])/g,
|
|
646221
|
+
(_m, v) => fg2564(PASTEL.shellVar, v)
|
|
646222
|
+
);
|
|
646223
|
+
result = result.replace(
|
|
646224
|
+
/((?:^|\s))(--?[a-zA-Z][\w-]*)/g,
|
|
646225
|
+
(_m, ws, flag) => ws + fg2564(PASTEL.shellFlag, flag)
|
|
646226
|
+
);
|
|
646227
|
+
result = result.replace(
|
|
646228
|
+
/(\|{1,2}|>{1,2}|<{1,2}|&{1,2}|;)/g,
|
|
646229
|
+
(_m, op) => fg2564(PASTEL.shellOp, op)
|
|
646230
|
+
);
|
|
645964
646231
|
result = result.replace(
|
|
645965
646232
|
/^(\s*)(npm|npx|node|pnpm|yarn|git|docker|kubectl|curl|wget|cat|grep|find|ls|cd|cp|mv|rm|mkdir|chmod|chown|echo|printf|sed|awk|sort|uniq|head|tail|wc|tar|gzip|make|cargo|go|pip|python|python3|ruby|gem|brew|apt|yum|dnf|pacman|sudo|ssh|scp|rsync|man)\b/,
|
|
645966
646233
|
(_m, ws, cmd) => ws + boldText(fg2564(PASTEL.keyword, cmd))
|
|
645967
646234
|
);
|
|
645968
|
-
result = result.replace(
|
|
646235
|
+
result = result.replace(
|
|
646236
|
+
/(#[^{].*$)/gm,
|
|
646237
|
+
(_m, cm) => fg2564(PASTEL.comment, cm)
|
|
646238
|
+
);
|
|
645969
646239
|
return result;
|
|
645970
646240
|
}
|
|
645971
646241
|
// -------------------------------------------------------------------------
|
|
@@ -645979,7 +646249,14 @@ var init_stream_renderer = __esm({
|
|
|
645979
646249
|
if (headingMatch) {
|
|
645980
646250
|
const level = headingMatch[1].length;
|
|
645981
646251
|
const text2 = headingMatch[2];
|
|
645982
|
-
const colors2 = [
|
|
646252
|
+
const colors2 = [
|
|
646253
|
+
PASTEL.heading1,
|
|
646254
|
+
PASTEL.heading2,
|
|
646255
|
+
PASTEL.heading3,
|
|
646256
|
+
PASTEL.heading3,
|
|
646257
|
+
183,
|
|
646258
|
+
183
|
|
646259
|
+
];
|
|
645983
646260
|
return boldText(fg2564(colors2[level - 1] ?? 147, text2));
|
|
645984
646261
|
}
|
|
645985
646262
|
if (/^[-*_]{3,}\s*$/.test(line)) {
|
|
@@ -646005,13 +646282,34 @@ var init_stream_renderer = __esm({
|
|
|
646005
646282
|
*/
|
|
646006
646283
|
highlightInline(text2) {
|
|
646007
646284
|
let result = text2;
|
|
646008
|
-
result = result.replace(
|
|
646009
|
-
|
|
646010
|
-
|
|
646011
|
-
|
|
646012
|
-
result = result.replace(
|
|
646013
|
-
|
|
646014
|
-
|
|
646285
|
+
result = result.replace(
|
|
646286
|
+
/`([^`]+)`/g,
|
|
646287
|
+
(_m, code8) => fg2564(PASTEL.inlineCode, code8)
|
|
646288
|
+
);
|
|
646289
|
+
result = result.replace(
|
|
646290
|
+
/\*{3}([^*]+)\*{3}/g,
|
|
646291
|
+
(_m, t2) => boldText(italicText(t2))
|
|
646292
|
+
);
|
|
646293
|
+
result = result.replace(
|
|
646294
|
+
/\*{2}([^*]+)\*{2}/g,
|
|
646295
|
+
(_m, t2) => boldText(t2)
|
|
646296
|
+
);
|
|
646297
|
+
result = result.replace(
|
|
646298
|
+
/(?<!\*)\*([^*]+)\*(?!\*)/g,
|
|
646299
|
+
(_m, t2) => italicText(t2)
|
|
646300
|
+
);
|
|
646301
|
+
result = result.replace(
|
|
646302
|
+
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
646303
|
+
(_m, label, url) => boldText(fg2564(PASTEL.link, label)) + " " + dimText(fg2564(PASTEL.link, `(${url})`))
|
|
646304
|
+
);
|
|
646305
|
+
result = result.replace(
|
|
646306
|
+
/(?<!\w)__([^_]+)__(?!\w)/g,
|
|
646307
|
+
(_m, t2) => boldText(t2)
|
|
646308
|
+
);
|
|
646309
|
+
result = result.replace(
|
|
646310
|
+
/(?<!\w)_([^_]+)_(?!\w)/g,
|
|
646311
|
+
(_m, t2) => italicText(t2)
|
|
646312
|
+
);
|
|
646015
646313
|
result = result.replace(/~~([^~]+)~~/g, (_m, t2) => dimText(t2));
|
|
646016
646314
|
return result;
|
|
646017
646315
|
}
|
|
@@ -703914,6 +704212,7 @@ ${entry.fullContent}`
|
|
|
703914
704212
|
if (!liveShellBlock) return;
|
|
703915
704213
|
liveShellBlock.repaintTimer = null;
|
|
703916
704214
|
if (statusBar?.isActive) statusBar.refreshDisplay();
|
|
704215
|
+
if (liveShellBlock.state.status === "running") scheduleLiveShellRepaint();
|
|
703917
704216
|
}, 33);
|
|
703918
704217
|
liveShellBlock.repaintTimer.unref?.();
|
|
703919
704218
|
};
|
|
@@ -704015,6 +704314,7 @@ ${entry.fullContent}`
|
|
|
704015
704314
|
(width) => buildShellLiveBlockLines(state, width)
|
|
704016
704315
|
);
|
|
704017
704316
|
liveShellStatusBar.appendDynamicBlock(id);
|
|
704317
|
+
scheduleLiveShellRepaint();
|
|
704018
704318
|
}
|
|
704019
704319
|
});
|
|
704020
704320
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Delay Fix Review — Commits Since Delay Analysis
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-06-10
|
|
4
|
+
**Reference:** `/docs/operations/delay-analysis.md` (15 delay sources documented)
|
|
5
|
+
|
|
6
|
+
## Commit Map
|
|
7
|
+
|
|
8
|
+
| Commit | Message | Files | Insertions | Date |
|
|
9
|
+
|--------|---------|-------|------------|------|
|
|
10
|
+
| b24bc55d | slots | 5 | +80/-18 | Jun 9 22:04 |
|
|
11
|
+
| cb043dce | interactive | 11 | +865/-259 | Jun 9 21:45 |
|
|
12
|
+
| ca1da293 | error catch | 12 | +389/-144 | Jun 9 10:26 |
|
|
13
|
+
| 1fcdd81e | progress | 10 | +724/-19 | Jun 8 22:46 |
|
|
14
|
+
|
|
15
|
+
Total: 38 files changed, ~2,058 insertions, ~440 deletions across ~4 hours.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Delay Source Mapping — What Got Fixed
|
|
20
|
+
|
|
21
|
+
### 1. `stableValueKey` — O(n) JSON.stringify on large arrays/objects (Delay #1)
|
|
22
|
+
**Status: FIXED** (commit b24bc55d)
|
|
23
|
+
|
|
24
|
+
Evidence from `git show b24bc55d -- packages/orchestrator/src/streaming-executor.ts`:
|
|
25
|
+
```diff
|
|
26
|
+
- if (Array.isArray(value)) return `[${value.map(stableValueKey).join(",")}]`;
|
|
27
|
+
+ if (Array.isArray(value)) {
|
|
28
|
+
+ if (value.length > 256) return `[${value.length}items]`;
|
|
29
|
+
+ return `[${value.map(stableValueKey).join(",")}]`;
|
|
30
|
+
+ }
|
|
31
|
+
+ const raw = JSON.stringify(value);
|
|
32
|
+
+ if (raw.length > 10_240) {
|
|
33
|
+
+ let hash = 5381;
|
|
34
|
+
+ for (let i = 0; i < raw.length; i++)
|
|
35
|
+
+ hash = ((hash << 5) + hash + raw.charCodeAt(i)) | 0;
|
|
36
|
+
+ return `{size:${raw.length},hash:${Math.abs(hash).toString(36)}}`;
|
|
37
|
+
+ }
|
|
38
|
+
```
|
|
39
|
+
- Array length cap at 256 items prevents O(n) traversal on large arrays
|
|
40
|
+
- Object size cap at 10KB prevents O(n) stringify on large objects
|
|
41
|
+
- Fallback to djb2 hash for oversized objects
|
|
42
|
+
- **Impact:** High — this was a core loop bottleneck in tool deduplication
|
|
43
|
+
|
|
44
|
+
### 2. Tool batching / deduplication (Delay #2)
|
|
45
|
+
**Status: PARTIALLY ADDRESSED** (commit b24bc55d)
|
|
46
|
+
|
|
47
|
+
`tool-batching.ts` changed (+26/-18 in b24bc55d). The `stableValueKey` fix above directly addresses the dedup cost. Need to verify if batching window logic was also touched.
|
|
48
|
+
|
|
49
|
+
### 3. Ollama pool / GPU detection (Delay #3, #4)
|
|
50
|
+
**Status: MAJOR REWRITE** (commits cb043dce + b24bc55d)
|
|
51
|
+
|
|
52
|
+
- `ollama-pool.ts`: +452/-259 in cb043dce, +35/-1 in b24bc55d
|
|
53
|
+
- This is the single largest change — a full rewrite of the Ollama pool
|
|
54
|
+
- The "slots" commit (b24bc55d) specifically touched ollama-pool.ts with 35 insertions
|
|
55
|
+
- **Impact:** Very high — GPU detection and model loading are on the critical path
|
|
56
|
+
|
|
57
|
+
### 4. Cascade backend / parallel inference (Delay #5)
|
|
58
|
+
**Status: CHANGED** (commit cb043dce)
|
|
59
|
+
|
|
60
|
+
`cascadeBackend.ts` changed +118/-lines in cb043dce. The "interactive" commit touched this file. Need to verify if parallel backend selection was improved.
|
|
61
|
+
|
|
62
|
+
### 5. Steering intake timeout (Delay #6)
|
|
63
|
+
**Status: CHANGED** (commit cb043dce)
|
|
64
|
+
|
|
65
|
+
`steeringIntake.ts` changed +79/-lines in cb043dce. The "interactive" commit touched this. Need to verify timeout values.
|
|
66
|
+
|
|
67
|
+
### 6. Verifier runner timeout (Delay #7)
|
|
68
|
+
**Status: CHANGED** (commit b24bc55d)
|
|
69
|
+
|
|
70
|
+
`verifierRunner.ts` changed +12/-lines in b24bc55d. The "slots" commit touched this.
|
|
71
|
+
|
|
72
|
+
### 7. Preflight snapshot (Delay #8)
|
|
73
|
+
**Status: CHANGED** (commit cb043dce)
|
|
74
|
+
|
|
75
|
+
`preflightSnapshot.ts` changed +44/-lines in cb043dce.
|
|
76
|
+
|
|
77
|
+
### 8. Agentic runner error handling (Delay #9)
|
|
78
|
+
**Status: FIXED** (commits ca1da293 + 1fcdd81e)
|
|
79
|
+
|
|
80
|
+
- ca1da293: agenticRunner.ts +102/-lines (error catch)
|
|
81
|
+
- 1fcdd81e: agenticRunner.ts +28/-lines (progress)
|
|
82
|
+
- Total: ~130 lines of error handling improvements
|
|
83
|
+
|
|
84
|
+
### 9. Prompt caching (Delay #10)
|
|
85
|
+
**Status: ADDED** (commit 1fcdd81e)
|
|
86
|
+
|
|
87
|
+
`prompt-cache.ts` added (+30 lines) in commit 1fcdd81e "progress". New file for prompt caching.
|
|
88
|
+
|
|
89
|
+
### 10. Context references (Delay #11)
|
|
90
|
+
**Status: IMPROVED** (commit 1fcdd81e)
|
|
91
|
+
|
|
92
|
+
`context-references.ts` changed +55/-lines in 1fcdd81e.
|
|
93
|
+
|
|
94
|
+
### 11. TUI render / text wrapping (Delay #12)
|
|
95
|
+
**Status: FIXED** (commits cb043dce + b24bc55d)
|
|
96
|
+
|
|
97
|
+
- cb043dce: render.ts +44/-lines
|
|
98
|
+
- b24bc55d: render.ts +13/-lines
|
|
99
|
+
- Both commits touched render.ts for text rendering improvements
|
|
100
|
+
|
|
101
|
+
### 12. Interactive mode (Delay #13)
|
|
102
|
+
**Status: ADDED** (commit cb043dce)
|
|
103
|
+
|
|
104
|
+
New file `packages/cli/src/tui/interactive.ts` (+39 lines) in cb043dce.
|
|
105
|
+
|
|
106
|
+
### 13. Integration tests (Delay #14)
|
|
107
|
+
**Status: ADDED** (commits ca1da293 + 1fcdd81e)
|
|
108
|
+
|
|
109
|
+
- ca1da293: 4 new test files
|
|
110
|
+
- 1fcdd81e: 2 new test files (agenticRunner.test.ts, prompt-caching.test.ts)
|
|
111
|
+
|
|
112
|
+
### 14. Publish artifacts (Delay #15)
|
|
113
|
+
**Status: UNCHANGED** (no delay-related changes)
|
|
114
|
+
|
|
115
|
+
Only `publish/npm-shrinkwrap.json` and `publish/package.json` changed in working tree (uncommitted).
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Summary Assessment
|
|
120
|
+
|
|
121
|
+
### Fixed / Addressed (8/15 delay sources)
|
|
122
|
+
1. **stableValueKey** — fully fixed with array/object size caps
|
|
123
|
+
2. **Tool deduplication** — addressed via stableValueKey fix
|
|
124
|
+
3. **Ollama pool** — major rewrite (452+35 lines)
|
|
125
|
+
4. **Agentic runner errors** — ~130 lines of error handling
|
|
126
|
+
5. **Prompt caching** — new file added
|
|
127
|
+
6. **Context references** — improved (+55 lines)
|
|
128
|
+
7. **TUI render** — text wrapping fixed
|
|
129
|
+
8. **Interactive mode** — new feature added
|
|
130
|
+
|
|
131
|
+
### Changed but Need Verification (4/15)
|
|
132
|
+
9. **Cascade backend** — +118 lines, need to verify parallel improvement
|
|
133
|
+
10. **Steering intake** — +79 lines, need to verify timeout values
|
|
134
|
+
11. **Verifier runner** — +12 lines, need to verify timeout values
|
|
135
|
+
12. **Preflight snapshot** — +44 lines, need to verify probe timeout
|
|
136
|
+
|
|
137
|
+
### Not Addressed (3/15)
|
|
138
|
+
13. **Publish artifacts** — no delay-related changes
|
|
139
|
+
14. **Integration tests** — added but not a delay fix per se
|
|
140
|
+
15. **Working tree state** — only publish files changed (uncommitted)
|
|
141
|
+
|
|
142
|
+
### Overall Assessment
|
|
143
|
+
- **~53% of delay sources addressed** (8/15 fixed, 4/15 changed pending verification)
|
|
144
|
+
- The "slots" commit (b24bc55d) is the most recent and focused on core loop fixes
|
|
145
|
+
- The "interactive" commit (cb043dce) is the largest and touched the most files
|
|
146
|
+
- **Key gap:** Need to verify the actual timeout values in cascadeBackend.ts, steeringIntake.ts, and verifierRunner.ts to confirm the changes actually reduce delays
|
|
147
|
+
- **Key gap:** The working tree has 2 uncommitted changes in publish/ — need to check if these are relevant
|
|
148
|
+
|
|
149
|
+
### Recommended Next Steps
|
|
150
|
+
1. Verify timeout values in cascadeBackend.ts, steeringIntake.ts, verifierRunner.ts
|
|
151
|
+
2. Check if ollama-pool.ts rewrite includes GPU detection improvements
|
|
152
|
+
3. Verify the working tree changes in publish/ are intentional
|
|
153
|
+
4. Run the build to ensure all changes compile cleanly
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.270",
|
|
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.270",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED