@wrongstack/core 0.87.0 → 0.89.3
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-C9P_HPez.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
- package/dist/{agent-subagent-runner-2Aq0jOSj.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +477 -476
- package/dist/{events-DnRqXaZ3.d.ts → brain-s9DyD_Vf.d.ts} +185 -92
- package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
- package/dist/{config-_DZ7dN-T.d.ts → config-84VaZpH6.d.ts} +45 -38
- package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
- package/dist/coordination/index.d.ts +16 -17
- package/dist/coordination/index.js +208 -93
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-DEXI4jsl.d.ts → default-config-CXsDvOmP.d.ts} +3 -1
- package/dist/defaults/index.d.ts +32 -34
- package/dist/defaults/index.js +744 -274
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
- package/dist/execution/index.d.ts +18 -19
- package/dist/execution/index.js +79 -64
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +9 -10
- package/dist/extension/index.js +8 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-BNOLadHw.d.ts → index-CqrroYcU.d.ts} +13 -15
- package/dist/{index-N0_c4bHQ.d.ts → index-D3Nax3YU.d.ts} +11 -10
- package/dist/index.d.ts +191 -178
- package/dist/index.js +1419 -526
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -9
- package/dist/infrastructure/index.js +16 -5
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +14 -16
- package/dist/kernel/index.js +17 -0
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
- package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
- package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-D3E5ixAR.d.ts} +3 -3
- package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +8 -6
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
- package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-DllpCVkF.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
- package/dist/{null-fleet-bus-BY0AN-sr.d.ts → null-fleet-bus-BzzciAc4.d.ts} +39 -32
- package/dist/observability/index.d.ts +3 -3
- package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
- package/dist/{parallel-eternal-engine-D402RASp.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +34 -33
- package/dist/{path-resolver-UPFTsDyD.d.ts → path-resolver-B7hgMAVe.d.ts} +3 -3
- package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
- package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
- package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-C1Ad9OjI.d.ts} +73 -73
- package/dist/{plan-templates-DRvPgkfZ.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
- package/dist/{provider-runner-COAJM8tC.d.ts → provider-runner-cqvlB_oS.d.ts} +5 -5
- package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
- package/dist/sdd/index.d.ts +12 -33
- package/dist/sdd/index.js +110 -50
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
- package/dist/security/index.d.ts +4 -5
- package/dist/security/index.js +22 -4
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
- package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-IVzs2GpE.d.ts} +1 -1
- package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
- package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.d.ts} +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +3 -9
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +134 -14
- package/dist/storage/index.js +982 -248
- package/dist/storage/index.js.map +1 -1
- package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
- package/dist/types/index.d.ts +26 -28
- package/dist/types/index.js +62 -37
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.d.ts +7 -0
- package/dist/utils/expect-defined.js +11 -0
- package/dist/utils/expect-defined.js.map +1 -0
- package/dist/utils/index.d.ts +11 -20
- package/dist/utils/index.js +61 -43
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/memory-CEXuo7sz.d.ts +0 -16
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Assert a value is neither null nor undefined. Throws if it is.
|
|
2
|
+
* Useful after optional chaining and indexed access when the
|
|
3
|
+
* control flow guarantees the value exists but TypeScript can't
|
|
4
|
+
* prove it (e.g. after a check on a related field). */
|
|
5
|
+
declare function expectDefined<T>(value: T | null | undefined, label?: string): T;
|
|
6
|
+
|
|
7
|
+
export { expectDefined };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/utils/expect-defined.ts
|
|
2
|
+
function expectDefined(value, label) {
|
|
3
|
+
if (value === null || value === void 0) {
|
|
4
|
+
throw new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { expectDefined };
|
|
10
|
+
//# sourceMappingURL=expect-defined.js.map
|
|
11
|
+
//# sourceMappingURL=expect-defined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/expect-defined.ts"],"names":[],"mappings":";AAIO,SAAS,aAAA,CAAiB,OAA6B,KAAA,EAAmB;AAC/E,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AACzC,IAAA,MAAM,IAAI,KAAA,CAAM,KAAA,GAAQ,CAAA,SAAA,EAAY,KAAK,mBAAmB,8BAA8B,CAAA;AAAA,EAC5F;AACA,EAAA,OAAO,KAAA;AACT","file":"expect-defined.js","sourcesContent":["/** Assert a value is neither null nor undefined. Throws if it is.\n * Useful after optional chaining and indexed access when the\n * control flow guarantees the value exists but TypeScript can't\n * prove it (e.g. after a check on a related field). */\nexport function expectDefined<T>(value: T | null | undefined, label?: string): T {\n if (value === null || value === undefined) {\n throw new Error(label ? `Expected ${label} to be defined` : 'Expected value to be defined');\n }\n return value;\n}\n"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
import {
|
|
1
|
+
import { s as TodoItem, M as Message, J as JSONSchema } from '../context-CNRYfhUv.js';
|
|
2
|
+
export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths } from '../wstack-paths-_lqjzErq.js';
|
|
3
|
+
export { expectDefined } from './expect-defined.js';
|
|
4
|
+
import { a as ModelsDevPayload } from '../models-registry-B6_KfS65.js';
|
|
5
|
+
import { q as CustomModelDefinition } from '../config-84VaZpH6.js';
|
|
5
6
|
|
|
6
7
|
interface AtomicWriteOptions {
|
|
7
8
|
mode?: number | undefined;
|
|
8
9
|
encoding?: BufferEncoding | undefined;
|
|
9
10
|
}
|
|
11
|
+
interface FileLockOptions {
|
|
12
|
+
timeoutMs?: number | undefined;
|
|
13
|
+
staleMs?: number | undefined;
|
|
14
|
+
}
|
|
10
15
|
declare function atomicWrite(targetPath: string, content: string | Uint8Array, opts?: AtomicWriteOptions): Promise<void>;
|
|
11
16
|
declare function ensureDir(dir: string): Promise<void>;
|
|
17
|
+
declare function withFileLock<T>(targetPath: string, fn: () => Promise<T>, opts?: FileLockOptions): Promise<T>;
|
|
12
18
|
|
|
13
19
|
interface SafeParseResult<T> {
|
|
14
20
|
ok: boolean;
|
|
@@ -254,12 +260,6 @@ declare function buildChildEnv(optsOrSessionId?: BuildChildEnvOptions | string):
|
|
|
254
260
|
* and an abortable variant can be introduced without a codebase-wide hunt. */
|
|
255
261
|
declare function sleep(ms: number): Promise<void>;
|
|
256
262
|
|
|
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
|
-
|
|
263
263
|
/**
|
|
264
264
|
* Tool output serialization utilities.
|
|
265
265
|
* Extracted from Agent.executeTools to allow reuse and consistent output handling.
|
|
@@ -429,15 +429,6 @@ interface CompileFail {
|
|
|
429
429
|
}
|
|
430
430
|
declare function compileUserRegex(pattern: string, flags: string): CompileResult | CompileFail;
|
|
431
431
|
|
|
432
|
-
/**
|
|
433
|
-
* Glob pattern → concrete file path expansion.
|
|
434
|
-
*
|
|
435
|
-
* Supports: *, **, ?, [...]
|
|
436
|
-
* Does NOT support brace expansion {a,b}.
|
|
437
|
-
*
|
|
438
|
-
* Returns the input as-is if it contains no glob metacharacters.
|
|
439
|
-
* On Windows, both / and \ are accepted as path separators.
|
|
440
|
-
*/
|
|
441
432
|
/**
|
|
442
433
|
* Resolve `pattern` to the set of concrete file paths it matches.
|
|
443
434
|
* Literal paths (no glob chars) are returned as-is.
|
|
@@ -501,4 +492,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
501
492
|
*/
|
|
502
493
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
503
494
|
|
|
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,
|
|
495
|
+
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, 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, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
package/dist/utils/index.js
CHANGED
|
@@ -46,6 +46,49 @@ async function atomicWrite(targetPath, content, opts = {}) {
|
|
|
46
46
|
async function ensureDir(dir) {
|
|
47
47
|
await fs.mkdir(dir, { recursive: true });
|
|
48
48
|
}
|
|
49
|
+
async function withFileLock(targetPath, fn, opts = {}) {
|
|
50
|
+
const dir = path2.dirname(targetPath);
|
|
51
|
+
await fs.mkdir(dir, { recursive: true });
|
|
52
|
+
const lockPath = path2.join(dir, `.${path2.basename(targetPath)}.lock`);
|
|
53
|
+
const timeoutMs = opts.timeoutMs ?? 5e3;
|
|
54
|
+
const staleMs = opts.staleMs ?? 3e4;
|
|
55
|
+
const started = Date.now();
|
|
56
|
+
let handle;
|
|
57
|
+
for (; ; ) {
|
|
58
|
+
try {
|
|
59
|
+
handle = await fs.open(lockPath, "wx");
|
|
60
|
+
await handle.writeFile(`${process.pid}:${Date.now()}`);
|
|
61
|
+
break;
|
|
62
|
+
} catch (err) {
|
|
63
|
+
if (err.code !== "EEXIST") throw err;
|
|
64
|
+
try {
|
|
65
|
+
const stat3 = await fs.stat(lockPath);
|
|
66
|
+
if (Date.now() - stat3.mtimeMs > staleMs) {
|
|
67
|
+
await fs.unlink(lockPath);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (Date.now() - started >= timeoutMs) {
|
|
74
|
+
throw new Error(`Timed out waiting for file lock: ${targetPath}`);
|
|
75
|
+
}
|
|
76
|
+
await new Promise((resolve3) => setTimeout(resolve3, 25));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return await fn();
|
|
81
|
+
} finally {
|
|
82
|
+
try {
|
|
83
|
+
await handle?.close();
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await fs.unlink(lockPath);
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
49
92
|
var TRANSIENT_RENAME_CODES = /* @__PURE__ */ new Set(["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"]);
|
|
50
93
|
async function renameWithRetry(from, to) {
|
|
51
94
|
if (process.platform !== "win32") {
|
|
@@ -269,10 +312,15 @@ function writeErr(s, stream = process.stderr) {
|
|
|
269
312
|
|
|
270
313
|
// src/utils/color.ts
|
|
271
314
|
var isColorTty = () => {
|
|
272
|
-
if (process.env.NO_COLOR) return false;
|
|
273
|
-
if (process.env.FORCE_COLOR) return true;
|
|
315
|
+
if (envFlag(process.env.NO_COLOR)) return false;
|
|
316
|
+
if (envFlag(process.env.FORCE_COLOR)) return true;
|
|
274
317
|
return isStdoutTTY();
|
|
275
318
|
};
|
|
319
|
+
function envFlag(value) {
|
|
320
|
+
if (value === void 0) return false;
|
|
321
|
+
if (value.trim() === "") return false;
|
|
322
|
+
return !/^(0|false|no|off)$/i.test(value.trim());
|
|
323
|
+
}
|
|
276
324
|
var COLOR = isColorTty();
|
|
277
325
|
var wrap = (open2, close) => (s) => COLOR ? `\x1B[${open2}m${s}\x1B[${close}m` : s;
|
|
278
326
|
var color = {
|
|
@@ -316,13 +364,15 @@ function formatTodosList(todos) {
|
|
|
316
364
|
return lines.join("\n");
|
|
317
365
|
}
|
|
318
366
|
|
|
319
|
-
// src/utils/
|
|
320
|
-
function expectDefined(value) {
|
|
367
|
+
// src/utils/expect-defined.ts
|
|
368
|
+
function expectDefined(value, label) {
|
|
321
369
|
if (value === null || value === void 0) {
|
|
322
|
-
throw new Error("Expected value to be defined");
|
|
370
|
+
throw new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
323
371
|
}
|
|
324
372
|
return value;
|
|
325
373
|
}
|
|
374
|
+
|
|
375
|
+
// src/utils/glob-match.ts
|
|
326
376
|
function escapeRegex(s) {
|
|
327
377
|
return s.replace(/[.+^${}()|\\]/g, "\\$&");
|
|
328
378
|
}
|
|
@@ -695,14 +745,6 @@ function sleep(ms) {
|
|
|
695
745
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
696
746
|
}
|
|
697
747
|
|
|
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
|
-
|
|
706
748
|
// src/utils/tool-output-serializer.ts
|
|
707
749
|
function createToolOutputSerializer(opts = {}) {
|
|
708
750
|
const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
|
|
@@ -748,12 +790,6 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
748
790
|
}
|
|
749
791
|
|
|
750
792
|
// src/utils/token-estimate.ts
|
|
751
|
-
function expectDefined3(value) {
|
|
752
|
-
if (value === null || value === void 0) {
|
|
753
|
-
throw new Error("Expected value to be defined");
|
|
754
|
-
}
|
|
755
|
-
return value;
|
|
756
|
-
}
|
|
757
793
|
var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
|
|
758
794
|
var _cal = {
|
|
759
795
|
ratio: 1,
|
|
@@ -774,7 +810,7 @@ function getCachedEstimate(key, compute) {
|
|
|
774
810
|
if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
|
|
775
811
|
const keys = [...ESTIMATE_CACHE.keys()];
|
|
776
812
|
for (let i = 0; i < Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4); i++) {
|
|
777
|
-
ESTIMATE_CACHE.delete(
|
|
813
|
+
ESTIMATE_CACHE.delete(expectDefined(keys[i]));
|
|
778
814
|
}
|
|
779
815
|
}
|
|
780
816
|
const estimate = compute();
|
|
@@ -887,12 +923,6 @@ function resetCalibration() {
|
|
|
887
923
|
}
|
|
888
924
|
|
|
889
925
|
// src/utils/message-invariants.ts
|
|
890
|
-
function expectDefined4(value) {
|
|
891
|
-
if (value === null || value === void 0) {
|
|
892
|
-
throw new Error("Expected value to be defined");
|
|
893
|
-
}
|
|
894
|
-
return value;
|
|
895
|
-
}
|
|
896
926
|
function repairToolUseAdjacency(messages) {
|
|
897
927
|
const removedToolUses = [];
|
|
898
928
|
const removedToolResults = [];
|
|
@@ -900,7 +930,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
900
930
|
let changed = false;
|
|
901
931
|
const out = [];
|
|
902
932
|
for (let i = 0; i < messages.length; i++) {
|
|
903
|
-
const original =
|
|
933
|
+
const original = expectDefined(messages[i]);
|
|
904
934
|
let msg = original;
|
|
905
935
|
if (hasToolUse(msg)) {
|
|
906
936
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -1113,12 +1143,6 @@ function compileUserRegex(pattern, flags) {
|
|
|
1113
1143
|
};
|
|
1114
1144
|
}
|
|
1115
1145
|
}
|
|
1116
|
-
function expectDefined5(value) {
|
|
1117
|
-
if (value === null || value === void 0) {
|
|
1118
|
-
throw new Error("Expected value to be defined");
|
|
1119
|
-
}
|
|
1120
|
-
return value;
|
|
1121
|
-
}
|
|
1122
1146
|
var GLOB_CHARS = /* @__PURE__ */ new Set(["*", "?", "["]);
|
|
1123
1147
|
var IS_WINDOWS = process.platform === "win32";
|
|
1124
1148
|
var SEP = IS_WINDOWS ? "\\" : "/";
|
|
@@ -1132,7 +1156,7 @@ function globToRegex(pat) {
|
|
|
1132
1156
|
let i = 0;
|
|
1133
1157
|
let re = "^";
|
|
1134
1158
|
while (i < pat.length) {
|
|
1135
|
-
const c =
|
|
1159
|
+
const c = expectDefined(pat[i]);
|
|
1136
1160
|
if (c === "*") {
|
|
1137
1161
|
if (pat[i + 1] === "*") {
|
|
1138
1162
|
re += ".*";
|
|
@@ -1171,7 +1195,7 @@ function globToRegex(pat) {
|
|
|
1171
1195
|
}
|
|
1172
1196
|
function baseDir(pat) {
|
|
1173
1197
|
let i = pat.length - 1;
|
|
1174
|
-
while (i >= 0 && !GLOB_CHARS.has(
|
|
1198
|
+
while (i >= 0 && !GLOB_CHARS.has(expectDefined(pat[i])) && pat[i] !== SEP && pat[i] !== "/") i--;
|
|
1175
1199
|
const cut = i >= 0 ? pat.lastIndexOf(SEP, i) : pat.lastIndexOf("/", i);
|
|
1176
1200
|
return cut < 0 ? "." : pat.slice(0, cut);
|
|
1177
1201
|
}
|
|
@@ -1236,12 +1260,6 @@ async function expandGlob(pattern) {
|
|
|
1236
1260
|
}
|
|
1237
1261
|
|
|
1238
1262
|
// src/utils/json-repair.ts
|
|
1239
|
-
function expectDefined6(value) {
|
|
1240
|
-
if (value === null || value === void 0) {
|
|
1241
|
-
throw new Error("Expected value to be defined");
|
|
1242
|
-
}
|
|
1243
|
-
return value;
|
|
1244
|
-
}
|
|
1245
1263
|
function completePartialObject(s) {
|
|
1246
1264
|
if (!s.trim().startsWith("{")) return s;
|
|
1247
1265
|
if (tryParse(s).ok) return s;
|
|
@@ -1253,7 +1271,7 @@ function completePartialObject(s) {
|
|
|
1253
1271
|
let contentEnd = 0;
|
|
1254
1272
|
let stringBraceDepth = 0;
|
|
1255
1273
|
for (let i = 0; i < s.length; i++) {
|
|
1256
|
-
const ch =
|
|
1274
|
+
const ch = expectDefined(s[i]);
|
|
1257
1275
|
if (inString) {
|
|
1258
1276
|
contentEnd = i + 1;
|
|
1259
1277
|
if (escaped) {
|
|
@@ -1410,6 +1428,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1410
1428
|
return out;
|
|
1411
1429
|
}
|
|
1412
1430
|
|
|
1413
|
-
export { atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob,
|
|
1431
|
+
export { 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, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
1414
1432
|
//# sourceMappingURL=index.js.map
|
|
1415
1433
|
//# sourceMappingURL=index.js.map
|