@gaunt-sloth/agent 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (85) hide show
  1. package/README.md +10 -0
  2. package/dist/builtInToolsConfig.d.ts +17 -3
  3. package/dist/builtInToolsConfig.js +41 -14
  4. package/dist/builtInToolsConfig.js.map +1 -1
  5. package/dist/core/GthDeepAgent.d.ts +63 -13
  6. package/dist/core/GthDeepAgent.js +360 -130
  7. package/dist/core/GthDeepAgent.js.map +1 -1
  8. package/dist/core/debugCapture.d.ts +8 -49
  9. package/dist/core/debugCapture.js +1 -1
  10. package/dist/core/debugCapture.js.map +1 -1
  11. package/dist/core/deepAgentPermissions.d.ts +73 -13
  12. package/dist/core/deepAgentPermissions.js +191 -29
  13. package/dist/core/deepAgentPermissions.js.map +1 -1
  14. package/dist/core/gthAcpServer.js +11 -0
  15. package/dist/core/gthAcpServer.js.map +1 -1
  16. package/dist/core/gthDeepAgentFactory.d.ts +3 -0
  17. package/dist/core/gthDeepAgentFactory.js +9 -1
  18. package/dist/core/gthDeepAgentFactory.js.map +1 -1
  19. package/dist/core/resolveAgentFactory.d.ts +14 -0
  20. package/dist/core/resolveAgentFactory.js +18 -0
  21. package/dist/core/resolveAgentFactory.js.map +1 -0
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/mcp/OAuthClientProviderImpl.js +2 -2
  26. package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
  27. package/dist/mcp/tlsTrust.d.ts +61 -0
  28. package/dist/mcp/tlsTrust.js +109 -0
  29. package/dist/mcp/tlsTrust.js.map +1 -0
  30. package/dist/middleware/registry.d.ts +1 -1
  31. package/dist/middleware/registry.js +1 -1
  32. package/dist/middleware/types.d.ts +1 -1
  33. package/dist/middleware/types.js +1 -1
  34. package/dist/modules/a2a/A2AClientWrapper.d.ts +46 -0
  35. package/dist/modules/a2a/A2AClientWrapper.js +71 -0
  36. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
  37. package/dist/modules/acpModule.d.ts +5 -2
  38. package/dist/modules/acpModule.js +13 -2
  39. package/dist/modules/acpModule.js.map +1 -1
  40. package/dist/modules/apiAgUiModule.js +48 -16
  41. package/dist/modules/apiAgUiModule.js.map +1 -1
  42. package/dist/modules/interactiveSessionModule.js +140 -7
  43. package/dist/modules/interactiveSessionModule.js.map +1 -1
  44. package/dist/resolvers.js +104 -9
  45. package/dist/resolvers.js.map +1 -1
  46. package/dist/tools/GthCustomToolkit.js.map +1 -1
  47. package/dist/tools/GthDevToolkit.d.ts +45 -1
  48. package/dist/tools/GthDevToolkit.js +204 -17
  49. package/dist/tools/GthDevToolkit.js.map +1 -1
  50. package/dist/tools/GthFileSystemToolkit.d.ts +47 -0
  51. package/dist/tools/GthFileSystemToolkit.js +305 -18
  52. package/dist/tools/GthFileSystemToolkit.js.map +1 -1
  53. package/dist/tools/gthChecklistTool.d.ts +30 -0
  54. package/dist/tools/gthChecklistTool.js +81 -0
  55. package/dist/tools/gthChecklistTool.js.map +1 -0
  56. package/dist/tools/gthGrepTool.d.ts +54 -0
  57. package/dist/tools/gthGrepTool.js +482 -0
  58. package/dist/tools/gthGrepTool.js.map +1 -0
  59. package/dist/tools/shell/allowlist.d.ts +11 -0
  60. package/dist/tools/shell/allowlist.js +12 -0
  61. package/dist/tools/shell/allowlist.js.map +1 -0
  62. package/dist/tools/shell/arity.d.ts +11 -0
  63. package/dist/tools/shell/arity.js +12 -0
  64. package/dist/tools/shell/arity.js.map +1 -0
  65. package/dist/tools/shell/env.d.ts +22 -0
  66. package/dist/tools/shell/env.js +110 -0
  67. package/dist/tools/shell/env.js.map +1 -0
  68. package/dist/tools/shell/hardline.d.ts +15 -0
  69. package/dist/tools/shell/hardline.js +88 -0
  70. package/dist/tools/shell/hardline.js.map +1 -0
  71. package/dist/tools/shell/normalize.d.ts +10 -0
  72. package/dist/tools/shell/normalize.js +11 -0
  73. package/dist/tools/shell/normalize.js.map +1 -0
  74. package/dist/tools/shell/outputBuffer.d.ts +53 -0
  75. package/dist/tools/shell/outputBuffer.js +157 -0
  76. package/dist/tools/shell/outputBuffer.js.map +1 -0
  77. package/dist/tools/shell/workDir.d.ts +11 -0
  78. package/dist/tools/shell/workDir.js +45 -0
  79. package/dist/tools/shell/workDir.js.map +1 -0
  80. package/dist/utils/mcpAuthError.d.ts +36 -0
  81. package/dist/utils/mcpAuthError.js +89 -0
  82. package/dist/utils/mcpAuthError.js.map +1 -0
  83. package/dist/utils/mcpUtils.js +16 -0
  84. package/dist/utils/mcpUtils.js.map +1 -1
  85. package/package.json +14 -13
package/README.md CHANGED
@@ -8,9 +8,19 @@ The deep-agent runtime for Gaunt Sloth. Consolidates what were previously
8
8
  - MCP client + OAuth provider
9
9
  - A2A client and tools
10
10
  - The AG-UI server (`startAgUiServer`) and interactive session module
11
+ - The ACP (Agent Client Protocol) server (`startAcpServer`), exposed as the
12
+ `gaunt-sloth-acp` binary
11
13
  - The `createResolvers` tool/middleware resolver wiring
12
14
 
13
15
  It builds on `@gaunt-sloth/core` (config, provider factory, lean langchain runtime).
14
16
 
17
+ > **Running the ACP server:** prefer `gaunt-sloth --acp-agent` from the
18
+ > [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) app, not the standalone
19
+ > `gaunt-sloth-acp` binary. The LLM providers are `peerDependencies` of `@gaunt-sloth/core` that
20
+ > only the app declares, so a bare `@gaunt-sloth/agent` install has no providers to construct a
21
+ > model from. See the
22
+ > [app README → ACP server](https://github.com/pukeko-robotics/gaunt-sloth/blob/main/packages/app/README.md#acp-server-editor-integration)
23
+ > for setup and a Zed `settings.json` example.
24
+
15
25
  > `@gaunt-sloth/tools` and `@gaunt-sloth/api` are deprecated and now re-export
16
26
  > from this package.
@@ -10,15 +10,29 @@ export declare const AVAILABLE_BUILT_IN_TOOLS: {
10
10
  /**
11
11
  * Reference tool. Simply prints provided argument to the screen.
12
12
  */
13
- readonly gth_status_update: "#src/tools/gthStatusUpdateTool.js";
13
+ readonly gth_status_update: '#src/tools/gthStatusUpdateTool.js';
14
14
  /**
15
15
  * Web fetch tool.
16
16
  */
17
- readonly gth_web_fetch: "#src/tools/gthWebFetchTool.js";
17
+ readonly gth_web_fetch: '#src/tools/gthWebFetchTool.js';
18
18
  /**
19
19
  * AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
20
20
  */
21
- readonly show_a2ui_surface: "#src/tools/showA2UISurfaceTool.js";
21
+ readonly show_a2ui_surface: '#src/tools/showA2UISurfaceTool.js';
22
+ /**
23
+ * Checklist / todo planning tool for the lean agent (the `write_todos` equivalent). Enabled
24
+ * by default (see {@link DEFAULT_CONFIG}); disable by setting your own `builtInTools`.
25
+ */
26
+ readonly gth_checklist: '#src/tools/gthChecklistTool.js';
27
+ /**
28
+ * Content-search (grep) tool: ripgrep-backed regex search over file CONTENTS, with an
29
+ * in-process JS fallback when `rg` is absent. Permission-light (no shell approval) and
30
+ * available in every mode. Named `gth_grep` to avoid colliding with the deep backend's
31
+ * built-in `grep`. Enabled by default (see {@link DEFAULT_CONFIG.builtInTools}, GS2-51); disable
32
+ * with `{ "builtInTools": { "gth_grep": { "enabled": false } } }`. Its searched corpus is
33
+ * selectable via the `fileSet` tool-config key (`gitignore` default / `all`).
34
+ */
35
+ readonly gth_grep: '#src/tools/gthGrepTool.js';
22
36
  };
23
37
  /**
24
38
  * Get default tools based on filesystem and built-in tools configuration
@@ -3,6 +3,7 @@
3
3
  * Built-in tools config. {@link AVAILABLE_BUILT_IN_TOOLS} has a list of available tools.
4
4
  */
5
5
  import GthFileSystemToolkit from '#src/tools/GthFileSystemToolkit.js';
6
+ import { getEffectiveDevToolsConfig, normalizeBuiltInTools, isBuiltInToolEntryEnabled, DEV_TOOL_NAMES, } from '@gaunt-sloth/core/config.js';
6
7
  import { displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
7
8
  import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
8
9
  import GthDevToolkit from '#src/tools/GthDevToolkit.js';
@@ -25,6 +26,20 @@ export const AVAILABLE_BUILT_IN_TOOLS = {
25
26
  * AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
26
27
  */
27
28
  show_a2ui_surface: '#src/tools/showA2UISurfaceTool.js',
29
+ /**
30
+ * Checklist / todo planning tool for the lean agent (the `write_todos` equivalent). Enabled
31
+ * by default (see {@link DEFAULT_CONFIG}); disable by setting your own `builtInTools`.
32
+ */
33
+ gth_checklist: '#src/tools/gthChecklistTool.js',
34
+ /**
35
+ * Content-search (grep) tool: ripgrep-backed regex search over file CONTENTS, with an
36
+ * in-process JS fallback when `rg` is absent. Permission-light (no shell approval) and
37
+ * available in every mode. Named `gth_grep` to avoid colliding with the deep backend's
38
+ * built-in `grep`. Enabled by default (see {@link DEFAULT_CONFIG.builtInTools}, GS2-51); disable
39
+ * with `{ "builtInTools": { "gth_grep": { "enabled": false } } }`. Its searched corpus is
40
+ * selectable via the `fileSet` tool-config key (`gitignore` default / `all`).
41
+ */
42
+ gth_grep: '#src/tools/gthGrepTool.js',
28
43
  };
29
44
  /**
30
45
  * Get default tools based on filesystem and built-in tools configuration
@@ -33,24 +48,29 @@ export async function getDefaultTools(config, command) {
33
48
  const filesystemTools = filterFilesystemTools(config.filesystem, config.aiignore, config.binaryFormats);
34
49
  const builtInTools = await getBuiltInTools(config);
35
50
  // Dev tools (run commands etc.) are available to the interactive `code` command and to the
36
- // scripted `exec` command — both are "do-the-job" runs each via its own per-command config.
37
- // `ask --write` (config.askWriteMode) opts `ask` into the same do-the-job tools, reusing the
38
- // devTools config the --write flag copied onto commands.ask.
51
+ // scripted `exec` command — both are "do-the-job" runs. `ask --write` (config.askWriteMode) opts
52
+ // `ask` into the same do-the-job tools. CFG-18: the dev/shell config is resolved from the unified
53
+ // `builtInTools` registry by the shared core resolver (was per-command `devTools`).
39
54
  const askWrite = command === 'ask' && config.askWriteMode === true;
40
- const devToolConfig = command === 'exec'
41
- ? config.commands?.exec?.devTools
42
- : askWrite
43
- ? config.commands?.ask?.devTools
44
- : config.commands?.code?.devTools;
55
+ const devToolConfig = getEffectiveDevToolsConfig(config, command);
45
56
  const devTools = await filterDevTools(askWrite ? 'code' : command, devToolConfig);
46
57
  const customTools = getCustomTools(config, command);
47
58
  return [...filesystemTools, ...devTools, ...customTools, ...builtInTools];
48
59
  }
49
60
  async function filterDevTools(command, devToolConfig) {
50
- if ((command !== 'code' && command !== 'exec') || !devToolConfig) {
61
+ // Dev tools only apply to the do-the-job commands (`code` / `exec`; `ask --write` is mapped
62
+ // to `code` by the caller). EXT-12: for `code` the toolkit is constructed even when no
63
+ // devTools config is present, so the shell tool's absent-config default (ON in `code`) can
64
+ // emit `run_shell_command` (still gated). For `exec` we keep the prior behaviour — no config
65
+ // means no dev tools — by short-circuiting when the config is absent.
66
+ if (command !== 'code' && command !== 'exec') {
51
67
  return [];
52
68
  }
53
- const toolkit = new GthDevToolkit(devToolConfig);
69
+ if (command === 'exec' && !devToolConfig) {
70
+ return [];
71
+ }
72
+ // Pass the command so GthDevToolkit resolves the shell default for the active mode.
73
+ const toolkit = new GthDevToolkit(devToolConfig ?? {}, command);
54
74
  return [...toolkit.getTools()];
55
75
  }
56
76
  /**
@@ -126,10 +146,17 @@ function filterFilesystemTools(filesystemConfig, aiignoreConfig, binaryFormats)
126
146
  */
127
147
  async function getBuiltInTools(config) {
128
148
  const tools = [];
129
- if (!config.builtInTools) {
130
- return tools;
131
- }
132
- for (const toolName of config.builtInTools) {
149
+ // CFG-18: `builtInTools` may be a string[] or the widened registry — normalize to a name→value
150
+ // lookup. Dev/shell tools (run_*, run_shell_command) are emitted by GthDevToolkit via the dev
151
+ // bucket, so skip them here (a registry entry for them is legitimate, not an unknown built-in).
152
+ const registry = normalizeBuiltInTools(config.builtInTools);
153
+ for (const [toolName, value] of Object.entries(registry)) {
154
+ if (DEV_TOOL_NAMES.includes(toolName)) {
155
+ continue;
156
+ }
157
+ if (!isBuiltInToolEntryEnabled(value)) {
158
+ continue;
159
+ }
133
160
  if (toolName in AVAILABLE_BUILT_IN_TOOLS) {
134
161
  try {
135
162
  const tool = await import(AVAILABLE_BUILT_IN_TOOLS[toolName]);
@@ -1 +1 @@
1
- {"version":3,"file":"builtInToolsConfig.js","sourceRoot":"","sources":["../src/builtInToolsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC;;OAEG;IACH,iBAAiB,EAAE,mCAAmC;IACtD;;OAEG;IACH,aAAa,EAAE,+BAA+B;IAC9C;;OAEG;IACH,iBAAiB,EAAE,mCAAmC;CAC9C,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAiB,EACjB,OAAoB;IAEpB,MAAM,eAAe,GAAG,qBAAqB,CAC3C,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,aAAa,CACrB,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IACnD,2FAA2F;IAC3F,8FAA8F;IAC9F,6FAA6F;IAC7F,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC;IACnE,MAAM,aAAa,GACjB,OAAO,KAAK,MAAM;QAChB,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ;QACjC,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,MAAM,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K,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzD,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;QACD,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,IAAI,wBAAwB,EAAE,CAAC;YACzC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,MAAM,CACvB,wBAAwB,CAAC,QAAiD,CAAC,CAC5E,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,cAAc,CAAC,iCAAiC,QAAQ,MAAM,KAAK,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
2
  import { GthAbstractAgent } from '@gaunt-sloth/core/core/GthAbstractAgent.js';
3
3
  import { type GthCommand } from '@gaunt-sloth/core/core/types.js';
4
+ export { appendOsShellNote, appendCwdNote, appendCommitCoAuthorNote, appendModelContextNote, resolveModelIdentity, OS_SHELL_GUIDANCE, } from '@gaunt-sloth/core/utils/systemPromptNotes.js';
4
5
  import type { StructuredToolInterface } from '@langchain/core/tools';
5
6
  import type { BaseCheckpointSaver } from '@langchain/langgraph';
7
+ import { type InterruptOnConfig } from 'langchain';
6
8
  import { type FilesystemPermission } from '#src/core/deepAgentPermissions.js';
7
- import type { DebugCapture, DebugRequestExtras } from '#src/core/debugCapture.js';
9
+ export { extractDebugRequestExtras } from '#src/core/debugCapture.js';
8
10
  /**
9
11
  * The subset of `createDeepAgent` params that are independent of the transport
10
12
  * (the local runner vs. the ACP server). Both {@link GthDeepAgent.init} (which adds the
@@ -31,6 +33,21 @@ export interface GthDeepAgentParams {
31
33
  * no prompt content is composed (lets deepagents use only its base prompt).
32
34
  */
33
35
  systemPrompt: string | undefined;
36
+ /**
37
+ * Per-tool human-in-the-loop configuration passed straight to
38
+ * `createDeepAgent({ interruptOn })` (deepagents installs LangChain's
39
+ * `humanInTheLoopMiddleware` for it). A matching tool call suspends the graph with a
40
+ * `__interrupt__` (a `HITLRequest`) so a consumer can approve/reject before the tool runs;
41
+ * resume with `new Command({ resume: { decisions: [...] } })` on the same `thread_id`.
42
+ *
43
+ * gsloth sets this for the opt-in `run_shell_command` tool whenever the shell tool is
44
+ * enabled — including under `run_shell_command.yolo` in interactive `code` mode, where the tool
45
+ * stays gated so the runtime `/auto-approve` flag governs it (the runner seeds that flag ON
46
+ * from shellYolo and auto-approves silently). It is left `undefined` only for a non-interactive
47
+ * yolo run (exec / ask --write), whose single-shot path does not drain interrupts, so the tool
48
+ * there runs inline without suspending. See `getAgentBuildParams`.
49
+ */
50
+ interruptOn?: Record<string, boolean | InterruptOnConfig>;
34
51
  }
35
52
  /**
36
53
  * Deep agent: builds a `createDeepAgent` graph (deepagents). All run/stream/event
@@ -43,7 +60,10 @@ export interface GthDeepAgentParams {
43
60
  * {@link FilesystemBackend}. gsloth's `.aiignore` + `filesystem` config are mapped
44
61
  * onto deepagents `permissions` (see {@link buildPermissions}). Any resolved tool
45
62
  * that reuses a deepagents filesystem-tool name is therefore superseded and dropped
46
- * (`createDeepAgent` would otherwise throw on the collision).
63
+ * (`createDeepAgent` would otherwise throw on the collision). EXT-14: the
64
+ * `FilesystemBackend` itself is wrapped with {@link guardFilesystemBackend} before it
65
+ * reaches `createDeepAgent`, adding a realpath (symlink-resolved) containment check the
66
+ * permission globs alone can't provide.
47
67
  * - todos / subagents / summarization come from deepagents' standard middleware.
48
68
  *
49
69
  * The transport-agnostic param assembly lives in {@link buildDeepAgentParams} so the ACP
@@ -51,13 +71,6 @@ export interface GthDeepAgentParams {
51
71
  * middleware hardening without re-running `createDeepAgent` locally.
52
72
  */
53
73
  export declare class GthDeepAgent extends GthAbstractAgent {
54
- /**
55
- * Opt-in debug sink for the TUI `/debug` panel. Set AFTER {@link init} via
56
- * `runner.getAgent()`; read lazily inside the `wrapModelCall` middleware so that when it
57
- * is `undefined` (the normal path) the middleware is a transparent pass-through. Never
58
- * touched by the lean agent or the AG-UI server, so those contracts are unchanged.
59
- */
60
- debugCapture: DebugCapture | undefined;
61
74
  init(command: GthCommand | undefined, configIn: GthConfig, checkpointer?: BaseCheckpointSaver | undefined): Promise<void>;
62
75
  /**
63
76
  * Assemble the transport-agnostic {@link GthDeepAgentParams}: resolve tools (with the
@@ -69,8 +82,45 @@ export declare class GthDeepAgent extends GthAbstractAgent {
69
82
  buildDeepAgentParams(command: GthCommand | undefined, configIn: GthConfig): Promise<GthDeepAgentParams>;
70
83
  }
71
84
  /**
72
- * Assemble the non-message request parts ({@link DebugRequestExtras}) for the `/debug`
73
- * panel from a `wrapModelCall` request, defensively and key-free. Never throws (the caller
74
- * already guards, but a debug sink must never break a run) and never dumps the raw model.
85
+ * EXT-22: shared virtualMode path-namespace guidance ONE source of truth used by BOTH the S2
86
+ * early-framing note ({@link appendVirtualCwdNote}, injected into gsloth's composed systemPrompt =
87
+ * block 0) and the S1 last-word correction middleware
88
+ * ({@link createPathNamespaceCorrectionMiddleware}, appended after deepagents' `/`-rooted line).
89
+ *
90
+ * In a virtualMode `code` session (EXT-16, e.g. Windows) the deepagents filesystem tools use a
91
+ * VIRTUAL `/` root (= the working dir) while `run_shell_command` uses REAL native OS paths; the
92
+ * model conflates the two forms. This text draws the distinction and steers toward cwd-relative
93
+ * paths (the one form both tool families read alike).
94
+ *
95
+ * It deliberately does NOT equate the virtual root with a specific real path (no "`/` = D:\\work"):
96
+ * virtualMode withholds the real cwd on purpose (see the systemPrompt gate in {@link
97
+ * GthDeepAgent.init}), so the guidance is about the DISTINCTION between the two namespaces and the
98
+ * safety of relative paths, not a mapping between them.
99
+ */
100
+ export declare const PATH_NAMESPACE_GUIDANCE: string;
101
+ /**
102
+ * EXT-22 (S2): virtualMode variant of {@link appendCwdNote}. On the `code` path when the fs
103
+ * backend runs in virtualMode (EXT-16), inject the shared path-namespace guidance EARLY in
104
+ * gsloth's composed systemPrompt (block 0) so the model is framed before deepagents' own prompt.
105
+ *
106
+ * This is early framing only: deepagents' hardcoded `/`-rooted line lands in a LATER block and can
107
+ * partially override block 0, so the authoritative last word is delivered by the S1 middleware
108
+ * ({@link createPathNamespaceCorrectionMiddleware}); see handoff/spike-systemmessage-ordering.md.
109
+ * Returns the note alone when there is no base prompt.
110
+ */
111
+ export declare function appendVirtualCwdNote(systemPrompt: string | undefined): string;
112
+ /**
113
+ * EXT-22 (S1): the load-bearing path-namespace correction. A gsloth `wrapModelCall` middleware
114
+ * runs INNERMOST (inside deepagents' filesystem middleware), so appending a trailing block to
115
+ * `request.systemMessage` lands AFTER deepagents' hardcoded "All file paths must start with a /."
116
+ * line — giving gsloth the last word on path semantics (empirically verified; see
117
+ * handoff/spike-systemmessage-ordering.md). It APPENDS via `request.systemMessage.concat(...)`
118
+ * (mirroring how deepagents appends its own fs prompt), never string-splices, and returns a NEW
119
+ * request so it never mutates persisted state (no compounding across turns).
120
+ *
121
+ * `appendCorrection` gates it to `code` + virtualMode: only there do the fs virtual `/` root and
122
+ * the shell's real-OS paths diverge. On POSIX real-path mode deepagents' "start with /" is
123
+ * literally true, so the middleware is a transparent pass-through (like the debug-capture
124
+ * middleware when no sink is attached).
75
125
  */
76
- export declare function extractDebugRequestExtras(request: unknown): DebugRequestExtras | undefined;
126
+ export declare function createPathNamespaceCorrectionMiddleware(appendCorrection: boolean): import("langchain").AgentMiddleware<undefined, undefined, unknown, readonly (import("@langchain/core/tools").ServerTool | import("@langchain/core/tools").ClientTool)[], readonly []>;