@wrongstack/tools 1.0.3 → 1.0.5

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 (112) hide show
  1. package/README.md +0 -6
  2. package/dist/_util.d.ts +18 -0
  3. package/dist/audit.js +4 -4
  4. package/dist/bash.js +2 -2
  5. package/dist/browser/index.d.ts +1 -1
  6. package/dist/browser/index.js +9 -1
  7. package/dist/browser/tools.d.ts +14 -0
  8. package/dist/builtin.d.ts +16 -13
  9. package/dist/builtin.js +41 -45
  10. package/dist/{chunk-AQ5YBURX.js → chunk-2IC5FRD7.js} +2 -2
  11. package/dist/{chunk-VU3QBYL4.js → chunk-2ZWQIVEW.js} +2 -2
  12. package/dist/{chunk-JDOO4P6Z.js → chunk-3F7HQ3KS.js} +2 -2
  13. package/dist/{chunk-DX5KZEMK.js → chunk-47GYABZW.js} +2 -2
  14. package/dist/{chunk-KYVOTHG7.js → chunk-4KI4HHID.js} +2 -2
  15. package/dist/{chunk-3JVSOBHU.js → chunk-54SIRJ6D.js} +4 -4
  16. package/dist/{chunk-X6KXNHUO.js → chunk-5BKQVP56.js} +22 -5
  17. package/dist/{chunk-SMARDKAC.js → chunk-5UA4TNJJ.js} +2 -2
  18. package/dist/{chunk-SOR7OCYP.js → chunk-6XYFYLN7.js} +23 -1
  19. package/dist/{chunk-VO6M2FVG.js → chunk-6ZRP5IKQ.js} +2 -2
  20. package/dist/{chunk-E2ZD4ERD.js → chunk-7EQ2LUXU.js} +3 -3
  21. package/dist/{chunk-6LCKF5KH.js → chunk-7PEZU5Y4.js} +1 -1
  22. package/dist/{chunk-7HL23T3T.js → chunk-BU6VUXWG.js} +2 -2
  23. package/dist/{chunk-KIQTABBJ.js → chunk-C64UUXTA.js} +3 -3
  24. package/dist/{chunk-PNLDTRC5.js → chunk-CYPYJIAF.js} +7 -7
  25. package/dist/{chunk-IRUEHGCR.js → chunk-D4HWMWGE.js} +3 -3
  26. package/dist/{chunk-CVNCSMVU.js → chunk-DOHU3XHS.js} +46 -6
  27. package/dist/{chunk-32XPUSY3.js → chunk-FRIUJ534.js} +3 -3
  28. package/dist/{chunk-AMURQAJX.js → chunk-G35NLPG5.js} +3 -3
  29. package/dist/{chunk-ZUFHAHTE.js → chunk-HKR56VNF.js} +15 -2
  30. package/dist/{chunk-ASEXQRA7.js → chunk-IMIHTHF7.js} +8 -6
  31. package/dist/{chunk-77MBK46T.js → chunk-IOOFLBVM.js} +3 -3
  32. package/dist/{chunk-3LS3FYEF.js → chunk-JK5WXW4S.js} +2 -2
  33. package/dist/{chunk-GU7QJ37F.js → chunk-JQ43NVFU.js} +2 -2
  34. package/dist/{chunk-YECHJJJF.js → chunk-K7Y2IWEB.js} +4 -4
  35. package/dist/{chunk-VZGPASGD.js → chunk-MG7CUN6R.js} +2 -2
  36. package/dist/{chunk-NOCU555K.js → chunk-NKOTOW6X.js} +3 -3
  37. package/dist/{chunk-YDTRKEYY.js → chunk-OBVXDVLE.js} +3 -3
  38. package/dist/{chunk-TYRVYBHW.js → chunk-OVFQC6FU.js} +235 -176
  39. package/dist/{chunk-VKAJMHVG.js → chunk-OZVGRDCM.js} +3 -3
  40. package/dist/{chunk-FC3X7GGJ.js → chunk-R36RWYXE.js} +3 -3
  41. package/dist/{chunk-Z34CUZCZ.js → chunk-S6E2AM4U.js} +3 -3
  42. package/dist/chunk-SIIOHBNY.js +38 -0
  43. package/dist/{chunk-4YKVHCQC.js → chunk-TGVQMKVH.js} +3 -3
  44. package/dist/{chunk-QU2VRCMM.js → chunk-TL5T4A4E.js} +3 -3
  45. package/dist/{chunk-6ZLRRC74.js → chunk-WBAPU3AB.js} +40 -2
  46. package/dist/{chunk-RV7BVTDG.js → chunk-WKXL5XHU.js} +2 -2
  47. package/dist/{chunk-2CTZW6JQ.js → chunk-XHSHNOAF.js} +12 -11
  48. package/dist/{chunk-24T5XIJU.js → chunk-YA2ZYCJY.js} +4 -4
  49. package/dist/{chunk-T7YVY2BV.js → chunk-YILT3CSO.js} +2 -2
  50. package/dist/{chunk-OUEH4I4X.js → chunk-YJQQ5F5J.js} +3 -3
  51. package/dist/{chunk-MIV2RU5B.js → chunk-ZETZHHV5.js} +3 -3
  52. package/dist/{chunk-4ERMPDHV.js → chunk-ZSW5KO5S.js} +21 -17
  53. package/dist/clarify.d.ts +18 -3
  54. package/dist/codebase-index/codebase-search-tool.d.ts +2 -3
  55. package/dist/codebase-index/gitignore.d.ts +1 -1
  56. package/dist/codebase-index/index.js +7 -7
  57. package/dist/codebase-index/parser-worker-script.js +1 -1
  58. package/dist/codebase-index/project-server-endpoint.d.ts +33 -0
  59. package/dist/codebase-index/project-server.js +6 -5
  60. package/dist/codebase-index/worker.js +3 -3
  61. package/dist/diff.js +2 -2
  62. package/dist/e2e.js +2 -2
  63. package/dist/edit.js +7 -7
  64. package/dist/exec.js +2 -2
  65. package/dist/fetch.js +2 -2
  66. package/dist/format.js +4 -4
  67. package/dist/git.js +2 -2
  68. package/dist/glob.js +3 -3
  69. package/dist/grep.js +3 -3
  70. package/dist/index.d.ts +2 -8
  71. package/dist/index.js +76 -117
  72. package/dist/install.js +4 -4
  73. package/dist/json.js +2 -2
  74. package/dist/kanban.js +2 -2
  75. package/dist/languages/index.js +2 -2
  76. package/dist/{legacy-bridge-WVQ4BHDI.js → legacy-bridge-XM2GV665.js} +4 -4
  77. package/dist/lint.js +4 -4
  78. package/dist/logs.js +2 -2
  79. package/dist/outdated.js +2 -2
  80. package/dist/pack.js +42 -46
  81. package/dist/{parser-dispatch-UQAB4E6V.js → parser-dispatch-HZDZSIYH.js} +2 -2
  82. package/dist/patch.js +7 -7
  83. package/dist/plan.js +4 -4
  84. package/dist/read-url-content.d.ts +17 -0
  85. package/dist/read.js +7 -7
  86. package/dist/replace.js +7 -7
  87. package/dist/session-kanban.js +1 -1
  88. package/dist/session-shell.d.ts +12 -0
  89. package/dist/session-shell.js +8 -0
  90. package/dist/task.js +4 -4
  91. package/dist/test.js +4 -4
  92. package/dist/todo.js +3 -3
  93. package/dist/tool-search.js +1 -1
  94. package/dist/tool-tier.d.ts +12 -2
  95. package/dist/tool-tier.js +43 -47
  96. package/dist/tree.js +2 -2
  97. package/dist/typecheck.js +4 -4
  98. package/dist/write.js +7 -7
  99. package/package.json +9 -21
  100. package/dist/batch-tool-use.d.ts +0 -24
  101. package/dist/batch-tool-use.js +0 -7
  102. package/dist/chunk-7ODZTPCU.js +0 -128
  103. package/dist/chunk-CHEK3ASV.js +0 -183
  104. package/dist/chunk-KLJZ4WV4.js +0 -213
  105. package/dist/chunk-VBF2YXUW.js +0 -203
  106. package/dist/document.d.ts +0 -25
  107. package/dist/document.js +0 -8
  108. package/dist/scaffold.d.ts +0 -23
  109. package/dist/scaffold.js +0 -10
  110. package/dist/set-working-dir.d.ts +0 -17
  111. package/dist/tool-help.d.ts +0 -21
  112. package/dist/tool-help.js +0 -7
@@ -1,203 +0,0 @@
1
- // src/batch-tool-use.ts
2
- import {
3
- GOVERNED_TOOL_EXECUTOR_META_KEY
4
- } from "@wrongstack/core/types";
5
- var BATCHABLE_TOOL_NAMES = [
6
- "read",
7
- "glob",
8
- "grep",
9
- "tree",
10
- "codebase-stats",
11
- "codebase-search",
12
- "language_info",
13
- "tool_search",
14
- "memory_for_file",
15
- "memory_for_path",
16
- "memory_search"
17
- ];
18
- var BATCHABLE_TOOLS = new Set(BATCHABLE_TOOL_NAMES);
19
- var MAX_BATCH_CALLS = 8;
20
- var MAX_PARALLEL_BATCH_CALLS = 3;
21
- var batchToolUseTool = {
22
- name: "batch_tool_use",
23
- category: "Meta",
24
- description: "Execute a small batch of independent, read-only discovery calls. Process, mutation, browser-action, MCP, delegation, and nested meta tools are not eligible.",
25
- usageHint: `BOUNDED READ-ONLY BATCHING:
26
-
27
- - Use only for a small set of independent reads or searches that are all needed now.
28
- - Do not wrap normal sequential reasoning or every tool call in a batch.
29
- - \`parallel: true\` (default) runs at most three eligible calls concurrently.
30
- - \`stop_on_error: true\` makes it fail fast on the first error.
31
- - Eligible tools: ${BATCHABLE_TOOL_NAMES.join(", ")}.`,
32
- permission: "confirm",
33
- // Scheduling barrier: keep the outer meta-call out of ToolExecutor's
34
- // non-mutating fan-out even though every eligible inner tool is read-only.
35
- mutating: true,
36
- timeoutMs: 12e4,
37
- capabilities: ["tool.meta"],
38
- icon: "meta",
39
- inputSchema: {
40
- type: "object",
41
- properties: {
42
- calls: {
43
- type: "array",
44
- maxItems: MAX_BATCH_CALLS,
45
- items: {
46
- type: "object",
47
- properties: {
48
- tool: {
49
- type: "string",
50
- enum: [...BATCHABLE_TOOL_NAMES],
51
- description: "An explicitly batch-safe, read-only discovery tool."
52
- },
53
- input: { type: "object" }
54
- },
55
- required: ["tool"]
56
- },
57
- description: `Up to ${MAX_BATCH_CALLS} independent, batch-safe read calls.`
58
- },
59
- stop_on_error: {
60
- type: "boolean",
61
- description: "Stop execution on first error (default: false)"
62
- },
63
- parallel: {
64
- type: "boolean",
65
- description: "Execute calls in parallel (default: true)"
66
- }
67
- },
68
- required: ["calls"]
69
- },
70
- async execute(input, ctx, _opts) {
71
- if (!input?.calls || input.calls.length === 0) {
72
- return {
73
- results: [],
74
- total: 0,
75
- succeeded: 0,
76
- failed: 0,
77
- stop_on_error: false
78
- };
79
- }
80
- if (input.calls.length > MAX_BATCH_CALLS) {
81
- throw new Error(`batch_tool_use: calls must contain at most ${MAX_BATCH_CALLS} items`);
82
- }
83
- const governedExecute = ctx.meta?.[GOVERNED_TOOL_EXECUTOR_META_KEY];
84
- if (typeof governedExecute !== "function") {
85
- return {
86
- results: input.calls.map((call) => ({
87
- tool: call.tool,
88
- success: false,
89
- error: "governed nested execution is unavailable; call the tool directly",
90
- executionMs: 0
91
- })),
92
- total: input.calls.length,
93
- succeeded: 0,
94
- failed: input.calls.length,
95
- stop_on_error: input.stop_on_error ?? false
96
- };
97
- }
98
- const results = [];
99
- let succeeded = 0;
100
- let failed = 0;
101
- if (input.parallel !== false) {
102
- let stopRequested = false;
103
- const allResults = await mapWithConcurrency(
104
- input.calls,
105
- MAX_PARALLEL_BATCH_CALLS,
106
- async (call) => {
107
- const result = await executeSingle(call, ctx, governedExecute);
108
- if (input.stop_on_error && !result.success) stopRequested = true;
109
- return result;
110
- },
111
- () => stopRequested
112
- );
113
- const executed = allResults.filter(
114
- (r) => r !== void 0
115
- );
116
- results.push(...executed);
117
- succeeded = executed.filter((r) => r.success).length;
118
- failed = executed.filter((r) => !r.success).length;
119
- } else {
120
- for (const call of input.calls) {
121
- const result = await executeSingle(call, ctx, governedExecute);
122
- results.push(result);
123
- if (result.success) {
124
- succeeded++;
125
- } else {
126
- failed++;
127
- if (input.stop_on_error) break;
128
- }
129
- }
130
- }
131
- return {
132
- results,
133
- total: input.calls.length,
134
- succeeded,
135
- failed,
136
- stop_on_error: input.stop_on_error ?? false
137
- };
138
- }
139
- };
140
- async function mapWithConcurrency(items, limit, run, shouldStop) {
141
- const results = new Array(items.length);
142
- let nextIndex = 0;
143
- const worker = async () => {
144
- while (nextIndex < items.length) {
145
- if (shouldStop?.()) return;
146
- const index = nextIndex++;
147
- results[index] = await run(items[index]);
148
- }
149
- };
150
- await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
151
- return results;
152
- }
153
- async function executeSingle(call, ctx, governedExecute) {
154
- const start = Date.now();
155
- if (call.tool === batchToolUseTool.name) {
156
- return {
157
- tool: call.tool,
158
- success: false,
159
- error: "recursive batch_tool_use execution is not allowed",
160
- executionMs: Date.now() - start
161
- };
162
- }
163
- const tool = (ctx.catalogTools ?? ctx.tools).find(
164
- (candidate) => candidate.name === call.tool
165
- );
166
- if (!tool) {
167
- return {
168
- tool: call.tool,
169
- success: false,
170
- error: `tool "${call.tool}" not found`,
171
- executionMs: Date.now() - start
172
- };
173
- }
174
- if (!BATCHABLE_TOOLS.has(tool.name) || tool.mutating) {
175
- return {
176
- tool: call.tool,
177
- success: false,
178
- error: `tool "${call.tool}" is not eligible for batch execution; call it directly. Allowed: ${BATCHABLE_TOOL_NAMES.join(", ")}`,
179
- executionMs: Date.now() - start
180
- };
181
- }
182
- try {
183
- const result = await governedExecute(call.tool, call.input);
184
- return {
185
- tool: call.tool,
186
- success: result.success,
187
- ...result.success ? { result: result.result } : { error: result.error ?? "nested tool failed" },
188
- executionMs: Date.now() - start
189
- };
190
- } catch (e) {
191
- return {
192
- tool: call.tool,
193
- success: false,
194
- error: e instanceof Error ? e.message : String(e),
195
- executionMs: Date.now() - start
196
- };
197
- }
198
- }
199
-
200
- export {
201
- batchToolUseTool
202
- };
203
- //# sourceMappingURL=chunk-VBF2YXUW.js.map
@@ -1,25 +0,0 @@
1
- import type { Tool } from '@wrongstack/core/types';
2
- export interface DocumentInput {
3
- target: 'file' | 'function' | 'class' | 'type' | 'all';
4
- path?: string | undefined;
5
- files?: string | string[] | undefined;
6
- style?: 'jsdoc' | 'tsdoc' | 'block' | undefined;
7
- overwrite?: boolean | undefined;
8
- cwd?: string | undefined;
9
- }
10
- export interface DocumentedItem {
11
- path: string;
12
- name: string;
13
- signature: string;
14
- docstring: string;
15
- status: 'documented' | 'skipped' | 'error';
16
- error?: string | undefined;
17
- }
18
- export interface DocumentOutput {
19
- files_processed: number;
20
- items_documented: number;
21
- results: DocumentedItem[];
22
- style: string;
23
- }
24
- export declare const documentTool: Tool<DocumentInput, DocumentOutput>;
25
- //# sourceMappingURL=document.d.ts.map
package/dist/document.js DELETED
@@ -1,8 +0,0 @@
1
- import {
2
- documentTool
3
- } from "./chunk-CHEK3ASV.js";
4
- import "./chunk-ZUFHAHTE.js";
5
- export {
6
- documentTool
7
- };
8
- //# sourceMappingURL=document.js.map
@@ -1,23 +0,0 @@
1
- import type { Tool } from '@wrongstack/core/types';
2
- export interface ScaffoldInput {
3
- template: string;
4
- name: string;
5
- cwd?: string | undefined;
6
- vars?: Record<string, string>;
7
- dry_run?: boolean | undefined;
8
- }
9
- export interface ScaffoldOutput {
10
- template: string;
11
- name: string;
12
- files_created: number;
13
- files: string[];
14
- dry_run: boolean;
15
- output: string;
16
- }
17
- export interface ScaffoldTemplate {
18
- description: string;
19
- files: Record<string, string>;
20
- }
21
- export declare const BUILT_IN_TEMPLATES: Record<string, ScaffoldTemplate>;
22
- export declare const scaffoldTool: Tool<ScaffoldInput, ScaffoldOutput>;
23
- //# sourceMappingURL=scaffold.d.ts.map
package/dist/scaffold.js DELETED
@@ -1,10 +0,0 @@
1
- import {
2
- BUILT_IN_TEMPLATES,
3
- scaffoldTool
4
- } from "./chunk-KLJZ4WV4.js";
5
- import "./chunk-ZUFHAHTE.js";
6
- export {
7
- BUILT_IN_TEMPLATES,
8
- scaffoldTool
9
- };
10
- //# sourceMappingURL=scaffold.js.map
@@ -1,17 +0,0 @@
1
- import type { Tool } from '@wrongstack/core/types';
2
- export interface SetWorkingDirInput {
3
- /** Relative or absolute path to navigate to. Must stay within projectRoot. */
4
- path?: string | undefined;
5
- }
6
- export interface SetWorkingDirOutput {
7
- /** The new working directory (absolute path). */
8
- current: string;
9
- /** The previous working directory (absolute path). */
10
- previous?: string | undefined;
11
- /** Human-readable confirmation message. */
12
- message?: string | undefined;
13
- /** Error if the directory doesn't exist or is outside the project root. */
14
- error?: string | undefined;
15
- }
16
- export declare const setWorkingDirTool: Tool<SetWorkingDirInput, SetWorkingDirOutput>;
17
- //# sourceMappingURL=set-working-dir.d.ts.map
@@ -1,21 +0,0 @@
1
- import type { Tool } from '@wrongstack/core/types';
2
- export interface ToolHelpInput {
3
- tool?: string | undefined;
4
- format?: 'short' | 'full' | 'markdown' | undefined;
5
- include_examples?: boolean | undefined;
6
- }
7
- export interface ToolHelpOutput {
8
- tool?: string | undefined;
9
- help: string;
10
- tools: {
11
- name: string;
12
- description: string;
13
- usageHint: string;
14
- inputSchema: unknown;
15
- permission: string;
16
- mutating: boolean;
17
- }[];
18
- total: number;
19
- }
20
- export declare const toolHelpTool: Tool<ToolHelpInput, ToolHelpOutput>;
21
- //# sourceMappingURL=tool-help.d.ts.map
package/dist/tool-help.js DELETED
@@ -1,7 +0,0 @@
1
- import {
2
- toolHelpTool
3
- } from "./chunk-7ODZTPCU.js";
4
- export {
5
- toolHelpTool
6
- };
7
- //# sourceMappingURL=tool-help.js.map