@wrongstack/core 0.82.6 → 0.84.1
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/defaults/index.d.ts +1 -1
- package/dist/defaults/index.js +15 -15
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.js +6 -7
- package/dist/execution/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +84 -78
- package/dist/index.js.map +1 -1
- package/dist/{secret-scrubber-7rSC_emZ.d.ts → secret-scrubber-yGBFQYju.d.ts} +10 -2
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +8 -7
- package/dist/security/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +8 -7
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +12 -1
- package/dist/utils/index.js +23 -10
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -249,6 +249,17 @@ interface BuildChildEnvOptions {
|
|
|
249
249
|
*/
|
|
250
250
|
declare function buildChildEnv(optsOrSessionId?: BuildChildEnvOptions | string): NodeJS.ProcessEnv;
|
|
251
251
|
|
|
252
|
+
/** Resolve a promise after `ms` milliseconds. Prefer this over raw
|
|
253
|
+
* `setTimeout` wrappers so all delay sites use a single implementation
|
|
254
|
+
* and an abortable variant can be introduced without a codebase-wide hunt. */
|
|
255
|
+
declare function sleep(ms: number): Promise<void>;
|
|
256
|
+
|
|
257
|
+
/** Assert a value is neither null nor undefined. Throws if it is.
|
|
258
|
+
* Useful after optional chaining and indexed access when the
|
|
259
|
+
* control flow guarantees the value exists but TypeScript can't
|
|
260
|
+
* prove it (e.g. after a check on a related field). */
|
|
261
|
+
declare function expectDefined<T>(value: T | null | undefined): T;
|
|
262
|
+
|
|
252
263
|
/**
|
|
253
264
|
* Tool output serialization utilities.
|
|
254
265
|
* Extracted from Agent.executeTools to allow reuse and consistent output handling.
|
|
@@ -490,4 +501,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
490
501
|
*/
|
|
491
502
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
492
503
|
|
|
493
|
-
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, 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, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, writeErr, writeOut };
|
|
504
|
+
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, 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, writeErr, writeOut };
|
package/dist/utils/index.js
CHANGED
|
@@ -690,6 +690,19 @@ function buildChildEnv(optsOrSessionId) {
|
|
|
690
690
|
return out;
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
+
// src/utils/sleep.ts
|
|
694
|
+
function sleep(ms) {
|
|
695
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// src/utils/expect-defined.ts
|
|
699
|
+
function expectDefined2(value) {
|
|
700
|
+
if (value === null || value === void 0) {
|
|
701
|
+
throw new Error("Expected value to be defined");
|
|
702
|
+
}
|
|
703
|
+
return value;
|
|
704
|
+
}
|
|
705
|
+
|
|
693
706
|
// src/utils/tool-output-serializer.ts
|
|
694
707
|
function createToolOutputSerializer(opts = {}) {
|
|
695
708
|
const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
|
|
@@ -735,7 +748,7 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
735
748
|
}
|
|
736
749
|
|
|
737
750
|
// src/utils/token-estimate.ts
|
|
738
|
-
function
|
|
751
|
+
function expectDefined3(value) {
|
|
739
752
|
if (value === null || value === void 0) {
|
|
740
753
|
throw new Error("Expected value to be defined");
|
|
741
754
|
}
|
|
@@ -761,7 +774,7 @@ function getCachedEstimate(key, compute) {
|
|
|
761
774
|
if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
|
|
762
775
|
const keys = [...ESTIMATE_CACHE.keys()];
|
|
763
776
|
for (let i = 0; i < Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4); i++) {
|
|
764
|
-
ESTIMATE_CACHE.delete(
|
|
777
|
+
ESTIMATE_CACHE.delete(expectDefined3(keys[i]));
|
|
765
778
|
}
|
|
766
779
|
}
|
|
767
780
|
const estimate = compute();
|
|
@@ -874,7 +887,7 @@ function resetCalibration() {
|
|
|
874
887
|
}
|
|
875
888
|
|
|
876
889
|
// src/utils/message-invariants.ts
|
|
877
|
-
function
|
|
890
|
+
function expectDefined4(value) {
|
|
878
891
|
if (value === null || value === void 0) {
|
|
879
892
|
throw new Error("Expected value to be defined");
|
|
880
893
|
}
|
|
@@ -887,7 +900,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
887
900
|
let changed = false;
|
|
888
901
|
const out = [];
|
|
889
902
|
for (let i = 0; i < messages.length; i++) {
|
|
890
|
-
const original =
|
|
903
|
+
const original = expectDefined4(messages[i]);
|
|
891
904
|
let msg = original;
|
|
892
905
|
if (hasToolUse(msg)) {
|
|
893
906
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -1100,7 +1113,7 @@ function compileUserRegex(pattern, flags) {
|
|
|
1100
1113
|
};
|
|
1101
1114
|
}
|
|
1102
1115
|
}
|
|
1103
|
-
function
|
|
1116
|
+
function expectDefined5(value) {
|
|
1104
1117
|
if (value === null || value === void 0) {
|
|
1105
1118
|
throw new Error("Expected value to be defined");
|
|
1106
1119
|
}
|
|
@@ -1119,7 +1132,7 @@ function globToRegex(pat) {
|
|
|
1119
1132
|
let i = 0;
|
|
1120
1133
|
let re = "^";
|
|
1121
1134
|
while (i < pat.length) {
|
|
1122
|
-
const c =
|
|
1135
|
+
const c = expectDefined5(pat[i]);
|
|
1123
1136
|
if (c === "*") {
|
|
1124
1137
|
if (pat[i + 1] === "*") {
|
|
1125
1138
|
re += ".*";
|
|
@@ -1158,7 +1171,7 @@ function globToRegex(pat) {
|
|
|
1158
1171
|
}
|
|
1159
1172
|
function baseDir(pat) {
|
|
1160
1173
|
let i = pat.length - 1;
|
|
1161
|
-
while (i >= 0 && !GLOB_CHARS.has(
|
|
1174
|
+
while (i >= 0 && !GLOB_CHARS.has(expectDefined5(pat[i])) && pat[i] !== SEP && pat[i] !== "/") i--;
|
|
1162
1175
|
const cut = i >= 0 ? pat.lastIndexOf(SEP, i) : pat.lastIndexOf("/", i);
|
|
1163
1176
|
return cut < 0 ? "." : pat.slice(0, cut);
|
|
1164
1177
|
}
|
|
@@ -1223,7 +1236,7 @@ async function expandGlob(pattern) {
|
|
|
1223
1236
|
}
|
|
1224
1237
|
|
|
1225
1238
|
// src/utils/json-repair.ts
|
|
1226
|
-
function
|
|
1239
|
+
function expectDefined6(value) {
|
|
1227
1240
|
if (value === null || value === void 0) {
|
|
1228
1241
|
throw new Error("Expected value to be defined");
|
|
1229
1242
|
}
|
|
@@ -1240,7 +1253,7 @@ function completePartialObject(s) {
|
|
|
1240
1253
|
let contentEnd = 0;
|
|
1241
1254
|
let stringBraceDepth = 0;
|
|
1242
1255
|
for (let i = 0; i < s.length; i++) {
|
|
1243
|
-
const ch =
|
|
1256
|
+
const ch = expectDefined6(s[i]);
|
|
1244
1257
|
if (inString) {
|
|
1245
1258
|
contentEnd = i + 1;
|
|
1246
1259
|
if (escaped) {
|
|
@@ -1397,6 +1410,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1397
1410
|
return out;
|
|
1398
1411
|
}
|
|
1399
1412
|
|
|
1400
|
-
export { atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, writeErr, writeOut };
|
|
1413
|
+
export { atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined2 as expectDefined, 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, writeErr, writeOut };
|
|
1401
1414
|
//# sourceMappingURL=index.js.map
|
|
1402
1415
|
//# sourceMappingURL=index.js.map
|