@standardagents/builder 0.24.1 → 0.24.3

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.
@@ -5990,8 +5990,22 @@ var init_context = __esm({
5990
5990
  var FlowEngine_exports = {};
5991
5991
  __export(FlowEngine_exports, {
5992
5992
  FlowEngine: () => FlowEngine,
5993
- HookBlockedExecutionError: () => HookBlockedExecutionError
5993
+ HookBlockedExecutionError: () => HookBlockedExecutionError,
5994
+ stepBudgetMessage: () => stepBudgetMessage
5994
5995
  });
5996
+ function stepBudgetMessage(stepsRemaining) {
5997
+ if (stepsRemaining > 20) return null;
5998
+ if (stepsRemaining === 0) {
5999
+ return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: You must complete your task NOW or an error will be thrown. This is your final step.";
6000
+ }
6001
+ if (stepsRemaining === 1) {
6002
+ return "[STEP BUDGET] \u26A0\uFE0F CRITICAL: Only 1 step available after this before an error will be thrown. Reach completion immediately.";
6003
+ }
6004
+ if (stepsRemaining <= 3) {
6005
+ return `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
6006
+ }
6007
+ return `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
6008
+ }
5995
6009
  var IMMEDIATE_BOOTSTRAP_TOOL_NAME, HookBlockedExecutionError, FlowEngine;
5996
6010
  var init_FlowEngine = __esm({
5997
6011
  "src/agents/FlowEngine.ts"() {
@@ -7823,20 +7837,13 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
7823
7837
  if (typeof maxSteps === "number" && !isNaN(maxSteps)) {
7824
7838
  const currentSideStepCount = state.currentSide === "a" ? state.sideAStepCount : state.sideBStepCount;
7825
7839
  const stepsRemaining = maxSteps - currentSideStepCount;
7826
- let budgetMessage;
7827
- if (stepsRemaining === 0) {
7828
- budgetMessage = "[STEP BUDGET] \u26A0\uFE0F CRITICAL: You must complete your task NOW or an error will be thrown. This is your final step.";
7829
- } else if (stepsRemaining === 1) {
7830
- budgetMessage = "[STEP BUDGET] \u26A0\uFE0F CRITICAL: Only 1 step available after this before an error will be thrown. Reach completion immediately.";
7831
- } else if (stepsRemaining <= 3) {
7832
- budgetMessage = `[STEP BUDGET] \u26A0\uFE0F WARNING: Only ${stepsRemaining} steps available before an error will be thrown. Reach completion as soon as possible.`;
7833
- } else {
7834
- budgetMessage = `[STEP BUDGET] ${stepsRemaining} steps available before an error will be thrown. Work efficiently toward completion.`;
7840
+ const budgetMessage = stepBudgetMessage(stepsRemaining);
7841
+ if (budgetMessage) {
7842
+ messages.push({
7843
+ role: "system",
7844
+ content: budgetMessage
7845
+ });
7835
7846
  }
7836
- messages.push({
7837
- role: "system",
7838
- content: budgetMessage
7839
- });
7840
7847
  }
7841
7848
  const subagentRegistry = await this.getSubagentRegistry(state);
7842
7849
  if (subagentRegistry.length > 0) {
@@ -54686,7 +54693,7 @@ function transformChatAssistantMessage3(msg) {
54686
54693
  }));
54687
54694
  }
54688
54695
  if (msg.reasoningDetails && msg.reasoningDetails.length > 0) {
54689
- message.reasoning_details = msg.reasoningDetails.map((detail) => {
54696
+ const details = msg.reasoningDetails.filter((detail) => detail.type !== "encrypted" || typeof detail.data === "string" && detail.data.length > 0).map((detail) => {
54690
54697
  if (detail.type === "text") {
54691
54698
  return { type: "reasoning.text", text: detail.text, format: detail.format };
54692
54699
  } else if (detail.type === "summary") {
@@ -54694,6 +54701,9 @@ function transformChatAssistantMessage3(msg) {
54694
54701
  }
54695
54702
  return { type: "reasoning.encrypted", data: detail.data, id: detail.id, format: detail.format };
54696
54703
  });
54704
+ if (details.length > 0) {
54705
+ message.reasoning_details = details;
54706
+ }
54697
54707
  }
54698
54708
  return message;
54699
54709
  }
@@ -55012,12 +55022,14 @@ function processChatStreamChunk2(chunk, state) {
55012
55022
  } else if (detail.type === "reasoning.summary") {
55013
55023
  accumulateReasoningDetail(state, detail);
55014
55024
  } else if (detail.type === "reasoning.encrypted") {
55015
- state.reasoningDetails.push({
55016
- type: "encrypted",
55017
- id: detail.id,
55018
- data: detail.data,
55019
- format: detail.format
55020
- });
55025
+ if (typeof detail.data === "string" && detail.data.length > 0) {
55026
+ state.reasoningDetails.push({
55027
+ type: "encrypted",
55028
+ id: detail.id,
55029
+ data: detail.data,
55030
+ format: detail.format
55031
+ });
55032
+ }
55021
55033
  }
55022
55034
  }
55023
55035
  }
@@ -70188,6 +70200,11 @@ var callback_get_default = defineController2(async ({ req, env: env2 }) => {
70188
70200
  }
70189
70201
  });
70190
70202
  }
70203
+ const landingRaw = env2.STANDARD_AGENTS_API_ROLE_LANDING_URL;
70204
+ const landing = typeof landingRaw === "string" ? landingRaw.trim() : "";
70205
+ if (landing && /^https:\/\//.test(landing)) {
70206
+ return new Response(null, { status: 302, headers: { Location: landing } });
70207
+ }
70191
70208
  return failRedirect(req, env2, "api_only_account");
70192
70209
  }
70193
70210
  const session = await mintLocalSessionForPlatformUser(env2, {