@standardagents/builder 0.27.7 → 0.27.8

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.
@@ -909,6 +909,10 @@ var init_ProviderRegistry = __esm({
909
909
  init_factory();
910
910
  ProviderRegistryImpl = class {
911
911
  providerCache = /* @__PURE__ */ new Map();
912
+ /** Why the last thread-scoped resolution did (not) contribute user env,
913
+ * keyed by the env object handed back — surfaced in missing-variable
914
+ * errors so a silent user-env failure is diagnosable from the log. */
915
+ scopeDiagnostics = /* @__PURE__ */ new WeakMap();
912
916
  providerOverrideFn = null;
913
917
  providerOverrideRevision = 0;
914
918
  setProviderOverride(fn) {
@@ -931,6 +935,7 @@ var init_ProviderRegistry = __esm({
931
935
  const threadEnv = state.thread.metadata?.env ?? state.thread.metadata?.tenvs ?? null;
932
936
  const userId = state.thread.metadata?.user_id ?? null;
933
937
  let userEnv = null;
938
+ let diagnostic = userId ? "" : "no thread user_id";
934
939
  if (userId) {
935
940
  try {
936
941
  const agentBuilderId = state.env.AGENT_BUILDER.idFromName("singleton");
@@ -942,14 +947,25 @@ var init_ProviderRegistry = __esm({
942
947
  for (const entry of entries) {
943
948
  if (entry?.name) userEnv[entry.name] = entry.value;
944
949
  }
950
+ diagnostic = `user env: ${Object.keys(userEnv).length} entries`;
951
+ } else {
952
+ diagnostic = `user env empty for ${userId} (entries: ${Array.isArray(entries) ? entries.length : typeof entries})`;
945
953
  }
954
+ } else {
955
+ diagnostic = "singleton has no getUserEnvEntries";
946
956
  }
947
957
  } catch (error) {
948
- console.warn("buildThreadScopedEnv: user env unavailable:", error instanceof Error ? error.message : String(error));
958
+ diagnostic = `user env lookup failed: ${error instanceof Error ? error.message : String(error)}`;
959
+ console.warn("buildThreadScopedEnv:", diagnostic);
949
960
  }
950
961
  }
951
- if (!userEnv && !threadEnv) return state.env;
952
- return { ...state.env, ...userEnv ?? {}, ...threadEnv ?? {} };
962
+ if (!userEnv && !threadEnv) {
963
+ this.scopeDiagnostics.set(state.env, diagnostic);
964
+ return state.env;
965
+ }
966
+ const merged = { ...state.env, ...userEnv ?? {}, ...threadEnv ?? {} };
967
+ this.scopeDiagnostics.set(merged, diagnostic);
968
+ return merged;
953
969
  }
954
970
  /**
955
971
  * Get provider for a model.
@@ -988,8 +1004,9 @@ var init_ProviderRegistry = __esm({
988
1004
  if (providerDefinition) {
989
1005
  const resolved = resolveDefinedProviderConfig(providerDefinition, env2);
990
1006
  if (resolved.missing.length > 0) {
1007
+ const scopeNote = this.scopeDiagnostics.get(env2);
991
1008
  throw new Error(
992
- `Missing required environment variables for provider '${providerName}': ${resolved.missing.join(", ")}.`
1009
+ `Missing required environment variables for provider '${providerName}': ${resolved.missing.join(", ")}.` + (scopeNote ? ` [thread-scoped env: ${scopeNote}]` : "")
993
1010
  );
994
1011
  }
995
1012
  const config = resolved.providerConfig;
@@ -66229,7 +66246,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
66229
66246
  });
66230
66247
 
66231
66248
  // src/version.ts
66232
- var BUILDER_VERSION = "0.27.7".length > 0 ? "0.27.7" : "dev";
66249
+ var BUILDER_VERSION = "0.27.8".length > 0 ? "0.27.8" : "dev";
66233
66250
 
66234
66251
  // src/api/diagnostics.get.ts
66235
66252
  init_LLMRequest();