@gaunt-sloth/agent 2.0.0-alpha.4 → 2.0.0-alpha.40
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/README.md +73 -23
- package/cli-acp.js +21 -24
- package/dist/builtInToolsConfig.d.ts +17 -3
- package/dist/builtInToolsConfig.js +43 -41
- package/dist/builtInToolsConfig.js.map +1 -1
- package/dist/core/debugCapture.d.ts +7 -49
- package/dist/core/debugCapture.js +1 -1
- package/dist/core/debugCapture.js.map +1 -1
- package/dist/core/resolveAgentFactory.d.ts +15 -0
- package/dist/core/resolveAgentFactory.js +17 -0
- package/dist/core/resolveAgentFactory.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
- package/dist/mcp/tlsTrust.d.ts +61 -0
- package/dist/mcp/tlsTrust.js +109 -0
- package/dist/mcp/tlsTrust.js.map +1 -0
- package/dist/middleware/binaryContentInjectionMiddleware.d.ts +8 -1
- package/dist/middleware/binaryContentInjectionMiddleware.js +11 -2
- package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -1
- package/dist/middleware/frontendImageInjectionMiddleware.d.ts +107 -0
- package/dist/middleware/frontendImageInjectionMiddleware.js +167 -0
- package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -0
- package/dist/middleware/registry.js +49 -1
- package/dist/middleware/registry.js.map +1 -1
- package/dist/middleware/types.d.ts +16 -2
- package/dist/modules/a2a/A2AClientWrapper.d.ts +56 -1
- package/dist/modules/a2a/A2AClientWrapper.js +131 -31
- package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
- package/dist/modules/acp/acpAgentApp.d.ts +57 -0
- package/dist/modules/acp/acpAgentApp.js +378 -0
- package/dist/modules/acp/acpAgentApp.js.map +1 -0
- package/dist/modules/acp/acpAgentAppV1.d.ts +52 -0
- package/dist/modules/acp/acpAgentAppV1.js +307 -0
- package/dist/modules/acp/acpAgentAppV1.js.map +1 -0
- package/dist/modules/acp/acpCommon.d.ts +167 -0
- package/dist/modules/acp/acpCommon.js +282 -0
- package/dist/modules/acp/acpCommon.js.map +1 -0
- package/dist/modules/acp/acpPermissions.d.ts +65 -0
- package/dist/modules/acp/acpPermissions.js +162 -0
- package/dist/modules/acp/acpPermissions.js.map +1 -0
- package/dist/modules/acp/acpPermissionsV1.d.ts +45 -0
- package/dist/modules/acp/acpPermissionsV1.js +110 -0
- package/dist/modules/acp/acpPermissionsV1.js.map +1 -0
- package/dist/modules/acp/acpRouter.d.ts +41 -0
- package/dist/modules/acp/acpRouter.js +48 -0
- package/dist/modules/acp/acpRouter.js.map +1 -0
- package/dist/modules/acp/acpStdio.d.ts +47 -0
- package/dist/modules/acp/acpStdio.js +71 -0
- package/dist/modules/acp/acpStdio.js.map +1 -0
- package/dist/modules/acp/acpToolCalls.d.ts +93 -0
- package/dist/modules/acp/acpToolCalls.js +193 -0
- package/dist/modules/acp/acpToolCalls.js.map +1 -0
- package/dist/modules/acp/acpUpdates.d.ts +48 -0
- package/dist/modules/acp/acpUpdates.js +142 -0
- package/dist/modules/acp/acpUpdates.js.map +1 -0
- package/dist/modules/acp/acpUpdatesV1.d.ts +61 -0
- package/dist/modules/acp/acpUpdatesV1.js +162 -0
- package/dist/modules/acp/acpUpdatesV1.js.map +1 -0
- package/dist/modules/apiAgUiModule.d.ts +87 -0
- package/dist/modules/apiAgUiModule.js +225 -32
- package/dist/modules/apiAgUiModule.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +524 -50
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/modules/slashCommands.d.ts +582 -0
- package/dist/modules/slashCommands.js +1001 -0
- package/dist/modules/slashCommands.js.map +1 -0
- package/dist/resolvers.js +119 -9
- package/dist/resolvers.js.map +1 -1
- package/dist/tools/GthCustomToolkit.js +95 -11
- package/dist/tools/GthCustomToolkit.js.map +1 -1
- package/dist/tools/GthDevToolkit.d.ts +9 -33
- package/dist/tools/GthDevToolkit.js +94 -73
- package/dist/tools/GthDevToolkit.js.map +1 -1
- package/dist/tools/GthFileSystemToolkit.d.ts +63 -0
- package/dist/tools/GthFileSystemToolkit.js +506 -105
- package/dist/tools/GthFileSystemToolkit.js.map +1 -1
- package/dist/tools/McpResourceTool.d.ts +31 -0
- package/dist/tools/McpResourceTool.js +106 -0
- package/dist/tools/McpResourceTool.js.map +1 -0
- package/dist/tools/gthChecklistTool.d.ts +30 -0
- package/dist/tools/gthChecklistTool.js +80 -0
- package/dist/tools/gthChecklistTool.js.map +1 -0
- package/dist/tools/gthGrepTool.d.ts +54 -0
- package/dist/tools/gthGrepTool.js +482 -0
- package/dist/tools/gthGrepTool.js.map +1 -0
- package/dist/tools/shell/env.js +1 -1
- package/dist/tools/shell/env.js.map +1 -1
- package/dist/tools/shell/outputBuffer.js.map +1 -1
- package/dist/tools/shell/workDir.d.ts +2 -0
- package/dist/tools/shell/workDir.js +19 -0
- package/dist/tools/shell/workDir.js.map +1 -0
- package/dist/utils/mcpAuthError.d.ts +36 -0
- package/dist/utils/mcpAuthError.js +89 -0
- package/dist/utils/mcpAuthError.js.map +1 -0
- package/dist/utils/mcpUtils.js +16 -0
- package/dist/utils/mcpUtils.js.map +1 -1
- package/package.json +12 -12
- package/dist/core/GthDeepAgent.d.ts +0 -151
- package/dist/core/GthDeepAgent.js +0 -604
- package/dist/core/GthDeepAgent.js.map +0 -1
- package/dist/core/deepAgentPermissions.d.ts +0 -73
- package/dist/core/deepAgentPermissions.js +0 -161
- package/dist/core/deepAgentPermissions.js.map +0 -1
- package/dist/core/gthAcpServer.d.ts +0 -27
- package/dist/core/gthAcpServer.js +0 -71
- package/dist/core/gthAcpServer.js.map +0 -1
- package/dist/core/gthDeepAgentFactory.d.ts +0 -8
- package/dist/core/gthDeepAgentFactory.js +0 -9
- package/dist/core/gthDeepAgentFactory.js.map +0 -1
- package/dist/modules/acpModule.d.ts +0 -40
- package/dist/modules/acpModule.js +0 -70
- package/dist/modules/acpModule.js.map +0 -1
- package/dist/tools/shell/allowlist.d.ts +0 -11
- package/dist/tools/shell/allowlist.js +0 -12
- package/dist/tools/shell/allowlist.js.map +0 -1
- package/dist/tools/shell/arity.d.ts +0 -11
- package/dist/tools/shell/arity.js +0 -12
- package/dist/tools/shell/arity.js.map +0 -1
- package/dist/tools/shell/hardline.d.ts +0 -15
- package/dist/tools/shell/hardline.js +0 -88
- package/dist/tools/shell/hardline.js.map +0 -1
- package/dist/tools/shell/normalize.d.ts +0 -10
- package/dist/tools/shell/normalize.js +0 -11
- package/dist/tools/shell/normalize.js.map +0 -1
|
@@ -5,47 +5,24 @@ import { BaseToolkit, tool } from '@langchain/core/tools';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { spawn, spawnSync } from 'child_process';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
|
|
8
|
+
// TUI-C31 (a): failure-path warnings/errors travel the tool-output channel (see emitToolOutput
|
|
9
|
+
// below) so they reach the managed frame under the Ink TUI instead of raw stdout; the channel's
|
|
10
|
+
// default sink still renders them via displayWarning/displayError for every headless surface.
|
|
9
11
|
import { getShellMaxOutputBytes, getShellTimeoutMs, isShellToolEnabled, } from '@gaunt-sloth/core/config.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
+
import { emitToolOutput } from '@gaunt-sloth/core/core/toolOutputChannel.js';
|
|
13
|
+
import { ShellCommandFailedError } from '@gaunt-sloth/core/core/shell/ShellCommandFailedError.js';
|
|
14
|
+
import { buildHardlineRefusal, checkHardline } from '@gaunt-sloth/core/core/shell/hardline.js';
|
|
12
15
|
import { buildScrubbedEnv } from '#src/tools/shell/env.js';
|
|
13
16
|
import { OutputBuffer } from '#src/tools/shell/outputBuffer.js';
|
|
17
|
+
import { getShellWorkDir } from '#src/tools/shell/workDir.js';
|
|
18
|
+
// EXT-21: `ShellCommandFailedError` lives in core so any agent can recognise a shell failure
|
|
19
|
+
// without breaking the agent→core dependency direction (the lean `GthLangChainAgent` lives in core
|
|
20
|
+
// and cannot import from agent). Re-exported here so `#src/tools/GthDevToolkit.js` importers
|
|
21
|
+
// resolve it too, and every throw below is one and the same core type the softener catches.
|
|
22
|
+
export { ShellCommandFailedError } from '@gaunt-sloth/core/core/shell/ShellCommandFailedError.js';
|
|
14
23
|
// Grace period (ms) between SIGTERM and the escalation to SIGKILL when a command
|
|
15
24
|
// exceeds its timeout. Mirrors opencode's `forceKillAfter` (3s).
|
|
16
25
|
const KILL_GRACE_MS = 3_000;
|
|
17
|
-
/**
|
|
18
|
-
* EXT-20: a run_* command that did NOT exit cleanly (non-zero exit code, or was killed for
|
|
19
|
-
* exceeding the timeout). Carries the FULL model-facing body text ({@link output}) so the
|
|
20
|
-
* softening middleware ({@link GthDeepShellExitSoftening}) can hand the model the exact same
|
|
21
|
-
* observation it saw before — the only change is the tool result's status flips to `'error'`,
|
|
22
|
-
* which drives the ✗ (`isError`) glyph.
|
|
23
|
-
*
|
|
24
|
-
* `executeCommand` previously `resolve()`d on a non-zero exit, so the LangChain `ToolMessage`
|
|
25
|
-
* stayed `status: 'success'` and every failure rendered a ✓. Throwing this typed error instead
|
|
26
|
-
* lets the deep-agent middleware convert it into an error `ToolMessage`. A clean exit (`code === 0`)
|
|
27
|
-
* still `resolve()`s; a spawn-level `child.on('error')` still rejects with a plain `Error`.
|
|
28
|
-
*/
|
|
29
|
-
export class ShellCommandFailedError extends Error {
|
|
30
|
-
/** The full model-facing body (command echo + `<COMMAND_OUTPUT>` + the failure/timeout tail). */
|
|
31
|
-
output;
|
|
32
|
-
/** The process exit code; `null` when the command was killed (timeout) and never exited cleanly. */
|
|
33
|
-
exitCode;
|
|
34
|
-
/** The exact command string that was executed. */
|
|
35
|
-
command;
|
|
36
|
-
/** The run_* tool name that invoked the command (e.g. `run_tests`, `run_shell_command`). */
|
|
37
|
-
toolName;
|
|
38
|
-
constructor(params) {
|
|
39
|
-
// Use the full body as the Error message so any generic logger/handler still surfaces the
|
|
40
|
-
// real command output rather than an opaque wrapper string.
|
|
41
|
-
super(params.output);
|
|
42
|
-
this.name = 'ShellCommandFailedError';
|
|
43
|
-
this.output = params.output;
|
|
44
|
-
this.exitCode = params.exitCode;
|
|
45
|
-
this.command = params.command;
|
|
46
|
-
this.toolName = params.toolName;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
26
|
/**
|
|
50
27
|
* Kill the child AND its descendants on timeout.
|
|
51
28
|
*
|
|
@@ -106,7 +83,9 @@ export function killProcessGroup(child, signal) {
|
|
|
106
83
|
// Already exited — nothing to do.
|
|
107
84
|
}
|
|
108
85
|
}
|
|
109
|
-
// Helper function to create a tool with dev type
|
|
86
|
+
// Helper function to create a tool with dev type. The fn's second parameter is LangChain's
|
|
87
|
+
// ToolRunnableConfig — when the framework invokes the tool with a ToolCall, `config.toolCall.id`
|
|
88
|
+
// identifies the call, which TUI-C17 threads into the live-output channel for attribution.
|
|
110
89
|
function createGthTool(fn, config, gthDevType) {
|
|
111
90
|
const toolInstance = tool(fn, config);
|
|
112
91
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -122,6 +101,25 @@ const RunSingleTestArgsSchema = z.object({
|
|
|
122
101
|
});
|
|
123
102
|
const RunShellCommandArgsSchema = z.object({
|
|
124
103
|
command: z.string().describe('The shell command to run'),
|
|
104
|
+
/**
|
|
105
|
+
* [[EXT-29]] (spec §5.1, §7) — **the move §7 already promises the model and it could not make.**
|
|
106
|
+
* The rejection message names *"call the same command with a justification"* among the moves
|
|
107
|
+
* available after a refusal; without an argument to carry one, the only way to act on that was to
|
|
108
|
+
* re-send the identical call, which is what makes an agent repeat itself and burn §5.3's cap
|
|
109
|
+
* without producing information.
|
|
110
|
+
*
|
|
111
|
+
* It reaches the rater as fenced, untrusted data, weighed asymmetrically (§5.1): a justification
|
|
112
|
+
* may only ever make an outcome LESS severe, and a stated intent that does not match what the
|
|
113
|
+
* command does is grounds for rejection rather than for a discount. Never sent for its own sake —
|
|
114
|
+
* an unprompted one is noise the rater still has to read.
|
|
115
|
+
*/
|
|
116
|
+
justification: z
|
|
117
|
+
.string()
|
|
118
|
+
.optional()
|
|
119
|
+
.describe('Optional. Why this command is the right one, in a sentence or two — supply it when ' +
|
|
120
|
+
'RE-CALLING a command that was rejected, so the reviewer can weigh what you are trying ' +
|
|
121
|
+
'to do. Address the objection you were given rather than restating the request; a ' +
|
|
122
|
+
'justification that does not match what the command actually does is rejected outright.'),
|
|
125
123
|
});
|
|
126
124
|
const TEST_PATH_PLACEHOLDER = '${testPath}';
|
|
127
125
|
export default class GthDevToolkit extends BaseToolkit {
|
|
@@ -129,8 +127,8 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
129
127
|
commands;
|
|
130
128
|
/**
|
|
131
129
|
* The active command, threaded through so the EXT-12 absent-config default for the shell
|
|
132
|
-
* tool (ON in `code`, OFF elsewhere) is resolved consistently with the
|
|
133
|
-
*
|
|
130
|
+
* tool (ON in `code`, OFF elsewhere) is resolved consistently with the approval-interrupt
|
|
131
|
+
* wiring. Omitted → historical OFF-by-default behaviour.
|
|
134
132
|
*/
|
|
135
133
|
command;
|
|
136
134
|
constructor(commands = {}, command) {
|
|
@@ -209,25 +207,39 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
209
207
|
* 2. output capped with a head/tail window + temp-file spillover,
|
|
210
208
|
* 3. provider/LLM credentials scrubbed from the child env,
|
|
211
209
|
* 4. an unbypassable hardline blocklist (refuses catastrophic commands BEFORE
|
|
212
|
-
* spawn — fires even when confirmation is bypassed by
|
|
210
|
+
* spawn — fires even when confirmation is bypassed by approvals.mode: bypass).
|
|
213
211
|
*
|
|
214
212
|
* Resolves with a model-facing string on a CLEAN exit (`code === 0`). EXT-20: a non-zero exit
|
|
215
213
|
* and a timeout-kill instead REJECT with a {@link ShellCommandFailedError} that carries the FULL
|
|
216
214
|
* model-facing body — the deep-agent {@link GthDeepShellExitSoftening} middleware converts that
|
|
217
215
|
* throw into an error `ToolMessage` (status:'error' → ✗) while preserving the output, so the
|
|
218
|
-
* model still sees the killed-after-N / exit-code message and can continue.
|
|
219
|
-
* (`child.on('error')`
|
|
216
|
+
* model still sees the killed-after-N / exit-code message and can continue. GS2-36: spawn-level
|
|
217
|
+
* failures (`child.on('error')` — missing shell binary, a non-existent cwd, EMFILE, …) ALSO reject
|
|
218
|
+
* with a {@link ShellCommandFailedError} (exitCode null) so the same softeners convert them into a
|
|
219
|
+
* recoverable error `ToolMessage`; previously they rejected a plain `Error` that neither softener
|
|
220
|
+
* recognised, so a spawn failure aborted the whole run.
|
|
220
221
|
*/
|
|
221
|
-
async executeCommand(command, toolName) {
|
|
222
|
-
|
|
223
|
-
//
|
|
224
|
-
//
|
|
222
|
+
async executeCommand(command, toolName, toolCallId) {
|
|
223
|
+
// TUI-C17: the "Executing" notice + live child output go through the tool-output channel.
|
|
224
|
+
// With no subscriber (every non-TUI surface) the channel's default sink reproduces the
|
|
225
|
+
// historical behaviour exactly (displayInfo notice, raw stdout chunks); under the Ink TUI
|
|
226
|
+
// the session subscribes and folds them into the managed frame instead.
|
|
227
|
+
emitToolOutput({
|
|
228
|
+
toolCallId,
|
|
229
|
+
toolName,
|
|
230
|
+
kind: 'notice',
|
|
231
|
+
text: `🔧 Executing ${toolName}: ${command}`,
|
|
232
|
+
});
|
|
233
|
+
// (4) Hardline blocklist — checked here so it fires regardless of the approval mode,
|
|
234
|
+
// allow-lists, or any confirmation path. Refuse WITHOUT executing. The approvals gate consults
|
|
235
|
+
// the SAME floor before it rates or prompts ([[EXT-29]] §4.2), so a matching command normally
|
|
236
|
+
// never reaches this line; this call is the guarantee that holds when nothing gated it at all.
|
|
225
237
|
const hardline = checkHardline(command);
|
|
226
238
|
if (hardline) {
|
|
227
|
-
const refusal =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
239
|
+
const refusal = buildHardlineRefusal(command, hardline);
|
|
240
|
+
// TUI-C31 (a): route through the tool-output channel so the refusal lands in the managed
|
|
241
|
+
// frame under the TUI (headless still gets displayWarning via the default sink, verbatim).
|
|
242
|
+
emitToolOutput({ toolCallId, toolName, kind: 'warning', text: `\n⛔ ${refusal}` });
|
|
231
243
|
return refusal;
|
|
232
244
|
}
|
|
233
245
|
const timeoutMs = getShellTimeoutMs(this.commands);
|
|
@@ -235,15 +247,10 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
235
247
|
return new Promise((resolve, reject) => {
|
|
236
248
|
const child = spawn(command, {
|
|
237
249
|
shell: true,
|
|
238
|
-
// EXT-22 (S4): spawn in the SAME directory the
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
// fs-backend root on the local code/chat runner. getCurrentWorkDir() =
|
|
243
|
-
// `process.env.INIT_CWD ?? process.cwd()` (core systemUtils); it only diverges from bare
|
|
244
|
-
// process.cwd() when INIT_CWD is set (npm-bin / IDE-spawned launches) — exactly the
|
|
245
|
-
// POSIX-latent divergence S4 closes. Evaluated at call time.
|
|
246
|
-
cwd: getCurrentWorkDir(),
|
|
250
|
+
// EXT-22 (S4) / EXT-23: spawn in the SAME directory the filesystem tools are rooted at, so
|
|
251
|
+
// the shell tool and the fs tools operate on one path namespace instead of diverging.
|
|
252
|
+
// Resolved through the shared seam (see tools/shell/workDir.ts) and evaluated at call time.
|
|
253
|
+
cwd: getShellWorkDir(),
|
|
247
254
|
// (1) Never let the child block on stdin (e.g. git commit opening $EDITOR).
|
|
248
255
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
249
256
|
// (1) POSIX: own process group so we can kill the whole tree on timeout
|
|
@@ -274,14 +281,14 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
274
281
|
if (child.stdout) {
|
|
275
282
|
child.stdout.on('data', (data) => {
|
|
276
283
|
const chunk = data.toString();
|
|
277
|
-
|
|
284
|
+
emitToolOutput({ toolCallId, toolName, kind: 'output', text: chunk });
|
|
278
285
|
buffer.append(chunk);
|
|
279
286
|
});
|
|
280
287
|
}
|
|
281
288
|
if (child.stderr) {
|
|
282
289
|
child.stderr.on('data', (data) => {
|
|
283
290
|
const chunk = data.toString();
|
|
284
|
-
|
|
291
|
+
emitToolOutput({ toolCallId, toolName, kind: 'output', text: chunk });
|
|
285
292
|
buffer.append(chunk);
|
|
286
293
|
});
|
|
287
294
|
}
|
|
@@ -328,17 +335,31 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
328
335
|
return;
|
|
329
336
|
settled = true;
|
|
330
337
|
clearTimers();
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
338
|
+
// GS2-36: a spawn-level failure used to reject a plain Error, which neither the lean
|
|
339
|
+
// (GthLeanShellExitSoftening) nor the deep (GthDeepShellExitSoftening) softener recognises —
|
|
340
|
+
// so it propagated to GthAgentRunner as a fatal `Stream processing failed` and crashed the
|
|
341
|
+
// run. Reject a ShellCommandFailedError (exitCode null, like a timeout-kill) so BOTH softeners
|
|
342
|
+
// convert it into a recoverable status:'error' ToolMessage and the model can route around it.
|
|
343
|
+
// The message is phrased as an action-oriented recovery hint (EXT-34 hermes style).
|
|
344
|
+
const errorMsg = `Failed to start command '${command}': ${error.message}. ` +
|
|
345
|
+
'Check that the command/executable exists and the working directory is valid, then retry.';
|
|
346
|
+
// TUI-C31 (a): route through the tool-output channel so the spawn-error advisory lands in
|
|
347
|
+
// the managed frame under the TUI (headless still gets displayError via the default sink).
|
|
348
|
+
emitToolOutput({ toolCallId, toolName, kind: 'error', text: errorMsg });
|
|
349
|
+
reject(new ShellCommandFailedError({
|
|
350
|
+
output: errorMsg,
|
|
351
|
+
exitCode: null,
|
|
352
|
+
command,
|
|
353
|
+
toolName,
|
|
354
|
+
}));
|
|
334
355
|
});
|
|
335
356
|
});
|
|
336
357
|
}
|
|
337
358
|
createTools() {
|
|
338
359
|
const tools = [];
|
|
339
360
|
if (this.commands.run_tests) {
|
|
340
|
-
tools.push(createGthTool(async (_args) => {
|
|
341
|
-
return await this.executeCommand(this.commands.run_tests, 'run_tests');
|
|
361
|
+
tools.push(createGthTool(async (_args, config) => {
|
|
362
|
+
return await this.executeCommand(this.commands.run_tests, 'run_tests', config?.toolCall?.id);
|
|
342
363
|
}, {
|
|
343
364
|
name: 'run_tests',
|
|
344
365
|
description: 'Execute the test suite for this project. Runs the configured test command and returns the output.' +
|
|
@@ -347,10 +368,10 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
347
368
|
}, 'execute'));
|
|
348
369
|
}
|
|
349
370
|
if (this.commands.run_single_test) {
|
|
350
|
-
tools.push(createGthTool(async (args) => {
|
|
371
|
+
tools.push(createGthTool(async (args, config) => {
|
|
351
372
|
const validatedPath = this.validateParameterValue(args.testPath, 'testPath');
|
|
352
373
|
const command = this.buildSingleTestCommand(validatedPath);
|
|
353
|
-
return await this.executeCommand(command, 'run_single_test');
|
|
374
|
+
return await this.executeCommand(command, 'run_single_test', config?.toolCall?.id);
|
|
354
375
|
}, {
|
|
355
376
|
name: 'run_single_test',
|
|
356
377
|
description: 'Execute a single test file. Runs the configured test command with the specified test file path. ' +
|
|
@@ -360,8 +381,8 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
360
381
|
}, 'execute'));
|
|
361
382
|
}
|
|
362
383
|
if (this.commands.run_lint) {
|
|
363
|
-
tools.push(createGthTool(async (_args) => {
|
|
364
|
-
return await this.executeCommand(this.commands.run_lint, 'run_lint');
|
|
384
|
+
tools.push(createGthTool(async (_args, config) => {
|
|
385
|
+
return await this.executeCommand(this.commands.run_lint, 'run_lint', config?.toolCall?.id);
|
|
365
386
|
}, {
|
|
366
387
|
name: 'run_lint',
|
|
367
388
|
description: 'Run the linter on the project code. Executes the configured lint command and returns any linting errors or warnings.' +
|
|
@@ -370,8 +391,8 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
370
391
|
}, 'execute'));
|
|
371
392
|
}
|
|
372
393
|
if (this.commands.run_build) {
|
|
373
|
-
tools.push(createGthTool(async (_args) => {
|
|
374
|
-
return await this.executeCommand(this.commands.run_build, 'run_build');
|
|
394
|
+
tools.push(createGthTool(async (_args, config) => {
|
|
395
|
+
return await this.executeCommand(this.commands.run_build, 'run_build', config?.toolCall?.id);
|
|
375
396
|
}, {
|
|
376
397
|
name: 'run_build',
|
|
377
398
|
description: 'Build the project. Executes the configured build command and returns the build output.' +
|
|
@@ -384,8 +405,8 @@ export default class GthDevToolkit extends BaseToolkit {
|
|
|
384
405
|
// agent (createDeepAgent `interruptOn`), not a parameter sanitizer — a real shell command
|
|
385
406
|
// legitimately contains pipes / `$` / `;`, so validateParameterValue must NOT be applied.
|
|
386
407
|
if (isShellToolEnabled(this.commands, this.command)) {
|
|
387
|
-
tools.push(createGthTool(async (args) => {
|
|
388
|
-
return await this.executeCommand(args.command, 'run_shell_command');
|
|
408
|
+
tools.push(createGthTool(async (args, config) => {
|
|
409
|
+
return await this.executeCommand(args.command, 'run_shell_command', config?.toolCall?.id);
|
|
389
410
|
}, {
|
|
390
411
|
name: 'run_shell_command',
|
|
391
412
|
description: 'Run an arbitrary shell command in the project working directory and return its ' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GthDevToolkit.js","sourceRoot":"","sources":["../../src/tools/GthDevToolkit.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAA2B,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpG,OAAO,EAEL,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OA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AyC,EACzC,MAA2B,EACV,EAAE;gBACnB,OAAO,MAAM,IAAI,CAAC,cAAc,CAC9B,IAAI,CAAC,QAAQ,CAAC,SAAU,EACxB,WAAW,EACX,MAAM,EAAE,QAAQ,EAAE,EAAE,CACrB,CAAC;YACJ,CAAC,EACD;gBACE,IAAI,EAAE,WAAW;gBACjB,WAAW,EACT,wFAAwF;oBACxF,gCAAgC,IAAI,CAAC,QAAQ,CAAC,SAAU,IAAI;gBAC9D,MAAM,EAAE,kBAAkB;aAC3B,EACD,SAAS,CACV,CACF,CAAC;QACJ,CAAC;QAED,yFAAyF;QACzF,yFAAyF;QACzF,0FAA0F;QAC1F,0FAA0F;QAC1F,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,KAAK,CAAC,IAAI,CACR,aAAa,CACX,KAAK,EACH,IAA+C,EAC/C,MAA2B,EACV,EAAE;gBACnB,OAAO,MAAM,IAAI,CAAC,cAAc,CAC9B,IAAI,CAAC,OAAO,EACZ,mBAAmB,EACnB,MAAM,EAAE,QAAQ,EAAE,EAAE,CACrB,CAAC;YACJ,CAAC,EACD;gBACE,IAAI,EAAE,mBAAmB;gBACzB,WAAW,EACT,iFAAiF;oBACjF,oFAAoF;oBACpF,mFAAmF;oBACnF,kEAAkE;gBACpE,MAAM,EAAE,yBAAyB;aAClC,EACD,SAAS,CACV,CACF,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -27,10 +27,73 @@ export default class GthFileSystemToolkit extends BaseToolkit {
|
|
|
27
27
|
private searchFiles;
|
|
28
28
|
private normalizeLineEndings;
|
|
29
29
|
private createUnifiedDiff;
|
|
30
|
+
/**
|
|
31
|
+
* Count non-overlapping exact occurrences of `search` in `content`.
|
|
32
|
+
* Uses an indexOf scan (no regex) so arbitrary text is matched literally.
|
|
33
|
+
*/
|
|
34
|
+
private countOccurrences;
|
|
30
35
|
private applyFileEdits;
|
|
31
36
|
private formatSize;
|
|
32
37
|
private tailFile;
|
|
33
38
|
private headFile;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the first `head` lines and the last `tail` lines of a file, separated by a
|
|
41
|
+
* `... [N lines skipped] ...` marker. When the two windows cover or overlap the whole
|
|
42
|
+
* file (`head + tail >= total`) the entire file is returned unchanged (no marker, no
|
|
43
|
+
* duplicated lines).
|
|
44
|
+
*/
|
|
45
|
+
private headAndTailFile;
|
|
46
|
+
/**
|
|
47
|
+
* Return the file's lines from the 1-based `offset` to EOF (GS2-39 paging). Deliberately does
|
|
48
|
+
* NOT apply `limit` here — the caller hands the result to capReadContent with maxLines = limit so
|
|
49
|
+
* that a limit-bounded read is *observable* to the envelope (it can then tell "more file remains
|
|
50
|
+
* past this window" from "reached EOF" and emit the correct resume notice). Pre-slicing to
|
|
51
|
+
* exactly `limit` lines here would hide that signal and silently drop the continuation.
|
|
52
|
+
*
|
|
53
|
+
* Mirrors headAndTailFile's trailing-newline handling so line numbering matches head/tail/full
|
|
54
|
+
* reads: a terminating newline yields a phantom trailing empty element that must not be counted
|
|
55
|
+
* as a real line. Clamps rather than throwing: an offset past EOF returns a short recoverable note
|
|
56
|
+
* (not an empty string, which is indistinguishable from an empty file).
|
|
57
|
+
*/
|
|
58
|
+
private windowFile;
|
|
59
|
+
/**
|
|
60
|
+
* Apply the read safety envelope (GS2-39) to already-selected file content:
|
|
61
|
+
* - any single line longer than MAX_LINE_LENGTH is truncated with LINE_TRUNCATED_SUFFIX;
|
|
62
|
+
* - emission stops once `maxLines` lines OR MAX_READ_BYTES bytes have been produced.
|
|
63
|
+
*
|
|
64
|
+
* When nothing exceeds the caps the content is returned verbatim (byte-identical), so normal
|
|
65
|
+
* files behave exactly as before — the change only bites on pathological / huge files.
|
|
66
|
+
*
|
|
67
|
+
* Three truncation signals are kept deliberately separate:
|
|
68
|
+
* - a per-line cut is marked only by the inline LINE_TRUNCATED_SUFFIX (no global notice);
|
|
69
|
+
* - the BYTE cap always appends the global "output truncated" notice, because it is the hard
|
|
70
|
+
* safety envelope regardless of who asked for the read;
|
|
71
|
+
* - the LINE cap appends the global notice only when `lineCapIsHard` is true — i.e. `maxLines`
|
|
72
|
+
* is the hard MAX_READ_LINES envelope (a defaulted or clamped-down window, or the whole-file
|
|
73
|
+
* read), NOT a deliberate small explicit `limit`. This distinguishes a *capped continuation*
|
|
74
|
+
* (notify so the model can page) from a *satisfied explicit window* (stay quiet).
|
|
75
|
+
*
|
|
76
|
+
* `startLine` is the 1-based file line of the first line in `content`; it is used only to put a
|
|
77
|
+
* concrete resume `offset` in the global notice. Pass `undefined` (head/tail paths, where the
|
|
78
|
+
* first emitted line is not line `startLine` of the file) to emit a generic notice instead.
|
|
79
|
+
*/
|
|
80
|
+
private capReadContent;
|
|
81
|
+
/**
|
|
82
|
+
* GS2-36 — turn a fatal tool throw into a recoverable, action-oriented errored result.
|
|
83
|
+
*
|
|
84
|
+
* A filesystem tool that throws (a denied/symlinked-out path from validatePath, a missing file,
|
|
85
|
+
* EISDIR, permission-denied, a directory-not-empty refusal, …) otherwise propagates to
|
|
86
|
+
* GthAgentRunner as a fatal `Stream processing failed` and crashes the whole turn. The house
|
|
87
|
+
* convention (AGENTS.md: a tool result must never abort a run; the write_file precedent in
|
|
88
|
+
* `5892801a`) is to return the failure to the model as a plain string it can act on. This wraps
|
|
89
|
+
* that string in a uniform `Error <action>: <message>` shape — the underlying fs/validation
|
|
90
|
+
* message (ENOENT / EISDIR / EACCES / "Access denied - …") is itself the actionable detail, and
|
|
91
|
+
* the deliberately-thrown logical messages (edit_file no-match/ambiguous, "Directory not empty",
|
|
92
|
+
* "Cannot delete protected directory") are already phrased as recovery hints. EXT-14 containment
|
|
93
|
+
* is preserved everywhere: validatePath runs first and throws on a symlink-out BEFORE any fs
|
|
94
|
+
* mutation, so the mutation never happens — the denial is merely surfaced as a result here.
|
|
95
|
+
*/
|
|
96
|
+
private recoverableError;
|
|
34
97
|
private createReadBinaryTool;
|
|
35
98
|
private createTools;
|
|
36
99
|
}
|