@standardagents/builder 0.37.1 → 0.37.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.
package/dist/index.js CHANGED
@@ -13719,7 +13719,7 @@ var init_ThreadStateImpl = __esm({
13719
13719
  const toolCallId = this._flowState?.currentToolCall?.id;
13720
13720
  const canPark = !!(toolCallId && this._executionState && typeof instance.dispatchClientTool === "function");
13721
13721
  const side = this._flowState?.currentSide === "b" ? "b" : "a";
13722
- const mustParkForApproval = request.requestPermission != null && await this.forwardedCallNeedsApproval(request);
13722
+ const mustParkForApproval = await this.forwardedCallNeedsApproval(request);
13723
13723
  if (mustParkForApproval && canPark && toolCallId && typeof instance.hasBridge === "function" && await instance.hasBridge()) {
13724
13724
  await instance.dispatchClientTool(request, toolCallId, side);
13725
13725
  const getDelivered = instance.getDeliveredClientToolResult;
@@ -14312,14 +14312,17 @@ var init_ThreadStateImpl = __esm({
14312
14312
  * dispatcher recorded in the runtime context instead.
14313
14313
  */
14314
14314
  _getRuntimeEnv() {
14315
+ const contextEnv = this._runtimeContext.env;
14316
+ if (contextEnv?.AGENT_BUILDER) {
14317
+ return contextEnv;
14318
+ }
14315
14319
  const instanceEnv = this._threadInstance.env;
14316
- const env = instanceEnv?.AGENT_BUILDER ? instanceEnv : this._runtimeContext.env;
14317
- if (!env?.AGENT_BUILDER) {
14320
+ if (!instanceEnv?.AGENT_BUILDER) {
14318
14321
  throw new Error(
14319
14322
  "No runtime environment available on this ThreadState. Stub-backed states must be constructed with runtimeContext.env."
14320
14323
  );
14321
14324
  }
14322
- return env;
14325
+ return instanceEnv;
14323
14326
  }
14324
14327
  /** The per-user hub stub for this thread's user (user-scope surfaces). */
14325
14328
  _getUserHubStub(userId) {