@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/runtime.js CHANGED
@@ -13710,7 +13710,7 @@ var init_ThreadStateImpl = __esm({
13710
13710
  const toolCallId = this._flowState?.currentToolCall?.id;
13711
13711
  const canPark = !!(toolCallId && this._executionState && typeof instance.dispatchClientTool === "function");
13712
13712
  const side = this._flowState?.currentSide === "b" ? "b" : "a";
13713
- const mustParkForApproval = request.requestPermission != null && await this.forwardedCallNeedsApproval(request);
13713
+ const mustParkForApproval = await this.forwardedCallNeedsApproval(request);
13714
13714
  if (mustParkForApproval && canPark && toolCallId && typeof instance.hasBridge === "function" && await instance.hasBridge()) {
13715
13715
  await instance.dispatchClientTool(request, toolCallId, side);
13716
13716
  const getDelivered = instance.getDeliveredClientToolResult;
@@ -14303,14 +14303,17 @@ var init_ThreadStateImpl = __esm({
14303
14303
  * dispatcher recorded in the runtime context instead.
14304
14304
  */
14305
14305
  _getRuntimeEnv() {
14306
+ const contextEnv = this._runtimeContext.env;
14307
+ if (contextEnv?.AGENT_BUILDER) {
14308
+ return contextEnv;
14309
+ }
14306
14310
  const instanceEnv = this._threadInstance.env;
14307
- const env = instanceEnv?.AGENT_BUILDER ? instanceEnv : this._runtimeContext.env;
14308
- if (!env?.AGENT_BUILDER) {
14311
+ if (!instanceEnv?.AGENT_BUILDER) {
14309
14312
  throw new Error(
14310
14313
  "No runtime environment available on this ThreadState. Stub-backed states must be constructed with runtimeContext.env."
14311
14314
  );
14312
14315
  }
14313
- return env;
14316
+ return instanceEnv;
14314
14317
  }
14315
14318
  /** The per-user hub stub for this thread's user (user-scope surfaces). */
14316
14319
  _getUserHubStub(userId) {