@standardagents/builder 0.41.13 → 0.41.14

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
@@ -30550,14 +30550,20 @@ var UserStateImpl = class {
30550
30550
  const singleton = this.singleton();
30551
30551
  const userValues = await singleton.getUserEnv(this.userId);
30552
30552
  if (userValues[name] !== void 0) return userValues[name];
30553
- const instanceValues = await singleton.getInstanceEnv();
30554
- if (instanceValues[name] !== void 0) return instanceValues[name];
30553
+ const instanceValue = await this.instanceEnv(name);
30554
+ if (instanceValue !== void 0) return instanceValue;
30555
30555
  throw new Error(`Environment variable not found: ${name}`);
30556
30556
  }
30557
- /** The instance's value only, for trust anchors (Users §2.3). */
30557
+ /**
30558
+ * The instance's value only, for trust anchors (Users §2.3): the value set
30559
+ * in the builder, then the deployed Worker's environment variable (the
30560
+ * platform's Environment settings), as a thread's env resolves.
30561
+ */
30558
30562
  async instanceEnv(name) {
30559
30563
  const values = await this.singleton().getInstanceEnv();
30560
- return values[name];
30564
+ if (values[name] !== void 0) return values[name];
30565
+ const worker = this.host.env[name];
30566
+ return typeof worker === "string" ? worker : void 0;
30561
30567
  }
30562
30568
  emit(event, data) {
30563
30569
  this.host.broadcastUserEvent(this.userId, event, data);