@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.
- package/dist/{agent-bridge-r9y6gdn4.d.ts → agent-bridge-BbZU5TPN.d.ts} +1 -1
- package/dist/{agent-subagent-runner-1GeQE_L0.d.ts → agent-subagent-runner-Bsueu0J2.d.ts} +2 -2
- package/dist/{brain-Cp_3GIS2.d.ts → brain-CS_B0vIE.d.ts} +2 -0
- package/dist/coordination/index.d.ts +7 -7
- package/dist/coordination/index.js +143 -6
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +13 -13
- package/dist/defaults/index.js +223 -65
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +6 -6
- package/dist/execution/index.js +143 -6
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +2 -2
- package/dist/{goal-preamble-CYJLg0wk.d.ts → goal-preamble-CbV8pXLD.d.ts} +3 -3
- package/dist/{index-CPweVoFM.d.ts → index-B5wz-GXm.d.ts} +1 -1
- package/dist/{index-BZdezm3g.d.ts → index-CI1hRfPt.d.ts} +2 -2
- package/dist/index.d.ts +22 -22
- package/dist/index.js +233 -70
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +3 -3
- package/dist/infrastructure/index.js +11 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +3 -3
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-Bl5LTvQg.d.ts → mcp-servers-CPERR2De.d.ts} +8 -1
- package/dist/{multi-agent-coordinator-QWEzJDlm.d.ts → multi-agent-coordinator-BSKSFNhv.d.ts} +1 -1
- package/dist/{null-fleet-bus-BUyfqh23.d.ts → null-fleet-bus-CGOez8Le.d.ts} +4 -4
- package/dist/observability/index.d.ts +1 -1
- package/dist/{parallel-eternal-engine-C75QuhAI.d.ts → parallel-eternal-engine-CYoTKjsz.d.ts} +4 -4
- package/dist/{path-resolver-DRjQBkoO.d.ts → path-resolver-DuhlmPil.d.ts} +1 -1
- package/dist/{plan-templates-CkKNPU3I.d.ts → plan-templates-DbH7lg-t.d.ts} +2 -2
- package/dist/{provider-runner-BNpuIyOL.d.ts → provider-runner-Cocq0O9E.d.ts} +1 -1
- package/dist/sdd/index.d.ts +3 -3
- package/dist/sdd/index.js +143 -6
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-DoISxaKO.d.ts → secret-vault-BJDY28ev.d.ts} +7 -1
- package/dist/{secret-vault-BTcC_T5v.d.ts → secret-vault-w8MbUe2Q.d.ts} +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.js +59 -22
- package/dist/security/index.js.map +1 -1
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.js +76 -42
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.js +59 -22
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +65 -1
- package/dist/utils/index.js +61 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -275,6 +275,70 @@ declare function sleep(ms: number): Promise<void>;
|
|
|
275
275
|
*/
|
|
276
276
|
declare function assertNever(x: never, message?: string): never;
|
|
277
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Deep merge utility — safely merges nested objects with configurable
|
|
280
|
+
* conflict resolution, array merging, and prototype-pollution guarding.
|
|
281
|
+
*
|
|
282
|
+
* Used by:
|
|
283
|
+
* - config-loader (config layer merging with primitive-array concatenation)
|
|
284
|
+
* - secret-vault (config patching)
|
|
285
|
+
* - json-path (json_merge tool with prefer-base / prefer-patch semantics)
|
|
286
|
+
*
|
|
287
|
+
* @module utils/deep-merge
|
|
288
|
+
*/
|
|
289
|
+
declare const FORBIDDEN_PROTO_KEYS: Set<string>;
|
|
290
|
+
/** True when every element is a primitive or null (no nested objects/arrays). */
|
|
291
|
+
declare function isPrimitiveArray(a: unknown[]): boolean;
|
|
292
|
+
interface DeepMergeOptions {
|
|
293
|
+
/**
|
|
294
|
+
* Which side wins on collision for scalars and arrays.
|
|
295
|
+
*
|
|
296
|
+
* - `'prefer-patch'` (default): patch value replaces base value.
|
|
297
|
+
* - `'prefer-base'`: base value is kept, patch value is ignored.
|
|
298
|
+
*/
|
|
299
|
+
conflictResolution?: 'prefer-base' | 'prefer-patch';
|
|
300
|
+
/**
|
|
301
|
+
* How to handle array values.
|
|
302
|
+
*
|
|
303
|
+
* - `'replace'` (default): patch array replaces base array entirely.
|
|
304
|
+
* - `'concat-primitives'`: when both values are primitive arrays,
|
|
305
|
+
* they are concatenated and deduped (via Set). Non-primitive
|
|
306
|
+
* arrays still replace the base wholesale.
|
|
307
|
+
*/
|
|
308
|
+
arrayMode?: 'replace' | 'concat-primitives';
|
|
309
|
+
/**
|
|
310
|
+
* Skip prototype-pollution keys (`__proto__`, `constructor`, etc.).
|
|
311
|
+
* Enabled by default. Only disable when you control both inputs
|
|
312
|
+
* and the keyset (e.g. when merging trusted JSON schemas).
|
|
313
|
+
*/
|
|
314
|
+
protectProto?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Optional callback fired when a non-primitive (object) array is
|
|
317
|
+
* replaced wholesale (only relevant with `arrayMode: 'concat-primitives'`).
|
|
318
|
+
* Receives the key name, existing array length, and patch array length.
|
|
319
|
+
* Used by config-loader for debug logging.
|
|
320
|
+
*/
|
|
321
|
+
onNonPrimitiveArrayReplace?: (key: string, existingLen: number, patchLen: number) => void;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Recursively merge `patch` into `base`, returning a new object.
|
|
325
|
+
*
|
|
326
|
+
* - Nested plain objects are merged recursively.
|
|
327
|
+
* - Arrays are handled per `options.arrayMode`.
|
|
328
|
+
* - Scalar collisions are resolved per `options.conflictResolution`.
|
|
329
|
+
* - `null` and non-object values in `patch` replace the base value
|
|
330
|
+
* (unless `conflictResolution` is `'prefer-base'`).
|
|
331
|
+
* - Keys in `base` that are absent from `patch` are preserved.
|
|
332
|
+
* - `FORBIDDEN_PROTO_KEYS` are skipped in the patch (unless
|
|
333
|
+
* `options.protectProto` is set to `false`).
|
|
334
|
+
*
|
|
335
|
+
* The function is generic over `T extends Record<string, unknown>` for
|
|
336
|
+
* callers that pass typed config objects, but the runtime signature
|
|
337
|
+
* also accepts `unknown` inputs (used by the json-path plugin).
|
|
338
|
+
*/
|
|
339
|
+
declare function deepMerge<T extends Record<string, unknown>>(base: T, patch: Record<string, unknown>, options?: DeepMergeOptions): T;
|
|
340
|
+
declare function deepMerge(base: unknown, patch: unknown, options?: DeepMergeOptions): unknown;
|
|
341
|
+
|
|
278
342
|
/**
|
|
279
343
|
* Tool output serialization utilities.
|
|
280
344
|
* Extracted from Agent.executeTools to allow reuse and consistent output handling.
|
|
@@ -517,4 +581,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
517
581
|
*/
|
|
518
582
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
519
583
|
|
|
520
|
-
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
584
|
+
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
package/dist/utils/index.js
CHANGED
|
@@ -823,7 +823,7 @@ function buildChildEnv(optsOrSessionId) {
|
|
|
823
823
|
const passthrough = hasOwn && process.env["WRONGSTACK_CHILD_ENV_PASSTHROUGH"] === "1" || legacyHasOwn && process.env["WRONGSTACK_BASH_ENV_PASSTHROUGH"] === "1";
|
|
824
824
|
if (passthrough && !process.env["CI"]) {
|
|
825
825
|
console.warn(
|
|
826
|
-
"[
|
|
826
|
+
"[agent] WARNING: WRONGSTACK_*_ENV_PASSTHROUGH=1 is active \u2014\n all parent env vars (including API keys) forwarded to child processes.\n Do not use on shared or multi-tenant systems."
|
|
827
827
|
);
|
|
828
828
|
}
|
|
829
829
|
const out = {};
|
|
@@ -862,6 +862,65 @@ function assertNever(x, message) {
|
|
|
862
862
|
);
|
|
863
863
|
}
|
|
864
864
|
|
|
865
|
+
// src/utils/deep-merge.ts
|
|
866
|
+
var FORBIDDEN_PROTO_KEYS = /* @__PURE__ */ new Set([
|
|
867
|
+
"__proto__",
|
|
868
|
+
"constructor",
|
|
869
|
+
"prototype",
|
|
870
|
+
"__defineGetter__",
|
|
871
|
+
"__defineSetter__",
|
|
872
|
+
"__lookupGetter__",
|
|
873
|
+
"__lookupSetter__"
|
|
874
|
+
]);
|
|
875
|
+
function isPrimitiveArray(a) {
|
|
876
|
+
return a.every((v) => v === null || typeof v !== "object" && typeof v !== "function");
|
|
877
|
+
}
|
|
878
|
+
function deepMerge(base, patch, options = {}) {
|
|
879
|
+
const {
|
|
880
|
+
conflictResolution = "prefer-patch",
|
|
881
|
+
arrayMode = "replace",
|
|
882
|
+
protectProto = true,
|
|
883
|
+
onNonPrimitiveArrayReplace
|
|
884
|
+
} = options;
|
|
885
|
+
if (typeof base !== "object" || base === null) {
|
|
886
|
+
return conflictResolution === "prefer-patch" ? patch : base;
|
|
887
|
+
}
|
|
888
|
+
if (typeof patch !== "object" || patch === null) {
|
|
889
|
+
return conflictResolution === "prefer-patch" ? patch : base;
|
|
890
|
+
}
|
|
891
|
+
if (Array.isArray(base) && Array.isArray(patch)) {
|
|
892
|
+
if (arrayMode === "concat-primitives" && isPrimitiveArray(base) && isPrimitiveArray(patch)) {
|
|
893
|
+
return [.../* @__PURE__ */ new Set([...base, ...patch])];
|
|
894
|
+
}
|
|
895
|
+
return conflictResolution === "prefer-patch" ? patch : base;
|
|
896
|
+
}
|
|
897
|
+
if (Array.isArray(base) || Array.isArray(patch)) {
|
|
898
|
+
return conflictResolution === "prefer-patch" ? patch : base;
|
|
899
|
+
}
|
|
900
|
+
const baseObj = base;
|
|
901
|
+
const patchObj = patch;
|
|
902
|
+
const out = { ...baseObj };
|
|
903
|
+
for (const [k, v] of Object.entries(patchObj)) {
|
|
904
|
+
if (protectProto && FORBIDDEN_PROTO_KEYS.has(k)) continue;
|
|
905
|
+
const existing = out[k];
|
|
906
|
+
if (v !== null && typeof v === "object" && !Array.isArray(v) && existing !== null && typeof existing === "object" && !Array.isArray(existing)) {
|
|
907
|
+
out[k] = deepMerge(existing, v, options);
|
|
908
|
+
} else if (Array.isArray(v) && Array.isArray(existing)) {
|
|
909
|
+
if (onNonPrimitiveArrayReplace && !isPrimitiveArray(v)) {
|
|
910
|
+
onNonPrimitiveArrayReplace(k, existing.length, v.length);
|
|
911
|
+
}
|
|
912
|
+
out[k] = deepMerge(existing, v, options);
|
|
913
|
+
} else if (v !== void 0) {
|
|
914
|
+
if (onNonPrimitiveArrayReplace && Array.isArray(v) && !isPrimitiveArray(v)) {
|
|
915
|
+
const existingLen = Array.isArray(existing) ? existing.length : 0;
|
|
916
|
+
onNonPrimitiveArrayReplace(k, existingLen, v.length);
|
|
917
|
+
}
|
|
918
|
+
out[k] = v;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return out;
|
|
922
|
+
}
|
|
923
|
+
|
|
865
924
|
// src/utils/tool-output-serializer.ts
|
|
866
925
|
function createToolOutputSerializer(opts = {}) {
|
|
867
926
|
const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
|
|
@@ -1566,6 +1625,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1566
1625
|
return out;
|
|
1567
1626
|
}
|
|
1568
1627
|
|
|
1569
|
-
export { assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeTaskItemProgress, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
1628
|
+
export { FORBIDDEN_PROTO_KEYS, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeTaskItemProgress, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
1570
1629
|
//# sourceMappingURL=index.js.map
|
|
1571
1630
|
//# sourceMappingURL=index.js.map
|