@gaunt-sloth/agent 0.1.8 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +14 -5
  2. package/cli-acp.js +35 -0
  3. package/cli.js +35 -0
  4. package/dist/builtInToolsConfig.d.ts +26 -0
  5. package/dist/builtInToolsConfig.js +148 -0
  6. package/dist/builtInToolsConfig.js.map +1 -0
  7. package/dist/core/GthDeepAgent.d.ts +76 -0
  8. package/dist/core/GthDeepAgent.js +368 -0
  9. package/dist/core/GthDeepAgent.js.map +1 -0
  10. package/dist/core/debugCapture.d.ts +51 -0
  11. package/dist/core/debugCapture.js +2 -0
  12. package/dist/core/debugCapture.js.map +1 -0
  13. package/dist/core/deepAgentPermissions.d.ts +55 -0
  14. package/dist/core/deepAgentPermissions.js +120 -0
  15. package/dist/core/deepAgentPermissions.js.map +1 -0
  16. package/dist/core/gthAcpServer.d.ts +27 -0
  17. package/dist/core/gthAcpServer.js +71 -0
  18. package/dist/core/gthAcpServer.js.map +1 -0
  19. package/dist/core/gthDeepAgentFactory.d.ts +8 -0
  20. package/dist/core/gthDeepAgentFactory.js +9 -0
  21. package/dist/core/gthDeepAgentFactory.js.map +1 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.js +16 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/mcp/OAuthClientProviderImpl.d.ts +37 -0
  26. package/dist/mcp/OAuthClientProviderImpl.js +223 -0
  27. package/dist/mcp/OAuthClientProviderImpl.js.map +1 -0
  28. package/dist/middleware/binaryContentInjectionMiddleware.d.ts +22 -0
  29. package/dist/middleware/binaryContentInjectionMiddleware.js +125 -0
  30. package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -0
  31. package/dist/middleware/registry.d.ts +34 -0
  32. package/dist/middleware/registry.js +124 -0
  33. package/dist/middleware/registry.js.map +1 -0
  34. package/dist/middleware/types.d.ts +89 -0
  35. package/dist/middleware/types.js +9 -0
  36. package/dist/middleware/types.js.map +1 -0
  37. package/dist/modules/a2a/A2AClientWrapper.d.ts +22 -0
  38. package/dist/modules/a2a/A2AClientWrapper.js +63 -0
  39. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -0
  40. package/dist/modules/acpModule.d.ts +37 -0
  41. package/dist/modules/acpModule.js +67 -0
  42. package/dist/modules/acpModule.js.map +1 -0
  43. package/dist/modules/apiAgUiModule.d.ts +2 -0
  44. package/dist/modules/apiAgUiModule.js +417 -0
  45. package/dist/modules/apiAgUiModule.js.map +1 -0
  46. package/dist/modules/interactiveSessionModule.d.ts +9 -0
  47. package/dist/modules/interactiveSessionModule.js +99 -0
  48. package/dist/modules/interactiveSessionModule.js.map +1 -0
  49. package/dist/resolvers.d.ts +18 -0
  50. package/dist/resolvers.js +140 -0
  51. package/dist/resolvers.js.map +1 -0
  52. package/dist/tools/A2AAgentTool.d.ts +24 -0
  53. package/dist/tools/A2AAgentTool.js +37 -0
  54. package/dist/tools/A2AAgentTool.js.map +1 -0
  55. package/dist/tools/GthCustomToolkit.d.ts +41 -0
  56. package/dist/tools/GthCustomToolkit.js +289 -0
  57. package/dist/tools/GthCustomToolkit.js.map +1 -0
  58. package/dist/tools/GthDevToolkit.d.ts +24 -0
  59. package/dist/tools/GthDevToolkit.js +189 -0
  60. package/dist/tools/GthDevToolkit.js.map +1 -0
  61. package/dist/tools/GthFileSystemToolkit.d.ts +36 -0
  62. package/dist/tools/GthFileSystemToolkit.js +775 -0
  63. package/dist/tools/GthFileSystemToolkit.js.map +1 -0
  64. package/dist/tools/binaryUtils.d.ts +13 -0
  65. package/dist/tools/binaryUtils.js +55 -0
  66. package/dist/tools/binaryUtils.js.map +1 -0
  67. package/dist/tools/gthStatusUpdateTool.d.ts +2 -0
  68. package/dist/tools/gthStatusUpdateTool.js +15 -0
  69. package/dist/tools/gthStatusUpdateTool.js.map +1 -0
  70. package/dist/tools/gthWebFetchTool.d.ts +2 -0
  71. package/dist/tools/gthWebFetchTool.js +47 -0
  72. package/dist/tools/gthWebFetchTool.js.map +1 -0
  73. package/dist/tools/showA2UISurfaceTool.d.ts +9 -0
  74. package/dist/tools/showA2UISurfaceTool.js +25 -0
  75. package/dist/tools/showA2UISurfaceTool.js.map +1 -0
  76. package/dist/utils/mcpUtils.d.ts +13 -0
  77. package/dist/utils/mcpUtils.js +225 -0
  78. package/dist/utils/mcpUtils.js.map +1 -0
  79. package/package.json +49 -10
  80. package/index.js +0 -6
package/README.md CHANGED
@@ -1,7 +1,16 @@
1
- # @gaunt-sloth/agent — placeholder (0.1.8)
1
+ # @gaunt-sloth/agent
2
2
 
3
- This is a **name-reservation placeholder**, not the real package.
3
+ The deep-agent runtime for Gaunt Sloth. Consolidates what were previously
4
+ `@gaunt-sloth/tools` and `@gaunt-sloth/api`:
4
5
 
5
- The real **Deep agent runtime for Gaunt Sloth** (tools, middleware, MCP/A2A clients, AG-UI
6
- server) ships from the [gaunt-sloth monorepo](https://github.com/Galvanized-Pukeko/gaunt-sloth/tree/main/packages/agent)
7
- via the `release.yml` pipeline, starting at `2.0.0-alpha.0`.
6
+ - Built-in tools and toolkits (filesystem, dev, custom, web fetch, status update)
7
+ - Middleware registry (summarization, prompt caching, binary content injection)
8
+ - MCP client + OAuth provider
9
+ - A2A client and tools
10
+ - The AG-UI server (`startAgUiServer`) and interactive session module
11
+ - The `createResolvers` tool/middleware resolver wiring
12
+
13
+ It builds on `@gaunt-sloth/core` (config, provider factory, lean langchain runtime).
14
+
15
+ > `@gaunt-sloth/tools` and `@gaunt-sloth/api` are deprecated and now re-export
16
+ > from this package.
package/cli-acp.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * ACP (Agent Client Protocol) server entry for the Gaunt Sloth deep agent.
5
+ * Usage: gaunt-sloth-acp
6
+ *
7
+ * Speaks ACP JSON-RPC over stdio, so an ACP host (Zed, JetBrains, a future Pukeko client)
8
+ * can spawn this binary as a coding agent subprocess.
9
+ *
10
+ * stdout is the ACP protocol channel and must stay clean: any stray byte corrupts framing.
11
+ * gsloth's console output (initConfig info, agent status) routes through console.log/info,
12
+ * which write to stdout — so before doing anything we redirect those to stderr. The ACP SDK
13
+ * writes the protocol via process.stdout.write directly and is unaffected; console.warn/error
14
+ * already go to stderr.
15
+ */
16
+
17
+ for (const method of ['log', 'info']) {
18
+ console[method] = (...args) => process.stderr.write(args.join(' ') + '\n');
19
+ }
20
+
21
+ import { initConfig } from '@gaunt-sloth/core/config.js';
22
+ import { displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
23
+ import { startAcpServer } from '#src/modules/acpModule.js';
24
+
25
+ async function main() {
26
+ try {
27
+ const config = await initConfig({});
28
+ await startAcpServer(config);
29
+ } catch (err) {
30
+ displayError(`ACP server failed: ${err instanceof Error ? err.message : String(err)}`);
31
+ process.exit(1);
32
+ }
33
+ }
34
+
35
+ main();
package/cli.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Simple CLI for gaunt-sloth-api
5
+ * Usage: gaunt-sloth-api [api-type]
6
+ *
7
+ * Starts an API server. Currently supports 'ag-ui' type.
8
+ */
9
+
10
+ import { initConfig } from '@gaunt-sloth/core/config.js';
11
+ import { startAgUiServer } from '#src/modules/apiAgUiModule.js';
12
+ import { displayError, displayInfo } from '@gaunt-sloth/core/utils/consoleUtils.js';
13
+
14
+ const args = process.argv.slice(2);
15
+ const apiType = args[0] || 'ag-ui';
16
+
17
+ async function main() {
18
+ try {
19
+ const config = await initConfig({});
20
+ const port = config.commands?.api?.port ?? 3000;
21
+
22
+ if (apiType === 'ag-ui') {
23
+ displayInfo('Starting AG-UI API server...');
24
+ await startAgUiServer(config, port);
25
+ } else {
26
+ displayError(`Unknown API type: ${apiType}. Supported types: ag-ui`);
27
+ process.exit(1);
28
+ }
29
+ } catch (err) {
30
+ displayError(`Error: ${err instanceof Error ? err.message : String(err)}`);
31
+ process.exit(1);
32
+ }
33
+ }
34
+
35
+ main();
@@ -0,0 +1,26 @@
1
+ import { StructuredToolInterface } from '@langchain/core/tools';
2
+ import { GthConfig } from '@gaunt-sloth/core/config.js';
3
+ import { GthCommand } from '@gaunt-sloth/core/core/types.js';
4
+ /**
5
+ * Available built-in tools may be configured in JSON config, see `builtInTools` of {@link GthConfig}.
6
+ *
7
+ * Does not include `filesystem`, because filesystem has its own config in {@link GthConfig}.
8
+ */
9
+ export declare const AVAILABLE_BUILT_IN_TOOLS: {
10
+ /**
11
+ * Reference tool. Simply prints provided argument to the screen.
12
+ */
13
+ readonly gth_status_update: "#src/tools/gthStatusUpdateTool.js";
14
+ /**
15
+ * Web fetch tool.
16
+ */
17
+ readonly gth_web_fetch: "#src/tools/gthWebFetchTool.js";
18
+ /**
19
+ * AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
20
+ */
21
+ readonly show_a2ui_surface: "#src/tools/showA2UISurfaceTool.js";
22
+ };
23
+ /**
24
+ * Get default tools based on filesystem and built-in tools configuration
25
+ */
26
+ export declare function getDefaultTools(config: GthConfig, command?: GthCommand): Promise<StructuredToolInterface[]>;
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Built-in tools config. {@link AVAILABLE_BUILT_IN_TOOLS} has a list of available tools.
4
+ */
5
+ import GthFileSystemToolkit from '#src/tools/GthFileSystemToolkit.js';
6
+ import { displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
7
+ import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
8
+ import GthDevToolkit from '#src/tools/GthDevToolkit.js';
9
+ import GthCustomToolkit from '#src/tools/GthCustomToolkit.js';
10
+ /**
11
+ * Available built-in tools may be configured in JSON config, see `builtInTools` of {@link GthConfig}.
12
+ *
13
+ * Does not include `filesystem`, because filesystem has its own config in {@link GthConfig}.
14
+ */
15
+ export const AVAILABLE_BUILT_IN_TOOLS = {
16
+ /**
17
+ * Reference tool. Simply prints provided argument to the screen.
18
+ */
19
+ gth_status_update: '#src/tools/gthStatusUpdateTool.js',
20
+ /**
21
+ * Web fetch tool.
22
+ */
23
+ gth_web_fetch: '#src/tools/gthWebFetchTool.js',
24
+ /**
25
+ * AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
26
+ */
27
+ show_a2ui_surface: '#src/tools/showA2UISurfaceTool.js',
28
+ };
29
+ /**
30
+ * Get default tools based on filesystem and built-in tools configuration
31
+ */
32
+ export async function getDefaultTools(config, command) {
33
+ const filesystemTools = filterFilesystemTools(config.filesystem, config.aiignore, config.binaryFormats);
34
+ const builtInTools = await getBuiltInTools(config);
35
+ // 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.
39
+ 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;
45
+ const devTools = await filterDevTools(askWrite ? 'code' : command, devToolConfig);
46
+ const customTools = getCustomTools(config, command);
47
+ return [...filesystemTools, ...devTools, ...customTools, ...builtInTools];
48
+ }
49
+ async function filterDevTools(command, devToolConfig) {
50
+ if ((command !== 'code' && command !== 'exec') || !devToolConfig) {
51
+ return [];
52
+ }
53
+ const toolkit = new GthDevToolkit(devToolConfig);
54
+ return [...toolkit.getTools()];
55
+ }
56
+ /**
57
+ * Get custom tools based on configuration.
58
+ * Supports global customTools and per-command overrides.
59
+ */
60
+ function getCustomTools(config, command) {
61
+ // Determine which custom tools to use
62
+ let toolsConfig;
63
+ if (command && config.commands?.[command]) {
64
+ const cmdConfig = config.commands[command];
65
+ // Check if command has customTools override
66
+ if ('customTools' in cmdConfig) {
67
+ toolsConfig = cmdConfig.customTools;
68
+ }
69
+ else {
70
+ // No override, use root-level
71
+ toolsConfig = config.customTools;
72
+ }
73
+ }
74
+ else {
75
+ // No command specified or no command config, use root-level
76
+ toolsConfig = config.customTools;
77
+ }
78
+ // If explicitly disabled or empty, return no tools
79
+ if (toolsConfig === false || !toolsConfig || Object.keys(toolsConfig).length === 0) {
80
+ return [];
81
+ }
82
+ // Create toolkit with the determined config
83
+ const toolkit = new GthCustomToolkit(toolsConfig);
84
+ return toolkit.getTools();
85
+ }
86
+ /**
87
+ * Filter filesystem tools based on configuration
88
+ */
89
+ function filterFilesystemTools(filesystemConfig, aiignoreConfig, binaryFormats) {
90
+ const toolkit = new GthFileSystemToolkit({
91
+ allowedDirectories: [getCurrentWorkDir()],
92
+ aiignoreConfig,
93
+ binaryFormats,
94
+ });
95
+ if (filesystemConfig === 'all') {
96
+ return toolkit.getTools();
97
+ }
98
+ if (filesystemConfig === 'none') {
99
+ return [];
100
+ }
101
+ if (filesystemConfig === 'read') {
102
+ // Read-only: only allow read operations
103
+ return toolkit.getFilteredTools(['read']);
104
+ }
105
+ if (!Array.isArray(filesystemConfig)) {
106
+ return toolkit.getTools();
107
+ }
108
+ if (filesystemConfig.includes('all')) {
109
+ return toolkit.getTools();
110
+ }
111
+ // Handle an array of specific tool names or 'read'/'all'
112
+ const allowedTools = filesystemConfig.includes('read')
113
+ ? toolkit.getFilteredTools(['read'])
114
+ : [];
115
+ // Also allow specific tool names
116
+ const allowedToolNames = new Set(filesystemConfig.filter((name) => name !== 'read' && name !== 'all'));
117
+ const specificNamedTools = toolkit.getTools().filter((tool) => {
118
+ return tool.name && allowedToolNames.has(tool.name);
119
+ });
120
+ // Combine and deduplicate
121
+ const allAllowedTools = [...allowedTools, ...specificNamedTools];
122
+ return allAllowedTools.filter((tool, index, arr) => arr.findIndex((t) => t.name === tool.name) === index);
123
+ }
124
+ /**
125
+ * Get built-in tools based on configuration
126
+ */
127
+ async function getBuiltInTools(config) {
128
+ const tools = [];
129
+ if (!config.builtInTools) {
130
+ return tools;
131
+ }
132
+ for (const toolName of config.builtInTools) {
133
+ if (toolName in AVAILABLE_BUILT_IN_TOOLS) {
134
+ try {
135
+ const tool = await import(AVAILABLE_BUILT_IN_TOOLS[toolName]);
136
+ tools.push(tool.get(config));
137
+ }
138
+ catch (error) {
139
+ displayWarning(`Failed to load built-in tool '${toolName}': ${error}`);
140
+ }
141
+ }
142
+ else {
143
+ displayWarning(`Unknown built-in tool: ${toolName}`);
144
+ }
145
+ }
146
+ return tools;
147
+ }
148
+ //# sourceMappingURL=builtInToolsConfig.js.map
@@ -0,0 +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,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AG,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"}
@@ -0,0 +1,76 @@
1
+ import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
+ import { GthAbstractAgent } from '@gaunt-sloth/core/core/GthAbstractAgent.js';
3
+ import { type GthCommand } from '@gaunt-sloth/core/core/types.js';
4
+ import type { StructuredToolInterface } from '@langchain/core/tools';
5
+ import type { BaseCheckpointSaver } from '@langchain/langgraph';
6
+ import { type FilesystemPermission } from '#src/core/deepAgentPermissions.js';
7
+ import type { DebugCapture, DebugRequestExtras } from '#src/core/debugCapture.js';
8
+ /**
9
+ * The subset of `createDeepAgent` params that are independent of the transport
10
+ * (the local runner vs. the ACP server). Both {@link GthDeepAgent.init} (which adds the
11
+ * console-bound tool-call-status middleware + a virtual {@link FilesystemBackend} +
12
+ * checkpointer and calls `createDeepAgent`) and the ACP entry (deepagents-acp
13
+ * `startServer`, which supplies its own ACP-proxying backend, checkpointer and tool-call
14
+ * reporting) consume these.
15
+ *
16
+ * `middleware` here deliberately EXCLUDES the tool-call-status middleware: that one writes
17
+ * to stdout, which on the ACP path is the JSON-RPC channel and must stay clean. The runner
18
+ * path appends it in {@link GthDeepAgent.init}.
19
+ */
20
+ export interface GthDeepAgentParams {
21
+ model: any;
22
+ tools: StructuredToolInterface[];
23
+ permissions: FilesystemPermission[];
24
+ middleware: any[];
25
+ /**
26
+ * gsloth's composed system prompt (backstory + guidelines + per-command mode prompt +
27
+ * system prompt). Passed to `createDeepAgent({ systemPrompt })`, where deepagents combines
28
+ * it ADDITIVELY with its own base + filesystem prompts into ONE system message. This replaces
29
+ * the previous per-turn `SystemMessage` injection by the runner/AG-UI callers — two system
30
+ * messages (deepagents' own + gsloth's, not first) are rejected by Anthropic. `undefined` when
31
+ * no prompt content is composed (lets deepagents use only its base prompt).
32
+ */
33
+ systemPrompt: string | undefined;
34
+ }
35
+ /**
36
+ * Deep agent: builds a `createDeepAgent` graph (deepagents). All run/stream/event
37
+ * plumbing lives in {@link GthAbstractAgent}; this class only knows how to construct
38
+ * the graph in {@link init}.
39
+ *
40
+ * Differences from the lean {@link GthLangChainAgent}:
41
+ * - deepagents provides the filesystem tools (`read_file`/`write_file`/`edit_file`/
42
+ * `ls`/`glob`/`grep`/`execute`) via its own middleware, backed by a
43
+ * {@link FilesystemBackend}. gsloth's `.aiignore` + `filesystem` config are mapped
44
+ * onto deepagents `permissions` (see {@link buildPermissions}). Any resolved tool
45
+ * that reuses a deepagents filesystem-tool name is therefore superseded and dropped
46
+ * (`createDeepAgent` would otherwise throw on the collision).
47
+ * - todos / subagents / summarization come from deepagents' standard middleware.
48
+ *
49
+ * The transport-agnostic param assembly lives in {@link buildDeepAgentParams} so the ACP
50
+ * entry (`deepagents-acp`) can reuse the exact same tool resolution, permission mapping and
51
+ * middleware hardening without re-running `createDeepAgent` locally.
52
+ */
53
+ 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
+ init(command: GthCommand | undefined, configIn: GthConfig, checkpointer?: BaseCheckpointSaver | undefined): Promise<void>;
62
+ /**
63
+ * Assemble the transport-agnostic {@link GthDeepAgentParams}: resolve tools (with the
64
+ * filesystem disabled so deepagents owns fs access), apply the allowedTools allow-list and
65
+ * the deepagents fs-name supersession safety-net, map `.aiignore` + filesystem mode onto
66
+ * deepagents permissions, and build the fs-denial-softening middleware. Shared by the local
67
+ * runner ({@link init}) and the `deepagents-acp` ACP entry.
68
+ */
69
+ buildDeepAgentParams(command: GthCommand | undefined, configIn: GthConfig): Promise<GthDeepAgentParams>;
70
+ }
71
+ /**
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.
75
+ */
76
+ export declare function extractDebugRequestExtras(request: unknown): DebugRequestExtras | undefined;