@standardagents/builder 0.27.8 → 0.27.10

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
@@ -846,30 +846,40 @@ function resolveDefinedProviderConfig(definition, env) {
846
846
  missing.push(slot.defaultEnv);
847
847
  }
848
848
  }
849
- for (const [slotName, source] of Object.entries(definition.config ?? {})) {
850
- if (source.type === "const") {
851
- values[slotName] = source.value;
852
- continue;
853
- }
854
- envKeys.push(source.name);
855
- variables.push({
856
- name: source.name,
857
- type: normalizeEnvType(source.valueType),
858
- required: source.required !== false && source.default === void 0,
859
- description: source.description ?? ""
860
- });
861
- const envValue = env[source.name];
862
- if (envValue !== void 0 && envValue !== null && envValue !== "") {
863
- values[slotName] = coerceProviderConfigValue(envValue, source.valueType);
864
- continue;
865
- }
866
- if (source.default !== void 0) {
867
- values[slotName] = source.default;
868
- continue;
849
+ const isConfigSource = (value) => !!value && typeof value === "object" && !Array.isArray(value) && (value.type === "env" || value.type === "const");
850
+ const resolveConfigValue = (value) => {
851
+ if (value === null || value === void 0) return void 0;
852
+ if (isConfigSource(value)) {
853
+ const source = value;
854
+ if (source.type === "const") return source.value;
855
+ envKeys.push(source.name);
856
+ variables.push({
857
+ name: source.name,
858
+ type: normalizeEnvType(source.valueType),
859
+ required: source.required !== false && source.default === void 0,
860
+ description: source.description ?? ""
861
+ });
862
+ const envValue = env[source.name];
863
+ if (envValue !== void 0 && envValue !== null && envValue !== "") {
864
+ return coerceProviderConfigValue(envValue, source.valueType);
865
+ }
866
+ if (source.default !== void 0) return source.default;
867
+ if (source.required !== false) missing.push(source.name);
868
+ return void 0;
869
869
  }
870
- if (source.required !== false) {
871
- missing.push(source.name);
870
+ if (typeof value === "object" && !Array.isArray(value)) {
871
+ const out = {};
872
+ for (const [key, entry] of Object.entries(value)) {
873
+ const resolved = resolveConfigValue(entry);
874
+ if (resolved !== void 0) out[key] = resolved;
875
+ }
876
+ return Object.keys(out).length > 0 ? out : void 0;
872
877
  }
878
+ return value;
879
+ };
880
+ for (const [slotName, source] of Object.entries(definition.config ?? {})) {
881
+ const resolved = resolveConfigValue(source);
882
+ if (resolved !== void 0) values[slotName] = resolved;
873
883
  }
874
884
  return {
875
885
  providerConfig: values,