@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.
Files changed (126) hide show
  1. package/README.md +73 -23
  2. package/cli-acp.js +21 -24
  3. package/dist/builtInToolsConfig.d.ts +17 -3
  4. package/dist/builtInToolsConfig.js +43 -41
  5. package/dist/builtInToolsConfig.js.map +1 -1
  6. package/dist/core/debugCapture.d.ts +7 -49
  7. package/dist/core/debugCapture.js +1 -1
  8. package/dist/core/debugCapture.js.map +1 -1
  9. package/dist/core/resolveAgentFactory.d.ts +15 -0
  10. package/dist/core/resolveAgentFactory.js +17 -0
  11. package/dist/core/resolveAgentFactory.js.map +1 -0
  12. package/dist/index.d.ts +5 -4
  13. package/dist/index.js +8 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
  16. package/dist/mcp/tlsTrust.d.ts +61 -0
  17. package/dist/mcp/tlsTrust.js +109 -0
  18. package/dist/mcp/tlsTrust.js.map +1 -0
  19. package/dist/middleware/binaryContentInjectionMiddleware.d.ts +8 -1
  20. package/dist/middleware/binaryContentInjectionMiddleware.js +11 -2
  21. package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -1
  22. package/dist/middleware/frontendImageInjectionMiddleware.d.ts +107 -0
  23. package/dist/middleware/frontendImageInjectionMiddleware.js +167 -0
  24. package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -0
  25. package/dist/middleware/registry.js +49 -1
  26. package/dist/middleware/registry.js.map +1 -1
  27. package/dist/middleware/types.d.ts +16 -2
  28. package/dist/modules/a2a/A2AClientWrapper.d.ts +56 -1
  29. package/dist/modules/a2a/A2AClientWrapper.js +131 -31
  30. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
  31. package/dist/modules/acp/acpAgentApp.d.ts +57 -0
  32. package/dist/modules/acp/acpAgentApp.js +378 -0
  33. package/dist/modules/acp/acpAgentApp.js.map +1 -0
  34. package/dist/modules/acp/acpAgentAppV1.d.ts +52 -0
  35. package/dist/modules/acp/acpAgentAppV1.js +307 -0
  36. package/dist/modules/acp/acpAgentAppV1.js.map +1 -0
  37. package/dist/modules/acp/acpCommon.d.ts +167 -0
  38. package/dist/modules/acp/acpCommon.js +282 -0
  39. package/dist/modules/acp/acpCommon.js.map +1 -0
  40. package/dist/modules/acp/acpPermissions.d.ts +65 -0
  41. package/dist/modules/acp/acpPermissions.js +162 -0
  42. package/dist/modules/acp/acpPermissions.js.map +1 -0
  43. package/dist/modules/acp/acpPermissionsV1.d.ts +45 -0
  44. package/dist/modules/acp/acpPermissionsV1.js +110 -0
  45. package/dist/modules/acp/acpPermissionsV1.js.map +1 -0
  46. package/dist/modules/acp/acpRouter.d.ts +41 -0
  47. package/dist/modules/acp/acpRouter.js +48 -0
  48. package/dist/modules/acp/acpRouter.js.map +1 -0
  49. package/dist/modules/acp/acpStdio.d.ts +47 -0
  50. package/dist/modules/acp/acpStdio.js +71 -0
  51. package/dist/modules/acp/acpStdio.js.map +1 -0
  52. package/dist/modules/acp/acpToolCalls.d.ts +93 -0
  53. package/dist/modules/acp/acpToolCalls.js +193 -0
  54. package/dist/modules/acp/acpToolCalls.js.map +1 -0
  55. package/dist/modules/acp/acpUpdates.d.ts +48 -0
  56. package/dist/modules/acp/acpUpdates.js +142 -0
  57. package/dist/modules/acp/acpUpdates.js.map +1 -0
  58. package/dist/modules/acp/acpUpdatesV1.d.ts +61 -0
  59. package/dist/modules/acp/acpUpdatesV1.js +162 -0
  60. package/dist/modules/acp/acpUpdatesV1.js.map +1 -0
  61. package/dist/modules/apiAgUiModule.d.ts +87 -0
  62. package/dist/modules/apiAgUiModule.js +225 -32
  63. package/dist/modules/apiAgUiModule.js.map +1 -1
  64. package/dist/modules/interactiveSessionModule.js +524 -50
  65. package/dist/modules/interactiveSessionModule.js.map +1 -1
  66. package/dist/modules/slashCommands.d.ts +582 -0
  67. package/dist/modules/slashCommands.js +1001 -0
  68. package/dist/modules/slashCommands.js.map +1 -0
  69. package/dist/resolvers.js +119 -9
  70. package/dist/resolvers.js.map +1 -1
  71. package/dist/tools/GthCustomToolkit.js +95 -11
  72. package/dist/tools/GthCustomToolkit.js.map +1 -1
  73. package/dist/tools/GthDevToolkit.d.ts +9 -33
  74. package/dist/tools/GthDevToolkit.js +94 -73
  75. package/dist/tools/GthDevToolkit.js.map +1 -1
  76. package/dist/tools/GthFileSystemToolkit.d.ts +63 -0
  77. package/dist/tools/GthFileSystemToolkit.js +506 -105
  78. package/dist/tools/GthFileSystemToolkit.js.map +1 -1
  79. package/dist/tools/McpResourceTool.d.ts +31 -0
  80. package/dist/tools/McpResourceTool.js +106 -0
  81. package/dist/tools/McpResourceTool.js.map +1 -0
  82. package/dist/tools/gthChecklistTool.d.ts +30 -0
  83. package/dist/tools/gthChecklistTool.js +80 -0
  84. package/dist/tools/gthChecklistTool.js.map +1 -0
  85. package/dist/tools/gthGrepTool.d.ts +54 -0
  86. package/dist/tools/gthGrepTool.js +482 -0
  87. package/dist/tools/gthGrepTool.js.map +1 -0
  88. package/dist/tools/shell/env.js +1 -1
  89. package/dist/tools/shell/env.js.map +1 -1
  90. package/dist/tools/shell/outputBuffer.js.map +1 -1
  91. package/dist/tools/shell/workDir.d.ts +2 -0
  92. package/dist/tools/shell/workDir.js +19 -0
  93. package/dist/tools/shell/workDir.js.map +1 -0
  94. package/dist/utils/mcpAuthError.d.ts +36 -0
  95. package/dist/utils/mcpAuthError.js +89 -0
  96. package/dist/utils/mcpAuthError.js.map +1 -0
  97. package/dist/utils/mcpUtils.js +16 -0
  98. package/dist/utils/mcpUtils.js.map +1 -1
  99. package/package.json +12 -12
  100. package/dist/core/GthDeepAgent.d.ts +0 -151
  101. package/dist/core/GthDeepAgent.js +0 -604
  102. package/dist/core/GthDeepAgent.js.map +0 -1
  103. package/dist/core/deepAgentPermissions.d.ts +0 -73
  104. package/dist/core/deepAgentPermissions.js +0 -161
  105. package/dist/core/deepAgentPermissions.js.map +0 -1
  106. package/dist/core/gthAcpServer.d.ts +0 -27
  107. package/dist/core/gthAcpServer.js +0 -71
  108. package/dist/core/gthAcpServer.js.map +0 -1
  109. package/dist/core/gthDeepAgentFactory.d.ts +0 -8
  110. package/dist/core/gthDeepAgentFactory.js +0 -9
  111. package/dist/core/gthDeepAgentFactory.js.map +0 -1
  112. package/dist/modules/acpModule.d.ts +0 -40
  113. package/dist/modules/acpModule.js +0 -70
  114. package/dist/modules/acpModule.js.map +0 -1
  115. package/dist/tools/shell/allowlist.d.ts +0 -11
  116. package/dist/tools/shell/allowlist.js +0 -12
  117. package/dist/tools/shell/allowlist.js.map +0 -1
  118. package/dist/tools/shell/arity.d.ts +0 -11
  119. package/dist/tools/shell/arity.js +0 -12
  120. package/dist/tools/shell/arity.js.map +0 -1
  121. package/dist/tools/shell/hardline.d.ts +0 -15
  122. package/dist/tools/shell/hardline.js +0 -88
  123. package/dist/tools/shell/hardline.js.map +0 -1
  124. package/dist/tools/shell/normalize.d.ts +0 -10
  125. package/dist/tools/shell/normalize.js +0 -11
  126. package/dist/tools/shell/normalize.js.map +0 -1
@@ -1,604 +0,0 @@
1
- import { isShellToolEnabled } from '@gaunt-sloth/core/config.js';
2
- import { GthAbstractAgent } from '@gaunt-sloth/core/core/GthAbstractAgent.js';
3
- import { StatusLevel } from '@gaunt-sloth/core/core/types.js';
4
- import { debugLog, debugLogObject } from '@gaunt-sloth/core/utils/debugUtils.js';
5
- import { buildSystemMessages, formatToolCalls, readChatPrompt, readCodePrompt, readExecPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
6
- import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
7
- import { AIMessage, ToolMessage } from '@langchain/core/messages';
8
- import { createMiddleware } from 'langchain';
9
- import { createDeepAgent, FilesystemBackend } from 'deepagents';
10
- import { buildPermissions, FILESYSTEM_TOOL_NAMES, } from '#src/core/deepAgentPermissions.js';
11
- import { ShellCommandFailedError } from '#src/tools/GthDevToolkit.js';
12
- /**
13
- * EXT-16: decide whether the deepagents filesystem backend must run in virtualMode.
14
- *
15
- * deepagents' permission layer (`validatePath`) requires POSIX `/`-rooted glob paths, and its
16
- * fs tools hand the SAME model-supplied path string to both the permission check and the native
17
- * `path.resolve`/`fs` backend. On Windows a real cwd is `D:\...`, which can satisfy neither side
18
- * as one string, so the EXT-13 real-path sandbox throws `Error: path must be absolute` on every
19
- * turn and the agent hangs. The precise trigger is "the real cwd is not POSIX-rooted", so we key
20
- * off that directly (not just `win32`): when true, run virtualMode (cwd→`/`) with virtual
21
- * permissions — the pre-EXT-13 known-good behavior. POSIX keeps the EXT-13 real-path namespace.
22
- */
23
- function shouldUseVirtualFs() {
24
- return !getCurrentWorkDir().startsWith('/');
25
- }
26
- /**
27
- * Deep agent: builds a `createDeepAgent` graph (deepagents). All run/stream/event
28
- * plumbing lives in {@link GthAbstractAgent}; this class only knows how to construct
29
- * the graph in {@link init}.
30
- *
31
- * Differences from the lean {@link GthLangChainAgent}:
32
- * - deepagents provides the filesystem tools (`read_file`/`write_file`/`edit_file`/
33
- * `ls`/`glob`/`grep`/`execute`) via its own middleware, backed by a
34
- * {@link FilesystemBackend}. gsloth's `.aiignore` + `filesystem` config are mapped
35
- * onto deepagents `permissions` (see {@link buildPermissions}). Any resolved tool
36
- * that reuses a deepagents filesystem-tool name is therefore superseded and dropped
37
- * (`createDeepAgent` would otherwise throw on the collision).
38
- * - todos / subagents / summarization come from deepagents' standard middleware.
39
- *
40
- * The transport-agnostic param assembly lives in {@link buildDeepAgentParams} so the ACP
41
- * entry (`deepagents-acp`) can reuse the exact same tool resolution, permission mapping and
42
- * middleware hardening without re-running `createDeepAgent` locally.
43
- */
44
- export class GthDeepAgent extends GthAbstractAgent {
45
- /**
46
- * Opt-in debug sink for the TUI `/debug` panel. Set AFTER {@link init} via
47
- * `runner.getAgent()`; read lazily inside the `wrapModelCall` middleware so that when it
48
- * is `undefined` (the normal path) the middleware is a transparent pass-through. Never
49
- * touched by the lean agent or the AG-UI server, so those contracts are unchanged.
50
- */
51
- debugCapture;
52
- async init(command, configIn, checkpointer) {
53
- const params = await this.buildDeepAgentParams(command, configIn);
54
- // Runner-path only: surface requested tool calls to the console. This is intentionally
55
- // NOT part of buildDeepAgentParams — it writes via statusUpdate (stdout) and the ACP
56
- // server renders tool calls itself over its own protocol channel.
57
- const statusUpdate = this.statusUpdate;
58
- const toolCallStatusMiddleware = createMiddleware({
59
- name: 'GthMiddlewareToolCallStatusUpdate',
60
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
- afterModel: (state) => {
62
- debugLogObject('postModel state', state);
63
- const lastMessage = state.messages[state.messages.length - 1];
64
- if (AIMessage.isInstance(lastMessage) &&
65
- lastMessage.tool_calls &&
66
- lastMessage.tool_calls?.length > 0) {
67
- statusUpdate(StatusLevel.INFO, `\nRequested tools: ${formatToolCalls(lastMessage.tool_calls)}\n`);
68
- }
69
- return state;
70
- },
71
- });
72
- // Debug-capture middleware (TUI `/debug` panel). Always installed but lazy: it reads
73
- // `this.debugCapture` per call, so until the TUI attaches a sink it is a transparent
74
- // pass-through (one extra await around the handler — the normal path pays nothing).
75
- // `request.messages` is the real history at call time (post-summarization/middleware),
76
- // and `handler(request)` resolves to the AIMessage response (decision (a): whole
77
- // resolved message, not per-chunk — the streaming core stays untouched).
78
- const getDebugCapture = () => this.debugCapture;
79
- const debugCaptureMiddleware = createMiddleware({
80
- name: 'GthMiddlewareDebugCapture',
81
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
- wrapModelCall: async (request, handler) => {
83
- const capture = getDebugCapture();
84
- if (!capture)
85
- return handler(request);
86
- try {
87
- capture.onRequest?.(request.messages, extractDebugRequestExtras(request));
88
- }
89
- catch {
90
- /* a debug sink must never break the run */
91
- }
92
- const response = await handler(request);
93
- try {
94
- capture.onResponse?.(response);
95
- }
96
- catch {
97
- /* a debug sink must never break the run */
98
- }
99
- return response;
100
- },
101
- });
102
- // EXT-16: whether the deepagents fs backend runs in virtualMode. deepagents' permission layer
103
- // requires POSIX `/`-rooted paths, so a Windows real cwd (`D:\...`) can't be expressed as a
104
- // permission glob and the EXT-13 real-path mode hangs there (`Error: path must be absolute`).
105
- // When the real cwd isn't POSIX-rooted, fall back to virtualMode (cwd→`/`) with virtual
106
- // permissions — the pre-EXT-13 known-good Windows behavior. Computed here because the EXT-22 S1
107
- // middleware (below), the backend, and the systemPrompt gate (further down) all key off it.
108
- const useVirtualFs = shouldUseVirtualFs();
109
- // EXT-22 (S1): last-word path-namespace correction. Appends the shared guidance as a trailing
110
- // system-message block ONLY in code + virtualMode (where the fs virtual `/` root and the
111
- // shell's real-OS paths diverge); a transparent pass-through otherwise. Added LAST in the
112
- // middleware array so, being the innermost wrapModelCall, its block lands AFTER deepagents'
113
- // "All file paths must start with a /." line (see handoff/spike-systemmessage-ordering.md).
114
- const pathNamespaceCorrectionMiddleware = createPathNamespaceCorrectionMiddleware(this.command === 'code' && useVirtualFs);
115
- const middleware = [
116
- ...params.middleware,
117
- toolCallStatusMiddleware,
118
- debugCaptureMiddleware,
119
- pathNamespaceCorrectionMiddleware,
120
- ];
121
- this.statusUpdate(StatusLevel.INFO, `Loaded middleware: ${middleware.map((m) => m.name).join(', ')}`);
122
- // EXT-13: the backend always runs in REAL-path mode (virtualMode off) so the deepagents fs
123
- // tools and the EXT-9 run_shell_command tool share ONE path namespace — real absolute paths
124
- // rooted at cwd. Containment is enforced entirely by the permission allow/deny globs built in
125
- // buildDeepAgentParams (default: allow cwd/**, deny /**), which match what virtualMode used to
126
- // give for free (see deepAgentPermissions + the EXT-13 symlink/`..` parity tests).
127
- // `--allow-dir` (config.allowDirs) further widens those allow-rules to reach extra real dirs;
128
- // it removes a guardrail, so it is announced loudly by the exec command and surfaced here.
129
- const allowDirs = this.config?.allowDirs;
130
- const widenFs = Array.isArray(allowDirs) && allowDirs.length > 0;
131
- if (widenFs) {
132
- this.statusUpdate(StatusLevel.WARNING, `Filesystem sandbox widened beyond cwd (--allow-dir): ${allowDirs.join(', ')}` +
133
- (useVirtualFs
134
- ? ' — note: on this platform the sandbox runs in virtual mode, so widening beyond cwd is not applied.'
135
- : ''));
136
- }
137
- const backend = new FilesystemBackend({
138
- rootDir: getCurrentWorkDir(),
139
- virtualMode: useVirtualFs,
140
- });
141
- // EXT-13 (part b): on the local-runner code path the model used to be told nothing about
142
- // where it is, so it assumed `/` was cwd and fed `/`-rooted paths to the real-fs shell. Now
143
- // the backend uses real absolute paths (above), so inject the dynamic real cwd + path model
144
- // into the prompt the model actually receives. Code mode only — the surface with full fs +
145
- // shell access; the ACP transport keeps virtualMode and re-roots per session, so this
146
- // real-path note must NOT leak there (which is why it lives in init(), not the
147
- // transport-agnostic buildDeepAgentParams).
148
- // In virtualMode (EXT-16, Windows) the real-cwd note must NOT be injected — it would mislabel
149
- // the namespace (the fs tools' `/` is the virtual root, not the real cwd). Instead, EXT-22 (S2)
150
- // injects the virtualMode path-namespace note so the model is told EARLY that the fs virtual
151
- // `/` root and run_shell_command's real-OS paths differ (the S1 middleware repeats it as the
152
- // authoritative last word after deepagents' `/`-rooted line). Non-code paths get neither.
153
- const systemPrompt = this.command === 'code'
154
- ? useVirtualFs
155
- ? appendVirtualCwdNote(params.systemPrompt)
156
- : appendCwdNote(params.systemPrompt, getCurrentWorkDir())
157
- : params.systemPrompt;
158
- this.agent = createDeepAgent({
159
- model: params.model,
160
- tools: params.tools,
161
- // gsloth's composed prompt, combined ADDITIVELY by deepagents with its base + fs prompts
162
- // into a single system message (avoids the two-system-message Anthropic rejection).
163
- systemPrompt,
164
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
- middleware: middleware,
166
- backend,
167
- permissions: params.permissions,
168
- // Per-tool human-in-the-loop gating (e.g. run_shell_command confirmation). When set,
169
- // deepagents installs humanInTheLoopMiddleware so a matching tool call suspends the graph
170
- // for approval; `undefined` (the default, and under yolo) leaves every tool ungated.
171
- interruptOn: params.interruptOn,
172
- checkpointer,
173
- });
174
- debugLog('Deep agent created successfully');
175
- }
176
- /**
177
- * Assemble the transport-agnostic {@link GthDeepAgentParams}: resolve tools (with the
178
- * filesystem disabled so deepagents owns fs access), apply the allowedTools allow-list and
179
- * the deepagents fs-name supersession safety-net, map `.aiignore` + filesystem mode onto
180
- * deepagents permissions, and build the fs-denial-softening middleware. Shared by the local
181
- * runner ({@link init}) and the `deepagents-acp` ACP entry.
182
- */
183
- async buildDeepAgentParams(command, configIn) {
184
- this.command = command;
185
- debugLog(`GthDeepAgent.buildDeepAgentParams called with command: ${command || 'default'}`);
186
- // Merge command-specific filesystem config if provided
187
- this.config = this.getEffectiveConfig(configIn, command);
188
- debugLogObject('Effective Config', {
189
- filesystem: this.config.filesystem,
190
- builtInTools: this.config.builtInTools,
191
- streamOutput: this.config.streamOutput,
192
- debugLog: this.config.debugLog,
193
- });
194
- this.statusUpdate(StatusLevel.INFO, `Workdir: ${getCurrentWorkDir()}`);
195
- if (this.config.modelDisplayName) {
196
- this.statusUpdate(StatusLevel.INFO, `Model: ${this.config.modelDisplayName}`);
197
- }
198
- // An empty allowedTools allow-list disables every tool. Skip resolution entirely so we
199
- // don't contact MCP servers (and trigger OAuth) just to discard the result.
200
- const allowedTools = this.config.allowedTools;
201
- const toolsDisabled = Array.isArray(allowedTools) && allowedTools.length === 0;
202
- if (toolsDisabled) {
203
- this.statusUpdate(StatusLevel.INFO, 'Tool loading disabled by allowedTools: []; MCP/A2A servers will not be contacted. Omit allowedTools for no filtering.');
204
- }
205
- // Resolve tools with filesystem access disabled. deepagents OWNS the filesystem
206
- // (its fs middleware + the `permissions` built below); gsloth's filesystem toolkit
207
- // must NOT be loaded here, because its non-colliding tools (read_multiple_files,
208
- // delete_file, search_files, …) would otherwise bypass deepagents' permission
209
- // enforcement entirely — a model could read an .aiignore-protected file through them.
210
- debugLog('Resolving tools (filesystem disabled; deepagents provides fs)...');
211
- const toolResolutionConfig = { ...this.config, filesystem: 'none' };
212
- const resolvedTools = !toolsDisabled && this.resolvers?.resolveTools
213
- ? await this.resolvers.resolveTools(toolResolutionConfig, command)
214
- : [];
215
- debugLog(`Resolved tools loaded: ${resolvedTools.length}`);
216
- // Get user config tools (toolkit-flattened; client tools get interrupt() stubs)
217
- const flattenedConfigTools = toolsDisabled
218
- ? []
219
- : this.extractAndFlattenTools(this.config.tools || []);
220
- debugLog(`User config tools loaded: ${flattenedConfigTools.length}`);
221
- // Combine all tools, then apply the allowedTools name allow-list when configured.
222
- let tools = [...resolvedTools, ...flattenedConfigTools];
223
- if (Array.isArray(allowedTools)) {
224
- const allowed = new Set(allowedTools);
225
- tools = tools.filter((tool) => !tool.name || allowed.has(tool.name));
226
- }
227
- // Safety net: a custom/dev/MCP tool may still reuse a deepagents filesystem-tool
228
- // name (createDeepAgent throws on such a collision). Drop the colliding tool — the
229
- // deep agent's built-in fs tool wins. With filesystem disabled above this is normally
230
- // empty; it only fires for a genuine user/MCP name clash.
231
- const reserved = new Set(FILESYSTEM_TOOL_NAMES);
232
- const superseded = tools.filter((tool) => tool.name && reserved.has(tool.name));
233
- const passThroughTools = tools.filter((tool) => !tool.name || !reserved.has(tool.name));
234
- if (superseded.length > 0) {
235
- const names = superseded.map((tool) => tool.name).join(', ');
236
- this.statusUpdate(StatusLevel.WARNING, `Dropping tool(s) that collide with deepagents built-in filesystem tools: ${names}`);
237
- }
238
- if (passThroughTools.length > 0) {
239
- const toolNames = passThroughTools
240
- .map((tool) => tool.name)
241
- .filter((name) => name)
242
- .join(', ');
243
- this.statusUpdate(StatusLevel.INFO, `Loaded tools: ${toolNames}`);
244
- debugLog(`Total tools available: ${passThroughTools.length}`);
245
- debugLogObject('All Tools', toolNames.split(', '));
246
- }
247
- debugLog('Creating deep agent...');
248
- // Resolve middleware via resolver or fall back to empty. These are applied AFTER
249
- // deepagents' standard middleware (todos, subagents, summarization, filesystem).
250
- const resolvedMiddleware = this.resolvers?.resolveMiddleware
251
- ? await this.resolvers.resolveMiddleware(
252
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
- this.config.middleware, this.config)
254
- : [];
255
- // deepagents' standard middleware already summarizes long conversations; drop any
256
- // gsloth-configured summarization middleware so the deep agent doesn't summarize twice.
257
- const configuredMiddleware = resolvedMiddleware.filter((m) => {
258
- const name = m.name ?? '';
259
- if (/summar/i.test(name)) {
260
- debugLog(`Dropping duplicate summarization middleware '${name}' (deepagents provides it)`);
261
- return false;
262
- }
263
- return true;
264
- });
265
- // Soften deepagents' fail-hard filesystem tool throws. By default the permission layer
266
- // THROWS on both a denied read/write AND on a malformed path the model supplied — a relative
267
- // path, a `..`/`~` segment, or an empty string (deepagents' validatePath, run BEFORE the
268
- // permission check in enforcePermission). Any of these aborts the WHOLE run. On the AG-UI
269
- // transport that throw propagates out of streamWithEvents into the run handler's catch, which
270
- // emits RUN_ERROR and ends the response WITHOUT a terminal RUN_FINISHED — and since AG-UI's
271
- // protocol makes RUN_ERROR terminal ("no further events can be sent"), a consumer waiting for
272
- // RUN_FINISHED hangs (EXT-24). Wrap tool calls so each of these becomes a recoverable error
273
- // ToolMessage instead, letting the model observe the mistake, retry with a good path, and
274
- // finish the run normally (reaching RUN_FINISHED). This preserves gsloth's recoverable-denial
275
- // UX (the old GthFileSystemToolkit returned a message rather than throwing). Only these known
276
- // fs path/permission messages are caught; every other throw (GraphInterrupt from a client-tool
277
- // interrupt stub, AbortError on client disconnect, unexpected errors) is rethrown untouched so
278
- // control-flow and genuine failures still surface.
279
- const fsDenialSoftening = createMiddleware({
280
- name: 'GthDeepFsDenialSoftening',
281
- wrapToolCall: async (request, handler) => {
282
- try {
283
- return await handler(request);
284
- }
285
- catch (e) {
286
- const message = e instanceof Error ? e.message : String(e);
287
- // deepagents fs enforcement throws (middleware/fs.ts enforcePermission +
288
- // permissions/enforce.ts validatePath): a permission denial, or a path that is
289
- // relative / contains ".." or "~" / is empty. All are recoverable model-input errors.
290
- if (/permission denied for (read|write)|path must (be absolute|not contain|be a non-empty string)/i.test(message)) {
291
- debugLog(`Softened fs tool throw into a ToolMessage: ${message}`);
292
- return new ToolMessage({
293
- content: message,
294
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
295
- tool_call_id: request.toolCall?.id ?? '',
296
- status: 'error',
297
- });
298
- }
299
- throw e;
300
- }
301
- },
302
- });
303
- // EXT-20: sibling of fsDenialSoftening for the run_* (dev/shell) tools. GthDevToolkit's
304
- // executeCommand now THROWS a ShellCommandFailedError on a non-zero exit or a timeout-kill
305
- // (instead of resolving with the failure text), so the tool result no longer misreports
306
- // status:'success' (✓). Catch it here and return an error ToolMessage that PRESERVES the full
307
- // stdout/stderr body — the model's observation is unchanged except that status flips to
308
- // 'error', which drives the ✗ (isError) glyph (GthAbstractAgent maps status==='error' →
309
- // isError). Returning a ToolMessage (rather than rethrowing) also means the approved-then-failed
310
- // command does NOT trigger a retry loop — it is a normal, observed tool result.
311
- const shellExitSoftening = createMiddleware({
312
- name: 'GthDeepShellExitSoftening',
313
- wrapToolCall: async (request, handler) => {
314
- try {
315
- return await handler(request);
316
- }
317
- catch (e) {
318
- if (e instanceof ShellCommandFailedError) {
319
- debugLog(`Softened shell/dev command failure (exit ${e.exitCode ?? 'timeout'}) into an ` +
320
- `error ToolMessage for '${e.command}'`);
321
- return new ToolMessage({
322
- content: e.output,
323
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
- tool_call_id: request.toolCall?.id ?? '',
325
- status: 'error',
326
- });
327
- }
328
- throw e;
329
- }
330
- },
331
- });
332
- // fsDenialSoftening first so it is the outermost wrapToolCall — it must see the throw from
333
- // deepagents' permission-enforcing fs tools. shellExitSoftening sits right after it (still
334
- // outboard of any user-configured middleware, so it always sees the raw ShellCommandFailedError
335
- // throw before a user wrapToolCall could transform it). Order between the two softeners is not
336
- // load-bearing: they catch DISJOINT conditions (a permission-denied regex vs an
337
- // `instanceof ShellCommandFailedError`) and each rethrows what it doesn't recognize, so neither
338
- // can swallow the other. The console-bound tool-call-status middleware is NOT added here (see
339
- // GthDeepAgentParams.middleware); the runner appends it.
340
- const middleware = [fsDenialSoftening, shellExitSoftening, ...configuredMiddleware];
341
- // Map gsloth's .aiignore + filesystem mode onto deepagents permission rules. When
342
- // `--allow-dir` widens the sandbox, the backend runs without virtualMode, so paths are REAL
343
- // absolute paths: constrain read+write to cwd + the allowed dirs (everything else denied),
344
- // layered under the .aiignore deny rules.
345
- const permissions = buildPermissions({
346
- filesystem: this.config.filesystem,
347
- aiignore: this.config.aiignore,
348
- allowDirs: Array.isArray(this.config.allowDirs) && this.config.allowDirs.length > 0
349
- ? this.config.allowDirs
350
- : undefined,
351
- },
352
- // EXT-16: build virtual (`/`-rooted) permission rules when the backend will run in
353
- // virtualMode (Windows), matching the FilesystemBackend created in init().
354
- shouldUseVirtualFs());
355
- debugLogObject('Filesystem permissions', permissions);
356
- // Compose gsloth's system prompt (backstory + guidelines + per-command mode prompt +
357
- // system prompt) so identity profiles (Gaunt Sloth, sorcerer, fisher-alt, …) and
358
- // `.gsloth.*.md` are honored. This is passed to createDeepAgent as `systemPrompt` — combined
359
- // additively with deepagents' base + fs prompts into ONE system message — rather than injected
360
- // as a separate SystemMessage per turn (which produced a non-first system message that
361
- // Anthropic rejects). 'code' uses the code-mode prompt; 'exec' uses the prompt-as-script
362
- // exec-mode prompt; chat/api/others use the chat prompt.
363
- const modePrompt = this.command === 'code'
364
- ? readCodePrompt(this.config)
365
- : this.command === 'exec'
366
- ? readExecPrompt(this.config)
367
- : readChatPrompt(this.config);
368
- const systemMessages = buildSystemMessages(this.config, modePrompt);
369
- const systemPrompt = typeof systemMessages[0]?.content === 'string' ? systemMessages[0].content : undefined;
370
- // Gate the opt-in run_shell_command tool behind a per-command approval interrupt. The tool
371
- // is only emitted (by GthDevToolkit, via builtInToolsConfig) when its devTools.shell flag is
372
- // set; mirror the same per-command devTools resolution here so the interrupt is wired only
373
- // when the tool actually exists. yolo (shellYolo) opts OUT of the confirmation: leave
374
- // interruptOn undefined so the tool runs without suspending.
375
- const devTools = this.getEffectiveDevToolsConfig();
376
- // EXT-12 — pass the active command so the absent-config default (shell ON in `code`)
377
- // is applied consistently with where the tool is actually emitted (GthDevToolkit).
378
- const shellEnabled = isShellToolEnabled(devTools, this.command);
379
- const interruptOn = shellEnabled && devTools?.shellYolo !== true
380
- ? { run_shell_command: { allowedDecisions: ['approve', 'reject'] } }
381
- : undefined;
382
- if (interruptOn) {
383
- this.statusUpdate(StatusLevel.INFO, 'Shell tool (run_shell_command) enabled with per-command approval (interruptOn).');
384
- }
385
- else if (shellEnabled) {
386
- this.statusUpdate(StatusLevel.WARNING, 'Shell tool (run_shell_command) enabled in YOLO mode: commands run WITHOUT confirmation.');
387
- }
388
- return {
389
- model: this.config.llm,
390
- tools: passThroughTools,
391
- permissions,
392
- middleware,
393
- systemPrompt,
394
- interruptOn,
395
- };
396
- }
397
- /**
398
- * Resolve the {@link GthDevToolsConfig} that applies to the active command, mirroring the
399
- * per-command selection in `builtInToolsConfig.getDefaultTools` (which is what actually emits
400
- * the dev tools): `exec` → `commands.exec.devTools`, `ask --write` → `commands.ask.devTools`,
401
- * otherwise (`code`) → `commands.code.devTools`. Returns `undefined` for any other command,
402
- * matching the toolkit being inert there. Kept private and side-effect-free so the interrupt
403
- * wiring above and the tool emission stay in lockstep.
404
- */
405
- getEffectiveDevToolsConfig() {
406
- const config = this.config;
407
- if (!config)
408
- return undefined;
409
- const command = this.command;
410
- const askWrite = command === 'ask' && config.askWriteMode === true;
411
- if (command === 'exec')
412
- return config.commands?.exec?.devTools;
413
- if (askWrite)
414
- return config.commands?.ask?.devTools;
415
- if (command === 'code')
416
- return config.commands?.code?.devTools;
417
- return undefined;
418
- }
419
- }
420
- /**
421
- * EXT-22: shared virtualMode path-namespace guidance — ONE source of truth used by BOTH the S2
422
- * early-framing note ({@link appendVirtualCwdNote}, injected into gsloth's composed systemPrompt =
423
- * block 0) and the S1 last-word correction middleware
424
- * ({@link createPathNamespaceCorrectionMiddleware}, appended after deepagents' `/`-rooted line).
425
- *
426
- * In a virtualMode `code` session (EXT-16, e.g. Windows) the deepagents filesystem tools use a
427
- * VIRTUAL `/` root (= the working dir) while `run_shell_command` uses REAL native OS paths; the
428
- * model conflates the two forms. This text draws the distinction and steers toward cwd-relative
429
- * paths (the one form both tool families read alike).
430
- *
431
- * It deliberately does NOT equate the virtual root with a specific real path (no "`/` = D:\\work"):
432
- * virtualMode withholds the real cwd on purpose (see the systemPrompt gate in {@link
433
- * GthDeepAgent.init}), so the guidance is about the DISTINCTION between the two namespaces and the
434
- * safety of relative paths, not a mapping between them.
435
- */
436
- export const PATH_NAMESPACE_GUIDANCE = 'The filesystem tools (ls, read_file, write_file, edit_file, glob, grep) use a VIRTUAL root in ' +
437
- 'this session: a leading `/` means your working directory, and their paths are written ' +
438
- '`/`-rooted relative to it (this is what "all file paths must start with a /" refers to). That ' +
439
- '`/` is NOT the real operating-system filesystem root. run_shell_command is different: it runs ' +
440
- 'in the real operating system and uses real native paths (on Windows, e.g. ' +
441
- '`C:\\Users\\...\\project`, with backslashes), never the virtual `/` root. A `/`-rooted path ' +
442
- 'from the filesystem tools is NOT a valid shell path and must never be passed to ' +
443
- 'run_shell_command. The one form that means the same thing to both tool families is a path ' +
444
- 'RELATIVE to the working directory (e.g. `src/index.ts`); prefer relative paths for both. When ' +
445
- 'you must be absolute, use `/`-rooted form ONLY for the filesystem tools and real native form ' +
446
- 'ONLY for run_shell_command.';
447
- /**
448
- * EXT-22 (S2): virtualMode variant of {@link appendCwdNote}. On the `code` path when the fs
449
- * backend runs in virtualMode (EXT-16), inject the shared path-namespace guidance EARLY in
450
- * gsloth's composed systemPrompt (block 0) so the model is framed before deepagents' own prompt.
451
- *
452
- * This is early framing only: deepagents' hardcoded `/`-rooted line lands in a LATER block and can
453
- * partially override block 0, so the authoritative last word is delivered by the S1 middleware
454
- * ({@link createPathNamespaceCorrectionMiddleware}); see handoff/spike-systemmessage-ordering.md.
455
- * Returns the note alone when there is no base prompt.
456
- */
457
- export function appendVirtualCwdNote(systemPrompt) {
458
- const note = `Filesystem vs shell path namespaces: ${PATH_NAMESPACE_GUIDANCE}`;
459
- return systemPrompt ? `${systemPrompt}\n\n${note}` : note;
460
- }
461
- /**
462
- * EXT-22 (S1): the load-bearing path-namespace correction. A gsloth `wrapModelCall` middleware
463
- * runs INNERMOST (inside deepagents' filesystem middleware), so appending a trailing block to
464
- * `request.systemMessage` lands AFTER deepagents' hardcoded "All file paths must start with a /."
465
- * line — giving gsloth the last word on path semantics (empirically verified; see
466
- * handoff/spike-systemmessage-ordering.md). It APPENDS via `request.systemMessage.concat(...)`
467
- * (mirroring how deepagents appends its own fs prompt), never string-splices, and returns a NEW
468
- * request so it never mutates persisted state (no compounding across turns).
469
- *
470
- * `appendCorrection` gates it to `code` + virtualMode: only there do the fs virtual `/` root and
471
- * the shell's real-OS paths diverge. On POSIX real-path mode deepagents' "start with /" is
472
- * literally true, so the middleware is a transparent pass-through (like the debug-capture
473
- * middleware when no sink is attached).
474
- */
475
- export function createPathNamespaceCorrectionMiddleware(appendCorrection) {
476
- return createMiddleware({
477
- name: 'GthDeepPathNamespaceCorrection',
478
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
479
- wrapModelCall: async (request, handler) => {
480
- if (!appendCorrection || !request?.systemMessage)
481
- return handler(request);
482
- const correction = 'IMPORTANT — path namespaces (authoritative; this overrides any earlier instruction that ' +
483
- `implies every path is a simple \`/\`-rooted filesystem path): ${PATH_NAMESPACE_GUIDANCE}`;
484
- return handler({ ...request, systemMessage: request.systemMessage.concat(correction) });
485
- },
486
- });
487
- }
488
- /**
489
- * EXT-13 (part b): append a real-cwd / path-model note to the composed code-mode system prompt.
490
- *
491
- * The default code-mode backend runs in REAL-path mode (no virtualMode), so the deepagents fs
492
- * tools and `run_shell_command` share one real-absolute-path namespace rooted at `cwd`. Neither
493
- * deepagents' base prompt nor `.gsloth.code.md` states the actual cwd, so without this the model
494
- * assumes `/` is cwd and hands `/`-rooted paths to the real-fs shell. The cwd is injected
495
- * dynamically (never baked into the .md). Returns the note alone when there is no base prompt.
496
- */
497
- export function appendCwdNote(systemPrompt, cwd) {
498
- const cwdNote = `Working directory: ${cwd}\n` +
499
- 'Paths are real absolute filesystem paths (there is no virtual root). The working directory ' +
500
- 'above is where this session runs; relative paths resolve against it, and both the filesystem ' +
501
- 'tools (ls/glob/read_file/write_file/edit_file/grep) and run_shell_command operate on these ' +
502
- 'same real paths. Check the current directory before filesystem operations and prefer absolute ' +
503
- 'paths (or paths relative to the working directory); do not assume the current directory is "/".';
504
- return systemPrompt ? `${systemPrompt}\n\n${cwdNote}` : cwdNote;
505
- }
506
- /**
507
- * Scalar model-param fields worth surfacing in the `/debug` panel. Deliberately an
508
- * allowlist (NOT a whole-object dump) so no credential field (`apiKey`, `accessToken`, …)
509
- * can ever leak into the rendered debug view.
510
- *
511
- * `streaming` is intentionally NOT here: it is the model instance's static flag, which is
512
- * usually `false` even when the turn streams — the GthAgentRunner decides streaming by calling
513
- * `.stream()` vs `.invoke()`, not by this property — so surfacing it just misleads.
514
- */
515
- const DEBUG_MODEL_PARAM_KEYS = [
516
- 'model',
517
- 'modelName',
518
- 'modelId',
519
- 'deploymentName',
520
- 'temperature',
521
- 'topP',
522
- 'topK',
523
- 'maxTokens',
524
- 'maxOutputTokens',
525
- 'maxReasoningTokens',
526
- 'reasoningEffort',
527
- 'thinkingBudget',
528
- 'stop',
529
- 'provider',
530
- ];
531
- /** Pull the key-free scalar model params from the (provider-specific) model instance. */
532
- function extractModelParams(model) {
533
- if (!model || typeof model !== 'object')
534
- return undefined;
535
- const src = model;
536
- const out = {};
537
- for (const key of DEBUG_MODEL_PARAM_KEYS) {
538
- const value = src[key];
539
- if (value === undefined || value === null)
540
- continue;
541
- // Only scalars / scalar arrays — never nested objects that could carry credentials.
542
- if (typeof value === 'object' && !Array.isArray(value))
543
- continue;
544
- out[key] = value;
545
- }
546
- // `model` / `modelName` / `modelId` are langchain aliases for the same value; collapse the
547
- // duplicates so the panel shows the model id once instead of two identical lines.
548
- if (typeof out.model !== 'string' && typeof out.modelName === 'string') {
549
- out.model = out.modelName;
550
- }
551
- if (out.modelName === out.model)
552
- delete out.modelName;
553
- if (out.modelId === out.model)
554
- delete out.modelId;
555
- return Object.keys(out).length > 0 ? out : undefined;
556
- }
557
- /** Best-effort tool definition (name + description + schema) for the debug view. */
558
- function extractToolDefs(tools) {
559
- if (!Array.isArray(tools) || tools.length === 0)
560
- return undefined;
561
- const defs = [];
562
- for (const tool of tools) {
563
- if (!tool || typeof tool !== 'object')
564
- continue;
565
- const t = tool;
566
- const name = typeof t.name === 'string' ? t.name : undefined;
567
- if (!name)
568
- continue;
569
- const description = typeof t.description === 'string' ? t.description : undefined;
570
- // LangChain StructuredTools expose a Zod/JSON `schema`; some carry it on `lc_kwargs`.
571
- const schema = t.schema ?? undefined;
572
- defs.push({ name, description, schema });
573
- }
574
- return defs.length > 0 ? defs : undefined;
575
- }
576
- /**
577
- * Assemble the non-message request parts ({@link DebugRequestExtras}) for the `/debug`
578
- * panel from a `wrapModelCall` request, defensively and key-free. Never throws (the caller
579
- * already guards, but a debug sink must never break a run) and never dumps the raw model.
580
- */
581
- export function extractDebugRequestExtras(request) {
582
- if (!request || typeof request !== 'object')
583
- return undefined;
584
- const req = request;
585
- const systemMessage = req.systemMessage;
586
- const systemPrompt = typeof req.systemPrompt === 'string' && req.systemPrompt
587
- ? req.systemPrompt
588
- : typeof systemMessage?.content === 'string'
589
- ? systemMessage.content
590
- : undefined;
591
- const extras = {
592
- systemPrompt,
593
- tools: extractToolDefs(req.tools),
594
- modelParams: extractModelParams(req.model),
595
- toolChoice: req.toolChoice,
596
- };
597
- // Return undefined when nothing useful was captured so the renderer can show a clear empty state.
598
- const hasAny = extras.systemPrompt !== undefined ||
599
- extras.tools !== undefined ||
600
- extras.modelParams !== undefined ||
601
- extras.toolChoice !== undefined;
602
- return hasAny ? extras : undefined;
603
- }
604
- //# sourceMappingURL=GthDeepAgent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GthDeepAgent.js","sourceRoot":"","sources":["../../src/core/GthDeepA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