@standardagents/builder 0.24.2 → 0.24.4
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/built-in-routes.js +45 -23
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.js +27 -16
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +27 -16
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1307,10 +1307,14 @@ function buildRequestBody(context, modelDef) {
|
|
|
1307
1307
|
visionFiltering
|
|
1308
1308
|
};
|
|
1309
1309
|
}
|
|
1310
|
-
function buildProviderRequest(context, modelDef, signal) {
|
|
1310
|
+
function buildProviderRequest(context, modelDef, signal, user) {
|
|
1311
1311
|
const { requestBody } = buildRequestBody(context, modelDef);
|
|
1312
1312
|
return {
|
|
1313
1313
|
...requestBody,
|
|
1314
|
+
// Stable per-thread identity: providers that support it (OpenRouter's
|
|
1315
|
+
// provider-sticky routing) pin the thread to one upstream, which is what
|
|
1316
|
+
// makes prompt caching hit across consecutive steps.
|
|
1317
|
+
user,
|
|
1314
1318
|
signal
|
|
1315
1319
|
};
|
|
1316
1320
|
}
|
|
@@ -1657,7 +1661,7 @@ var init_LLMRequest = __esm({
|
|
|
1657
1661
|
parentSignal.addEventListener("abort", onParentAbort, { once: true });
|
|
1658
1662
|
}
|
|
1659
1663
|
}
|
|
1660
|
-
const request = buildProviderRequest(context, modelDef, streamAbort.signal);
|
|
1664
|
+
const request = buildProviderRequest(context, modelDef, streamAbort.signal, state.threadId);
|
|
1661
1665
|
let response;
|
|
1662
1666
|
await state.stream.waitFor(
|
|
1663
1667
|
async () => {
|
|
@@ -6067,8 +6071,22 @@ var init_context = __esm({
|
|
|
6067
6071
|
var FlowEngine_exports = {};
|
|
6068
6072
|
__export(FlowEngine_exports, {
|
|
6069
6073
|
FlowEngine: () => FlowEngine,
|
|
6070
|
-
HookBlockedExecutionError: () => HookBlockedExecutionError
|
|
6074
|
+
HookBlockedExecutionError: () => HookBlockedExecutionError,
|
|
6075
|
+
stepBudgetMessage: () => stepBudgetMessage
|
|
6071
6076
|
});
|
|
6077
|
+
function stepBudgetMessage(stepsRemaining) {
|
|
6078
|
+
if (stepsRemaining > 20) return null;
|
|
6079
|
+
if (stepsRemaining === 0) {
|
|
6080
|
+
return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: You must complete your task NOW or an error will be thrown. This is your final step.";
|
|
6081
|
+
}
|
|
6082
|
+
if (stepsRemaining === 1) {
|
|
6083
|
+
return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: Only 1 step available after this before an error will be thrown. Reach completion immediately.";
|
|
6084
|
+
}
|
|
6085
|
+
if (stepsRemaining <= 3) {
|
|
6086
|
+
return `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
|
|
6087
|
+
}
|
|
6088
|
+
return `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
|
|
6089
|
+
}
|
|
6072
6090
|
var IMMEDIATE_BOOTSTRAP_TOOL_NAME, HookBlockedExecutionError, FlowEngine;
|
|
6073
6091
|
var init_FlowEngine = __esm({
|
|
6074
6092
|
"src/agents/FlowEngine.ts"() {
|
|
@@ -7900,20 +7918,13 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
7900
7918
|
if (typeof maxSteps === "number" && !isNaN(maxSteps)) {
|
|
7901
7919
|
const currentSideStepCount = state.currentSide === "a" ? state.sideAStepCount : state.sideBStepCount;
|
|
7902
7920
|
const stepsRemaining = maxSteps - currentSideStepCount;
|
|
7903
|
-
|
|
7904
|
-
if (
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
budgetMessage = `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
|
|
7910
|
-
} else {
|
|
7911
|
-
budgetMessage = `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
|
|
7921
|
+
const budgetMessage = stepBudgetMessage(stepsRemaining);
|
|
7922
|
+
if (budgetMessage) {
|
|
7923
|
+
messages.push({
|
|
7924
|
+
role: "system",
|
|
7925
|
+
content: budgetMessage
|
|
7926
|
+
});
|
|
7912
7927
|
}
|
|
7913
|
-
messages.push({
|
|
7914
|
-
role: "system",
|
|
7915
|
-
content: budgetMessage
|
|
7916
|
-
});
|
|
7917
7928
|
}
|
|
7918
7929
|
const subagentRegistry = await this.getSubagentRegistry(state);
|
|
7919
7930
|
if (subagentRegistry.length > 0) {
|