@wrongstack/core 0.148.0 → 0.155.0

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.
Files changed (50) hide show
  1. package/dist/{agent-bridge-r9y6gdn4.d.ts → agent-bridge-BbZU5TPN.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-1GeQE_L0.d.ts → agent-subagent-runner-Bsueu0J2.d.ts} +2 -2
  3. package/dist/{brain-Cp_3GIS2.d.ts → brain-CS_B0vIE.d.ts} +2 -0
  4. package/dist/coordination/index.d.ts +7 -7
  5. package/dist/coordination/index.js +143 -6
  6. package/dist/coordination/index.js.map +1 -1
  7. package/dist/defaults/index.d.ts +13 -13
  8. package/dist/defaults/index.js +223 -65
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/execution/index.d.ts +6 -6
  11. package/dist/execution/index.js +143 -6
  12. package/dist/execution/index.js.map +1 -1
  13. package/dist/extension/index.d.ts +2 -2
  14. package/dist/{goal-preamble-CYJLg0wk.d.ts → goal-preamble-CbV8pXLD.d.ts} +3 -3
  15. package/dist/{index-CPweVoFM.d.ts → index-B5wz-GXm.d.ts} +1 -1
  16. package/dist/{index-BZdezm3g.d.ts → index-CI1hRfPt.d.ts} +2 -2
  17. package/dist/index.d.ts +22 -22
  18. package/dist/index.js +233 -70
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +3 -3
  21. package/dist/infrastructure/index.js +11 -2
  22. package/dist/infrastructure/index.js.map +1 -1
  23. package/dist/kernel/index.d.ts +3 -3
  24. package/dist/kernel/index.js.map +1 -1
  25. package/dist/{mcp-servers-Bl5LTvQg.d.ts → mcp-servers-CPERR2De.d.ts} +8 -1
  26. package/dist/{multi-agent-coordinator-QWEzJDlm.d.ts → multi-agent-coordinator-BSKSFNhv.d.ts} +1 -1
  27. package/dist/{null-fleet-bus-BUyfqh23.d.ts → null-fleet-bus-CGOez8Le.d.ts} +4 -4
  28. package/dist/observability/index.d.ts +1 -1
  29. package/dist/{parallel-eternal-engine-C75QuhAI.d.ts → parallel-eternal-engine-CYoTKjsz.d.ts} +4 -4
  30. package/dist/{path-resolver-DRjQBkoO.d.ts → path-resolver-DuhlmPil.d.ts} +1 -1
  31. package/dist/{plan-templates-CkKNPU3I.d.ts → plan-templates-DbH7lg-t.d.ts} +2 -2
  32. package/dist/{provider-runner-BNpuIyOL.d.ts → provider-runner-Cocq0O9E.d.ts} +1 -1
  33. package/dist/sdd/index.d.ts +3 -3
  34. package/dist/sdd/index.js +143 -6
  35. package/dist/sdd/index.js.map +1 -1
  36. package/dist/{secret-vault-DoISxaKO.d.ts → secret-vault-BJDY28ev.d.ts} +7 -1
  37. package/dist/{secret-vault-BTcC_T5v.d.ts → secret-vault-w8MbUe2Q.d.ts} +1 -1
  38. package/dist/security/index.d.ts +2 -2
  39. package/dist/security/index.js +59 -22
  40. package/dist/security/index.js.map +1 -1
  41. package/dist/storage/index.d.ts +5 -5
  42. package/dist/storage/index.js +76 -42
  43. package/dist/storage/index.js.map +1 -1
  44. package/dist/types/index.d.ts +11 -11
  45. package/dist/types/index.js +59 -22
  46. package/dist/types/index.js.map +1 -1
  47. package/dist/utils/index.d.ts +65 -1
  48. package/dist/utils/index.js +61 -2
  49. package/dist/utils/index.js.map +1 -1
  50. package/package.json +1 -1
@@ -1315,7 +1315,7 @@ var FileMemoryBackend = class {
1315
1315
  const line = `
1316
1316
  - [${entry.ts}] ${id}${meta} ${entry.text.replace(/\n/g, " ")}
1317
1317
  `;
1318
- const next = existing.trim() ? existing.replace(/\n+$/, "") + line : `# WrongStack Memory
1318
+ const next = existing.trim() ? existing.replace(/\n+$/, "") + line : `# Agent Memory
1319
1319
  ${line}`;
1320
1320
  await atomicWrite(file, next);
1321
1321
  }
@@ -2173,6 +2173,67 @@ function deepFreeze(obj) {
2173
2173
  }
2174
2174
  return Object.freeze(obj);
2175
2175
  }
2176
+
2177
+ // src/utils/deep-merge.ts
2178
+ var FORBIDDEN_PROTO_KEYS = /* @__PURE__ */ new Set([
2179
+ "__proto__",
2180
+ "constructor",
2181
+ "prototype",
2182
+ "__defineGetter__",
2183
+ "__defineSetter__",
2184
+ "__lookupGetter__",
2185
+ "__lookupSetter__"
2186
+ ]);
2187
+ function isPrimitiveArray(a) {
2188
+ return a.every((v) => v === null || typeof v !== "object" && typeof v !== "function");
2189
+ }
2190
+ function deepMerge(base, patch, options = {}) {
2191
+ const {
2192
+ conflictResolution = "prefer-patch",
2193
+ arrayMode = "replace",
2194
+ protectProto = true,
2195
+ onNonPrimitiveArrayReplace
2196
+ } = options;
2197
+ if (typeof base !== "object" || base === null) {
2198
+ return conflictResolution === "prefer-patch" ? patch : base;
2199
+ }
2200
+ if (typeof patch !== "object" || patch === null) {
2201
+ return conflictResolution === "prefer-patch" ? patch : base;
2202
+ }
2203
+ if (Array.isArray(base) && Array.isArray(patch)) {
2204
+ if (arrayMode === "concat-primitives" && isPrimitiveArray(base) && isPrimitiveArray(patch)) {
2205
+ return [.../* @__PURE__ */ new Set([...base, ...patch])];
2206
+ }
2207
+ return conflictResolution === "prefer-patch" ? patch : base;
2208
+ }
2209
+ if (Array.isArray(base) || Array.isArray(patch)) {
2210
+ return conflictResolution === "prefer-patch" ? patch : base;
2211
+ }
2212
+ const baseObj = base;
2213
+ const patchObj = patch;
2214
+ const out = { ...baseObj };
2215
+ for (const [k, v] of Object.entries(patchObj)) {
2216
+ if (protectProto && FORBIDDEN_PROTO_KEYS.has(k)) continue;
2217
+ const existing = out[k];
2218
+ if (v !== null && typeof v === "object" && !Array.isArray(v) && existing !== null && typeof existing === "object" && !Array.isArray(existing)) {
2219
+ out[k] = deepMerge(existing, v, options);
2220
+ } else if (Array.isArray(v) && Array.isArray(existing)) {
2221
+ if (onNonPrimitiveArrayReplace && !isPrimitiveArray(v)) {
2222
+ onNonPrimitiveArrayReplace(k, existing.length, v.length);
2223
+ }
2224
+ out[k] = deepMerge(existing, v, options);
2225
+ } else if (v !== void 0) {
2226
+ if (onNonPrimitiveArrayReplace && Array.isArray(v) && !isPrimitiveArray(v)) {
2227
+ const existingLen = Array.isArray(existing) ? existing.length : 0;
2228
+ onNonPrimitiveArrayReplace(k, existingLen, v.length);
2229
+ }
2230
+ out[k] = v;
2231
+ }
2232
+ }
2233
+ return out;
2234
+ }
2235
+
2236
+ // src/security/secret-vault.ts
2176
2237
  function decryptConfigSecrets(cfg, vault, opts) {
2177
2238
  const warn = ((msg) => console.warn(msg));
2178
2239
  return walk(cfg, vault, (v, key) => {
@@ -2387,43 +2448,16 @@ var defaultIndexing = {
2387
2448
  watchExternal: true,
2388
2449
  debounceMs: 400
2389
2450
  };
2390
- function isPrimitiveArray(a) {
2391
- return a.every((v) => v === null || typeof v !== "object");
2392
- }
2393
- var FORBIDDEN_PROTO_KEYS = /* @__PURE__ */ new Set([
2394
- "__proto__",
2395
- "constructor",
2396
- "prototype",
2397
- "__defineGetter__",
2398
- "__defineSetter__",
2399
- "__lookupGetter__",
2400
- "__lookupSetter__"
2401
- ]);
2402
- function deepMerge(base, patch) {
2403
- if (typeof base !== "object" || base === null) return patch ?? base;
2404
- if (typeof patch !== "object" || patch === null) return base;
2405
- const out = { ...base };
2406
- for (const [k, v] of Object.entries(patch)) {
2407
- if (FORBIDDEN_PROTO_KEYS.has(k)) continue;
2408
- const existing = out[k];
2409
- if (Array.isArray(v)) {
2410
- if (Array.isArray(existing) && isPrimitiveArray(v) && isPrimitiveArray(existing)) {
2411
- out[k] = [.../* @__PURE__ */ new Set([...existing, ...v])];
2412
- } else {
2413
- out[k] = v;
2414
- if (envBoolOptional(process.env.WRONGSTACK_DEBUG_CONFIG)) {
2415
- console.warn(
2416
- `[config] Non-primitive array for "${k}" replaced (global + local config merge). Global entries: ${existing?.length ?? 0}, local entries: ${v.length}.`
2417
- );
2418
- }
2419
- }
2420
- } else if (typeof v === "object" && v !== null && typeof existing === "object" && existing !== null) {
2421
- out[k] = deepMerge(existing, v);
2422
- } else if (v !== void 0) {
2423
- out[k] = v;
2424
- }
2451
+ function deepMerge2(base, patch) {
2452
+ const opts = { arrayMode: "concat-primitives" };
2453
+ if (envBoolOptional(process.env.WRONGSTACK_DEBUG_CONFIG)) {
2454
+ opts.onNonPrimitiveArrayReplace = (key, existingLen, patchLen) => {
2455
+ console.warn(
2456
+ `[config] Non-primitive array for "${key}" replaced (global + local config merge). Global entries: ${existingLen}, local entries: ${patchLen}.`
2457
+ );
2458
+ };
2425
2459
  }
2426
- return out;
2460
+ return deepMerge(base, patch, opts);
2427
2461
  }
2428
2462
  var DefaultConfigLoader = class {
2429
2463
  paths;
@@ -2443,9 +2477,9 @@ var DefaultConfigLoader = class {
2443
2477
  this.readJson(this.paths.projectLocalConfig),
2444
2478
  this.readJson(this.paths.inProjectConfig)
2445
2479
  ]);
2446
- cfg = deepMerge(cfg, global);
2447
- cfg = deepMerge(cfg, local);
2448
- cfg = deepMerge(cfg, inProject);
2480
+ cfg = deepMerge2(cfg, global);
2481
+ cfg = deepMerge2(cfg, local);
2482
+ cfg = deepMerge2(cfg, inProject);
2449
2483
  for (const [key, fn] of Object.entries(ENV_MAP)) {
2450
2484
  const v = process.env[key];
2451
2485
  if (v) fn(cfg, v);
@@ -2459,14 +2493,14 @@ var DefaultConfigLoader = class {
2459
2493
  try {
2460
2494
  const patch = await src.read();
2461
2495
  if (patch && Object.keys(patch).length > 0) {
2462
- cfg = deepMerge(cfg, patch);
2496
+ cfg = deepMerge2(cfg, patch);
2463
2497
  }
2464
2498
  } catch (err) {
2465
2499
  console.warn(`Config source "${src.name}" failed`, err);
2466
2500
  }
2467
2501
  }
2468
2502
  if (opts.cliFlags) {
2469
- cfg = deepMerge(cfg, opts.cliFlags);
2503
+ cfg = deepMerge2(cfg, opts.cliFlags);
2470
2504
  }
2471
2505
  if (this.vault) {
2472
2506
  cfg = decryptConfigSecrets(cfg, this.vault);