@standardagents/builder 0.41.12 → 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/built-in-routes.js +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +18 -4
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
package/dist/runtime.js
CHANGED
|
@@ -30545,11 +30545,25 @@ var UserStateImpl = class {
|
|
|
30545
30545
|
const { entries, total } = await this.host.listUserValues(this.userId, options);
|
|
30546
30546
|
return { entries, total };
|
|
30547
30547
|
}
|
|
30548
|
+
/** User-account value first, then the instance's (Users §2.3). */
|
|
30548
30549
|
async env(name) {
|
|
30549
|
-
const
|
|
30550
|
-
const
|
|
30551
|
-
if (
|
|
30552
|
-
|
|
30550
|
+
const singleton = this.singleton();
|
|
30551
|
+
const userValues = await singleton.getUserEnv(this.userId);
|
|
30552
|
+
if (userValues[name] !== void 0) return userValues[name];
|
|
30553
|
+
const instanceValue = await this.instanceEnv(name);
|
|
30554
|
+
if (instanceValue !== void 0) return instanceValue;
|
|
30555
|
+
throw new Error(`Environment variable not found: ${name}`);
|
|
30556
|
+
}
|
|
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
|
+
*/
|
|
30562
|
+
async instanceEnv(name) {
|
|
30563
|
+
const values = await this.singleton().getInstanceEnv();
|
|
30564
|
+
if (values[name] !== void 0) return values[name];
|
|
30565
|
+
const worker = this.host.env[name];
|
|
30566
|
+
return typeof worker === "string" ? worker : void 0;
|
|
30553
30567
|
}
|
|
30554
30568
|
emit(event, data) {
|
|
30555
30569
|
this.host.broadcastUserEvent(this.userId, event, data);
|