@karmaniverous/jeeves 0.4.1 → 0.4.2

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.
@@ -261,14 +261,14 @@ const PLATFORM_COMPONENTS = [
261
261
  * Core library version, inlined at build time.
262
262
  *
263
263
  * @remarks
264
- * The `0.4.0` placeholder is replaced by
264
+ * The `0.4.1` placeholder is replaced by
265
265
  * `@rollup/plugin-replace` during the build with the actual version
266
266
  * from `package.json`. This ensures the correct version survives
267
267
  * when consumers bundle core into their own dist (where runtime
268
268
  * `import.meta.url`-based resolution would find the wrong package.json).
269
269
  */
270
270
  /** The core library version from package.json (inlined at build time). */
271
- const CORE_VERSION = '0.4.0';
271
+ const CORE_VERSION = '0.4.1';
272
272
 
273
273
  /**
274
274
  * Dynamic discovery of installed Jeeves component CLIs.
@@ -119,14 +119,14 @@ const COMPONENT_VERSIONS_FILE = 'component-versions.json';
119
119
  * Core library version, inlined at build time.
120
120
  *
121
121
  * @remarks
122
- * The `0.4.0` placeholder is replaced by
122
+ * The `0.4.1` placeholder is replaced by
123
123
  * `@rollup/plugin-replace` during the build with the actual version
124
124
  * from `package.json`. This ensures the correct version survives
125
125
  * when consumers bundle core into their own dist (where runtime
126
126
  * `import.meta.url`-based resolution would find the wrong package.json).
127
127
  */
128
128
  /** The core library version from package.json (inlined at build time). */
129
- const CORE_VERSION = '0.4.0';
129
+ const CORE_VERSION = '0.4.1';
130
130
 
131
131
  /**
132
132
  * Shared file I/O helpers for managed section operations.
@@ -162,6 +162,19 @@ z.object({
162
162
  .args(z.record(z.unknown()))
163
163
  .returns(z.promise(z.void()))
164
164
  .optional(),
165
+ /**
166
+ * Custom merge function for config apply. Receives the existing config
167
+ * and the patch, returns the merged result. Optional — if omitted,
168
+ * the default deep-merge (object-recursive, array-replacing) is used.
169
+ *
170
+ * Use this to implement domain-specific merge strategies such as
171
+ * name-based array merging for inference rules.
172
+ */
173
+ customMerge: z
174
+ .function()
175
+ .args(z.record(z.unknown()), z.record(z.unknown()))
176
+ .returns(z.record(z.unknown()))
177
+ .optional(),
165
178
  /**
166
179
  * Returns command + args for launching the service process.
167
180
  * Consumed by `start` CLI command and `service install`.
package/dist/index.d.ts CHANGED
@@ -130,6 +130,15 @@ declare const jeevesComponentDescriptorSchema: z.ZodObject<{
130
130
  * write-only (service picks up changes on restart).
131
131
  */
132
132
  onConfigApply: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodRecord<z.ZodString, z.ZodUnknown>], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>>;
133
+ /**
134
+ * Custom merge function for config apply. Receives the existing config
135
+ * and the patch, returns the merged result. Optional — if omitted,
136
+ * the default deep-merge (object-recursive, array-replacing) is used.
137
+ *
138
+ * Use this to implement domain-specific merge strategies such as
139
+ * name-based array merging for inference rules.
140
+ */
141
+ customMerge: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>], z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
133
142
  /**
134
143
  * Returns command + args for launching the service process.
135
144
  * Consumed by `start` CLI command and `service install`.
@@ -171,6 +180,7 @@ declare const jeevesComponentDescriptorSchema: z.ZodObject<{
171
180
  generateToolsContent: (...args: unknown[]) => string;
172
181
  serviceName?: string | undefined;
173
182
  onConfigApply?: ((args_0: Record<string, unknown>, ...args: unknown[]) => Promise<void>) | undefined;
183
+ customMerge?: ((args_0: Record<string, unknown>, args_1: Record<string, unknown>, ...args: unknown[]) => Record<string, unknown>) | undefined;
174
184
  dependencies?: {
175
185
  hard: string[];
176
186
  soft: string[];
@@ -192,6 +202,7 @@ declare const jeevesComponentDescriptorSchema: z.ZodObject<{
192
202
  generateToolsContent: (...args: unknown[]) => string;
193
203
  serviceName?: string | undefined;
194
204
  onConfigApply?: ((args_0: Record<string, unknown>, ...args: unknown[]) => Promise<void>) | undefined;
205
+ customMerge?: ((args_0: Record<string, unknown>, args_1: Record<string, unknown>, ...args: unknown[]) => Record<string, unknown>) | undefined;
195
206
  dependencies?: {
196
207
  hard: string[];
197
208
  soft: string[];
package/dist/index.js CHANGED
@@ -176,14 +176,14 @@ const PLATFORM_COMPONENTS = [
176
176
  * Core library version, inlined at build time.
177
177
  *
178
178
  * @remarks
179
- * The `0.4.0` placeholder is replaced by
179
+ * The `0.4.1` placeholder is replaced by
180
180
  * `@rollup/plugin-replace` during the build with the actual version
181
181
  * from `package.json`. This ensures the correct version survives
182
182
  * when consumers bundle core into their own dist (where runtime
183
183
  * `import.meta.url`-based resolution would find the wrong package.json).
184
184
  */
185
185
  /** The core library version from package.json (inlined at build time). */
186
- const CORE_VERSION = '0.4.0';
186
+ const CORE_VERSION = '0.4.1';
187
187
 
188
188
  /**
189
189
  * Workspace and config root initialization.
@@ -405,7 +405,8 @@ function createConfigApplyHandler(descriptor) {
405
405
  // Read existing config
406
406
  const existing = readConfigFile(configPath);
407
407
  // Merge or replace
408
- const merged = replace ? { ...patch } : deepMerge(existing, patch);
408
+ const mergeFn = descriptor.customMerge ?? deepMerge;
409
+ const merged = replace ? { ...patch } : mergeFn(existing, patch);
409
410
  // Validate against schema
410
411
  const schema = descriptor.configSchema;
411
412
  const parseResult = schema.safeParse(merged);
@@ -1501,6 +1502,19 @@ const jeevesComponentDescriptorSchema = z.object({
1501
1502
  .args(z.record(z.unknown()))
1502
1503
  .returns(z.promise(z.void()))
1503
1504
  .optional(),
1505
+ /**
1506
+ * Custom merge function for config apply. Receives the existing config
1507
+ * and the patch, returns the merged result. Optional — if omitted,
1508
+ * the default deep-merge (object-recursive, array-replacing) is used.
1509
+ *
1510
+ * Use this to implement domain-specific merge strategies such as
1511
+ * name-based array merging for inference rules.
1512
+ */
1513
+ customMerge: z
1514
+ .function()
1515
+ .args(z.record(z.unknown()), z.record(z.unknown()))
1516
+ .returns(z.record(z.unknown()))
1517
+ .optional(),
1504
1518
  /**
1505
1519
  * Returns command + args for launching the service process.
1506
1520
  * Consumed by `start` CLI command and `service install`.
package/package.json CHANGED
@@ -139,5 +139,5 @@
139
139
  },
140
140
  "type": "module",
141
141
  "types": "dist/index.d.ts",
142
- "version": "0.4.1"
142
+ "version": "0.4.2"
143
143
  }