@dexto/agent-config 1.15.0-beta.2 → 1.15.0-beta.4

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.cjs CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  ReactiveOverflowCompactionConfigSchema: () => import_compaction.ReactiveOverflowCompactionConfigSchema,
28
28
  ToolFactoryEntrySchema: () => import_agent_config.ToolFactoryEntrySchema,
29
29
  applyImageDefaults: () => import_apply_image_defaults.applyImageDefaults,
30
+ assertSafeConfigKeys: () => import_assert_safe_config_keys.assertSafeConfigKeys,
30
31
  cleanNullValues: () => import_clean_null_values.cleanNullValues,
31
32
  createAgentConfigSchema: () => import_agent_config.createAgentConfigSchema,
32
33
  loadImage: () => import_load_image.loadImage,
@@ -45,6 +46,7 @@ var import_resolve_services_from_config = require("./resolver/resolve-services-f
45
46
  var import_resolve_services_from_config2 = require("./resolver/resolve-services-from-config.js");
46
47
  var import_to_dexto_agent_options = require("./resolver/to-dexto-agent-options.js");
47
48
  var import_clean_null_values = require("./utils/clean-null-values.js");
49
+ var import_assert_safe_config_keys = require("./utils/assert-safe-config-keys.js");
48
50
  // Annotate the CommonJS export names for ESM import in node:
49
51
  0 && (module.exports = {
50
52
  AgentConfigSchema,
@@ -56,6 +58,7 @@ var import_clean_null_values = require("./utils/clean-null-values.js");
56
58
  ReactiveOverflowCompactionConfigSchema,
57
59
  ToolFactoryEntrySchema,
58
60
  applyImageDefaults,
61
+ assertSafeConfigKeys,
59
62
  cleanNullValues,
60
63
  createAgentConfigSchema,
61
64
  loadImage,
package/dist/index.d.ts CHANGED
@@ -13,4 +13,5 @@ export { resolveToolsFromEntries } from './resolver/resolve-services-from-config
13
13
  export { toDextoAgentOptions } from './resolver/to-dexto-agent-options.js';
14
14
  export type { ResolvedServices } from './resolver/types.js';
15
15
  export { cleanNullValues } from './utils/clean-null-values.js';
16
+ export { assertSafeConfigKeys } from './utils/assert-safe-config-keys.js';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,gCAAgC,EAChC,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,gCAAgC,EAChC,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACR,WAAW,EACX,oBAAoB,EACpB,gBAAgB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EACH,sBAAsB,EACtB,yBAAyB,EACzB,sCAAsC,EACtC,0BAA0B,GAC7B,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACR,gBAAgB,EAChB,yBAAyB,EACzB,gCAAgC,EAChC,oBAAoB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAA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,oCAAoC,CAAC"}
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { resolveServicesFromConfig } from "./resolver/resolve-services-from-conf
16
16
  import { resolveToolsFromEntries } from "./resolver/resolve-services-from-config.js";
17
17
  import { toDextoAgentOptions } from "./resolver/to-dexto-agent-options.js";
18
18
  import { cleanNullValues } from "./utils/clean-null-values.js";
19
+ import { assertSafeConfigKeys } from "./utils/assert-safe-config-keys.js";
19
20
  export {
20
21
  AgentConfigSchema,
21
22
  CompactionConfigSchema,
@@ -26,6 +27,7 @@ export {
26
27
  ReactiveOverflowCompactionConfigSchema,
27
28
  ToolFactoryEntrySchema,
28
29
  applyImageDefaults,
30
+ assertSafeConfigKeys,
29
31
  cleanNullValues,
30
32
  createAgentConfigSchema,
31
33
  loadImage,
@@ -21,6 +21,7 @@ __export(apply_image_defaults_exports, {
21
21
  applyImageDefaults: () => applyImageDefaults
22
22
  });
23
23
  module.exports = __toCommonJS(apply_image_defaults_exports);
24
+ var import_assert_safe_config_keys = require("../utils/assert-safe-config-keys.js");
24
25
  var import_utils = require("./utils.js");
25
26
  function promptIdentityKey(prompt) {
26
27
  if (!(0, import_utils.isPlainObject)(prompt)) {
@@ -74,6 +75,8 @@ function mergePrompts(configPrompts, defaultPrompts) {
74
75
  return order.map((key) => entries.get(key));
75
76
  }
76
77
  function applyImageDefaults(config, defaults) {
78
+ (0, import_assert_safe_config_keys.assertSafeConfigKeys)(config);
79
+ (0, import_assert_safe_config_keys.assertSafeConfigKeys)(defaults);
77
80
  if (!defaults) {
78
81
  return config;
79
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"apply-image-defaults.d.ts","sourceRoot":"","sources":["../../src/resolver/apply-image-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoEvD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,WAAW,CA2B7F"}
1
+ {"version":3,"file":"apply-image-defaults.d.ts","sourceRoot":"","sources":["../../src/resolver/apply-image-defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoEvD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,WAAW,CA6B7F"}
@@ -1,3 +1,4 @@
1
+ import { assertSafeConfigKeys } from "../utils/assert-safe-config-keys.js";
1
2
  import { isPlainObject } from "./utils.js";
2
3
  function promptIdentityKey(prompt) {
3
4
  if (!isPlainObject(prompt)) {
@@ -51,6 +52,8 @@ function mergePrompts(configPrompts, defaultPrompts) {
51
52
  return order.map((key) => entries.get(key));
52
53
  }
53
54
  function applyImageDefaults(config, defaults) {
55
+ assertSafeConfigKeys(config);
56
+ assertSafeConfigKeys(defaults);
54
57
  if (!defaults) {
55
58
  return config;
56
59
  }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var assert_safe_config_keys_exports = {};
20
+ __export(assert_safe_config_keys_exports, {
21
+ assertSafeConfigKeys: () => assertSafeConfigKeys
22
+ });
23
+ module.exports = __toCommonJS(assert_safe_config_keys_exports);
24
+ function assertSafeConfigKeys(value) {
25
+ const seen = /* @__PURE__ */ new WeakSet();
26
+ function visit(current, path) {
27
+ if (current === null || typeof current !== "object" || seen.has(current)) return;
28
+ seen.add(current);
29
+ for (const [key, child] of Object.entries(current)) {
30
+ const childPath = path ? `${path}.${key}` : key;
31
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
32
+ throw new Error(`Forbidden configuration key: ${childPath}`);
33
+ }
34
+ visit(child, childPath);
35
+ }
36
+ }
37
+ visit(value, "");
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ assertSafeConfigKeys
42
+ });
@@ -0,0 +1,3 @@
1
+ /** Reject keys that can alter object prototypes when configuration is copied or merged. */
2
+ export declare function assertSafeConfigKeys(value: unknown): void;
3
+ //# sourceMappingURL=assert-safe-config-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-safe-config-keys.d.ts","sourceRoot":"","sources":["../../src/utils/assert-safe-config-keys.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAczD"}
@@ -0,0 +1,18 @@
1
+ function assertSafeConfigKeys(value) {
2
+ const seen = /* @__PURE__ */ new WeakSet();
3
+ function visit(current, path) {
4
+ if (current === null || typeof current !== "object" || seen.has(current)) return;
5
+ seen.add(current);
6
+ for (const [key, child] of Object.entries(current)) {
7
+ const childPath = path ? `${path}.${key}` : key;
8
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
9
+ throw new Error(`Forbidden configuration key: ${childPath}`);
10
+ }
11
+ visit(child, childPath);
12
+ }
13
+ }
14
+ visit(value, "");
15
+ }
16
+ export {
17
+ assertSafeConfigKeys
18
+ };
@@ -21,30 +21,19 @@ __export(clean_null_values_exports, {
21
21
  cleanNullValues: () => cleanNullValues
22
22
  });
23
23
  module.exports = __toCommonJS(clean_null_values_exports);
24
+ var import_assert_safe_config_keys = require("./assert-safe-config-keys.js");
24
25
  function cleanNullValues(obj) {
25
- if (obj === null || obj === void 0) return obj;
26
- if (typeof obj !== "object") return obj;
27
- if (Array.isArray(obj)) {
28
- return obj.map(
29
- (item) => typeof item === "object" && item !== null ? cleanNullValues(item) : item
30
- );
31
- }
32
- const cleaned = {};
33
- for (const [key, value] of Object.entries(obj)) {
34
- if (value === null) {
35
- continue;
36
- }
37
- if (typeof value === "object" && !Array.isArray(value)) {
38
- cleaned[key] = cleanNullValues(value);
39
- } else if (Array.isArray(value)) {
40
- cleaned[key] = value.map(
41
- (item) => typeof item === "object" && item !== null ? cleanNullValues(item) : item
42
- );
43
- } else {
44
- cleaned[key] = value;
26
+ (0, import_assert_safe_config_keys.assertSafeConfigKeys)(obj);
27
+ function clean(value) {
28
+ if (Array.isArray(value)) return value.map(clean);
29
+ if (value === null || typeof value !== "object") return value;
30
+ const result = {};
31
+ for (const [key, child] of Object.entries(value)) {
32
+ if (child !== null) result[key] = clean(child);
45
33
  }
34
+ return result;
46
35
  }
47
- return cleaned;
36
+ return clean(obj);
48
37
  }
49
38
  // Annotate the CommonJS export names for ESM import in node:
50
39
  0 && (module.exports = {
@@ -1,8 +1,3 @@
1
- /**
2
- * Recursively removes `null` values from an object.
3
- *
4
- * This handles YAML files that have explicit `apiKey: null` entries which would otherwise
5
- * cause Zod validation errors like "Expected string, received null".
6
- */
1
+ /** Recursively removes null values from a configuration object. */
7
2
  export declare function cleanNullValues<T extends Record<string, unknown>>(obj: T): T;
8
3
  //# sourceMappingURL=clean-null-values.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean-null-values.d.ts","sourceRoot":"","sources":["../../src/utils/clean-null-values.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA6B5E"}
1
+ {"version":3,"file":"clean-null-values.d.ts","sourceRoot":"","sources":["../../src/utils/clean-null-values.ts"],"names":[],"mappings":"AAEA,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAc5E"}
@@ -1,27 +1,16 @@
1
+ import { assertSafeConfigKeys } from "./assert-safe-config-keys.js";
1
2
  function cleanNullValues(obj) {
2
- if (obj === null || obj === void 0) return obj;
3
- if (typeof obj !== "object") return obj;
4
- if (Array.isArray(obj)) {
5
- return obj.map(
6
- (item) => typeof item === "object" && item !== null ? cleanNullValues(item) : item
7
- );
8
- }
9
- const cleaned = {};
10
- for (const [key, value] of Object.entries(obj)) {
11
- if (value === null) {
12
- continue;
13
- }
14
- if (typeof value === "object" && !Array.isArray(value)) {
15
- cleaned[key] = cleanNullValues(value);
16
- } else if (Array.isArray(value)) {
17
- cleaned[key] = value.map(
18
- (item) => typeof item === "object" && item !== null ? cleanNullValues(item) : item
19
- );
20
- } else {
21
- cleaned[key] = value;
3
+ assertSafeConfigKeys(obj);
4
+ function clean(value) {
5
+ if (Array.isArray(value)) return value.map(clean);
6
+ if (value === null || typeof value !== "object") return value;
7
+ const result = {};
8
+ for (const [key, child] of Object.entries(value)) {
9
+ if (child !== null) result[key] = clean(child);
22
10
  }
11
+ return result;
23
12
  }
24
- return cleaned;
13
+ return clean(obj);
25
14
  }
26
15
  export {
27
16
  cleanNullValues
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/agent-config",
3
- "version": "1.15.0-beta.2",
3
+ "version": "1.15.0-beta.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "zod": "^4.3.6",
19
- "@dexto/core": "1.15.0-beta.2",
20
- "@dexto/storage": "1.15.0-beta.2"
19
+ "@dexto/core": "1.15.0-beta.4",
20
+ "@dexto/storage": "1.15.0-beta.4"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.13.5",