@wrongstack/tools 0.306.3 → 0.307.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/audit.js +50 -9
- package/dist/auto-proceed-loop-guard.js +8 -2
- package/dist/bash.js +57 -22
- package/dist/builtin.d.ts +6 -6
- package/dist/builtin.js +11315 -9317
- package/dist/clarify.d.ts +32 -0
- package/dist/codebase-index/ast-invariant-engine.d.ts +102 -0
- package/dist/codebase-index/ast-symbol-mutator.d.ts +28 -0
- package/dist/codebase-index/background-indexer.d.ts +9 -0
- package/dist/codebase-index/codebase-ast-replace-tool.d.ts +31 -0
- package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +40 -0
- package/dist/codebase-index/codebase-invariant-check-tool.d.ts +23 -0
- package/dist/codebase-index/codebase-repo-map-tool.d.ts +22 -0
- package/dist/codebase-index/codebase-skeleton-tool.d.ts +36 -0
- package/dist/codebase-index/codebase-targeted-test-tool.d.ts +30 -0
- package/dist/codebase-index/index.d.ts +11 -1
- package/dist/codebase-index/index.js +4141 -1479
- package/dist/codebase-index/project-server-client-state.d.ts +79 -0
- package/dist/codebase-index/project-server-client.d.ts +3 -71
- package/dist/codebase-index/project-server-protocol.d.ts +1 -0
- package/dist/codebase-index/project-server.js +751 -909
- package/dist/codebase-index/repo-map.d.ts +20 -0
- package/dist/codebase-index/skeleton-extractor.d.ts +64 -0
- package/dist/codebase-index/tree-sitter-parser.d.ts +11 -0
- package/dist/codebase-index/worker.js +723 -891
- package/dist/codebase-index/writer-mutations.d.ts +26 -0
- package/dist/codebase-index/writer-refs.d.ts +50 -0
- package/dist/codebase-index/writer-search.d.ts +30 -0
- package/dist/codebase-index/writer.d.ts +2 -320
- package/dist/diff.js +3 -2
- package/dist/document.js +37 -2
- package/dist/e2e.js +3 -2
- package/dist/edit.js +8558 -348
- package/dist/exec.js +76 -22
- package/dist/fetch.js +11 -9
- package/dist/format.js +50 -9
- package/dist/glob.js +8 -3
- package/dist/grep.js +22 -10
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11411 -9440
- package/dist/install.js +50 -9
- package/dist/json.js +91 -17
- package/dist/kanban-board-actions.d.ts +4 -0
- package/dist/kanban-lifecycle-actions.d.ts +4 -0
- package/dist/kanban-serializer.d.ts +21 -0
- package/dist/kanban.js +985 -1034
- package/dist/languages/index.js +17 -10
- package/dist/lint.js +50 -9
- package/dist/logs.js +17 -6
- package/dist/next-steps.d.ts +8 -0
- package/dist/next-steps.js +18 -0
- package/dist/outdated.js +18 -11
- package/dist/pack.js +11308 -9317
- package/dist/patch.js +8301 -77
- package/dist/plan.js +1231 -1281
- package/dist/process-registry.js +14 -8
- package/dist/ps-slash.js +65 -30
- package/dist/read.js +754 -912
- package/dist/replace.js +8456 -195
- package/dist/scaffold.js +36 -1
- package/dist/search.js +21 -15
- package/dist/security-ast-scan-tool.d.ts +43 -0
- package/dist/session-kanban-graph.d.ts +9 -0
- package/dist/session-kanban-sync.d.ts +31 -0
- package/dist/session-kanban.d.ts +5 -141
- package/dist/session-kanban.js +367 -360
- package/dist/task.js +1157 -1207
- package/dist/test.js +50 -9
- package/dist/todo.js +2187 -2237
- package/dist/tool-diff.js +6 -1
- package/dist/tool-summary.js +4 -2
- package/dist/tool-tier.js +11315 -9317
- package/dist/tree.js +36 -1
- package/dist/typecheck.js +51 -10
- package/dist/write.js +8374 -152
- package/package.json +7 -7
package/dist/languages/index.js
CHANGED
|
@@ -2550,13 +2550,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
2550
2550
|
};
|
|
2551
2551
|
child.on("error", settle);
|
|
2552
2552
|
child.on("close", settle);
|
|
2553
|
-
timeout = setTimeout(
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2553
|
+
timeout = setTimeout(
|
|
2554
|
+
() => {
|
|
2555
|
+
try {
|
|
2556
|
+
child.kill();
|
|
2557
|
+
} catch {
|
|
2558
|
+
}
|
|
2559
|
+
settle();
|
|
2560
|
+
},
|
|
2561
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
2562
|
+
);
|
|
2560
2563
|
timeout.unref?.();
|
|
2561
2564
|
child.unref();
|
|
2562
2565
|
return true;
|
|
@@ -2730,7 +2733,10 @@ var ProcessRegistryImpl = class {
|
|
|
2730
2733
|
getBreakerCountdown() {
|
|
2731
2734
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
2732
2735
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
2733
|
-
return {
|
|
2736
|
+
return {
|
|
2737
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
2738
|
+
totalMs: this.autoKillResetMs
|
|
2739
|
+
};
|
|
2734
2740
|
}
|
|
2735
2741
|
/**
|
|
2736
2742
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -3214,8 +3220,9 @@ async function resolveRealInsideRoot(absPath, ctx) {
|
|
|
3214
3220
|
}
|
|
3215
3221
|
throw err;
|
|
3216
3222
|
}
|
|
3217
|
-
|
|
3218
|
-
|
|
3223
|
+
const candidate = pendingTail.length > 0 ? path5.join(real, ...pendingTail) : real;
|
|
3224
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
3225
|
+
return candidate;
|
|
3219
3226
|
}
|
|
3220
3227
|
throw new Error(
|
|
3221
3228
|
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
package/dist/lint.js
CHANGED
|
@@ -422,13 +422,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
422
422
|
};
|
|
423
423
|
child.on("error", settle);
|
|
424
424
|
child.on("close", settle);
|
|
425
|
-
timeout = setTimeout(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
425
|
+
timeout = setTimeout(
|
|
426
|
+
() => {
|
|
427
|
+
try {
|
|
428
|
+
child.kill();
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
settle();
|
|
432
|
+
},
|
|
433
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
434
|
+
);
|
|
432
435
|
timeout.unref?.();
|
|
433
436
|
child.unref();
|
|
434
437
|
return true;
|
|
@@ -602,7 +605,10 @@ var ProcessRegistryImpl = class {
|
|
|
602
605
|
getBreakerCountdown() {
|
|
603
606
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
604
607
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
605
|
-
return {
|
|
608
|
+
return {
|
|
609
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
610
|
+
totalMs: this.autoKillResetMs
|
|
611
|
+
};
|
|
606
612
|
}
|
|
607
613
|
/**
|
|
608
614
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -1041,6 +1047,7 @@ function utf8Prefix(text, maxBytes) {
|
|
|
1041
1047
|
}
|
|
1042
1048
|
|
|
1043
1049
|
// src/_util.ts
|
|
1050
|
+
import * as fsp2 from "node:fs/promises";
|
|
1044
1051
|
import * as path3 from "node:path";
|
|
1045
1052
|
import * as Core from "@wrongstack/core/utils";
|
|
1046
1053
|
function resolvePath(input, ctx) {
|
|
@@ -1064,6 +1071,40 @@ function ensureInsideRoot(absPath, ctx) {
|
|
|
1064
1071
|
function safeResolve(input, ctx) {
|
|
1065
1072
|
return ensureInsideRoot(resolvePath(input, ctx), ctx);
|
|
1066
1073
|
}
|
|
1074
|
+
async function resolveRealInsideRoot(absPath, ctx) {
|
|
1075
|
+
if (ctx.allowOutsideProjectRoot) return absPath;
|
|
1076
|
+
const realRoots = await Promise.all(
|
|
1077
|
+
allowedRoots(ctx).map((r) => fsp2.realpath(r).catch(() => path3.resolve(r)))
|
|
1078
|
+
);
|
|
1079
|
+
let probe = absPath;
|
|
1080
|
+
const pendingTail = [];
|
|
1081
|
+
for (; ; ) {
|
|
1082
|
+
let real;
|
|
1083
|
+
try {
|
|
1084
|
+
real = await fsp2.realpath(probe);
|
|
1085
|
+
} catch (err) {
|
|
1086
|
+
if (err.code === "ENOENT") {
|
|
1087
|
+
const parent = path3.dirname(probe);
|
|
1088
|
+
if (parent === probe) return absPath;
|
|
1089
|
+
pendingTail.unshift(path3.basename(probe));
|
|
1090
|
+
probe = parent;
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
throw err;
|
|
1094
|
+
}
|
|
1095
|
+
const candidate = pendingTail.length > 0 ? path3.join(real, ...pendingTail) : real;
|
|
1096
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
1097
|
+
return candidate;
|
|
1098
|
+
}
|
|
1099
|
+
throw new Error(
|
|
1100
|
+
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
async function safeResolveReal(input, ctx) {
|
|
1105
|
+
const abs = safeResolve(input, ctx);
|
|
1106
|
+
return await resolveRealInsideRoot(abs, ctx);
|
|
1107
|
+
}
|
|
1067
1108
|
var COMMAND_OUTPUT_MAX_BYTES = 32768;
|
|
1068
1109
|
var REPEAT_RUN_THRESHOLD = 3;
|
|
1069
1110
|
function collapseCarriageReturns(text) {
|
|
@@ -3584,7 +3625,7 @@ var lintTool = {
|
|
|
3584
3625
|
return final;
|
|
3585
3626
|
},
|
|
3586
3627
|
async *executeStream(input, ctx, opts) {
|
|
3587
|
-
const cwd = input.cwd ?
|
|
3628
|
+
const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
|
|
3588
3629
|
const linter = input.linter ?? "auto";
|
|
3589
3630
|
if (linter === "auto" && !input.files) {
|
|
3590
3631
|
const bridge = await tryLegacyCodeOperation("lint", {
|
package/dist/logs.js
CHANGED
|
@@ -171,8 +171,9 @@ async function resolveRealInsideRoot(absPath, ctx) {
|
|
|
171
171
|
}
|
|
172
172
|
throw err;
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
const candidate = pendingTail.length > 0 ? path.join(real, ...pendingTail) : real;
|
|
175
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
176
|
+
return candidate;
|
|
176
177
|
}
|
|
177
178
|
throw new Error(
|
|
178
179
|
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
@@ -226,7 +227,7 @@ var logsTool = {
|
|
|
226
227
|
}
|
|
227
228
|
},
|
|
228
229
|
async execute(input, ctx, opts) {
|
|
229
|
-
const cwd = input.cwd ?
|
|
230
|
+
const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
|
|
230
231
|
const lines = input.lines ?? 100;
|
|
231
232
|
let filterRe = null;
|
|
232
233
|
if (input.filter) {
|
|
@@ -286,7 +287,13 @@ async function dockerLogs(service, lines, filterRe, cwd, signal, since) {
|
|
|
286
287
|
clearTimeout(timer);
|
|
287
288
|
resolve2(result);
|
|
288
289
|
};
|
|
289
|
-
const child = spawn("docker", args, {
|
|
290
|
+
const child = spawn("docker", args, {
|
|
291
|
+
cwd,
|
|
292
|
+
signal,
|
|
293
|
+
env: buildChildEnv(),
|
|
294
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
295
|
+
windowsHide: true
|
|
296
|
+
});
|
|
290
297
|
const timer = setTimeout(() => {
|
|
291
298
|
child.kill("SIGTERM");
|
|
292
299
|
finish(empty());
|
|
@@ -298,10 +305,14 @@ async function dockerLogs(service, lines, filterRe, cwd, signal, since) {
|
|
|
298
305
|
if (stderr.length < MAX) stderr += c.toString();
|
|
299
306
|
});
|
|
300
307
|
child.stdout?.on("error", (e) => {
|
|
301
|
-
console.log(
|
|
308
|
+
console.log(
|
|
309
|
+
JSON.stringify({ level: "debug", event: "pipe_error", stream: "stdout", error: e.message })
|
|
310
|
+
);
|
|
302
311
|
});
|
|
303
312
|
child.stderr?.on("error", (e) => {
|
|
304
|
-
console.log(
|
|
313
|
+
console.log(
|
|
314
|
+
JSON.stringify({ level: "debug", event: "pipe_error", stream: "stderr", error: e.message })
|
|
315
|
+
);
|
|
305
316
|
});
|
|
306
317
|
child.on("close", () => {
|
|
307
318
|
const output = stdout + stderr;
|
package/dist/next-steps.d.ts
CHANGED
|
@@ -46,6 +46,14 @@ export interface ParseNextStepsResult {
|
|
|
46
46
|
/** The first item's text when it has auto="true"; otherwise empty. */
|
|
47
47
|
autoTexts: string[];
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate the structured input of the `nextsteps` tool for UI consumers.
|
|
51
|
+
*
|
|
52
|
+
* The runtime normally folds this input into the terminal assistant response.
|
|
53
|
+
* Browser clients still keep this projection as a fallback for a terminal
|
|
54
|
+
* response that is missing (for example after an interrupted stream).
|
|
55
|
+
*/
|
|
56
|
+
export declare function projectNextStepsToolInput(input: unknown): ParsedNextStep[];
|
|
49
57
|
/**
|
|
50
58
|
* Whether an LLM response's stop reason means the message is the FINAL one of
|
|
51
59
|
* a turn.
|
package/dist/next-steps.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
// src/next-steps.ts
|
|
2
|
+
function projectNextStepsToolInput(input) {
|
|
3
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return [];
|
|
4
|
+
const rawSteps = input["steps"];
|
|
5
|
+
if (!Array.isArray(rawSteps)) return [];
|
|
6
|
+
const steps = [];
|
|
7
|
+
for (const candidate of rawSteps) {
|
|
8
|
+
if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) continue;
|
|
9
|
+
const text = candidate["text"];
|
|
10
|
+
if (typeof text !== "string" || !text.trim()) continue;
|
|
11
|
+
const auto = steps.length === 0 && candidate["auto"] === true;
|
|
12
|
+
steps.push(
|
|
13
|
+
auto ? { index: steps.length + 1, text: text.trim(), auto: true } : { index: steps.length + 1, text: text.trim() }
|
|
14
|
+
);
|
|
15
|
+
if (steps.length >= MAX_STEPS) break;
|
|
16
|
+
}
|
|
17
|
+
return steps;
|
|
18
|
+
}
|
|
2
19
|
function isFinalTurnStopReason(stopReason) {
|
|
3
20
|
return stopReason !== "tool_use" && stopReason !== "tool_call";
|
|
4
21
|
}
|
|
@@ -116,6 +133,7 @@ function stripNextStepsBlock(text) {
|
|
|
116
133
|
export {
|
|
117
134
|
isFinalTurnStopReason,
|
|
118
135
|
parseNextSteps,
|
|
136
|
+
projectNextStepsToolInput,
|
|
119
137
|
stripNextStepsBlock
|
|
120
138
|
};
|
|
121
139
|
//# sourceMappingURL=next-steps.js.map
|
package/dist/outdated.js
CHANGED
|
@@ -102,8 +102,9 @@ async function resolveRealInsideRoot(absPath, ctx) {
|
|
|
102
102
|
}
|
|
103
103
|
throw err;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const candidate = pendingTail.length > 0 ? path.join(real, ...pendingTail) : real;
|
|
106
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
107
|
+
return candidate;
|
|
107
108
|
}
|
|
108
109
|
throw new Error(
|
|
109
110
|
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
@@ -2789,13 +2790,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
2789
2790
|
};
|
|
2790
2791
|
child.on("error", settle);
|
|
2791
2792
|
child.on("close", settle);
|
|
2792
|
-
timeout = setTimeout(
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2793
|
+
timeout = setTimeout(
|
|
2794
|
+
() => {
|
|
2795
|
+
try {
|
|
2796
|
+
child.kill();
|
|
2797
|
+
} catch {
|
|
2798
|
+
}
|
|
2799
|
+
settle();
|
|
2800
|
+
},
|
|
2801
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
2802
|
+
);
|
|
2799
2803
|
timeout.unref?.();
|
|
2800
2804
|
child.unref();
|
|
2801
2805
|
return true;
|
|
@@ -2983,7 +2987,10 @@ var init_process_registry = __esm({
|
|
|
2983
2987
|
getBreakerCountdown() {
|
|
2984
2988
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
2985
2989
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
2986
|
-
return {
|
|
2990
|
+
return {
|
|
2991
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
2992
|
+
totalMs: this.autoKillResetMs
|
|
2993
|
+
};
|
|
2987
2994
|
}
|
|
2988
2995
|
/**
|
|
2989
2996
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -5020,7 +5027,7 @@ var outdatedTool = {
|
|
|
5020
5027
|
}
|
|
5021
5028
|
},
|
|
5022
5029
|
async execute(input, ctx, opts) {
|
|
5023
|
-
const cwd = input.cwd ?
|
|
5030
|
+
const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
|
|
5024
5031
|
const manager = await detectPackageManager(cwd, ctx.projectRoot);
|
|
5025
5032
|
if (manager === "npm") {
|
|
5026
5033
|
try {
|