@wrongstack/tools 1.0.8 → 1.0.9
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/_win32-resolve.d.ts +5 -0
- package/dist/audit.js +5 -5
- package/dist/bash.js +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/builtin.js +41 -41
- package/dist/{chunk-N3OTTQNC.js → chunk-2OCAAFAT.js} +44 -25
- package/dist/{chunk-5MP76C72.js → chunk-2UVAIS5O.js} +24 -29
- package/dist/{chunk-SIIOHBNY.js → chunk-3RRK33YM.js} +2 -2
- package/dist/{chunk-M2W36JT7.js → chunk-4CE3RKEP.js} +6 -3
- package/dist/{chunk-QJARSK2G.js → chunk-4SUGLJLO.js} +11 -3
- package/dist/{chunk-AH7J5HWL.js → chunk-5RBUYFRV.js} +15 -7
- package/dist/{chunk-WKLUOXR4.js → chunk-7GOE2ZTZ.js} +2 -2
- package/dist/{chunk-O6AGFJBO.js → chunk-7V33PHT6.js} +49 -77
- package/dist/{chunk-CAF4L6KN.js → chunk-C3WP6ZOT.js} +36 -48
- package/dist/{chunk-KMXPP32M.js → chunk-C6ZOXNXV.js} +13 -3
- package/dist/{chunk-EGT5QLCB.js → chunk-D6RQZMZS.js} +123 -255
- package/dist/{chunk-S6CGSFLX.js → chunk-DBG7UQGK.js} +10 -3
- package/dist/{chunk-FI6SOIVE.js → chunk-DLZCOEVG.js} +21 -3
- package/dist/{chunk-NL45OWEO.js → chunk-DOAHONOS.js} +7 -12
- package/dist/{chunk-3LQJXJDM.js → chunk-E7A4SLKR.js} +2 -2
- package/dist/{chunk-JB5JLY7V.js → chunk-ENE22I5W.js} +387 -394
- package/dist/{chunk-SEONDNLN.js → chunk-G7CYW5EP.js} +2 -2
- package/dist/{chunk-MF6ZUBI7.js → chunk-HV7RWDCL.js} +3 -3
- package/dist/{chunk-TU6UVATU.js → chunk-HYHE4VNA.js} +3 -3
- package/dist/{chunk-HIRVCXLP.js → chunk-IE4KDAOB.js} +3 -3
- package/dist/{chunk-YA2ZYCJY.js → chunk-JPK2HHBK.js} +1 -1
- package/dist/{chunk-7E55DAFW.js → chunk-KHUCKLOR.js} +12 -7
- package/dist/{chunk-R3HIZVFS.js → chunk-KPDCKSN5.js} +23 -3
- package/dist/{chunk-B3MGJBFI.js → chunk-KS2OEZWV.js} +23 -47
- package/dist/{chunk-UI3ZJIG3.js → chunk-LKLIQUCW.js} +14 -8
- package/dist/{chunk-62OAECEQ.js → chunk-LLSFOUZF.js} +8 -8
- package/dist/{chunk-YZQSUL5G.js → chunk-M4ZHHCCW.js} +14 -6
- package/dist/{chunk-IXIS7RSG.js → chunk-MRXWOOOR.js} +29 -47
- package/dist/{chunk-C4DSQBTT.js → chunk-NEYUPZL6.js} +3 -3
- package/dist/{chunk-6XYFYLN7.js → chunk-O2MHULBO.js} +13 -8
- package/dist/{chunk-B62LKMWQ.js → chunk-OKZJJDOG.js} +86 -188
- package/dist/{chunk-HOFVYIPI.js → chunk-ON6ET5ER.js} +16 -1
- package/dist/{chunk-KF7GMVNU.js → chunk-OUERRFEM.js} +32 -11
- package/dist/{chunk-GNLHBDFO.js → chunk-OXO773CW.js} +127 -196
- package/dist/{chunk-GF4JHLCO.js → chunk-PWZUHZP7.js} +2 -2
- package/dist/{chunk-5KRKL3WD.js → chunk-QA37PFYL.js} +28 -67
- package/dist/{chunk-OGQMPX3J.js → chunk-QAWI3RSK.js} +37 -81
- package/dist/{chunk-ZMCV3XOV.js → chunk-SPNXDTCJ.js} +29 -63
- package/dist/{chunk-H2VB7GCR.js → chunk-ULI2J6TX.js} +27 -14
- package/dist/{chunk-EMA2XENR.js → chunk-UVYRQKPZ.js} +4 -3
- package/dist/{chunk-2NTHMZV3.js → chunk-VMJY6FYJ.js} +693 -276
- package/dist/{chunk-YUK3WLHJ.js → chunk-WEUEU53R.js} +2 -2
- package/dist/{chunk-ZOUG3KKS.js → chunk-XPVYZ2S6.js} +2 -2
- package/dist/{chunk-5U5ULQX2.js → chunk-XZLVJD56.js} +5 -1
- package/dist/{chunk-HCPSVK7J.js → chunk-YKSOSI2N.js} +47 -31
- package/dist/codebase-index/codebase-ast-replace-tool.d.ts +5 -6
- package/dist/codebase-index/codebase-context-tool.d.ts +4 -6
- package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +1 -2
- package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +0 -2
- package/dist/codebase-index/codebase-index-tool.d.ts +0 -2
- package/dist/codebase-index/codebase-invariant-check-tool.d.ts +1 -2
- package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +0 -2
- package/dist/codebase-index/codebase-repo-map-tool.d.ts +1 -2
- package/dist/codebase-index/codebase-search-tool.d.ts +1 -1
- package/dist/codebase-index/codebase-targeted-test-tool.d.ts +1 -2
- package/dist/codebase-index/index.js +8 -8
- package/dist/codebase-index/parser-worker-script.js +3 -3
- package/dist/codebase-index/project-server.js +5 -5
- package/dist/codebase-index/worker.js +4 -4
- package/dist/design.js +1 -1
- package/dist/diff.js +1 -1
- package/dist/edit.js +7 -7
- package/dist/exec.d.ts +7 -7
- package/dist/exec.js +2 -2
- package/dist/format.js +5 -5
- package/dist/git.js +1 -1
- package/dist/glob.js +1 -1
- package/dist/{go-parser-VDPRQEGM.js → go-parser-Z4H6SR3R.js} +6 -3
- package/dist/grep.js +1 -1
- package/dist/index.js +45 -45
- package/dist/install.js +5 -5
- package/dist/json.d.ts +0 -1
- package/dist/json.js +1 -1
- package/dist/kanban-presence.d.ts +6 -0
- package/dist/kanban-serializer.d.ts +9 -1
- package/dist/kanban-split-task-handler.d.ts +1 -1
- package/dist/kanban-tool-results.d.ts +57 -2
- package/dist/kanban-tool-types.d.ts +16 -5
- package/dist/kanban.d.ts +14 -0
- package/dist/kanban.js +9 -1
- package/dist/languages/index.js +3 -3
- package/dist/{legacy-bridge-4T4OTSQP.js → legacy-bridge-BPT2S2F4.js} +5 -5
- package/dist/lint.js +5 -5
- package/dist/logs.js +1 -1
- package/dist/mode.d.ts +3 -2
- package/dist/mode.js +1 -1
- package/dist/outdated.js +2 -2
- package/dist/pack.js +42 -42
- package/dist/{parser-dispatch-4E2SDQUO.js → parser-dispatch-WG4DNBHH.js} +4 -4
- package/dist/patch.js +7 -7
- package/dist/plan.d.ts +2 -1
- package/dist/plan.js +3 -3
- package/dist/{py-parser-MAW6DHFE.js → py-parser-4PFZYAJ7.js} +3 -3
- package/dist/read.js +7 -7
- package/dist/replace.js +7 -7
- package/dist/search.d.ts +0 -6
- package/dist/search.js +1 -1
- package/dist/security-ast-scan-tool.d.ts +1 -2
- package/dist/session-shell.js +2 -2
- package/dist/task.d.ts +2 -1
- package/dist/task.js +3 -3
- package/dist/test.d.ts +8 -1
- package/dist/test.js +5 -5
- package/dist/todo.js +2 -2
- package/dist/tool-search.d.ts +2 -0
- package/dist/tool-search.js +1 -1
- package/dist/tool-tier.js +43 -43
- package/dist/tool-use.d.ts +2 -2
- package/dist/tool-use.js +1 -1
- package/dist/tree.js +1 -1
- package/dist/typecheck.js +5 -5
- package/dist/wasm/bash/tree-sitter-bash.wasm +0 -0
- package/dist/wasm/c/tree-sitter-c.wasm +0 -0
- package/dist/wasm/c_sharp/tree-sitter-c_sharp.wasm +0 -0
- package/dist/wasm/checksums.json +16 -0
- package/dist/wasm/cpp/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/elixir/tree-sitter-elixir.wasm +0 -0
- package/dist/wasm/go/tree-sitter-go.wasm +0 -0
- package/dist/wasm/java/tree-sitter-java.wasm +0 -0
- package/dist/wasm/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/dist/wasm/php/tree-sitter-php.wasm +0 -0
- package/dist/wasm/python/tree-sitter-python.wasm +0 -0
- package/dist/wasm/ruby/tree-sitter-ruby.wasm +0 -0
- package/dist/wasm/rust/tree-sitter-rust.wasm +0 -0
- package/dist/wasm/swift/tree-sitter-swift.wasm +0 -0
- package/dist/wasm/tree-sitter-runtime.wasm +0 -0
- package/dist/win32.d.ts +1 -1
- package/dist/win32.js +3 -1
- package/dist/write.js +7 -7
- package/package.json +10 -10
|
@@ -15,85 +15,85 @@ import {
|
|
|
15
15
|
codebaseStatsTool,
|
|
16
16
|
codebaseTargetedTestTool,
|
|
17
17
|
deadCodeScanTool
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ENE22I5W.js";
|
|
19
19
|
import {
|
|
20
20
|
designTool
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MRXWOOOR.js";
|
|
22
22
|
import {
|
|
23
23
|
planTool
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7V33PHT6.js";
|
|
25
25
|
import {
|
|
26
26
|
taskTool
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-OKZJJDOG.js";
|
|
28
28
|
import {
|
|
29
29
|
testTool
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-OUERRFEM.js";
|
|
31
31
|
import {
|
|
32
32
|
installTool
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ULI2J6TX.js";
|
|
34
34
|
import {
|
|
35
35
|
auditTool
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-YKSOSI2N.js";
|
|
37
37
|
import {
|
|
38
38
|
outdatedTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-DOAHONOS.js";
|
|
40
40
|
import {
|
|
41
41
|
logsTool
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-C3WP6ZOT.js";
|
|
43
43
|
import {
|
|
44
44
|
toolSearchTool
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JPK2HHBK.js";
|
|
46
46
|
import {
|
|
47
47
|
toolUseTool
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-KS2OEZWV.js";
|
|
49
49
|
import {
|
|
50
50
|
gitTool
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-SPNXDTCJ.js";
|
|
52
52
|
import {
|
|
53
53
|
patchTool
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-2UVAIS5O.js";
|
|
55
55
|
import {
|
|
56
56
|
jsonTool
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-D6RQZMZS.js";
|
|
58
58
|
import {
|
|
59
59
|
diffTool
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-2OCAAFAT.js";
|
|
61
61
|
import {
|
|
62
62
|
treeTool
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-M4ZHHCCW.js";
|
|
64
64
|
import {
|
|
65
65
|
lintTool
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-KPDCKSN5.js";
|
|
67
67
|
import {
|
|
68
68
|
formatTool
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-4SUGLJLO.js";
|
|
70
70
|
import {
|
|
71
71
|
typecheckTool
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-5RBUYFRV.js";
|
|
73
73
|
import {
|
|
74
74
|
languageInfoTool,
|
|
75
75
|
languagePackageTool,
|
|
76
76
|
languageTool
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-G7CYW5EP.js";
|
|
78
78
|
import {
|
|
79
79
|
replaceTool
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-C6ZOXNXV.js";
|
|
81
81
|
import {
|
|
82
82
|
globTool
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-ON6ET5ER.js";
|
|
84
84
|
import {
|
|
85
85
|
grepTool
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-DLZCOEVG.js";
|
|
87
87
|
import {
|
|
88
88
|
bashTool,
|
|
89
89
|
checkAndBlockKillCommand,
|
|
90
90
|
diagnoseBashism,
|
|
91
91
|
shellArgs
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-QA37PFYL.js";
|
|
93
93
|
import {
|
|
94
94
|
detectDanger,
|
|
95
95
|
execTool
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-QAWI3RSK.js";
|
|
97
97
|
import {
|
|
98
98
|
buildChildEnv
|
|
99
99
|
} from "./chunk-BTSFTGIL.js";
|
|
@@ -110,31 +110,31 @@ import {
|
|
|
110
110
|
} from "./chunk-4SW6BXUR.js";
|
|
111
111
|
import {
|
|
112
112
|
searchTool
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-LLSFOUZF.js";
|
|
114
114
|
import {
|
|
115
115
|
guardedFetch
|
|
116
116
|
} from "./chunk-NBDZMMG2.js";
|
|
117
117
|
import {
|
|
118
118
|
todoTool
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-DBG7UQGK.js";
|
|
120
120
|
import {
|
|
121
121
|
kanbanTool
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-VMJY6FYJ.js";
|
|
123
123
|
import {
|
|
124
124
|
browserTools
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-O2MHULBO.js";
|
|
126
126
|
import {
|
|
127
127
|
readTool
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-IE4KDAOB.js";
|
|
129
129
|
import {
|
|
130
130
|
writeTool
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-PWZUHZP7.js";
|
|
132
132
|
import {
|
|
133
133
|
editTool
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-7GOE2ZTZ.js";
|
|
135
135
|
import {
|
|
136
136
|
resolvePowerShell
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-XZLVJD56.js";
|
|
138
138
|
import {
|
|
139
139
|
normalizeCommandOutput,
|
|
140
140
|
safeResolveProjectPath,
|
|
@@ -143,6 +143,7 @@ import {
|
|
|
143
143
|
|
|
144
144
|
// src/clarify.ts
|
|
145
145
|
import { randomUUID } from "node:crypto";
|
|
146
|
+
import { ToolValidationError } from "@wrongstack/core/types";
|
|
146
147
|
import { toErrorMessage } from "@wrongstack/core/utils";
|
|
147
148
|
var clarifyTool = {
|
|
148
149
|
name: "clarify",
|
|
@@ -192,40 +193,41 @@ var clarifyTool = {
|
|
|
192
193
|
additionalProperties: false
|
|
193
194
|
},
|
|
194
195
|
async execute(input, ctx, opts) {
|
|
196
|
+
const signal = opts?.signal ?? ctx.signal;
|
|
197
|
+
signal?.throwIfAborted();
|
|
198
|
+
let request;
|
|
195
199
|
try {
|
|
196
|
-
|
|
197
|
-
signal.throwIfAborted();
|
|
198
|
-
const request = normalizeRequest(input);
|
|
199
|
-
let response;
|
|
200
|
-
if (typeof ctx.requestUserInput === "function")
|
|
201
|
-
response = await ctx.requestUserInput(request, signal);
|
|
202
|
-
else response = await legacyHostResponse(ctx, request);
|
|
203
|
-
const autoDecided = response === void 0;
|
|
204
|
-
const resolved = response ?? recommendedResponse(request);
|
|
205
|
-
if (resolved.status === "cancelled")
|
|
206
|
-
return skipped(request, "User cancelled the clarification form.");
|
|
207
|
-
const answers = materializeAnswers(request, resolved.answers);
|
|
208
|
-
const primary = answers[0];
|
|
209
|
-
const decisionSummary = `${autoDecided ? "Auto-selected recommended answers in non-interactive mode" : "User clarified"}: ${answers.map((answer) => {
|
|
210
|
-
if (answer.delegatedToModel)
|
|
211
|
-
return `"${answer.question}": model should decide (user delegated)`;
|
|
212
|
-
const values = [
|
|
213
|
-
...answer.selectedOptions,
|
|
214
|
-
...answer.customResponse ? [answer.customResponse] : []
|
|
215
|
-
];
|
|
216
|
-
return `"${answer.question}": ${values.join(", ") || "(blank)"}`;
|
|
217
|
-
}).join("; ")}`;
|
|
218
|
-
return {
|
|
219
|
-
status: autoDecided ? "auto_decided" : "answered",
|
|
220
|
-
question: primary.question,
|
|
221
|
-
selectedOptions: primary.selectedOptions,
|
|
222
|
-
customResponse: primary.customResponse,
|
|
223
|
-
answers,
|
|
224
|
-
decisionSummary
|
|
225
|
-
};
|
|
200
|
+
request = normalizeRequest(input);
|
|
226
201
|
} catch (error) {
|
|
227
|
-
|
|
202
|
+
throw new ToolValidationError({ message: `clarify: ${toErrorMessage(error)}`, cause: error });
|
|
228
203
|
}
|
|
204
|
+
let response;
|
|
205
|
+
if (typeof ctx.requestUserInput === "function")
|
|
206
|
+
response = await ctx.requestUserInput(request, signal);
|
|
207
|
+
else response = await legacyHostResponse(ctx, request);
|
|
208
|
+
const autoDecided = response === void 0;
|
|
209
|
+
const resolved = response ?? recommendedResponse(request);
|
|
210
|
+
if (resolved.status === "cancelled")
|
|
211
|
+
return skipped(request, "User cancelled the clarification form.");
|
|
212
|
+
const answers = materializeAnswers(request, resolved.answers);
|
|
213
|
+
const primary = answers[0];
|
|
214
|
+
const decisionSummary = `${autoDecided ? "Auto-selected recommended answers in non-interactive mode" : "User clarified"}: ${answers.map((answer) => {
|
|
215
|
+
if (answer.delegatedToModel)
|
|
216
|
+
return `"${answer.question}": model should decide (user delegated)`;
|
|
217
|
+
const values = [
|
|
218
|
+
...answer.selectedOptions,
|
|
219
|
+
...answer.customResponse ? [answer.customResponse] : []
|
|
220
|
+
];
|
|
221
|
+
return `"${answer.question}": ${values.join(", ") || "(blank)"}`;
|
|
222
|
+
}).join("; ")}`;
|
|
223
|
+
return {
|
|
224
|
+
status: autoDecided ? "auto_decided" : "answered",
|
|
225
|
+
question: primary.question,
|
|
226
|
+
selectedOptions: primary.selectedOptions,
|
|
227
|
+
customResponse: primary.customResponse,
|
|
228
|
+
answers,
|
|
229
|
+
decisionSummary
|
|
230
|
+
};
|
|
229
231
|
}
|
|
230
232
|
};
|
|
231
233
|
function optionArraySchema() {
|
|
@@ -476,15 +478,6 @@ function skipped(request, error) {
|
|
|
476
478
|
error
|
|
477
479
|
};
|
|
478
480
|
}
|
|
479
|
-
function skippedFromInput(input, error) {
|
|
480
|
-
return {
|
|
481
|
-
status: "skipped",
|
|
482
|
-
question: input.question ?? input.questions?.[0]?.question ?? input.tabs?.[0]?.questions[0]?.question ?? "",
|
|
483
|
-
selectedOptions: [],
|
|
484
|
-
decisionSummary: "",
|
|
485
|
-
error
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
481
|
|
|
489
482
|
// src/pwsh.ts
|
|
490
483
|
import { spawn } from "node:child_process";
|
|
@@ -495,7 +488,7 @@ import {
|
|
|
495
488
|
emitProcessOutput,
|
|
496
489
|
emitProcessStarted
|
|
497
490
|
} from "@wrongstack/core/observability";
|
|
498
|
-
import { ToolValidationError } from "@wrongstack/core/types";
|
|
491
|
+
import { ToolValidationError as ToolValidationError2 } from "@wrongstack/core/types";
|
|
499
492
|
var MAX_OUTPUT = 32768;
|
|
500
493
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
501
494
|
var STREAM_FLUSH_INTERVAL_MS = 200;
|
|
@@ -654,7 +647,7 @@ var pwshTool = {
|
|
|
654
647
|
},
|
|
655
648
|
async *executeStream(input, ctx, opts) {
|
|
656
649
|
if (!input?.command || typeof input.command !== "string" || !input.command.trim()) {
|
|
657
|
-
throw new
|
|
650
|
+
throw new ToolValidationError2({
|
|
658
651
|
message: "pwsh: command is required and cannot be empty",
|
|
659
652
|
field: "command"
|
|
660
653
|
});
|
|
@@ -676,31 +669,13 @@ var pwshTool = {
|
|
|
676
669
|
const isBackground = !!(input.run_in_background || input.background);
|
|
677
670
|
const registry = getProcessRegistry();
|
|
678
671
|
if (!registry.beforeCall(isBackground)) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
output: "",
|
|
683
|
-
exit_code: 1,
|
|
684
|
-
timed_out: false,
|
|
685
|
-
pid: null,
|
|
686
|
-
error: "pwsh: circuit breaker open \u2014 too many consecutive failures or slow calls. Use /kill to inspect or /kill reset to recover."
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
return;
|
|
672
|
+
throw new Error(
|
|
673
|
+
"pwsh: circuit breaker open \u2014 too many consecutive failures or slow calls. Use /kill to inspect or /kill reset to recover."
|
|
674
|
+
);
|
|
690
675
|
}
|
|
691
676
|
const killCheck = await checkAndBlockKillCommand(input.command);
|
|
692
677
|
if (killCheck.blocked) {
|
|
693
|
-
|
|
694
|
-
type: "final",
|
|
695
|
-
output: {
|
|
696
|
-
output: "",
|
|
697
|
-
exit_code: 1,
|
|
698
|
-
timed_out: false,
|
|
699
|
-
pid: null,
|
|
700
|
-
error: `pwsh: ${killCheck.reason}`
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
return;
|
|
678
|
+
throw new Error(`pwsh: ${killCheck.reason}`);
|
|
704
679
|
}
|
|
705
680
|
const isWin = os.platform() === "win32";
|
|
706
681
|
const bin = isWin ? resolvePowerShell("pwsh.exe") : "pwsh";
|
|
@@ -713,17 +688,7 @@ var pwshTool = {
|
|
|
713
688
|
try {
|
|
714
689
|
targetCwd = await safeResolveReal(input.workdir ?? ctx.workingDir ?? ctx.projectRoot, ctx);
|
|
715
690
|
} catch (err) {
|
|
716
|
-
|
|
717
|
-
type: "final",
|
|
718
|
-
output: {
|
|
719
|
-
output: "",
|
|
720
|
-
exit_code: 1,
|
|
721
|
-
timed_out: false,
|
|
722
|
-
pid: null,
|
|
723
|
-
error: `pwsh: ${err.message}`
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
return;
|
|
691
|
+
throw new Error(`pwsh: ${err.message}`, { cause: err });
|
|
727
692
|
}
|
|
728
693
|
const startedAt = Date.now();
|
|
729
694
|
const detached = !isWin;
|
|
@@ -755,17 +720,9 @@ var pwshTool = {
|
|
|
755
720
|
timedOut: false,
|
|
756
721
|
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
757
722
|
});
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
output: "",
|
|
762
|
-
exit_code: 1,
|
|
763
|
-
timed_out: false,
|
|
764
|
-
pid: null,
|
|
765
|
-
error: `pwsh: spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
return;
|
|
723
|
+
throw new Error(`pwsh: spawn failed: ${err instanceof Error ? err.message : String(err)}`, {
|
|
724
|
+
cause: err
|
|
725
|
+
});
|
|
769
726
|
}
|
|
770
727
|
const pid2 = child2.pid;
|
|
771
728
|
let bgTelemetryCompleted = false;
|
|
@@ -843,17 +800,7 @@ Working directory: ${targetCwd}`,
|
|
|
843
800
|
return;
|
|
844
801
|
}
|
|
845
802
|
completeBackground(1);
|
|
846
|
-
|
|
847
|
-
type: "final",
|
|
848
|
-
output: {
|
|
849
|
-
output: "",
|
|
850
|
-
exit_code: 1,
|
|
851
|
-
timed_out: false,
|
|
852
|
-
pid: null,
|
|
853
|
-
error: "pwsh: failed to obtain PID for background process"
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
return;
|
|
803
|
+
throw new Error("pwsh: failed to obtain PID for background process");
|
|
857
804
|
}
|
|
858
805
|
const spool = createOutputSpool({ tool: "pwsh", thresholdBytes: MAX_OUTPUT });
|
|
859
806
|
let child;
|
|
@@ -884,17 +831,9 @@ Working directory: ${targetCwd}`,
|
|
|
884
831
|
timedOut: false,
|
|
885
832
|
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
886
833
|
});
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
output: "",
|
|
891
|
-
exit_code: 1,
|
|
892
|
-
timed_out: false,
|
|
893
|
-
pid: null,
|
|
894
|
-
error: `pwsh: spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
895
|
-
}
|
|
896
|
-
};
|
|
897
|
-
return;
|
|
834
|
+
throw new Error(`pwsh: spawn failed: ${err instanceof Error ? err.message : String(err)}`, {
|
|
835
|
+
cause: err
|
|
836
|
+
});
|
|
898
837
|
}
|
|
899
838
|
const pid = child.pid;
|
|
900
839
|
let stdoutBytes = 0;
|
|
@@ -1083,16 +1022,6 @@ Working directory: ${targetCwd}`,
|
|
|
1083
1022
|
yield { type: "partial_output", text: remainder };
|
|
1084
1023
|
}
|
|
1085
1024
|
const spooled = spool.finalize();
|
|
1086
|
-
yield {
|
|
1087
|
-
type: "final",
|
|
1088
|
-
output: {
|
|
1089
|
-
output: normalizeCommandOutput(buf) + (spooled ? spoolNote(spooled) : ""),
|
|
1090
|
-
exit_code: isAbort ? 124 : 1,
|
|
1091
|
-
timed_out: isAbort,
|
|
1092
|
-
pid: pid ?? null,
|
|
1093
|
-
error: isAbort ? "Command aborted by user or signal" : c.err.message
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
1025
|
ctx.recordSideEffect?.({
|
|
1097
1026
|
toolUseId: `pwsh-${Date.now()}`,
|
|
1098
1027
|
toolName: "pwsh",
|
|
@@ -1101,6 +1030,19 @@ Working directory: ${targetCwd}`,
|
|
|
1101
1030
|
outcome: isAbort ? "aborted" : `error (${c.err.message})`,
|
|
1102
1031
|
risk: "shell"
|
|
1103
1032
|
});
|
|
1033
|
+
if (!isAbort) {
|
|
1034
|
+
throw new Error(`pwsh: process error: ${c.err.message}`, { cause: c.err });
|
|
1035
|
+
}
|
|
1036
|
+
yield {
|
|
1037
|
+
type: "final",
|
|
1038
|
+
output: {
|
|
1039
|
+
output: normalizeCommandOutput(buf) + (spooled ? spoolNote(spooled) : ""),
|
|
1040
|
+
exit_code: 124,
|
|
1041
|
+
timed_out: true,
|
|
1042
|
+
pid: pid ?? null,
|
|
1043
|
+
error: "Command aborted by user or signal"
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1104
1046
|
return;
|
|
1105
1047
|
}
|
|
1106
1048
|
if (c.kind === "end") {
|
|
@@ -1261,7 +1203,6 @@ var readUrlContentTool = {
|
|
|
1261
1203
|
// src/security-ast-scan-tool.ts
|
|
1262
1204
|
import * as fs from "node:fs/promises";
|
|
1263
1205
|
import * as path from "node:path";
|
|
1264
|
-
import { toErrorMessage as toErrorMessage2 } from "@wrongstack/core/utils";
|
|
1265
1206
|
var SECRET_PATTERNS = [
|
|
1266
1207
|
{ name: "AWS Access Key", regex: /\b(AKIA[0-9A-Z]{16})\b/ },
|
|
1267
1208
|
{ name: "GitHub Token", regex: /\b(gh[pousr]_[A-Za-z0-9_]{36,255})\b/ },
|
|
@@ -1421,58 +1362,48 @@ var securityAstScanTool = {
|
|
|
1421
1362
|
},
|
|
1422
1363
|
additionalProperties: false
|
|
1423
1364
|
},
|
|
1365
|
+
// Failures THROW so the executor marks the call is_error. The old catch
|
|
1366
|
+
// returned `status: 'error'`, which the executor recorded as a successful
|
|
1367
|
+
// call — for a scanner that reads as "ran fine", the worst possible lie.
|
|
1424
1368
|
async execute(input, ctx) {
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
if (!content) {
|
|
1435
|
-
return {
|
|
1436
|
-
status: "clean",
|
|
1437
|
-
filesScanned: 0,
|
|
1438
|
-
totalFindings: 0,
|
|
1439
|
-
criticalCount: 0,
|
|
1440
|
-
warningCount: 0,
|
|
1441
|
-
findings: [],
|
|
1442
|
-
summary: "No content or file provided to scan."
|
|
1443
|
-
};
|
|
1444
|
-
}
|
|
1445
|
-
let findings = analyzeSecurityAndPerformance(targetFile, content);
|
|
1446
|
-
if (input.rules && input.rules.length > 0) {
|
|
1447
|
-
const ruleSet = new Set(input.rules);
|
|
1448
|
-
findings = findings.filter((f) => ruleSet.has(f.ruleId));
|
|
1449
|
-
}
|
|
1450
|
-
const criticalCount = findings.filter((f) => f.severity === "critical").length;
|
|
1451
|
-
const warningCount = findings.filter((f) => f.severity === "warning").length;
|
|
1452
|
-
const totalFindings = findings.length;
|
|
1453
|
-
const status = totalFindings === 0 ? "clean" : "findings_detected";
|
|
1454
|
-
const summary = totalFindings === 0 ? `Security & Performance AST Scan: CLEAN (${targetFile})` : `Security & Performance AST Scan: ${totalFindings} issue(s) detected (${criticalCount} critical, ${warningCount} warning).`;
|
|
1455
|
-
return {
|
|
1456
|
-
status,
|
|
1457
|
-
filesScanned: 1,
|
|
1458
|
-
totalFindings,
|
|
1459
|
-
criticalCount,
|
|
1460
|
-
warningCount,
|
|
1461
|
-
findings,
|
|
1462
|
-
summary
|
|
1463
|
-
};
|
|
1464
|
-
} catch (err) {
|
|
1369
|
+
const projectRoot = ctx.projectRoot ?? ctx.cwd ?? process.cwd();
|
|
1370
|
+
let targetFile = input.file ?? "inline-code.ts";
|
|
1371
|
+
let content = input.content;
|
|
1372
|
+
if (!content && input.file) {
|
|
1373
|
+
const absPath = await safeResolveProjectPath(input.file, ctx);
|
|
1374
|
+
targetFile = path.relative(projectRoot, absPath).replace(/\\/g, "/");
|
|
1375
|
+
content = await fs.readFile(absPath, "utf8");
|
|
1376
|
+
}
|
|
1377
|
+
if (!content) {
|
|
1465
1378
|
return {
|
|
1466
|
-
status: "
|
|
1379
|
+
status: "clean",
|
|
1467
1380
|
filesScanned: 0,
|
|
1468
1381
|
totalFindings: 0,
|
|
1469
1382
|
criticalCount: 0,
|
|
1470
1383
|
warningCount: 0,
|
|
1471
1384
|
findings: [],
|
|
1472
|
-
summary: ""
|
|
1473
|
-
error: toErrorMessage2(err)
|
|
1385
|
+
summary: "No content or file provided to scan."
|
|
1474
1386
|
};
|
|
1475
1387
|
}
|
|
1388
|
+
let findings = analyzeSecurityAndPerformance(targetFile, content);
|
|
1389
|
+
if (input.rules && input.rules.length > 0) {
|
|
1390
|
+
const ruleSet = new Set(input.rules);
|
|
1391
|
+
findings = findings.filter((f) => ruleSet.has(f.ruleId));
|
|
1392
|
+
}
|
|
1393
|
+
const criticalCount = findings.filter((f) => f.severity === "critical").length;
|
|
1394
|
+
const warningCount = findings.filter((f) => f.severity === "warning").length;
|
|
1395
|
+
const totalFindings = findings.length;
|
|
1396
|
+
const status = totalFindings === 0 ? "clean" : "findings_detected";
|
|
1397
|
+
const summary = totalFindings === 0 ? `Security & Performance AST Scan: CLEAN (${targetFile})` : `Security & Performance AST Scan: ${totalFindings} issue(s) detected (${criticalCount} critical, ${warningCount} warning).`;
|
|
1398
|
+
return {
|
|
1399
|
+
status,
|
|
1400
|
+
filesScanned: 1,
|
|
1401
|
+
totalFindings,
|
|
1402
|
+
criticalCount,
|
|
1403
|
+
warningCount,
|
|
1404
|
+
findings,
|
|
1405
|
+
summary
|
|
1406
|
+
};
|
|
1476
1407
|
}
|
|
1477
1408
|
};
|
|
1478
1409
|
|
|
@@ -1692,4 +1623,4 @@ export {
|
|
|
1692
1623
|
TIER3_TOOLS,
|
|
1693
1624
|
builtinTools
|
|
1694
1625
|
};
|
|
1695
|
-
//# sourceMappingURL=chunk-
|
|
1626
|
+
//# sourceMappingURL=chunk-OXO773CW.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MSOAX3GC.js";
|
|
4
4
|
import {
|
|
5
5
|
enqueueReindex
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HYHE4VNA.js";
|
|
7
7
|
import {
|
|
8
8
|
safeResolveReal,
|
|
9
9
|
sha256hex,
|
|
@@ -179,4 +179,4 @@ async function finishWrite(input, ctx, prepared, signal) {
|
|
|
179
179
|
export {
|
|
180
180
|
writeTool
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-PWZUHZP7.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-HDYUBRMF.js";
|
|
15
15
|
import {
|
|
16
16
|
resolvePowerShell
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XZLVJD56.js";
|
|
18
18
|
import {
|
|
19
19
|
normalizeCommandOutput
|
|
20
20
|
} from "./chunk-2IAEJRLT.js";
|
|
@@ -549,31 +549,15 @@ var bashTool = {
|
|
|
549
549
|
const registry = getProcessRegistry();
|
|
550
550
|
const bypassBreaker = !!input.background;
|
|
551
551
|
if (!registry.beforeCall(bypassBreaker)) {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
output: "",
|
|
556
|
-
exit_code: 1,
|
|
557
|
-
timed_out: false,
|
|
558
|
-
pid: null,
|
|
559
|
-
error: "bash: circuit breaker open \u2014 too many consecutive failures or slow calls. Use /kill to inspect or /kill reset to recover."
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
return;
|
|
552
|
+
throw new Error(
|
|
553
|
+
"bash: circuit breaker open \u2014 too many consecutive failures or slow calls. Use /kill to inspect or /kill reset to recover."
|
|
554
|
+
);
|
|
563
555
|
}
|
|
564
556
|
const killCheck = await checkAndBlockKillCommand(input.command);
|
|
565
557
|
if (killCheck.blocked) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
output: "",
|
|
570
|
-
exit_code: 1,
|
|
571
|
-
timed_out: false,
|
|
572
|
-
pid: null,
|
|
573
|
-
error: killCheck.reason || "Kill command blocked: targets a protected WrongStack process."
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
return;
|
|
558
|
+
throw new Error(
|
|
559
|
+
`bash: ${killCheck.reason || "Kill command blocked: targets a protected WrongStack process."}`
|
|
560
|
+
);
|
|
577
561
|
}
|
|
578
562
|
const PIPE_TO_SHELL_PATTERN = /\|\s*(?:sudo\s+)?(sh|bash|ksh|zsh|fish|cmd|powershell|pwsh)(?:\.exe)?\b/i;
|
|
579
563
|
const pipeToShellNote = PIPE_TO_SHELL_PATTERN.test(input.command) ? "\n\n[wrongstack] Caution: this command pipes output into a shell interpreter (pipe-to-shell). Piped content executes as arbitrary code \u2014 review the source before trusting the result, and prefer downloading to a file and inspecting it first." : "";
|
|
@@ -654,17 +638,9 @@ var bashTool = {
|
|
|
654
638
|
timedOut: false,
|
|
655
639
|
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
656
640
|
});
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
output: "",
|
|
661
|
-
exit_code: 1,
|
|
662
|
-
timed_out: false,
|
|
663
|
-
pid: null,
|
|
664
|
-
error: `spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
return;
|
|
641
|
+
throw new Error(`bash: spawn failed: ${err instanceof Error ? err.message : String(err)}`, {
|
|
642
|
+
cause: err
|
|
643
|
+
});
|
|
668
644
|
}
|
|
669
645
|
const pid2 = child2.pid;
|
|
670
646
|
const stdoutBytes2 = 0;
|
|
@@ -723,17 +699,7 @@ var bashTool = {
|
|
|
723
699
|
});
|
|
724
700
|
if (typeof pid2 !== "number") {
|
|
725
701
|
completeBackground(1);
|
|
726
|
-
|
|
727
|
-
type: "final",
|
|
728
|
-
output: {
|
|
729
|
-
output: "",
|
|
730
|
-
exit_code: 1,
|
|
731
|
-
timed_out: false,
|
|
732
|
-
pid: null,
|
|
733
|
-
error: "Failed to launch background process: invalid PID"
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
return;
|
|
702
|
+
throw new Error("bash: failed to launch background process: invalid PID");
|
|
737
703
|
}
|
|
738
704
|
child2.unref();
|
|
739
705
|
yield {
|
|
@@ -785,17 +751,9 @@ var bashTool = {
|
|
|
785
751
|
timedOut: false,
|
|
786
752
|
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
787
753
|
});
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
output: "",
|
|
792
|
-
exit_code: 1,
|
|
793
|
-
timed_out: false,
|
|
794
|
-
pid: null,
|
|
795
|
-
error: `spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
return;
|
|
754
|
+
throw new Error(`bash: spawn failed: ${err instanceof Error ? err.message : String(err)}`, {
|
|
755
|
+
cause: err
|
|
756
|
+
});
|
|
799
757
|
}
|
|
800
758
|
const pid = child.pid;
|
|
801
759
|
let stdoutBytes = 0;
|
|
@@ -982,16 +940,6 @@ var bashTool = {
|
|
|
982
940
|
yield { type: "partial_output", text: remainder };
|
|
983
941
|
}
|
|
984
942
|
const spooled = spool.finalize();
|
|
985
|
-
yield {
|
|
986
|
-
type: "final",
|
|
987
|
-
output: {
|
|
988
|
-
output: normalizeCommandOutput(buf) + (spooled ? spoolNote(spooled) : "") + pipeToShellNote,
|
|
989
|
-
exit_code: isAbort ? 124 : 1,
|
|
990
|
-
timed_out: isAbort,
|
|
991
|
-
pid: pid ?? null,
|
|
992
|
-
error: isAbort ? "Command aborted by user or signal" : c.err.message
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
943
|
ctx.recordSideEffect?.({
|
|
996
944
|
toolUseId: `bash-${Date.now()}`,
|
|
997
945
|
toolName: "bash",
|
|
@@ -1000,6 +948,19 @@ var bashTool = {
|
|
|
1000
948
|
outcome: isAbort ? "aborted" : `error (${c.err.message})`,
|
|
1001
949
|
risk: "shell"
|
|
1002
950
|
});
|
|
951
|
+
if (!isAbort) {
|
|
952
|
+
throw new Error(`bash: process error: ${c.err.message}`, { cause: c.err });
|
|
953
|
+
}
|
|
954
|
+
yield {
|
|
955
|
+
type: "final",
|
|
956
|
+
output: {
|
|
957
|
+
output: normalizeCommandOutput(buf) + (spooled ? spoolNote(spooled) : "") + pipeToShellNote,
|
|
958
|
+
exit_code: 124,
|
|
959
|
+
timed_out: true,
|
|
960
|
+
pid: pid ?? null,
|
|
961
|
+
error: "Command aborted by user or signal"
|
|
962
|
+
}
|
|
963
|
+
};
|
|
1003
964
|
return;
|
|
1004
965
|
}
|
|
1005
966
|
if (c.kind === "end") {
|
|
@@ -1093,4 +1054,4 @@ export {
|
|
|
1093
1054
|
checkAndBlockKillCommand,
|
|
1094
1055
|
bashTool
|
|
1095
1056
|
};
|
|
1096
|
-
//# sourceMappingURL=chunk-
|
|
1057
|
+
//# sourceMappingURL=chunk-QA37PFYL.js.map
|