@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/runtime.js
CHANGED
|
@@ -1298,10 +1298,14 @@ function buildRequestBody(context, modelDef) {
|
|
|
1298
1298
|
visionFiltering
|
|
1299
1299
|
};
|
|
1300
1300
|
}
|
|
1301
|
-
function buildProviderRequest(context, modelDef, signal) {
|
|
1301
|
+
function buildProviderRequest(context, modelDef, signal, user) {
|
|
1302
1302
|
const { requestBody } = buildRequestBody(context, modelDef);
|
|
1303
1303
|
return {
|
|
1304
1304
|
...requestBody,
|
|
1305
|
+
// Stable per-thread identity: providers that support it (OpenRouter's
|
|
1306
|
+
// provider-sticky routing) pin the thread to one upstream, which is what
|
|
1307
|
+
// makes prompt caching hit across consecutive steps.
|
|
1308
|
+
user,
|
|
1305
1309
|
signal
|
|
1306
1310
|
};
|
|
1307
1311
|
}
|
|
@@ -1648,7 +1652,7 @@ var init_LLMRequest = __esm({
|
|
|
1648
1652
|
parentSignal.addEventListener("abort", onParentAbort, { once: true });
|
|
1649
1653
|
}
|
|
1650
1654
|
}
|
|
1651
|
-
const request = buildProviderRequest(context, modelDef, streamAbort.signal);
|
|
1655
|
+
const request = buildProviderRequest(context, modelDef, streamAbort.signal, state.threadId);
|
|
1652
1656
|
let response;
|
|
1653
1657
|
await state.stream.waitFor(
|
|
1654
1658
|
async () => {
|
|
@@ -6058,8 +6062,22 @@ var init_context = __esm({
|
|
|
6058
6062
|
var FlowEngine_exports = {};
|
|
6059
6063
|
__export(FlowEngine_exports, {
|
|
6060
6064
|
FlowEngine: () => FlowEngine,
|
|
6061
|
-
HookBlockedExecutionError: () => HookBlockedExecutionError
|
|
6065
|
+
HookBlockedExecutionError: () => HookBlockedExecutionError,
|
|
6066
|
+
stepBudgetMessage: () => stepBudgetMessage
|
|
6062
6067
|
});
|
|
6068
|
+
function stepBudgetMessage(stepsRemaining) {
|
|
6069
|
+
if (stepsRemaining > 20) return null;
|
|
6070
|
+
if (stepsRemaining === 0) {
|
|
6071
|
+
return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: You must complete your task NOW or an error will be thrown. This is your final step.";
|
|
6072
|
+
}
|
|
6073
|
+
if (stepsRemaining === 1) {
|
|
6074
|
+
return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: Only 1 step available after this before an error will be thrown. Reach completion immediately.";
|
|
6075
|
+
}
|
|
6076
|
+
if (stepsRemaining <= 3) {
|
|
6077
|
+
return `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
|
|
6078
|
+
}
|
|
6079
|
+
return `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
|
|
6080
|
+
}
|
|
6063
6081
|
var IMMEDIATE_BOOTSTRAP_TOOL_NAME, HookBlockedExecutionError, FlowEngine;
|
|
6064
6082
|
var init_FlowEngine = __esm({
|
|
6065
6083
|
"src/agents/FlowEngine.ts"() {
|
|
@@ -7891,20 +7909,13 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
7891
7909
|
if (typeof maxSteps === "number" && !isNaN(maxSteps)) {
|
|
7892
7910
|
const currentSideStepCount = state.currentSide === "a" ? state.sideAStepCount : state.sideBStepCount;
|
|
7893
7911
|
const stepsRemaining = maxSteps - currentSideStepCount;
|
|
7894
|
-
|
|
7895
|
-
if (
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
budgetMessage = `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
|
|
7901
|
-
} else {
|
|
7902
|
-
budgetMessage = `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
|
|
7912
|
+
const budgetMessage = stepBudgetMessage(stepsRemaining);
|
|
7913
|
+
if (budgetMessage) {
|
|
7914
|
+
messages.push({
|
|
7915
|
+
role: "system",
|
|
7916
|
+
content: budgetMessage
|
|
7917
|
+
});
|
|
7903
7918
|
}
|
|
7904
|
-
messages.push({
|
|
7905
|
-
role: "system",
|
|
7906
|
-
content: budgetMessage
|
|
7907
|
-
});
|
|
7908
7919
|
}
|
|
7909
7920
|
const subagentRegistry = await this.getSubagentRegistry(state);
|
|
7910
7921
|
if (subagentRegistry.length > 0) {
|