@rulvar/core 1.222.0 → 1.223.0
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 +28 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12719,7 +12719,8 @@ async function runAgent(options) {
|
|
|
12719
12719
|
kind: "budget",
|
|
12720
12720
|
retryable: false
|
|
12721
12721
|
};
|
|
12722
|
-
|
|
12722
|
+
const lastMessage = messages[messages.length - 1];
|
|
12723
|
+
errorMessage = (grantedRepairTurns > 0 && lastMessage !== void 0 && lastMessage.parts.some((part) => part.type === "tool-result" && part.name === options.terminalTool?.name && part.isError === true) ? "the granted repair turn could not be funded: " : "") + (thrown instanceof Error ? thrown.message : String(thrown));
|
|
12723
12724
|
break;
|
|
12724
12725
|
}
|
|
12725
12726
|
turns += 1;
|
|
@@ -24228,8 +24229,32 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24228
24229
|
try {
|
|
24229
24230
|
result = await runtime.runInScope(orchestratorState, () => ctx.agent(orchestratorPrompt(goal, opts?.maxSpawns, promptLines.length === 0 ? void 0 : promptLines), agentOpts));
|
|
24230
24231
|
} catch (thrown) {
|
|
24232
|
+
if (thrown instanceof BudgetExhaustedError) {
|
|
24233
|
+
const repairEntryRef = thrown.data?.entryRef;
|
|
24234
|
+
const repairTerminal = typeof repairEntryRef === "number" ? internals.replayer.snapshot().find((entry) => entry.seq === repairEntryRef) : void 0;
|
|
24235
|
+
const repairMessage = repairTerminal?.error?.message ?? "";
|
|
24236
|
+
if (repairMessage.includes("the granted repair turn could not be funded: ")) {
|
|
24237
|
+
const repairDeclineKey = deriverV2.deriveKey({ kind: "orchestrator-repair-grant-declined" });
|
|
24238
|
+
if (!internals.replayer.snapshot().some((entry) => entry.kind === "decision" && entry.key === repairDeclineKey)) await internals.replayer.appendSinglePhase({
|
|
24239
|
+
scope: callingState.scope,
|
|
24240
|
+
key: repairDeclineKey,
|
|
24241
|
+
kind: "decision",
|
|
24242
|
+
status: "ok",
|
|
24243
|
+
spanId: internals.spans.mint(callingState.spanId),
|
|
24244
|
+
site: "orchestrator-budget",
|
|
24245
|
+
value: {
|
|
24246
|
+
decisionType: "orchestrator_repair_grant_declined",
|
|
24247
|
+
reason: repairMessage.slice(0, 300),
|
|
24248
|
+
terminalRef: repairTerminal?.seq ?? null,
|
|
24249
|
+
remainingUsd: internals.budget.remainingUsd() ?? null
|
|
24250
|
+
}
|
|
24251
|
+
});
|
|
24252
|
+
throw new FailRunError(`the orchestrator finish could not complete its granted repair: ${repairMessage}`, { data: { source: "orchestrator_finish_validation" } });
|
|
24253
|
+
}
|
|
24254
|
+
}
|
|
24231
24255
|
const budgetReason = thrown instanceof BudgetExhaustedError ? thrown.data?.reason : void 0;
|
|
24232
|
-
|
|
24256
|
+
const crossed = thrown instanceof BudgetExhaustedError ? thrown.data : void 0;
|
|
24257
|
+
if (budgetReason !== "in-flight-exposure" && budgetReason !== "output-floor" && crossed?.source !== "root" && crossed?.account !== "run") throw thrown;
|
|
24233
24258
|
const exposureKey = deriverV2.deriveKey({ kind: "orchestrator-exposure-fallback" });
|
|
24234
24259
|
if (!internals.replayer.snapshot().some((entry) => entry.kind === "decision" && entry.key === exposureKey)) await internals.replayer.appendSinglePhase({
|
|
24235
24260
|
scope: callingState.scope,
|
|
@@ -24240,7 +24265,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24240
24265
|
site: "orchestrator-budget",
|
|
24241
24266
|
value: {
|
|
24242
24267
|
decisionType: "orchestrator_finalize_fallback",
|
|
24243
|
-
reason: budgetReason === "output-floor" ? "budget-floor" : "exposure-abort",
|
|
24268
|
+
reason: budgetReason === "output-floor" ? "budget-floor" : budgetReason === "in-flight-exposure" ? "exposure-abort" : "budget-ceiling",
|
|
24244
24269
|
turnsUsed: 0,
|
|
24245
24270
|
foldParams: {
|
|
24246
24271
|
planHash: "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.223.0",
|
|
4
4
|
"description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|