@gaunt-sloth/agent 2.0.0-alpha.0 → 2.0.0-alpha.10
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/LICENSE +7 -0
- package/README.md +9 -0
- package/dist/builtInToolsConfig.d.ts +5 -0
- package/dist/builtInToolsConfig.js +16 -2
- package/dist/builtInToolsConfig.js.map +1 -1
- package/dist/core/GthDeepAgent.d.ts +108 -13
- package/dist/core/GthDeepAgent.js +352 -121
- package/dist/core/GthDeepAgent.js.map +1 -1
- package/dist/core/debugCapture.d.ts +8 -49
- package/dist/core/debugCapture.js +1 -1
- package/dist/core/debugCapture.js.map +1 -1
- package/dist/core/deepAgentPermissions.d.ts +72 -12
- package/dist/core/deepAgentPermissions.js +191 -29
- package/dist/core/deepAgentPermissions.js.map +1 -1
- package/dist/core/gthAcpServer.js +11 -0
- package/dist/core/gthAcpServer.js.map +1 -1
- package/dist/core/gthDeepAgentFactory.d.ts +3 -0
- package/dist/core/gthDeepAgentFactory.js +9 -1
- package/dist/core/gthDeepAgentFactory.js.map +1 -1
- package/dist/core/resolveAgentFactory.d.ts +14 -0
- package/dist/core/resolveAgentFactory.js +18 -0
- package/dist/core/resolveAgentFactory.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/OAuthClientProviderImpl.js +2 -2
- package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
- package/dist/middleware/registry.d.ts +1 -1
- package/dist/middleware/registry.js +1 -1
- package/dist/middleware/types.d.ts +1 -1
- package/dist/middleware/types.js +1 -1
- package/dist/modules/acpModule.d.ts +5 -2
- package/dist/modules/acpModule.js +13 -2
- package/dist/modules/acpModule.js.map +1 -1
- package/dist/modules/apiAgUiModule.js +48 -16
- package/dist/modules/apiAgUiModule.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +130 -7
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/tools/GthDevToolkit.d.ts +45 -1
- package/dist/tools/GthDevToolkit.js +204 -17
- package/dist/tools/GthDevToolkit.js.map +1 -1
- package/dist/tools/gthChecklistTool.d.ts +30 -0
- package/dist/tools/gthChecklistTool.js +81 -0
- package/dist/tools/gthChecklistTool.js.map +1 -0
- package/dist/tools/shell/allowlist.d.ts +11 -0
- package/dist/tools/shell/allowlist.js +12 -0
- package/dist/tools/shell/allowlist.js.map +1 -0
- package/dist/tools/shell/arity.d.ts +11 -0
- package/dist/tools/shell/arity.js +12 -0
- package/dist/tools/shell/arity.js.map +1 -0
- package/dist/tools/shell/env.d.ts +22 -0
- package/dist/tools/shell/env.js +110 -0
- package/dist/tools/shell/env.js.map +1 -0
- package/dist/tools/shell/hardline.d.ts +15 -0
- package/dist/tools/shell/hardline.js +88 -0
- package/dist/tools/shell/hardline.js.map +1 -0
- package/dist/tools/shell/normalize.d.ts +10 -0
- package/dist/tools/shell/normalize.js +11 -0
- package/dist/tools/shell/normalize.js.map +1 -0
- package/dist/tools/shell/outputBuffer.d.ts +53 -0
- package/dist/tools/shell/outputBuffer.js +157 -0
- package/dist/tools/shell/outputBuffer.js.map +1 -0
- package/dist/tools/shell/workDir.d.ts +11 -0
- package/dist/tools/shell/workDir.js +45 -0
- package/dist/tools/shell/workDir.js.map +1 -0
- package/dist/utils/mcpUtils.js +16 -0
- package/dist/utils/mcpUtils.js.map +1 -1
- package/package.json +14 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025-present Andrew Kondratev
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,9 +8,18 @@ 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`](../app) app, not the standalone `gaunt-sloth-acp` binary. The LLM
|
|
19
|
+
> providers are `peerDependencies` of `@gaunt-sloth/core` that only the app declares, so a
|
|
20
|
+
> bare `@gaunt-sloth/agent` install has no providers to construct a model from. See the
|
|
21
|
+
> [app README → ACP server](../app/README.md#acp-server-editor-integration) for setup and a
|
|
22
|
+
> Zed `settings.json` example.
|
|
23
|
+
|
|
15
24
|
> `@gaunt-sloth/tools` and `@gaunt-sloth/api` are deprecated and now re-export
|
|
16
25
|
> from this package.
|
|
@@ -19,6 +19,11 @@ export declare const AVAILABLE_BUILT_IN_TOOLS: {
|
|
|
19
19
|
* AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
|
|
20
20
|
*/
|
|
21
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";
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* Get default tools based on filesystem and built-in tools configuration
|
|
@@ -25,6 +25,11 @@ export const AVAILABLE_BUILT_IN_TOOLS = {
|
|
|
25
25
|
* AG-UI A2UI surface tool: lets the agent render an A2UI surface in the web client.
|
|
26
26
|
*/
|
|
27
27
|
show_a2ui_surface: '#src/tools/showA2UISurfaceTool.js',
|
|
28
|
+
/**
|
|
29
|
+
* Checklist / todo planning tool for the lean agent (the `write_todos` equivalent). Enabled
|
|
30
|
+
* by default (see {@link DEFAULT_CONFIG}); disable by setting your own `builtInTools`.
|
|
31
|
+
*/
|
|
32
|
+
gth_checklist: '#src/tools/gthChecklistTool.js',
|
|
28
33
|
};
|
|
29
34
|
/**
|
|
30
35
|
* Get default tools based on filesystem and built-in tools configuration
|
|
@@ -47,10 +52,19 @@ export async function getDefaultTools(config, command) {
|
|
|
47
52
|
return [...filesystemTools, ...devTools, ...customTools, ...builtInTools];
|
|
48
53
|
}
|
|
49
54
|
async function filterDevTools(command, devToolConfig) {
|
|
50
|
-
|
|
55
|
+
// Dev tools only apply to the do-the-job commands (`code` / `exec`; `ask --write` is mapped
|
|
56
|
+
// to `code` by the caller). EXT-12: for `code` the toolkit is constructed even when no
|
|
57
|
+
// devTools config is present, so the shell tool's absent-config default (ON in `code`) can
|
|
58
|
+
// emit `run_shell_command` (still gated). For `exec` we keep the prior behaviour — no config
|
|
59
|
+
// means no dev tools — by short-circuiting when the config is absent.
|
|
60
|
+
if (command !== 'code' && command !== 'exec') {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
if (command === 'exec' && !devToolConfig) {
|
|
51
64
|
return [];
|
|
52
65
|
}
|
|
53
|
-
|
|
66
|
+
// Pass the command so GthDevToolkit resolves the shell default for the active mode.
|
|
67
|
+
const toolkit = new GthDevToolkit(devToolConfig ?? {}, command);
|
|
54
68
|
return [...toolkit.getTools()];
|
|
55
69
|
}
|
|
56
70
|
/**
|
|
@@ -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;
|
|
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,EA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,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,eAAe,GAAG,CAAC,GAAG,YAAY,EAAE,GAAG,kBAAkB,CAAC,CAAC;IACjE,OAAO,eAAe,CAAC,MAAM,CAC3B,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAC3E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,MAAiB;IAC9C,MAAM,KAAK,GAA8B,EAAE,CAAC;IAE5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC3C,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"}
|
|
@@ -3,8 +3,9 @@ import { GthAbstractAgent } from '@gaunt-sloth/core/core/GthAbstractAgent.js';
|
|
|
3
3
|
import { type GthCommand } from '@gaunt-sloth/core/core/types.js';
|
|
4
4
|
import type { StructuredToolInterface } from '@langchain/core/tools';
|
|
5
5
|
import type { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
6
|
+
import { type InterruptOnConfig } from 'langchain';
|
|
6
7
|
import { type FilesystemPermission } from '#src/core/deepAgentPermissions.js';
|
|
7
|
-
|
|
8
|
+
export { extractDebugRequestExtras } from '#src/core/debugCapture.js';
|
|
8
9
|
/**
|
|
9
10
|
* The subset of `createDeepAgent` params that are independent of the transport
|
|
10
11
|
* (the local runner vs. the ACP server). Both {@link GthDeepAgent.init} (which adds the
|
|
@@ -31,6 +32,21 @@ export interface GthDeepAgentParams {
|
|
|
31
32
|
* no prompt content is composed (lets deepagents use only its base prompt).
|
|
32
33
|
*/
|
|
33
34
|
systemPrompt: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Per-tool human-in-the-loop configuration passed straight to
|
|
37
|
+
* `createDeepAgent({ interruptOn })` (deepagents installs LangChain's
|
|
38
|
+
* `humanInTheLoopMiddleware` for it). A matching tool call suspends the graph with a
|
|
39
|
+
* `__interrupt__` (a `HITLRequest`) so a consumer can approve/reject before the tool runs;
|
|
40
|
+
* resume with `new Command({ resume: { decisions: [...] } })` on the same `thread_id`.
|
|
41
|
+
*
|
|
42
|
+
* gsloth sets this for the opt-in `run_shell_command` tool whenever `devTools.shell` is
|
|
43
|
+
* enabled — including under `devTools.shellYolo` in interactive `code` mode, where the tool
|
|
44
|
+
* stays gated so the runtime `/auto-approve` flag governs it (the runner seeds that flag ON
|
|
45
|
+
* from shellYolo and auto-approves silently). It is left `undefined` only for a non-interactive
|
|
46
|
+
* yolo run (exec / ask --write), whose single-shot path does not drain interrupts, so the tool
|
|
47
|
+
* there runs inline without suspending. See `getAgentBuildParams`.
|
|
48
|
+
*/
|
|
49
|
+
interruptOn?: Record<string, boolean | InterruptOnConfig>;
|
|
34
50
|
}
|
|
35
51
|
/**
|
|
36
52
|
* Deep agent: builds a `createDeepAgent` graph (deepagents). All run/stream/event
|
|
@@ -43,7 +59,10 @@ export interface GthDeepAgentParams {
|
|
|
43
59
|
* {@link FilesystemBackend}. gsloth's `.aiignore` + `filesystem` config are mapped
|
|
44
60
|
* onto deepagents `permissions` (see {@link buildPermissions}). Any resolved tool
|
|
45
61
|
* that reuses a deepagents filesystem-tool name is therefore superseded and dropped
|
|
46
|
-
* (`createDeepAgent` would otherwise throw on the collision).
|
|
62
|
+
* (`createDeepAgent` would otherwise throw on the collision). EXT-14: the
|
|
63
|
+
* `FilesystemBackend` itself is wrapped with {@link guardFilesystemBackend} before it
|
|
64
|
+
* reaches `createDeepAgent`, adding a realpath (symlink-resolved) containment check the
|
|
65
|
+
* permission globs alone can't provide.
|
|
47
66
|
* - todos / subagents / summarization come from deepagents' standard middleware.
|
|
48
67
|
*
|
|
49
68
|
* The transport-agnostic param assembly lives in {@link buildDeepAgentParams} so the ACP
|
|
@@ -51,13 +70,6 @@ export interface GthDeepAgentParams {
|
|
|
51
70
|
* middleware hardening without re-running `createDeepAgent` locally.
|
|
52
71
|
*/
|
|
53
72
|
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
73
|
init(command: GthCommand | undefined, configIn: GthConfig, checkpointer?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
62
74
|
/**
|
|
63
75
|
* Assemble the transport-agnostic {@link GthDeepAgentParams}: resolve tools (with the
|
|
@@ -67,10 +79,93 @@ export declare class GthDeepAgent extends GthAbstractAgent {
|
|
|
67
79
|
* runner ({@link init}) and the `deepagents-acp` ACP entry.
|
|
68
80
|
*/
|
|
69
81
|
buildDeepAgentParams(command: GthCommand | undefined, configIn: GthConfig): Promise<GthDeepAgentParams>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolve the {@link GthDevToolsConfig} that applies to the active command, mirroring the
|
|
84
|
+
* per-command selection in `builtInToolsConfig.getDefaultTools` (which is what actually emits
|
|
85
|
+
* the dev tools): `exec` → `commands.exec.devTools`, `ask --write` → `commands.ask.devTools`,
|
|
86
|
+
* otherwise (`code`) → `commands.code.devTools`. Returns `undefined` for any other command,
|
|
87
|
+
* matching the toolkit being inert there. Kept private and side-effect-free so the interrupt
|
|
88
|
+
* wiring above and the tool emission stay in lockstep.
|
|
89
|
+
*/
|
|
90
|
+
private getEffectiveDevToolsConfig;
|
|
70
91
|
}
|
|
71
92
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
93
|
+
* EXT-22: shared virtualMode path-namespace guidance — ONE source of truth used by BOTH the S2
|
|
94
|
+
* early-framing note ({@link appendVirtualCwdNote}, injected into gsloth's composed systemPrompt =
|
|
95
|
+
* block 0) and the S1 last-word correction middleware
|
|
96
|
+
* ({@link createPathNamespaceCorrectionMiddleware}, appended after deepagents' `/`-rooted line).
|
|
97
|
+
*
|
|
98
|
+
* In a virtualMode `code` session (EXT-16, e.g. Windows) the deepagents filesystem tools use a
|
|
99
|
+
* VIRTUAL `/` root (= the working dir) while `run_shell_command` uses REAL native OS paths; the
|
|
100
|
+
* model conflates the two forms. This text draws the distinction and steers toward cwd-relative
|
|
101
|
+
* paths (the one form both tool families read alike).
|
|
102
|
+
*
|
|
103
|
+
* It deliberately does NOT equate the virtual root with a specific real path (no "`/` = D:\\work"):
|
|
104
|
+
* virtualMode withholds the real cwd on purpose (see the systemPrompt gate in {@link
|
|
105
|
+
* GthDeepAgent.init}), so the guidance is about the DISTINCTION between the two namespaces and the
|
|
106
|
+
* safety of relative paths, not a mapping between them.
|
|
107
|
+
*/
|
|
108
|
+
export declare const PATH_NAMESPACE_GUIDANCE: string;
|
|
109
|
+
/**
|
|
110
|
+
* EXT-22 (S2): virtualMode variant of {@link appendCwdNote}. On the `code` path when the fs
|
|
111
|
+
* backend runs in virtualMode (EXT-16), inject the shared path-namespace guidance EARLY in
|
|
112
|
+
* gsloth's composed systemPrompt (block 0) so the model is framed before deepagents' own prompt.
|
|
113
|
+
*
|
|
114
|
+
* This is early framing only: deepagents' hardcoded `/`-rooted line lands in a LATER block and can
|
|
115
|
+
* partially override block 0, so the authoritative last word is delivered by the S1 middleware
|
|
116
|
+
* ({@link createPathNamespaceCorrectionMiddleware}); see handoff/spike-systemmessage-ordering.md.
|
|
117
|
+
* Returns the note alone when there is no base prompt.
|
|
118
|
+
*/
|
|
119
|
+
export declare function appendVirtualCwdNote(systemPrompt: string | undefined): string;
|
|
120
|
+
/**
|
|
121
|
+
* EXT-22 (S1): the load-bearing path-namespace correction. A gsloth `wrapModelCall` middleware
|
|
122
|
+
* runs INNERMOST (inside deepagents' filesystem middleware), so appending a trailing block to
|
|
123
|
+
* `request.systemMessage` lands AFTER deepagents' hardcoded "All file paths must start with a /."
|
|
124
|
+
* line — giving gsloth the last word on path semantics (empirically verified; see
|
|
125
|
+
* handoff/spike-systemmessage-ordering.md). It APPENDS via `request.systemMessage.concat(...)`
|
|
126
|
+
* (mirroring how deepagents appends its own fs prompt), never string-splices, and returns a NEW
|
|
127
|
+
* request so it never mutates persisted state (no compounding across turns).
|
|
128
|
+
*
|
|
129
|
+
* `appendCorrection` gates it to `code` + virtualMode: only there do the fs virtual `/` root and
|
|
130
|
+
* the shell's real-OS paths diverge. On POSIX real-path mode deepagents' "start with /" is
|
|
131
|
+
* literally true, so the middleware is a transparent pass-through (like the debug-capture
|
|
132
|
+
* middleware when no sink is attached).
|
|
133
|
+
*/
|
|
134
|
+
export declare function createPathNamespaceCorrectionMiddleware(appendCorrection: boolean): import("langchain").AgentMiddleware<undefined, undefined, unknown, readonly (import("@langchain/core/tools").ClientTool | import("@langchain/core/tools").ServerTool)[], readonly []>;
|
|
135
|
+
/**
|
|
136
|
+
* EXT-13 (part b): append a real-cwd / path-model note to the composed code-mode system prompt.
|
|
137
|
+
*
|
|
138
|
+
* The default code-mode backend runs in REAL-path mode (no virtualMode), so the deepagents fs
|
|
139
|
+
* tools and `run_shell_command` share one real-absolute-path namespace rooted at `cwd`. Neither
|
|
140
|
+
* deepagents' base prompt nor `.gsloth.code.md` states the actual cwd, so without this the model
|
|
141
|
+
* assumes `/` is cwd and hands `/`-rooted paths to the real-fs shell. The cwd is injected
|
|
142
|
+
* dynamically (never baked into the .md). Returns the note alone when there is no base prompt.
|
|
143
|
+
*/
|
|
144
|
+
export declare function appendCwdNote(systemPrompt: string | undefined, cwd: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* EXT-26: the platform-agnostic tail shared by both {@link appendOsShellNote} branches.
|
|
147
|
+
*
|
|
148
|
+
* The recurring failure mode on non-POSIX hosts is not just wrong command NAMES but shell
|
|
149
|
+
* REDIRECTION quoting: a grouped/multi-line `echo` redirect on cmd.exe reported success yet wrote
|
|
150
|
+
* a 0-byte file. So on every platform we steer file creation/mutation to the deepagents built-in
|
|
151
|
+
* `write_file`/`edit_file` tools (which never touch the shell's quoting) and keep each shell
|
|
152
|
+
* command a single line. Kept short — this is prompt text an LLM reads, not documentation.
|
|
153
|
+
*/
|
|
154
|
+
export declare const OS_SHELL_GUIDANCE: string;
|
|
155
|
+
/**
|
|
156
|
+
* EXT-26: append an OS + shell-dialect note to the composed code-mode system prompt.
|
|
157
|
+
*
|
|
158
|
+
* The deep-agent model was never told its host OS or which shell `run_shell_command` uses, so on
|
|
159
|
+
* non-POSIX hosts it defaulted to POSIX idioms that fail (ran `ls` where cmd.exe has `dir`, a
|
|
160
|
+
* multi-line echo-redirect that wrote 0 bytes, a PowerShell here-string, `python -c` multi-line).
|
|
161
|
+
* This is ORTHOGONAL to the EXT-13/16/22 path-namespace notes: those say WHERE the model is (path
|
|
162
|
+
* form); this says WHAT shell it speaks (dialect).
|
|
163
|
+
*
|
|
164
|
+
* The shell is derived from the SAME rule Node's `spawn(command, { shell: true })` uses — exactly
|
|
165
|
+
* how `run_shell_command` spawns (GthDevToolkit spawn) — so on `win32` it is cmd.exe (via
|
|
166
|
+
* `%ComSpec%`) and on POSIX it is `/bin/sh` (POSIX sh, NOT guaranteed bash). Computed from
|
|
167
|
+
* `process.platform` at call time so the text is correct per host. Returns the note alone when
|
|
168
|
+
* there is no base prompt. A single injection is authoritative (nothing in deepagents' base prompt
|
|
169
|
+
* contradicts shell dialect), so unlike EXT-22 no correction middleware is needed.
|
|
75
170
|
*/
|
|
76
|
-
export declare function
|
|
171
|
+
export declare function appendOsShellNote(systemPrompt: string | undefined): string;
|