@wrongstack/core 0.267.0 → 0.268.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 (74) hide show
  1. package/dist/{agent-bridge-STJ3JwwK.d.ts → agent-bridge-UhojbpWx.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CzPGP3jA.d.ts → agent-subagent-runner-Bvtf1o9K.d.ts} +7 -7
  3. package/dist/{brain-Cdg77tVN.d.ts → brain-69wzMKp1.d.ts} +1 -1
  4. package/dist/{compactor-iMZ84CXq.d.ts → compactor-CBQAJoDc.d.ts} +1 -1
  5. package/dist/{config-Du3pYYln.d.ts → config-VKfOZ-6X.d.ts} +70 -2
  6. package/dist/{context-dT5Ueund.d.ts → context-C0U8B9NF.d.ts} +24 -1
  7. package/dist/coordination/index.d.ts +56 -160
  8. package/dist/coordination/index.js +333 -63
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +94 -68
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +151 -36
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -6
  18. package/dist/global-mailbox-KByEFFBa.d.ts +663 -0
  19. package/dist/{goal-preamble-SulMTowG.d.ts → goal-preamble-CrYjmdw4.d.ts} +9 -9
  20. package/dist/{goal-store-CABDwdFE.d.ts → goal-store-Y_zdLZ3q.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +195 -0
  22. package/dist/hq/index.js +1884 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/{index-IEuxQd-E.d.ts → index-BfaS-f_m.d.ts} +2 -2
  25. package/dist/{index-DtCVWel4.d.ts → index-CtQnmkaS.d.ts} +8 -8
  26. package/dist/{index-Bms0m4oy.d.ts → index-gCv830d7.d.ts} +5 -5
  27. package/dist/index.d.ts +46 -42
  28. package/dist/index.js +2955 -1498
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +45 -18
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/{pipeline-BfD2k1rT.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  35. package/dist/{mcp-servers-C2cBTxUR.d.ts → mcp-servers-HT3Fi7Bl.d.ts} +10 -4
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +3 -2
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BqGZNJQ-.d.ts → models-registry-Bvcl3Vaa.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-B8R43uPz.d.ts → multi-agent-coordinator-BACjsmkC.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-CnXa5oTH.d.ts → null-fleet-bus-DA7fvhUg.d.ts} +6 -6
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-DdNnw9BQ.d.ts → parallel-eternal-engine-Ci71gYu_.d.ts} +9 -15
  44. package/dist/{path-resolver-COIMLCQL.d.ts → path-resolver-O1IJnmKE.d.ts} +4 -3
  45. package/dist/{permission-B75JAi3-.d.ts → permission-Bd-57Lbl.d.ts} +1 -1
  46. package/dist/{permission-policy-DlR9eJAM.d.ts → permission-policy-uNXC6Kge.d.ts} +2 -3
  47. package/dist/pipeline-BDNvENyV.d.ts +245 -0
  48. package/dist/{plan-templates-DSIKCXZN.d.ts → plan-templates-EMsalEtN.d.ts} +5 -5
  49. package/dist/{provider-model-resolve-BNRsNuJx.d.ts → provider-model-resolve-CEb9x886.d.ts} +3 -3
  50. package/dist/{provider-runner-CX7iIvox.d.ts → provider-runner-DWJbpo70.d.ts} +3 -3
  51. package/dist/{retry-policy-BilV1ujH.d.ts → retry-policy-C3s_lvdK.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +9 -8
  53. package/dist/sdd/index.js +32 -2
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/{secret-vault-gkvEZZfE.d.ts → secret-vault-Cgduf5xL.d.ts} +1 -1
  56. package/dist/security/index.d.ts +5 -5
  57. package/dist/security/index.js +39 -29
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-Bc7eWtT3.d.ts → selector-47LBnBVk.d.ts} +1 -1
  60. package/dist/{session-event-bridge-D-araDEz.d.ts → session-event-bridge-Cw7oqmW2.d.ts} +1 -1
  61. package/dist/{session-reader-D7Dapswh.d.ts → session-reader-DD4v2Obw.d.ts} +1 -1
  62. package/dist/storage/index.d.ts +14 -12
  63. package/dist/storage/index.js +63 -36
  64. package/dist/storage/index.js.map +1 -1
  65. package/dist/tools/index.d.ts +2 -2
  66. package/dist/tools/index.js +166 -31
  67. package/dist/tools/index.js.map +1 -1
  68. package/dist/types/index.d.ts +20 -19
  69. package/dist/types/index.js +68 -51
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/utils/index.d.ts +22 -3
  72. package/dist/utils/index.js +139 -1
  73. package/dist/utils/index.js.map +1 -1
  74. package/package.json +5 -1
@@ -1,8 +1,8 @@
1
- import { C as Context, w as ContextEvidenceState, k as ToolOutputMetadata, J as JSONSchema, M as Message, t as TodoItem } from '../context-dT5Ueund.js';
1
+ import { C as Context, z as ContextEvidenceState, k as ToolOutputMetadata, J as JSONSchema, M as Message, w as TodoItem } from '../context-C0U8B9NF.js';
2
2
  export { H as HttpDispatcher, a as HttpsAgentAsDispatcher } from '../dispatcher-types.d-BBeXBQgS.js';
3
3
  export { toErrorMessage } from './error.js';
4
4
  export { expectDefined } from './expect-defined.js';
5
- import { v as CustomModelDefinition, a as ModelsDevPayload } from '../config-Du3pYYln.js';
5
+ import { v as CustomModelDefinition, a as ModelsDevPayload } from '../config-VKfOZ-6X.js';
6
6
  export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from '../task-format-vGOIftmK.js';
7
7
  export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-hOpNLmvf.js';
8
8
  export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-u1q9Jkyk.js';
@@ -87,6 +87,20 @@ declare const color: {
87
87
  };
88
88
  declare function stripAnsi(s: string): string;
89
89
 
90
+ type JsonObject = Record<string, unknown>;
91
+ type JsonPathSegment = string | number;
92
+ type JsonPath = readonly JsonPathSegment[];
93
+ declare function readJsonObjectFile(filePath: string): Promise<JsonObject>;
94
+ declare function jsonObjectFileExists(filePath: string): Promise<boolean>;
95
+ declare function writeJsonObjectFile(filePath: string, value: JsonObject): Promise<void>;
96
+ declare function updateJsonObjectFile(filePath: string, mutator: (config: JsonObject) => void | JsonObject | Promise<void | JsonObject>): Promise<JsonObject>;
97
+ declare function getJsonPath(root: unknown, path: JsonPath): unknown;
98
+ declare function setJsonPath(root: JsonObject, path: JsonPath, value: unknown): JsonObject;
99
+ declare function removeJsonPath(root: JsonObject, path: JsonPath): boolean;
100
+ declare function setJsonPathInFile(filePath: string, path: JsonPath, value: unknown): Promise<JsonObject>;
101
+ declare function removeJsonPathInFile(filePath: string, path: JsonPath): Promise<JsonObject>;
102
+ declare function isJsonObject(value: unknown): value is JsonObject;
103
+
90
104
  declare function createContextEvidenceState(): ContextEvidenceState;
91
105
  interface RecordToolOutputEvidenceInput {
92
106
  toolUseId: string;
@@ -529,6 +543,11 @@ declare function writeErr(s: string, stream?: NodeJS.WriteStream): boolean;
529
543
  */
530
544
  declare function formatTodosList(todos: TodoItem[]): string;
531
545
 
546
+ declare function escapeGlobSubject(value: string): string;
547
+ declare function normalizePathSubject(value: string): string;
548
+ declare function isPathSubjectKey(subjectKey: string): boolean;
549
+ declare function subjectForToolInput(toolName: string, input: unknown, subjectKey?: string): string | undefined;
550
+
532
551
  /**
533
552
  * Estimate tokens for a tool_use block input.
534
553
  * Caches the stringified result keyed by the stable string representation
@@ -688,4 +707,4 @@ interface CompactWireToolDefinition {
688
707
  declare function compactToolDefinitionForWire(tool: ToolWireDefinitionLike, opts?: CompactToolDefinitionForWireOptions): CompactWireToolDefinition;
689
708
  declare function compactSchemaDescriptions(schema: unknown, maxDescriptionChars?: number): Record<string, unknown>;
690
709
 
691
- export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompactToolDefinitionForWireOptions, type CompactWireToolDefinition, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RecordToolOutputEvidenceInput, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type ToolWireDefinitionLike, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, recordToolOutputEvidence, recordUserIntentEvidence, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
710
+ export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompactToolDefinitionForWireOptions, type CompactWireToolDefinition, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type JsonObject, type JsonPath, type JsonPathSegment, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RecordToolOutputEvidenceInput, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type ToolWireDefinitionLike, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatTodosList, getCalibrationState, getJsonPath, getTermSize, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, onResize, readJsonObjectFile, recordActualUsage, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, sleep, stripAnsi, subjectForToolInput, toStyle, truncate, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut };
@@ -322,6 +322,109 @@ function stripAnsi(s) {
322
322
  ""
323
323
  );
324
324
  }
325
+ async function readJsonObjectFile(filePath) {
326
+ try {
327
+ const parsed = JSON.parse(await fs.readFile(filePath, "utf8"));
328
+ return isJsonObject(parsed) ? parsed : {};
329
+ } catch {
330
+ return {};
331
+ }
332
+ }
333
+ async function jsonObjectFileExists(filePath) {
334
+ try {
335
+ await fs.access(filePath);
336
+ return true;
337
+ } catch {
338
+ return false;
339
+ }
340
+ }
341
+ async function writeJsonObjectFile(filePath, value) {
342
+ await atomicWrite(filePath, JSON.stringify(value, null, 2), { mode: 384 });
343
+ }
344
+ async function updateJsonObjectFile(filePath, mutator) {
345
+ const config = await readJsonObjectFile(filePath);
346
+ const maybeNext = await mutator(config);
347
+ const next = maybeNext && isJsonObject(maybeNext) ? maybeNext : config;
348
+ await writeJsonObjectFile(filePath, next);
349
+ return next;
350
+ }
351
+ function getJsonPath(root, path4) {
352
+ let current = root;
353
+ for (const segment of path4) {
354
+ if (typeof segment === "number") {
355
+ if (!Array.isArray(current)) return void 0;
356
+ current = current[segment];
357
+ continue;
358
+ }
359
+ if (!isJsonObject(current)) return void 0;
360
+ current = current[segment];
361
+ }
362
+ return current;
363
+ }
364
+ function setJsonPath(root, path4, value) {
365
+ if (path4.length === 0) {
366
+ if (!isJsonObject(value)) throw new Error("Root config value must be an object");
367
+ return value;
368
+ }
369
+ const parent = ensureJsonParent(root, path4);
370
+ const leaf = lastPathSegment(path4);
371
+ if (typeof leaf === "number") {
372
+ if (!Array.isArray(parent)) throw new Error(`Cannot set numeric segment ${leaf} on non-array parent`);
373
+ parent[leaf] = value;
374
+ } else {
375
+ if (!isJsonObject(parent)) throw new Error(`Cannot set property ${leaf} on non-object parent`);
376
+ parent[leaf] = value;
377
+ }
378
+ return root;
379
+ }
380
+ function removeJsonPath(root, path4) {
381
+ if (path4.length === 0) return false;
382
+ const parent = getJsonPath(root, path4.slice(0, -1));
383
+ const leaf = lastPathSegment(path4);
384
+ if (typeof leaf === "number") {
385
+ if (!Array.isArray(parent) || leaf < 0 || leaf >= parent.length) return false;
386
+ parent.splice(leaf, 1);
387
+ return true;
388
+ }
389
+ if (!isJsonObject(parent) || !(leaf in parent)) return false;
390
+ delete parent[leaf];
391
+ return true;
392
+ }
393
+ async function setJsonPathInFile(filePath, path4, value) {
394
+ return updateJsonObjectFile(filePath, (config) => setJsonPath(config, path4, value));
395
+ }
396
+ async function removeJsonPathInFile(filePath, path4) {
397
+ return updateJsonObjectFile(filePath, (config) => {
398
+ removeJsonPath(config, path4);
399
+ });
400
+ }
401
+ function isJsonObject(value) {
402
+ return typeof value === "object" && value !== null && !Array.isArray(value);
403
+ }
404
+ function lastPathSegment(path4) {
405
+ const segment = path4[path4.length - 1];
406
+ if (segment === void 0) throw new Error("Invalid empty JSON path");
407
+ return segment;
408
+ }
409
+ function ensureJsonParent(root, path4) {
410
+ let current = root;
411
+ for (let i = 0; i < path4.length - 1; i += 1) {
412
+ const segment = path4[i];
413
+ const nextSegment = path4[i + 1];
414
+ if (segment === void 0) throw new Error("Invalid empty JSON path segment");
415
+ const nextContainer = typeof nextSegment === "number" ? [] : {};
416
+ if (typeof segment === "number") {
417
+ if (!Array.isArray(current)) throw new Error(`Cannot traverse numeric segment ${segment} on non-array parent`);
418
+ if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;
419
+ current = current[segment];
420
+ } else {
421
+ if (!isJsonObject(current)) throw new Error(`Cannot traverse property ${segment} on non-object parent`);
422
+ if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;
423
+ current = current[segment];
424
+ }
425
+ }
426
+ return current;
427
+ }
325
428
  var MAX_TOOL_CALLS = 80;
326
429
  var MAX_FACTS = 40;
327
430
  var MAX_ERRORS = 20;
@@ -1818,6 +1921,41 @@ function formatTodosList(todos) {
1818
1921
  return lines.join("\n");
1819
1922
  }
1820
1923
 
1924
+ // src/utils/tool-subject.ts
1925
+ var GLOB_METACHARACTERS = /[*?[\]]/g;
1926
+ function escapeGlobSubject(value) {
1927
+ return value.replace(GLOB_METACHARACTERS, (char) => `\\${char}`);
1928
+ }
1929
+ function normalizePathSubject(value) {
1930
+ return escapeGlobSubject(value.replace(/\\/g, "/"));
1931
+ }
1932
+ function isPathSubjectKey(subjectKey) {
1933
+ return subjectKey === "path" || subjectKey === "file" || subjectKey === "files";
1934
+ }
1935
+ function subjectForToolInput(toolName, input, subjectKey) {
1936
+ if (!input || typeof input !== "object") return void 0;
1937
+ const obj = input;
1938
+ if (subjectKey) {
1939
+ const value = obj[subjectKey];
1940
+ if (typeof value === "string") {
1941
+ return isPathSubjectKey(subjectKey) ? normalizePathSubject(value) : escapeGlobSubject(value);
1942
+ }
1943
+ }
1944
+ if (toolName === "bash" && typeof obj.command === "string") {
1945
+ return escapeGlobSubject(obj.command);
1946
+ }
1947
+ if (typeof obj.path === "string") {
1948
+ return normalizePathSubject(obj.path);
1949
+ }
1950
+ if (typeof obj.url === "string") {
1951
+ return escapeGlobSubject(obj.url);
1952
+ }
1953
+ if (typeof obj.name === "string") {
1954
+ return escapeGlobSubject(obj.name);
1955
+ }
1956
+ return void 0;
1957
+ }
1958
+
1821
1959
  // src/utils/tool-wire-compact.ts
1822
1960
  var TOOL_DESCRIPTION_MAX_CHARS = 640;
1823
1961
  var SCHEMA_DESCRIPTION_MAX_CHARS = 180;
@@ -2753,6 +2891,6 @@ function resolveWstackPaths(opts) {
2753
2891
  };
2754
2892
  }
2755
2893
 
2756
- export { FORBIDDEN_PROTO_KEYS, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, recordToolOutputEvidence, recordUserIntentEvidence, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toErrorMessage, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut, wstackGlobalRoot };
2894
+ export { FORBIDDEN_PROTO_KEYS, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getJsonPath, getTermSize, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, onResize, projectHash, projectSlug, readJsonObjectFile, recordActualUsage, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, sleep, stripAnsi, subjectForToolInput, toErrorMessage, toStyle, truncate, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut, wstackGlobalRoot };
2757
2895
  //# sourceMappingURL=index.js.map
2758
2896
  //# sourceMappingURL=index.js.map