@alfe.ai/integrations 0.0.32 → 0.0.33
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 +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -811,14 +811,28 @@ async function runHookWithContext(integrationPath, hookScript, options) {
|
|
|
811
811
|
* Deep-walk an object and replace `{{config.KEY}}` patterns with values
|
|
812
812
|
* from the per-agent config. Used to compose manifest runtime config
|
|
813
813
|
* with per-agent secrets (e.g., gateway token).
|
|
814
|
+
*
|
|
815
|
+
* Whole-value substitution: when a string is exactly `{{config.KEY}}` with
|
|
816
|
+
* no surrounding text, the raw config value is substituted preserving its
|
|
817
|
+
* type (array, object, boolean, …). For interpolation inside a larger
|
|
818
|
+
* string, only string/number values are substituted; other types fall
|
|
819
|
+
* through to keep the placeholder.
|
|
814
820
|
*/
|
|
821
|
+
const FULL_PLACEHOLDER = /^\{\{config\.([a-zA-Z0-9_]+)\}\}$/;
|
|
815
822
|
function interpolateSelfConfig(obj, config) {
|
|
816
823
|
const result = {};
|
|
817
|
-
for (const [key, value] of Object.entries(obj)) if (typeof value === "string")
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
824
|
+
for (const [key, value] of Object.entries(obj)) if (typeof value === "string") {
|
|
825
|
+
const wholeMatch = FULL_PLACEHOLDER.exec(value);
|
|
826
|
+
if (wholeMatch) {
|
|
827
|
+
const raw = config[wholeMatch[1]];
|
|
828
|
+
result[key] = raw !== void 0 ? raw : value;
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
result[key] = value.replace(/\{\{config\.([a-zA-Z0-9_]+)\}\}/g, (_match, configKey) => {
|
|
832
|
+
const val = config[configKey];
|
|
833
|
+
return typeof val === "string" || typeof val === "number" ? String(val) : _match;
|
|
834
|
+
});
|
|
835
|
+
} else if (value && typeof value === "object" && !Array.isArray(value)) result[key] = interpolateSelfConfig(value, config);
|
|
822
836
|
else result[key] = value;
|
|
823
837
|
return result;
|
|
824
838
|
}
|
package/package.json
CHANGED