nexus-agents 2.102.5 → 2.102.6
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/{chunk-3LC5NHC4.js → chunk-5VMCBHRX.js} +63 -8
- package/dist/chunk-5VMCBHRX.js.map +1 -0
- package/dist/{chunk-XY72JFG2.js → chunk-QM3WIUXB.js} +2 -2
- package/dist/{chunk-AQBPOBAT.js → chunk-W7JCGUTA.js} +3 -3
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2 -2
- package/dist/{setup-command-QOEYR6YI.js → setup-command-E2WOYCXO.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-3LC5NHC4.js.map +0 -1
- /package/dist/{chunk-XY72JFG2.js.map → chunk-QM3WIUXB.js.map} +0 -0
- /package/dist/{chunk-AQBPOBAT.js.map → chunk-W7JCGUTA.js.map} +0 -0
- /package/dist/{setup-command-QOEYR6YI.js.map → setup-command-E2WOYCXO.js.map} +0 -0
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
DEFAULT_TASK_TTL_MS,
|
|
94
94
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
95
95
|
clampTaskTtl
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-W7JCGUTA.js";
|
|
97
97
|
import {
|
|
98
98
|
getAvailabilityCache,
|
|
99
99
|
getCliForModelId,
|
|
@@ -20810,6 +20810,13 @@ var BudgetCircuitBreaker = class {
|
|
|
20810
20810
|
return `Budget warning: ${String(percentUsed)}% of budget will be used`;
|
|
20811
20811
|
}
|
|
20812
20812
|
};
|
|
20813
|
+
function createBudgetCircuitBreaker(maxTokens, config, logger56) {
|
|
20814
|
+
const mergedConfig = {
|
|
20815
|
+
...DEFAULT_BUDGET_CIRCUIT_CONFIG,
|
|
20816
|
+
...config
|
|
20817
|
+
};
|
|
20818
|
+
return new BudgetCircuitBreaker(maxTokens, mergedConfig, logger56);
|
|
20819
|
+
}
|
|
20813
20820
|
|
|
20814
20821
|
// src/workflows/budget-enforcement.ts
|
|
20815
20822
|
function applyBudgetEnforcement(step, contextManager, budgetEvents, config) {
|
|
@@ -43599,6 +43606,34 @@ async function runQualityGate(stage, checks, iteration = 1) {
|
|
|
43599
43606
|
};
|
|
43600
43607
|
}
|
|
43601
43608
|
|
|
43609
|
+
// src/pipeline/budget-guard.ts
|
|
43610
|
+
var BudgetGuard = class {
|
|
43611
|
+
breaker;
|
|
43612
|
+
constructor(breaker) {
|
|
43613
|
+
this.breaker = breaker;
|
|
43614
|
+
}
|
|
43615
|
+
/** Record tokens consumed by a completed call (best-effort; undefined ignored). */
|
|
43616
|
+
record(tokensUsed) {
|
|
43617
|
+
if (this.breaker === void 0 || tokensUsed === void 0 || tokensUsed <= 0) return;
|
|
43618
|
+
this.breaker.recordUsage(tokensUsed);
|
|
43619
|
+
}
|
|
43620
|
+
/** True once the budget circuit has opened — callers should stop spending. */
|
|
43621
|
+
isExhausted() {
|
|
43622
|
+
return this.breaker?.getState() === "open";
|
|
43623
|
+
}
|
|
43624
|
+
/** Whether a budget is actually being enforced (vs the no-op default). */
|
|
43625
|
+
get enforced() {
|
|
43626
|
+
return this.breaker !== void 0;
|
|
43627
|
+
}
|
|
43628
|
+
};
|
|
43629
|
+
function createBudgetGuard(budget) {
|
|
43630
|
+
if (budget === void 0) return new BudgetGuard();
|
|
43631
|
+
const breaker = createBudgetCircuitBreaker(budget.maxTokens, {
|
|
43632
|
+
...budget.criticalThreshold !== void 0 ? { criticalThreshold: budget.criticalThreshold } : {}
|
|
43633
|
+
});
|
|
43634
|
+
return new BudgetGuard(breaker);
|
|
43635
|
+
}
|
|
43636
|
+
|
|
43602
43637
|
// src/pipeline/agent-executor.ts
|
|
43603
43638
|
var logger40 = createLogger({ component: "agent-executor" });
|
|
43604
43639
|
var VOTE_PROPOSAL_MAX = 4e3;
|
|
@@ -43642,6 +43677,20 @@ function recordOutcome(args) {
|
|
|
43642
43677
|
logger40.debug("Failed to record outcome", { taskId: args.taskId, error: String(error) });
|
|
43643
43678
|
}
|
|
43644
43679
|
}
|
|
43680
|
+
async function runExpert(guard, expertType, prompt) {
|
|
43681
|
+
if (guard.isExhausted()) {
|
|
43682
|
+
return {
|
|
43683
|
+
success: false,
|
|
43684
|
+
text: "",
|
|
43685
|
+
expertType,
|
|
43686
|
+
durationMs: 0,
|
|
43687
|
+
error: "Budget exhausted \u2014 expert call skipped (#3395)"
|
|
43688
|
+
};
|
|
43689
|
+
}
|
|
43690
|
+
const result = await executeExpert(expertType, prompt);
|
|
43691
|
+
guard.record(result.tokensUsed);
|
|
43692
|
+
return result;
|
|
43693
|
+
}
|
|
43645
43694
|
var cachedMemory = null;
|
|
43646
43695
|
var memoryInitPromise = null;
|
|
43647
43696
|
async function initPipelineMemory() {
|
|
@@ -43787,18 +43836,21 @@ function getTrendContext() {
|
|
|
43787
43836
|
}
|
|
43788
43837
|
}
|
|
43789
43838
|
function createAgentStages(config = {}) {
|
|
43839
|
+
const guard = createBudgetGuard(config.budget);
|
|
43790
43840
|
return {
|
|
43791
43841
|
research: async (task) => {
|
|
43792
43842
|
emitStageEvent2("research", "started");
|
|
43793
43843
|
await postProgress(config, "Research", "Querying memory + research tools...");
|
|
43794
43844
|
const memoryCtx = await getMemoryContext(task);
|
|
43795
|
-
const discover = await
|
|
43845
|
+
const discover = await runExpert(
|
|
43846
|
+
guard,
|
|
43796
43847
|
"research",
|
|
43797
43848
|
`Use research_discover to find papers and repos related to:
|
|
43798
43849
|
|
|
43799
43850
|
${task}${memoryCtx}`
|
|
43800
43851
|
);
|
|
43801
|
-
const analyze = await
|
|
43852
|
+
const analyze = await runExpert(
|
|
43853
|
+
guard,
|
|
43802
43854
|
"research",
|
|
43803
43855
|
`Use research_analyze focus=gaps to identify what is missing for:
|
|
43804
43856
|
|
|
@@ -43844,7 +43896,7 @@ ${task}
|
|
|
43844
43896
|
|
|
43845
43897
|
${contextBlock}`;
|
|
43846
43898
|
await postProgress(config, "Plan", feedback !== void 0 ? "Revising..." : "Planning...");
|
|
43847
|
-
const r = await
|
|
43899
|
+
const r = await runExpert(guard, "architecture", prompt);
|
|
43848
43900
|
emitStageEvent2("plan", r.success ? "completed" : "failed", { durationMs: r.durationMs });
|
|
43849
43901
|
recordOutcome({
|
|
43850
43902
|
taskId: "plan",
|
|
@@ -43913,7 +43965,8 @@ ${contextBlock}`;
|
|
|
43913
43965
|
decompose: async (plan) => {
|
|
43914
43966
|
emitStageEvent2("decompose", "started");
|
|
43915
43967
|
await postProgress(config, "PM", "PM expert decomposing...");
|
|
43916
|
-
const r = await
|
|
43968
|
+
const r = await runExpert(
|
|
43969
|
+
guard,
|
|
43917
43970
|
"pm",
|
|
43918
43971
|
`Decompose into tasks.
|
|
43919
43972
|
Return JSON: [{id,title,description,assignedTo}]
|
|
@@ -43938,7 +43991,8 @@ ${plan}`
|
|
|
43938
43991
|
const fb = task.feedback !== void 0 ? `
|
|
43939
43992
|
|
|
43940
43993
|
QA feedback: ${task.feedback}` : "";
|
|
43941
|
-
const r = await
|
|
43994
|
+
const r = await runExpert(
|
|
43995
|
+
guard,
|
|
43942
43996
|
"code",
|
|
43943
43997
|
`Implement:
|
|
43944
43998
|
|
|
@@ -43962,7 +44016,8 @@ ${task.description}${fb}`
|
|
|
43962
44016
|
qaReview: async (task, implementation) => {
|
|
43963
44017
|
emitStageEvent2(`qa-${task.id}`, "started");
|
|
43964
44018
|
await postProgress(config, `QA [${task.id}]`, "QA expert reviewing...");
|
|
43965
|
-
const r = await
|
|
44019
|
+
const r = await runExpert(
|
|
44020
|
+
guard,
|
|
43966
44021
|
"qa",
|
|
43967
44022
|
`QA:
|
|
43968
44023
|
|
|
@@ -50680,4 +50735,4 @@ export {
|
|
|
50680
50735
|
detectBackend,
|
|
50681
50736
|
createTaskTracker
|
|
50682
50737
|
};
|
|
50683
|
-
//# sourceMappingURL=chunk-
|
|
50738
|
+
//# sourceMappingURL=chunk-5VMCBHRX.js.map
|