@standardagents/builder 0.27.10 → 0.27.11

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.
@@ -943,13 +943,25 @@ var init_ProviderRegistry = __esm({
943
943
  */
944
944
  async buildThreadScopedEnv(state) {
945
945
  const threadEnv = state.thread.metadata?.env ?? state.thread.metadata?.tenvs ?? null;
946
- const userId = state.thread.metadata?.user_id ?? null;
946
+ const agentBuilderId = state.env.AGENT_BUILDER.idFromName("singleton");
947
+ const agentBuilder = state.env.AGENT_BUILDER.get(agentBuilderId);
948
+ let userId = state.thread.metadata?.user_id ?? null;
949
+ let parent = state.thread.metadata?.parent ?? null;
950
+ let hops = 0;
951
+ while (!userId && parent && typeof agentBuilder.getThread === "function" && hops < 8) {
952
+ hops++;
953
+ try {
954
+ const parentThread = await agentBuilder.getThread(parent);
955
+ userId = parentThread?.user_id ?? null;
956
+ parent = parentThread?.parent ?? null;
957
+ } catch {
958
+ break;
959
+ }
960
+ }
947
961
  let userEnv = null;
948
- let diagnostic = userId ? "" : "no thread user_id";
962
+ let diagnostic = userId ? hops > 0 ? `owner via ${hops} parent hop(s)` : "" : "no thread user_id";
949
963
  if (userId) {
950
964
  try {
951
- const agentBuilderId = state.env.AGENT_BUILDER.idFromName("singleton");
952
- const agentBuilder = state.env.AGENT_BUILDER.get(agentBuilderId);
953
965
  if (typeof agentBuilder.getUserEnvEntries === "function") {
954
966
  const entries = await agentBuilder.getUserEnvEntries(userId);
955
967
  if (Array.isArray(entries) && entries.length > 0) {
@@ -66277,7 +66289,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
66277
66289
  });
66278
66290
 
66279
66291
  // src/version.ts
66280
- var BUILDER_VERSION = "0.27.10".length > 0 ? "0.27.10" : "dev";
66292
+ var BUILDER_VERSION = "0.27.11".length > 0 ? "0.27.11" : "dev";
66281
66293
 
66282
66294
  // src/api/diagnostics.get.ts
66283
66295
  init_LLMRequest();