@wrongstack/tools 0.319.1 → 1.0.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.
Files changed (203) hide show
  1. package/dist/_danger-detect.d.ts +8 -0
  2. package/dist/_syntax-check.d.ts +1 -2
  3. package/dist/audit.d.ts +4 -5
  4. package/dist/audit.js +8 -8
  5. package/dist/auto-proceed-loop-guard.js +9 -160
  6. package/dist/bash-kill-guard.d.ts +2 -3
  7. package/dist/bash.d.ts +2 -3
  8. package/dist/bash.js +6 -6
  9. package/dist/batch-tool-use.d.ts +2 -3
  10. package/dist/batch-tool-use.js +1 -1
  11. package/dist/browser/index.d.ts +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/tools.d.ts +56 -45
  14. package/dist/builtin.js +55 -55
  15. package/dist/{chunk-RJZQWEMS.js → chunk-24T5XIJU.js} +3 -2
  16. package/dist/{chunk-DTQ75VBC.js → chunk-2CTZW6JQ.js} +2 -2
  17. package/dist/chunk-37QKUQ2Z.js +171 -0
  18. package/dist/{chunk-LOBRWKCR.js → chunk-3D5DJWOE.js} +3 -3
  19. package/dist/{chunk-YOKD4GWJ.js → chunk-4ERMPDHV.js} +14 -8
  20. package/dist/{chunk-5EUJF3WC.js → chunk-4WPBS45A.js} +4 -5
  21. package/dist/{chunk-42BHI7TN.js → chunk-5ITQPCLC.js} +2 -2
  22. package/dist/{chunk-B4HTSV6Z.js → chunk-5KS24LTS.js} +11 -11
  23. package/dist/{chunk-QPNYDH5B.js → chunk-62OAECEQ.js} +29 -7
  24. package/dist/{chunk-IYKXK356.js → chunk-6GOZTS6F.js} +4 -4
  25. package/dist/{chunk-OG2BEUBY.js → chunk-7HL23T3T.js} +73 -16
  26. package/dist/{chunk-HFXSNKCV.js → chunk-7JJFC6CT.js} +1 -1
  27. package/dist/{chunk-TTZOK6IY.js → chunk-7N5U2RAU.js} +2 -2
  28. package/dist/{chunk-QBV725YG.js → chunk-7ODZTPCU.js} +2 -2
  29. package/dist/{chunk-OTINMOKK.js → chunk-AB2CAUOP.js} +66 -55
  30. package/dist/{chunk-6AAOT4PW.js → chunk-AQ5YBURX.js} +16 -4
  31. package/dist/{chunk-JDPQOR7C.js → chunk-ASEXQRA7.js} +19 -19
  32. package/dist/{chunk-FRN7TIAA.js → chunk-B3MGJBFI.js} +1 -1
  33. package/dist/{chunk-IWS56OY7.js → chunk-CGXTR34H.js} +63 -4
  34. package/dist/{chunk-IU4DV2PA.js → chunk-CHEK3ASV.js} +6 -3
  35. package/dist/{chunk-GOIZNNOA.js → chunk-DJYLI7EW.js} +1 -1
  36. package/dist/{chunk-CFLJFDYV.js → chunk-DK4J2WMH.js} +14 -11
  37. package/dist/{chunk-ZHH3BEWU.js → chunk-DRRY6SCM.js} +49 -22
  38. package/dist/{chunk-BK732J7I.js → chunk-FBUP524S.js} +4 -4
  39. package/dist/{chunk-WHIIIREL.js → chunk-FVM3O4JQ.js} +7 -3
  40. package/dist/chunk-FYDBUVQD.js +244 -0
  41. package/dist/{chunk-UDVKRX5R.js → chunk-GDDXX27P.js} +50 -50
  42. package/dist/{chunk-O44IMQCN.js → chunk-GKSG5CPH.js} +6 -6
  43. package/dist/{chunk-3PVYQFRQ.js → chunk-HDYUBRMF.js} +5 -3
  44. package/dist/{chunk-ELRRTWNP.js → chunk-IXIS7RSG.js} +2 -2
  45. package/dist/{chunk-X5FOFGXX.js → chunk-IYH4OHBP.js} +6 -6
  46. package/dist/{chunk-MNP3GE7H.js → chunk-JDOO4P6Z.js} +21 -16
  47. package/dist/{chunk-BSJSNVGA.js → chunk-KDEXUQY7.js} +24 -11
  48. package/dist/{chunk-V43EQ6VR.js → chunk-KE7A76VC.js} +3 -2
  49. package/dist/{chunk-2OXHS3KZ.js → chunk-KLJZ4WV4.js} +4 -3
  50. package/dist/{chunk-3M7LLN7W.js → chunk-LQSOU63Z.js} +12 -11
  51. package/dist/{chunk-DC4KMPJO.js → chunk-M6UV67BH.js} +2 -2
  52. package/dist/{chunk-C2DQKVLO.js → chunk-MJSJWXBF.js} +1 -1
  53. package/dist/{chunk-RNWUCZ2U.js → chunk-MK2JK35J.js} +29 -12
  54. package/dist/{chunk-FQZOHLG3.js → chunk-MSOAX3GC.js} +3 -2
  55. package/dist/{chunk-KY4PXYSO.js → chunk-N3K2SFEI.js} +534 -494
  56. package/dist/{chunk-EADULOZV.js → chunk-NJX2RXKJ.js} +50 -7
  57. package/dist/{chunk-AKHYMB4V.js → chunk-NN2SNP2R.js} +6 -6
  58. package/dist/{chunk-CMOUCKGC.js → chunk-NU2IZ72J.js} +6 -6
  59. package/dist/{chunk-RLMX75EM.js → chunk-O6BY43ZB.js} +29 -8
  60. package/dist/{chunk-NKNOBUBU.js → chunk-PVCB7RUZ.js} +2 -2
  61. package/dist/{chunk-UQQS3VNT.js → chunk-QA6IASYX.js} +8 -8
  62. package/dist/{chunk-VPALDFYM.js → chunk-RV7BVTDG.js} +1 -1
  63. package/dist/chunk-S57CDR2H.js +288 -0
  64. package/dist/{chunk-2VSZC6QM.js → chunk-SCMRM6NL.js} +6 -4
  65. package/dist/{chunk-W2CECGTG.js → chunk-SMARDKAC.js} +1 -1
  66. package/dist/{chunk-45JPRMC2.js → chunk-SOR7OCYP.js} +7 -3
  67. package/dist/{chunk-ATSKPZUK.js → chunk-T3SMFF5Q.js} +11 -5
  68. package/dist/{chunk-4BHUSMNL.js → chunk-UI3ZJIG3.js} +1 -1
  69. package/dist/{chunk-WXJY3BKV.js → chunk-VBF2YXUW.js} +2 -2
  70. package/dist/{chunk-FQNXYA6W.js → chunk-VU3QBYL4.js} +36 -5
  71. package/dist/{chunk-IIF5HIVF.js → chunk-VVZPQPTY.js} +2 -2
  72. package/dist/{chunk-VD2LV5WO.js → chunk-VZGPASGD.js} +37 -12
  73. package/dist/{chunk-64VIJPFV.js → chunk-WEEVSWQB.js} +17 -6
  74. package/dist/chunk-XXRMF2BC.js +186 -0
  75. package/dist/{chunk-RTZWBNTY.js → chunk-YEISRT4S.js} +7 -12
  76. package/dist/{chunk-Q5JPPCZC.js → chunk-YJTXRH5Y.js} +3 -2
  77. package/dist/{chunk-GMZYW52L.js → chunk-YULVUTK5.js} +6 -3
  78. package/dist/{chunk-NWZ6XGBJ.js → chunk-ZBMANLYH.js} +5 -3
  79. package/dist/{chunk-DP6CXMJZ.js → chunk-ZTCJCYLN.js} +3 -3
  80. package/dist/circuit-breaker.d.ts +1 -0
  81. package/dist/circuit-breaker.js +1 -1
  82. package/dist/clarify.d.ts +1 -0
  83. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +2 -3
  84. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +5 -4
  85. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +4 -3
  86. package/dist/codebase-index/codebase-index-tool.d.ts +2 -3
  87. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -3
  88. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +4 -3
  89. package/dist/codebase-index/codebase-repo-map-tool.d.ts +2 -3
  90. package/dist/codebase-index/codebase-search-tool.d.ts +2 -3
  91. package/dist/codebase-index/codebase-skeleton-tool.d.ts +2 -3
  92. package/dist/codebase-index/codebase-stats-tool.d.ts +9 -3
  93. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +4 -3
  94. package/dist/codebase-index/index.d.ts +11 -11
  95. package/dist/codebase-index/index.js +12 -12
  96. package/dist/codebase-index/parser-worker-script.js +3 -3
  97. package/dist/codebase-index/project-server-framing.d.ts +29 -0
  98. package/dist/codebase-index/project-server-lifecycle.d.ts +20 -0
  99. package/dist/codebase-index/project-server-operations.d.ts +37 -0
  100. package/dist/codebase-index/project-server-types.d.ts +30 -0
  101. package/dist/codebase-index/project-server-watcher.d.ts +25 -0
  102. package/dist/codebase-index/project-server.js +451 -394
  103. package/dist/codebase-index/worker.js +5 -5
  104. package/dist/codebase-index/writer-init.d.ts +13 -0
  105. package/dist/codebase-index/writer-maintenance.d.ts +14 -0
  106. package/dist/codebase-index/writer.d.ts +0 -15
  107. package/dist/design.d.ts +2 -2
  108. package/dist/design.js +1 -1
  109. package/dist/diff.d.ts +4 -4
  110. package/dist/diff.js +2 -2
  111. package/dist/document.d.ts +3 -4
  112. package/dist/document.js +1 -1
  113. package/dist/e2e.d.ts +1 -1
  114. package/dist/e2e.js +1 -1
  115. package/dist/edit.d.ts +3 -3
  116. package/dist/edit.js +9 -9
  117. package/dist/exec.d.ts +2 -3
  118. package/dist/exec.js +6 -6
  119. package/dist/fetch.d.ts +4 -3
  120. package/dist/fetch.js +1 -1
  121. package/dist/format.d.ts +17 -45
  122. package/dist/format.js +14 -10
  123. package/dist/git.d.ts +3 -3
  124. package/dist/git.js +1 -1
  125. package/dist/glob.d.ts +2 -3
  126. package/dist/glob.js +3 -3
  127. package/dist/{go-parser-IKHW67WE.js → go-parser-D7ELWQ7F.js} +2 -2
  128. package/dist/grep.d.ts +7 -5
  129. package/dist/grep.js +4 -4
  130. package/dist/index.d.ts +54 -45
  131. package/dist/index.js +122 -63
  132. package/dist/install.d.ts +7 -55
  133. package/dist/install.js +8 -8
  134. package/dist/{json-parser-2EOVP5MR.js → json-parser-34DHYCPW.js} +1 -18
  135. package/dist/json.d.ts +3 -4
  136. package/dist/json.js +2 -2
  137. package/dist/kanban-tool-types.d.ts +1 -2
  138. package/dist/kanban.d.ts +3 -19
  139. package/dist/kanban.js +1 -1
  140. package/dist/languages/execute-tool.d.ts +2 -3
  141. package/dist/languages/index.d.ts +2 -2
  142. package/dist/languages/index.js +6 -6
  143. package/dist/languages/tool.d.ts +3 -4
  144. package/dist/legacy-bridge-YXANP5QB.js +18 -0
  145. package/dist/lint.d.ts +5 -4
  146. package/dist/lint.js +8 -8
  147. package/dist/logs.d.ts +3 -4
  148. package/dist/logs.js +2 -2
  149. package/dist/memory.d.ts +7 -8
  150. package/dist/memory.js +1 -1
  151. package/dist/mode.d.ts +3 -4
  152. package/dist/mode.js +1 -1
  153. package/dist/next-steps-tool.d.ts +2 -3
  154. package/dist/next-steps.d.ts +11 -0
  155. package/dist/next-steps.js +10 -132
  156. package/dist/outdated.d.ts +5 -29
  157. package/dist/outdated.js +4 -4
  158. package/dist/pack.js +56 -56
  159. package/dist/{parser-dispatch-QGC4HSP5.js → parser-dispatch-BDVCJXTV.js} +4 -4
  160. package/dist/patch.d.ts +2 -3
  161. package/dist/patch.js +8 -8
  162. package/dist/plan.d.ts +4 -4
  163. package/dist/plan.js +3 -3
  164. package/dist/process-registry.js +2 -2
  165. package/dist/ps-slash.js +4 -4
  166. package/dist/pwsh.d.ts +1 -0
  167. package/dist/{py-parser-RFWG2HYI.js → py-parser-QC6MR4GB.js} +3 -3
  168. package/dist/read.d.ts +5 -5
  169. package/dist/read.js +8 -8
  170. package/dist/replace.d.ts +2 -3
  171. package/dist/replace.js +10 -10
  172. package/dist/scaffold.d.ts +7 -3
  173. package/dist/scaffold.js +3 -1
  174. package/dist/search.d.ts +17 -3
  175. package/dist/search.js +5 -1
  176. package/dist/set-working-dir.d.ts +2 -3
  177. package/dist/skill.d.ts +4 -5
  178. package/dist/skill.js +1 -1
  179. package/dist/task.d.ts +6 -6
  180. package/dist/task.js +3 -3
  181. package/dist/test.d.ts +5 -4
  182. package/dist/test.js +8 -8
  183. package/dist/todo.d.ts +8 -8
  184. package/dist/todo.js +2 -2
  185. package/dist/tool-diff.js +11 -230
  186. package/dist/tool-help.d.ts +2 -3
  187. package/dist/tool-help.js +1 -1
  188. package/dist/tool-search.d.ts +2 -3
  189. package/dist/tool-search.js +1 -1
  190. package/dist/tool-summary.js +5 -281
  191. package/dist/tool-tier.js +57 -57
  192. package/dist/tool-use.d.ts +2 -3
  193. package/dist/tool-use.js +1 -1
  194. package/dist/tree.d.ts +5 -3
  195. package/dist/tree.js +5 -1
  196. package/dist/typecheck.d.ts +3 -3
  197. package/dist/typecheck.js +8 -8
  198. package/dist/win32.js +1 -1
  199. package/dist/write.d.ts +2 -3
  200. package/dist/write.js +9 -9
  201. package/package.json +5 -5
  202. package/dist/legacy-bridge-3T7SR4SK.js +0 -18
  203. package/dist/spawn-background.d.ts +0 -80
package/dist/task.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  taskTool
3
- } from "./chunk-3M7LLN7W.js";
4
- import "./chunk-BK732J7I.js";
5
- import "./chunk-W2CECGTG.js";
3
+ } from "./chunk-LQSOU63Z.js";
4
+ import "./chunk-FBUP524S.js";
5
+ import "./chunk-SMARDKAC.js";
6
6
  import "./chunk-X6KXNHUO.js";
7
7
  export {
8
8
  taskTool
package/dist/test.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { Tool } from '@wrongstack/core/types';
2
- interface TestInput {
2
+ export type TestRunnerName = 'vitest' | 'jest' | 'mocha' | 'auto';
3
+ export interface TestInput {
3
4
  files?: string | string[] | undefined;
4
- runner?: 'vitest' | 'jest' | 'mocha' | 'auto' | undefined;
5
+ runner?: TestRunnerName | undefined;
5
6
  watch?: boolean | undefined;
6
7
  coverage?: boolean | undefined;
7
8
  cwd?: string | undefined;
@@ -9,7 +10,7 @@ interface TestInput {
9
10
  timeout?: number | undefined;
10
11
  verbose?: boolean | undefined;
11
12
  }
12
- interface TestOutput {
13
+ export interface TestOutput {
13
14
  runner: string;
14
15
  exit_code: number;
15
16
  tests_run: number;
@@ -19,6 +20,6 @@ interface TestOutput {
19
20
  output: string;
20
21
  truncated: boolean;
21
22
  }
23
+ export type TestContext = Parameters<Tool<TestInput, TestOutput>['execute']>[1];
22
24
  export declare const testTool: Tool<TestInput, TestOutput>;
23
- export {};
24
25
  //# sourceMappingURL=test.d.ts.map
package/dist/test.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  testTool
3
- } from "./chunk-UQQS3VNT.js";
4
- import "./chunk-ATSKPZUK.js";
5
- import "./chunk-TTZOK6IY.js";
6
- import "./chunk-ZHH3BEWU.js";
7
- import "./chunk-2VSZC6QM.js";
8
- import "./chunk-3PVYQFRQ.js";
9
- import "./chunk-HFXSNKCV.js";
10
- import "./chunk-V43EQ6VR.js";
3
+ } from "./chunk-QA6IASYX.js";
4
+ import "./chunk-T3SMFF5Q.js";
5
+ import "./chunk-7N5U2RAU.js";
6
+ import "./chunk-DRRY6SCM.js";
7
+ import "./chunk-SCMRM6NL.js";
8
+ import "./chunk-HDYUBRMF.js";
9
+ import "./chunk-7JJFC6CT.js";
10
+ import "./chunk-KE7A76VC.js";
11
11
  import "./chunk-ZUFHAHTE.js";
12
12
  export {
13
13
  testTool
package/dist/todo.d.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import type { TodoItem } from '@wrongstack/core/agent';
2
2
  import type { Tool } from '@wrongstack/core/types';
3
3
  import { type KanbanTask } from '@wrongstack/kanban';
4
- interface TodoInput {
4
+ export interface TodoInput {
5
5
  todos: TodoItem[];
6
6
  }
7
+ export interface TodoKanbanBinding {
8
+ todoId: string;
9
+ boardId: string;
10
+ taskId: string;
11
+ taskStatus: KanbanTask['status'];
12
+ }
7
13
  export interface TodoOutput {
8
14
  count: number;
9
15
  in_progress: number;
10
16
  kanban_synced?: number | undefined;
11
17
  kanban_warnings?: string[] | undefined;
12
- kanban_bindings?: Array<{
13
- todoId: string;
14
- boardId: string;
15
- taskId: string;
16
- taskStatus: KanbanTask['status'];
17
- }> | undefined;
18
+ kanban_bindings?: TodoKanbanBinding[] | undefined;
18
19
  }
19
20
  export declare const todoTool: Tool<TodoInput, TodoOutput>;
20
- export {};
21
21
  //# sourceMappingURL=todo.d.ts.map
package/dist/todo.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  todoTool
3
- } from "./chunk-BK732J7I.js";
4
- import "./chunk-W2CECGTG.js";
3
+ } from "./chunk-FBUP524S.js";
4
+ import "./chunk-SMARDKAC.js";
5
5
  import "./chunk-X6KXNHUO.js";
6
6
  export {
7
7
  todoTool
package/dist/tool-diff.js CHANGED
@@ -1,233 +1,14 @@
1
- // src/tool-diff.ts
2
- var DIFF_MAX_LINES = 5e3;
3
- function asObject(input) {
4
- if (typeof input === "string") {
5
- const s = input.trim();
6
- if (s.startsWith("{") || s.startsWith("[")) {
7
- try {
8
- const parsed = JSON.parse(s);
9
- if (parsed && typeof parsed === "object") return parsed;
10
- } catch {
11
- return null;
12
- }
13
- }
14
- return null;
15
- }
16
- if (input && typeof input === "object") return input;
17
- return null;
18
- }
19
- function diffFromToolInput(toolName, input) {
20
- if (!toolName) return null;
21
- const obj = asObject(input);
22
- if (!obj) return null;
23
- const name = toolName.toLowerCase();
24
- const filePath = String(obj.file_path ?? obj.path ?? "");
25
- switch (name) {
26
- case "edit":
27
- case "str_replace":
28
- case "edit_file":
29
- case "multi_edit": {
30
- const oldText = typeof obj.old_string === "string" ? obj.old_string : "";
31
- const newText = typeof obj.new_string === "string" ? obj.new_string : "";
32
- if (!oldText && !newText) return null;
33
- return { mode: "lcs", oldText, newText, caption: `edit ${filePath}`.trim() };
34
- }
35
- case "write":
36
- case "write_file":
37
- case "create_file": {
38
- const content = typeof obj.content === "string" ? obj.content : "";
39
- if (!content) return null;
40
- return {
41
- mode: "lcs",
42
- oldText: "",
43
- newText: content,
44
- caption: `write ${filePath} (new)`.trim()
45
- };
46
- }
47
- case "patch": {
48
- const patchText = typeof obj.patch === "string" ? obj.patch : "";
49
- if (!patchText.trim()) return null;
50
- return { mode: "unified", patchText, caption: filePath ? `patch ${filePath}` : "patch" };
51
- }
52
- default:
53
- return null;
54
- }
55
- }
56
- function computeLineDiff(oldText, newText) {
57
- const a = oldText.split("\n");
58
- const b = newText.split("\n");
59
- if (a.length > DIFF_MAX_LINES || b.length > DIFF_MAX_LINES) return null;
60
- const n = a.length;
61
- const m = b.length;
62
- const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
63
- for (let i2 = n - 1; i2 >= 0; i2--) {
64
- for (let j2 = m - 1; j2 >= 0; j2--) {
65
- dp[i2][j2] = a[i2] === b[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
66
- }
67
- }
68
- const rows = [];
69
- let i = 0;
70
- let j = 0;
71
- while (i < n && j < m) {
72
- if (a[i] === b[j]) {
73
- rows.push({ kind: "ctx", text: a[i] });
74
- i++;
75
- j++;
76
- } else if (dp[i + 1][j] >= dp[i][j + 1]) {
77
- rows.push({ kind: "del", text: a[i] });
78
- i++;
79
- } else {
80
- rows.push({ kind: "add", text: b[j] });
81
- j++;
82
- }
83
- }
84
- while (i < n) rows.push({ kind: "del", text: a[i++] });
85
- while (j < m) rows.push({ kind: "add", text: b[j++] });
86
- return rows;
87
- }
88
- function parseUnifiedDiff(patchText) {
89
- const rows = [];
90
- const lines = patchText.split("\n");
91
- for (const raw of lines) {
92
- if (raw.startsWith("@@") || raw.startsWith("--- ") || raw.startsWith("+++ ") || raw.startsWith("diff ") || raw.startsWith("index ") || raw.startsWith("\\ ")) {
93
- rows.push({ kind: "meta", text: raw });
94
- } else if (raw.startsWith("+")) {
95
- rows.push({ kind: "add", text: raw.slice(1) });
96
- } else if (raw.startsWith("-")) {
97
- rows.push({ kind: "del", text: raw.slice(1) });
98
- } else {
99
- rows.push({ kind: "ctx", text: raw.startsWith(" ") ? raw.slice(1) : raw });
100
- }
101
- }
102
- if (rows.length > 0 && rows[rows.length - 1].kind === "ctx" && rows[rows.length - 1].text === "") {
103
- rows.pop();
104
- }
105
- return rows;
106
- }
107
- function diffRowsFromToolInput(toolName, input) {
108
- const d = diffFromToolInput(toolName, input);
109
- if (!d) return null;
110
- if (d.mode === "unified") return { caption: d.caption, rows: parseUnifiedDiff(d.patchText) };
111
- return { caption: d.caption, rows: computeLineDiff(d.oldText, d.newText) };
112
- }
113
- var DIFF_LINE_SAFETY_CAP = 4e3;
114
- function truncMid(s, max) {
115
- if (s.length <= max) return s;
116
- return `${s.slice(0, max - 1)}\u2026`;
117
- }
118
- function parseUnifiedDiffPreview(diff, maxLines, lineCap = DIFF_LINE_SAFETY_CAP) {
119
- const all = [];
120
- let oldLn = 0;
121
- let newLn = 0;
122
- for (const raw of diff.split("\n")) {
123
- const line = raw.replace(/\r$/, "");
124
- if (line.startsWith("+++") || line.startsWith("---")) continue;
125
- if (line.startsWith("diff --git") || line.startsWith("index ")) continue;
126
- if (line.startsWith("@@")) {
127
- const m = line.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);
128
- if (m) {
129
- oldLn = Number.parseInt(m[1] ?? "0", 10) || 0;
130
- newLn = Number.parseInt(m[2] ?? "0", 10) || 0;
131
- }
132
- all.push({ kind: "hunk", text: truncMid(line, 60) });
133
- continue;
134
- }
135
- if (line.startsWith("+")) {
136
- all.push({ kind: "add", text: truncMid(line, lineCap), newLine: newLn });
137
- newLn++;
138
- continue;
139
- }
140
- if (line.startsWith("-")) {
141
- all.push({ kind: "del", text: truncMid(line, lineCap), oldLine: oldLn });
142
- oldLn++;
143
- continue;
144
- }
145
- if (line.startsWith("\\ No newline")) {
146
- all.push({ kind: "meta", text: line });
147
- continue;
148
- }
149
- if (line.length === 0) continue;
150
- all.push({ kind: "ctx", text: truncMid(line, lineCap), oldLine: oldLn, newLine: newLn });
151
- oldLn++;
152
- newLn++;
153
- }
154
- const added = all.filter((row) => row.kind === "add").length;
155
- const removed = all.filter((row) => row.kind === "del").length;
156
- if (all.length === 0) {
157
- return { rows: [], hidden: 0, added: 0, removed: 0, hiddenAdded: 0, hiddenRemoved: 0 };
158
- }
159
- if (all.length <= maxLines) {
160
- return { rows: all, hidden: 0, added, removed, hiddenAdded: 0, hiddenRemoved: 0 };
161
- }
162
- const rows = all.slice(0, maxLines);
163
- const hiddenRows = all.slice(maxLines);
164
- return {
165
- rows,
166
- hidden: hiddenRows.length,
167
- added,
168
- removed,
169
- hiddenAdded: hiddenRows.filter((row) => row.kind === "add").length,
170
- hiddenRemoved: hiddenRows.filter((row) => row.kind === "del").length
171
- };
172
- }
173
- var TOOL_DIFF_BROWSER_SRC = [
174
- "var DIFF_MAX_LINES = 5000;",
175
- "function __diffObj(input){",
176
- ' if(typeof input==="string"){ var s=input.trim(); if(s.charAt(0)==="{"||s.charAt(0)==="["){ try{ var p=JSON.parse(s); if(p&&typeof p==="object") return p; }catch(_e){} } return null; }',
177
- ' if(input&&typeof input==="object") return input; return null;',
178
- "}",
179
- "function diffFromToolInput(name, input){",
180
- " if(!name) return null;",
181
- " var obj=__diffObj(input); if(!obj) return null;",
182
- " var n=String(name).toLowerCase();",
183
- ' var fp=String(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:""));',
184
- ' if(n==="edit"||n==="str_replace"||n==="edit_file"||n==="multi_edit"){',
185
- ' var oldT=typeof obj.old_string==="string"?obj.old_string:"";',
186
- ' var newT=typeof obj.new_string==="string"?obj.new_string:"";',
187
- " if(!oldT&&!newT) return null;",
188
- ' return { mode:"lcs", oldText:oldT, newText:newT, caption:("edit "+fp).replace(/\\s+$/,"") };',
189
- " }",
190
- ' if(n==="write"||n==="write_file"||n==="create_file"){',
191
- ' var c=typeof obj.content==="string"?obj.content:"";',
192
- " if(!c) return null;",
193
- ' return { mode:"lcs", oldText:"", newText:c, caption:("write "+fp+" (new)").replace(/^\\s+/,"").replace(/\\s+$/,"") };',
194
- " }",
195
- ' if(n==="patch"){',
196
- ' var pt=typeof obj.patch==="string"?obj.patch:"";',
197
- ' if(!pt.replace(/\\s/g,"")) return null;',
198
- ' return { mode:"unified", patchText:pt, caption: fp ? ("patch "+fp) : "patch" };',
199
- " }",
200
- " return null;",
201
- "}",
202
- "function computeLineDiff(oldText, newText){",
203
- ' var a=oldText.split("\\n"), b=newText.split("\\n");',
204
- " if(a.length>DIFF_MAX_LINES||b.length>DIFF_MAX_LINES) return null;",
205
- " var nn=a.length, mm=b.length, i, j;",
206
- " var dp=new Array(nn+1); for(i=0;i<=nn;i++){ dp[i]=new Array(mm+1); for(j=0;j<=mm;j++) dp[i][j]=0; }",
207
- " for(i=nn-1;i>=0;i--){ for(j=mm-1;j>=0;j--){ dp[i][j]= a[i]===b[j] ? dp[i+1][j+1]+1 : Math.max(dp[i+1][j], dp[i][j+1]); } }",
208
- " var rows=[]; i=0; j=0;",
209
- ' while(i<nn&&j<mm){ if(a[i]===b[j]){ rows.push({kind:"ctx",text:a[i]}); i++; j++; } else if(dp[i+1][j]>=dp[i][j+1]){ rows.push({kind:"del",text:a[i]}); i++; } else { rows.push({kind:"add",text:b[j]}); j++; } }',
210
- ' while(i<nn){ rows.push({kind:"del",text:a[i]}); i++; }',
211
- ' while(j<mm){ rows.push({kind:"add",text:b[j]}); j++; }',
212
- " return rows;",
213
- "}",
214
- "function parseUnifiedDiff(patchText){",
215
- ' var rows=[], lines=patchText.split("\\n"), k, raw;',
216
- " for(k=0;k<lines.length;k++){ raw=lines[k];",
217
- ' if(raw.indexOf("@@")===0||raw.indexOf("--- ")===0||raw.indexOf("+++ ")===0||raw.indexOf("diff ")===0||raw.indexOf("index ")===0||raw.indexOf("\\\\ ")===0){ rows.push({kind:"meta",text:raw}); }',
218
- ' else if(raw.charAt(0)==="+"){ rows.push({kind:"add",text:raw.slice(1)}); }',
219
- ' else if(raw.charAt(0)==="-"){ rows.push({kind:"del",text:raw.slice(1)}); }',
220
- ' else { rows.push({kind:"ctx",text: raw.charAt(0)===" " ? raw.slice(1) : raw}); }',
221
- " }",
222
- ' if(rows.length>0 && rows[rows.length-1].kind==="ctx" && rows[rows.length-1].text===""){ rows.pop(); }',
223
- " return rows;",
224
- "}",
225
- "function diffRowsFromToolInput(name, input){",
226
- " var d=diffFromToolInput(name, input); if(!d) return null;",
227
- ' if(d.mode==="unified") return { caption:d.caption, rows:parseUnifiedDiff(d.patchText) };',
228
- " return { caption:d.caption, rows:computeLineDiff(d.oldText, d.newText) };",
229
- "}"
230
- ].join("\n");
1
+ import {
2
+ DIFF_LINE_SAFETY_CAP,
3
+ DIFF_MAX_LINES,
4
+ TOOL_DIFF_BROWSER_SRC,
5
+ computeLineDiff,
6
+ diffFromToolInput,
7
+ diffRowsFromToolInput,
8
+ parseUnifiedDiff,
9
+ parseUnifiedDiffPreview,
10
+ truncMid
11
+ } from "./chunk-FYDBUVQD.js";
231
12
  export {
232
13
  DIFF_LINE_SAFETY_CAP,
233
14
  DIFF_MAX_LINES,
@@ -1,10 +1,10 @@
1
1
  import type { Tool } from '@wrongstack/core/types';
2
- interface ToolHelpInput {
2
+ export interface ToolHelpInput {
3
3
  tool?: string | undefined;
4
4
  format?: 'short' | 'full' | 'markdown' | undefined;
5
5
  include_examples?: boolean | undefined;
6
6
  }
7
- interface ToolHelpOutput {
7
+ export interface ToolHelpOutput {
8
8
  tool?: string | undefined;
9
9
  help: string;
10
10
  tools: {
@@ -18,5 +18,4 @@ interface ToolHelpOutput {
18
18
  total: number;
19
19
  }
20
20
  export declare const toolHelpTool: Tool<ToolHelpInput, ToolHelpOutput>;
21
- export {};
22
21
  //# sourceMappingURL=tool-help.d.ts.map
package/dist/tool-help.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toolHelpTool
3
- } from "./chunk-QBV725YG.js";
3
+ } from "./chunk-7ODZTPCU.js";
4
4
  export {
5
5
  toolHelpTool
6
6
  };
@@ -1,12 +1,12 @@
1
1
  import type { Tool } from '@wrongstack/core/types';
2
- interface ToolSearchInput {
2
+ export interface ToolSearchInput {
3
3
  query?: string | undefined;
4
4
  tags?: string[] | undefined;
5
5
  permission?: 'auto' | 'confirm' | 'deny' | undefined;
6
6
  mutating?: boolean | undefined;
7
7
  limit?: number | undefined;
8
8
  }
9
- interface ToolSearchOutput {
9
+ export interface ToolSearchOutput {
10
10
  tools: {
11
11
  name: string;
12
12
  description: string;
@@ -19,5 +19,4 @@ interface ToolSearchOutput {
19
19
  _available?: number;
20
20
  }
21
21
  export declare const toolSearchTool: Tool<ToolSearchInput, ToolSearchOutput>;
22
- export {};
23
22
  //# sourceMappingURL=tool-search.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toolSearchTool
3
- } from "./chunk-RJZQWEMS.js";
3
+ } from "./chunk-24T5XIJU.js";
4
4
  export {
5
5
  toolSearchTool
6
6
  };