@standardagents/builder 0.41.13 → 0.41.15

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
@@ -39452,14 +39452,20 @@ var UserStateImpl = class {
39452
39452
  const singleton = this.singleton();
39453
39453
  const userValues = await singleton.getUserEnv(this.userId);
39454
39454
  if (userValues[name] !== void 0) return userValues[name];
39455
- const instanceValues = await singleton.getInstanceEnv();
39456
- if (instanceValues[name] !== void 0) return instanceValues[name];
39455
+ const instanceValue = await this.instanceEnv(name);
39456
+ if (instanceValue !== void 0) return instanceValue;
39457
39457
  throw new Error(`Environment variable not found: ${name}`);
39458
39458
  }
39459
- /** The instance's value only, for trust anchors (Users §2.3). */
39459
+ /**
39460
+ * The instance's value only, for trust anchors (Users §2.3): the value set
39461
+ * in the builder, then the deployed Worker's environment variable (the
39462
+ * platform's Environment settings), as a thread's env resolves.
39463
+ */
39460
39464
  async instanceEnv(name) {
39461
39465
  const values = await this.singleton().getInstanceEnv();
39462
- return values[name];
39466
+ if (values[name] !== void 0) return values[name];
39467
+ const worker = this.host.env[name];
39468
+ return typeof worker === "string" ? worker : void 0;
39463
39469
  }
39464
39470
  emit(event, data) {
39465
39471
  this.host.broadcastUserEvent(this.userId, event, data);