@wrongstack/core 0.84.1 → 0.89.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/{agent-bridge-C9P_HPez.d.ts → agent-bridge-B8F2ORwg.d.ts} +1 -1
- package/dist/{agent-subagent-runner-2Aq0jOSj.d.ts → agent-subagent-runner-CQaLFNnA.d.ts} +3 -2
- package/dist/coordination/index.d.ts +7 -7
- package/dist/coordination/index.js +183 -56
- 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 +10 -10
- package/dist/defaults/index.js +268 -68
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-DnRqXaZ3.d.ts → events-DzyLtja6.d.ts} +6 -0
- package/dist/execution/index.d.ts +5 -5
- package/dist/execution/index.js +56 -19
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +2 -2
- package/dist/{index-BNOLadHw.d.ts → index-Ca_lOmKl.d.ts} +2 -2
- package/dist/{index-N0_c4bHQ.d.ts → index-Dx-CnrDN.d.ts} +3 -1
- package/dist/index.d.ts +24 -21
- package/dist/index.js +448 -179
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +2 -2
- package/dist/infrastructure/index.js +12 -3
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +3 -3
- package/dist/kernel/index.js +17 -0
- package/dist/kernel/index.js.map +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-coordinator-DllpCVkF.d.ts → multi-agent-coordinator-Da9nd8Ic.d.ts} +1 -1
- package/dist/{null-fleet-bus-BY0AN-sr.d.ts → null-fleet-bus-CHJOXv3t.d.ts} +11 -5
- package/dist/observability/index.d.ts +1 -1
- package/dist/{parallel-eternal-engine-D402RASp.d.ts → parallel-eternal-engine-DyMCj2Pw.d.ts} +4 -3
- package/dist/{path-resolver-UPFTsDyD.d.ts → path-resolver-TjBlRKyH.d.ts} +1 -1
- package/dist/{plan-templates-DRvPgkfZ.d.ts → plan-templates-D9UhwoGh.d.ts} +1 -1
- package/dist/{provider-runner-COAJM8tC.d.ts → provider-runner-BEPWwkxH.d.ts} +1 -1
- package/dist/sdd/index.d.ts +3 -3
- package/dist/sdd/index.js +89 -19
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.js +18 -2
- package/dist/security/index.js.map +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.js +149 -90
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/dist/types/index.js +44 -7
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +6 -1
- package/dist/utils/index.js +51 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,8 +7,13 @@ interface AtomicWriteOptions {
|
|
|
7
7
|
mode?: number | undefined;
|
|
8
8
|
encoding?: BufferEncoding | undefined;
|
|
9
9
|
}
|
|
10
|
+
interface FileLockOptions {
|
|
11
|
+
timeoutMs?: number | undefined;
|
|
12
|
+
staleMs?: number | undefined;
|
|
13
|
+
}
|
|
10
14
|
declare function atomicWrite(targetPath: string, content: string | Uint8Array, opts?: AtomicWriteOptions): Promise<void>;
|
|
11
15
|
declare function ensureDir(dir: string): Promise<void>;
|
|
16
|
+
declare function withFileLock<T>(targetPath: string, fn: () => Promise<T>, opts?: FileLockOptions): Promise<T>;
|
|
12
17
|
|
|
13
18
|
interface SafeParseResult<T> {
|
|
14
19
|
ok: boolean;
|
|
@@ -501,4 +506,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
501
506
|
*/
|
|
502
507
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
503
508
|
|
|
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 };
|
|
509
|
+
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, 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, 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 = {
|
|
@@ -1410,6 +1458,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1410
1458
|
return out;
|
|
1411
1459
|
}
|
|
1412
1460
|
|
|
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 };
|
|
1461
|
+
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, withFileLock, writeErr, writeOut };
|
|
1414
1462
|
//# sourceMappingURL=index.js.map
|
|
1415
1463
|
//# sourceMappingURL=index.js.map
|