@gaunt-sloth/agent 2.0.0-alpha.35 → 2.0.0-alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/cli-acp.js +20 -24
- package/dist/builtInToolsConfig.d.ts +2 -2
- package/dist/builtInToolsConfig.js +2 -2
- package/dist/core/debugCapture.d.ts +4 -5
- package/dist/core/debugCapture.js.map +1 -1
- package/dist/core/resolveAgentFactory.d.ts +10 -9
- package/dist/core/resolveAgentFactory.js +11 -12
- package/dist/core/resolveAgentFactory.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/middleware/frontendImageInjectionMiddleware.d.ts +3 -2
- package/dist/middleware/frontendImageInjectionMiddleware.js +3 -2
- package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -1
- package/dist/middleware/registry.js +16 -3
- package/dist/middleware/registry.js.map +1 -1
- package/dist/modules/acp/acpAgentApp.d.ts +93 -0
- package/dist/modules/acp/acpAgentApp.js +593 -0
- package/dist/modules/acp/acpAgentApp.js.map +1 -0
- package/dist/modules/acp/acpPermissions.d.ts +60 -0
- package/dist/modules/acp/acpPermissions.js +158 -0
- package/dist/modules/acp/acpPermissions.js.map +1 -0
- package/dist/modules/acp/acpStdio.d.ts +41 -0
- package/dist/modules/acp/acpStdio.js +65 -0
- package/dist/modules/acp/acpStdio.js.map +1 -0
- package/dist/modules/acp/acpUpdates.d.ts +101 -0
- package/dist/modules/acp/acpUpdates.js +287 -0
- package/dist/modules/acp/acpUpdates.js.map +1 -0
- package/dist/modules/apiAgUiModule.js +8 -16
- package/dist/modules/apiAgUiModule.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +39 -6
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/tools/GthCustomToolkit.js +1 -1
- package/dist/tools/GthCustomToolkit.js.map +1 -1
- package/dist/tools/GthDevToolkit.d.ts +2 -2
- package/dist/tools/GthDevToolkit.js +8 -13
- package/dist/tools/GthDevToolkit.js.map +1 -1
- package/dist/tools/gthChecklistTool.js +4 -5
- package/dist/tools/gthChecklistTool.js.map +1 -1
- package/dist/tools/gthGrepTool.js +6 -6
- package/dist/tools/shell/workDir.d.ts +1 -10
- package/dist/tools/shell/workDir.js +10 -36
- package/dist/tools/shell/workDir.js.map +1 -1
- package/package.json +8 -9
- package/dist/core/GthDeepAgent.d.ts +0 -128
- package/dist/core/GthDeepAgent.js +0 -712
- package/dist/core/GthDeepAgent.js.map +0 -1
- package/dist/core/deepAgentPermissions.d.ts +0 -138
- package/dist/core/deepAgentPermissions.js +0 -309
- package/dist/core/deepAgentPermissions.js.map +0 -1
- package/dist/core/gthAcpServer.d.ts +0 -27
- package/dist/core/gthAcpServer.js +0 -82
- package/dist/core/gthAcpServer.js.map +0 -1
- package/dist/core/gthDeepAgentFactory.d.ts +0 -11
- package/dist/core/gthDeepAgentFactory.js +0 -17
- package/dist/core/gthDeepAgentFactory.js.map +0 -1
- package/dist/core/subagentProfiles.d.ts +0 -50
- package/dist/core/subagentProfiles.js +0 -76
- package/dist/core/subagentProfiles.js.map +0 -1
- package/dist/modules/acpModule.d.ts +0 -40
- package/dist/modules/acpModule.js +0 -86
- package/dist/modules/acpModule.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { StatusLevel } from '@gaunt-sloth/core/core/types.js';
|
|
2
|
-
import { GthDeepAgent } from '#src/core/GthDeepAgent.js';
|
|
3
|
-
/**
|
|
4
|
-
* A {@link GthAgentFactory} that produces a {@link GthDeepAgent}. Pass this to
|
|
5
|
-
* `GthAgentRunner` (its optional 3rd ctor arg) so the same runner drives a
|
|
6
|
-
* `createDeepAgent` graph instead of the lean default — without `core` ever
|
|
7
|
-
* importing `deepagents`.
|
|
8
|
-
*
|
|
9
|
-
* The deepagents backend is **experimental**: lean is the default. Selecting it (via
|
|
10
|
-
* `agent.backend: 'deep'`) emits a one-time warning so it is never used unknowingly.
|
|
11
|
-
*/
|
|
12
|
-
export const gthDeepAgentFactory = (statusUpdate, resolvers) => {
|
|
13
|
-
statusUpdate(StatusLevel.WARNING, 'Using the experimental deepagents backend (agent.backend: deep). The lean agent is the ' +
|
|
14
|
-
'default and recommended backend; deep may exhibit path-divergence or sporadic failures.');
|
|
15
|
-
return new GthDeepAgent(statusUpdate, resolvers);
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=gthDeepAgentFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gthDeepAgentFactory.js","sourceRoot":"","sources":["../../src/core/gthDeepAgentFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAoB,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE;IAC9E,YAAY,CACV,WAAW,CAAC,OAAO,EACnB,yFAAyF;QACvF,yFAAyF,CAC5F,CAAC;IACF,OAAO,IAAI,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* GS2-33 — the load-bearing capability: run a subagent under a NAMED config profile. When the
|
|
4
|
-
* parent declares `subagents: [{ name, profile }]`, the CHILD resolves THAT profile through the
|
|
5
|
-
* GS2-1 config cascade (`initConfig({ identityProfile: profile })`), so it gets the profile's own
|
|
6
|
-
* model + tools + prompt — e.g. a cheap flash-lite profile for a recall/search subagent while the
|
|
7
|
-
* parent runs on a strong model.
|
|
8
|
-
*
|
|
9
|
-
* This module is the subagent-spawn config-resolution seam. {@link resolveSubagentProfileConfig}
|
|
10
|
-
* threads the profile name through the cascade; {@link buildProfileSubagents} turns each declared
|
|
11
|
-
* spec into a deepagents {@link SubAgent} whose `model`/`tools`/`systemPrompt` come from the child
|
|
12
|
-
* profile. The deep backend wires the result into `createDeepAgent({ subagents })` (see
|
|
13
|
-
* `GthDeepAgent.init`). Resolution mutates process globals (`setProjectDir`/`setConsoleLevel`/
|
|
14
|
-
* `setUseColour`) exactly as a normal run's `initConfig` does — the caller snapshots + restores
|
|
15
|
-
* them around the build so a child profile's console/colour cannot leak into the parent run.
|
|
16
|
-
*/
|
|
17
|
-
import { type GthConfig, type SubagentProfileSpec } from '@gaunt-sloth/core/config.js';
|
|
18
|
-
import type { AgentResolvers, GthCommand } from '@gaunt-sloth/core/core/types.js';
|
|
19
|
-
import type { SubAgent } from 'deepagents';
|
|
20
|
-
/**
|
|
21
|
-
* Resolve a named profile into a fully-merged child {@link GthConfig} by threading the profile name
|
|
22
|
-
* through the GS2-1 cascade as `identityProfile`. Deliberately resolves with ONLY the profile
|
|
23
|
-
* override — no parent `-c` / `--model` — so the child is exactly what that profile's config dir
|
|
24
|
-
* defines (a parent `--model` must not silently retarget the child's profile model). The profile's
|
|
25
|
-
* own `.gsloth/.gsloth-settings/<profile>/` config becomes the project-file layer; global config +
|
|
26
|
-
* `DEFAULT_CONFIG` still underlay.
|
|
27
|
-
*
|
|
28
|
-
* NOTE: an explicitly-named profile that has no config dir makes `initConfig` fail loudly (the
|
|
29
|
-
* GS2-62 guard), so a typo'd subagent profile surfaces as an error rather than silently reusing the
|
|
30
|
-
* parent/global model.
|
|
31
|
-
*/
|
|
32
|
-
export declare function resolveSubagentProfileConfig(profile: string): Promise<GthConfig>;
|
|
33
|
-
/** Inputs for {@link buildProfileSubagents}. */
|
|
34
|
-
export interface BuildProfileSubagentsOptions {
|
|
35
|
-
/** The active command (drives which mode prompt the child composes). */
|
|
36
|
-
command: GthCommand | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* The parent's tool resolver, reused to resolve the CHILD's tools from its profile config (with
|
|
39
|
-
* the filesystem disabled — the deep backend owns fs access for subagents too). Optional: without
|
|
40
|
-
* it a subagent gets the deepagents default tool set.
|
|
41
|
-
*/
|
|
42
|
-
resolveTools?: AgentResolvers['resolveTools'];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Turn each {@link SubagentProfileSpec} into a deepagents {@link SubAgent} whose model + tools +
|
|
46
|
-
* prompt come from the named profile's resolved config. The returned specs are handed to
|
|
47
|
-
* `createDeepAgent({ subagents })`; the model — the whole point — is the child profile's `llm`,
|
|
48
|
-
* distinct from the parent's.
|
|
49
|
-
*/
|
|
50
|
-
export declare function buildProfileSubagents(specs: readonly SubagentProfileSpec[], options: BuildProfileSubagentsOptions): Promise<SubAgent[]>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* GS2-33 — the load-bearing capability: run a subagent under a NAMED config profile. When the
|
|
4
|
-
* parent declares `subagents: [{ name, profile }]`, the CHILD resolves THAT profile through the
|
|
5
|
-
* GS2-1 config cascade (`initConfig({ identityProfile: profile })`), so it gets the profile's own
|
|
6
|
-
* model + tools + prompt — e.g. a cheap flash-lite profile for a recall/search subagent while the
|
|
7
|
-
* parent runs on a strong model.
|
|
8
|
-
*
|
|
9
|
-
* This module is the subagent-spawn config-resolution seam. {@link resolveSubagentProfileConfig}
|
|
10
|
-
* threads the profile name through the cascade; {@link buildProfileSubagents} turns each declared
|
|
11
|
-
* spec into a deepagents {@link SubAgent} whose `model`/`tools`/`systemPrompt` come from the child
|
|
12
|
-
* profile. The deep backend wires the result into `createDeepAgent({ subagents })` (see
|
|
13
|
-
* `GthDeepAgent.init`). Resolution mutates process globals (`setProjectDir`/`setConsoleLevel`/
|
|
14
|
-
* `setUseColour`) exactly as a normal run's `initConfig` does — the caller snapshots + restores
|
|
15
|
-
* them around the build so a child profile's console/colour cannot leak into the parent run.
|
|
16
|
-
*/
|
|
17
|
-
import { initConfig } from '@gaunt-sloth/core/config.js';
|
|
18
|
-
import { buildSystemMessages, readModePrompt } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
19
|
-
import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
20
|
-
/**
|
|
21
|
-
* Resolve a named profile into a fully-merged child {@link GthConfig} by threading the profile name
|
|
22
|
-
* through the GS2-1 cascade as `identityProfile`. Deliberately resolves with ONLY the profile
|
|
23
|
-
* override — no parent `-c` / `--model` — so the child is exactly what that profile's config dir
|
|
24
|
-
* defines (a parent `--model` must not silently retarget the child's profile model). The profile's
|
|
25
|
-
* own `.gsloth/.gsloth-settings/<profile>/` config becomes the project-file layer; global config +
|
|
26
|
-
* `DEFAULT_CONFIG` still underlay.
|
|
27
|
-
*
|
|
28
|
-
* NOTE: an explicitly-named profile that has no config dir makes `initConfig` fail loudly (the
|
|
29
|
-
* GS2-62 guard), so a typo'd subagent profile surfaces as an error rather than silently reusing the
|
|
30
|
-
* parent/global model.
|
|
31
|
-
*/
|
|
32
|
-
export async function resolveSubagentProfileConfig(profile) {
|
|
33
|
-
return initConfig({ identityProfile: profile });
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Compose the child's system prompt the same way the parent does (backstory + guidelines +
|
|
37
|
-
* per-command mode prompt + system prompt via {@link buildSystemMessages}), so the subagent honours
|
|
38
|
-
* the profile's own prompt files. Returns `undefined` only when no prompt content composes.
|
|
39
|
-
*/
|
|
40
|
-
function composeChildSystemPrompt(config, command) {
|
|
41
|
-
const systemMessages = buildSystemMessages(config, readModePrompt(command, config));
|
|
42
|
-
return typeof systemMessages[0]?.content === 'string' ? systemMessages[0].content : undefined;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Turn each {@link SubagentProfileSpec} into a deepagents {@link SubAgent} whose model + tools +
|
|
46
|
-
* prompt come from the named profile's resolved config. The returned specs are handed to
|
|
47
|
-
* `createDeepAgent({ subagents })`; the model — the whole point — is the child profile's `llm`,
|
|
48
|
-
* distinct from the parent's.
|
|
49
|
-
*/
|
|
50
|
-
export async function buildProfileSubagents(specs, options) {
|
|
51
|
-
const subagents = [];
|
|
52
|
-
for (const spec of specs) {
|
|
53
|
-
debugLog(`Resolving subagent "${spec.name}" under profile "${spec.profile}"`);
|
|
54
|
-
const childConfig = await resolveSubagentProfileConfig(spec.profile);
|
|
55
|
-
// Resolve the child's tools from ITS profile config, filesystem disabled (deepagents provides
|
|
56
|
-
// fs for the subagent). An empty allowedTools allow-list disables every tool.
|
|
57
|
-
const allowedTools = childConfig.allowedTools;
|
|
58
|
-
const toolsDisabled = Array.isArray(allowedTools) && allowedTools.length === 0;
|
|
59
|
-
let tools = [];
|
|
60
|
-
if (!toolsDisabled && options.resolveTools) {
|
|
61
|
-
const resolved = await options.resolveTools({ ...childConfig, filesystem: 'none' }, options.command);
|
|
62
|
-
tools = resolved;
|
|
63
|
-
}
|
|
64
|
-
const systemPrompt = composeChildSystemPrompt(childConfig, options.command) ??
|
|
65
|
-
`You are the ${spec.name} subagent.`;
|
|
66
|
-
subagents.push({
|
|
67
|
-
name: spec.name,
|
|
68
|
-
description: spec.description ?? `Runs under the "${spec.profile}" config profile.`,
|
|
69
|
-
systemPrompt,
|
|
70
|
-
model: childConfig.llm,
|
|
71
|
-
tools,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return subagents;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=subagentProfiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subagentProfiles.js","sourceRoot":"","sources":["../../src/core/subagentProfiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAA4C,MAAM,6BAA6B,CAAC;AAEnG,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAIjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAAe;IAChE,OA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AW,EAAE,OAAO,CAAC,OAAO,CAAC;YACtD,eAAe,IAAI,CAAC,IAAI,YAAY,CAAC;QAEvC,SAAS,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,mBAAmB,IAAI,CAAC,OAAO,mBAAmB;YACnF,YAAY;YACZ,KAAK,EAAE,WAAW,CAAC,GAAG;YACtB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* ACP (Agent Client Protocol) server entry for the Gaunt Sloth deep agent.
|
|
4
|
-
*
|
|
5
|
-
* This is a parallel front-door to the AG-UI server ({@link startAgUiServer}); both expose
|
|
6
|
-
* the SAME {@link GthDeepAgent}. AG-UI stays the robot-controller path; ACP is an additional
|
|
7
|
-
* way to drive Galvanized Pukeko from an ACP host (Zed, JetBrains, a future Pukeko client).
|
|
8
|
-
*
|
|
9
|
-
* It reuses {@link GthDeepAgent.buildDeepAgentParams} so tool resolution (with the filesystem
|
|
10
|
-
* disabled so deepagents owns fs access), the `.aiignore`/filesystem→permission mapping and the
|
|
11
|
-
* fs-denial-softening middleware are identical to the local runner path. `deepagents-acp`
|
|
12
|
-
* supplies the rest of the coding-agent surface itself: a per-session `ACPFilesystemBackend`
|
|
13
|
-
* (proxying reads/writes through the ACP client so unsaved editor buffers are visible), the
|
|
14
|
-
* checkpointer, interactive `session/request_permission` gating, and tool-call/plan reporting.
|
|
15
|
-
*/
|
|
16
|
-
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
17
|
-
import type { GthCommand } from '@gaunt-sloth/core/core/types.js';
|
|
18
|
-
export interface StartAcpServerOptions {
|
|
19
|
-
/** Agent name advertised to the ACP client (used for session routing). */
|
|
20
|
-
name?: string;
|
|
21
|
-
/** Human-readable description shown to ACP clients when listing agents. */
|
|
22
|
-
description?: string;
|
|
23
|
-
/** gsloth command whose config/prompt to apply (defaults to `'code'`, the full-fs agent). */
|
|
24
|
-
command?: GthCommand;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Start the Gaunt Sloth deep agent as an ACP server over stdio.
|
|
28
|
-
*
|
|
29
|
-
* Resolves once the stdio transport is listening; the process then stays alive serving the
|
|
30
|
-
* ACP host until it is terminated. The returned promise rejecting means startup failed.
|
|
31
|
-
*
|
|
32
|
-
* NOTE: deepagents-acp 0.1.12 does NOT forward `permissions` to `createDeepAgent` — on the ACP
|
|
33
|
-
* path fs gating is delegated to the host's interactive permission prompts, not gsloth's
|
|
34
|
-
* `.aiignore`→permissions mapping. `permissions` is still passed here for forward-compatibility.
|
|
35
|
-
* EXT-13 caveat: the ACP backend keeps `virtualMode` ON (`/` = workspace, see gthAcpServer), while
|
|
36
|
-
* EXT-13 re-anchored gsloth's default permissions at the REAL absolute cwd for the local runner. So
|
|
37
|
-
* if a future deepagents-acp DOES forward these rules they would not match the virtual `/`-rooted
|
|
38
|
-
* paths the ACP backend hands them — revisit the mapping (or the ACP backend's mode) at that point.
|
|
39
|
-
*/
|
|
40
|
-
export declare function startAcpServer(config: GthConfig, options?: StartAcpServerOptions): Promise<void>;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* ACP (Agent Client Protocol) server entry for the Gaunt Sloth deep agent.
|
|
4
|
-
*
|
|
5
|
-
* This is a parallel front-door to the AG-UI server ({@link startAgUiServer}); both expose
|
|
6
|
-
* the SAME {@link GthDeepAgent}. AG-UI stays the robot-controller path; ACP is an additional
|
|
7
|
-
* way to drive Galvanized Pukeko from an ACP host (Zed, JetBrains, a future Pukeko client).
|
|
8
|
-
*
|
|
9
|
-
* It reuses {@link GthDeepAgent.buildDeepAgentParams} so tool resolution (with the filesystem
|
|
10
|
-
* disabled so deepagents owns fs access), the `.aiignore`/filesystem→permission mapping and the
|
|
11
|
-
* fs-denial-softening middleware are identical to the local runner path. `deepagents-acp`
|
|
12
|
-
* supplies the rest of the coding-agent surface itself: a per-session `ACPFilesystemBackend`
|
|
13
|
-
* (proxying reads/writes through the ACP client so unsaved editor buffers are visible), the
|
|
14
|
-
* checkpointer, interactive `session/request_permission` gating, and tool-call/plan reporting.
|
|
15
|
-
*/
|
|
16
|
-
import { getProcessCwd, stderr } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
17
|
-
import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
18
|
-
import { disableGeminiThoughtSummaries } from '@gaunt-sloth/core/providers/geminiThinking.js';
|
|
19
|
-
import { GthDeepAgent } from '#src/core/GthDeepAgent.js';
|
|
20
|
-
import { startGthAcpServer } from '#src/core/gthAcpServer.js';
|
|
21
|
-
import { createResolvers } from '#src/resolvers.js';
|
|
22
|
-
/**
|
|
23
|
-
* ACP-side status routing: the ACP protocol owns stdout (JSON-RPC framing), so agent
|
|
24
|
-
* status/info must never touch it. Route everything to stderr.
|
|
25
|
-
*/
|
|
26
|
-
const acpStatusUpdate = (_level, message) => {
|
|
27
|
-
stderr.write(`${message}\n`);
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Start the Gaunt Sloth deep agent as an ACP server over stdio.
|
|
31
|
-
*
|
|
32
|
-
* Resolves once the stdio transport is listening; the process then stays alive serving the
|
|
33
|
-
* ACP host until it is terminated. The returned promise rejecting means startup failed.
|
|
34
|
-
*
|
|
35
|
-
* NOTE: deepagents-acp 0.1.12 does NOT forward `permissions` to `createDeepAgent` — on the ACP
|
|
36
|
-
* path fs gating is delegated to the host's interactive permission prompts, not gsloth's
|
|
37
|
-
* `.aiignore`→permissions mapping. `permissions` is still passed here for forward-compatibility.
|
|
38
|
-
* EXT-13 caveat: the ACP backend keeps `virtualMode` ON (`/` = workspace, see gthAcpServer), while
|
|
39
|
-
* EXT-13 re-anchored gsloth's default permissions at the REAL absolute cwd for the local runner. So
|
|
40
|
-
* if a future deepagents-acp DOES forward these rules they would not match the virtual `/`-rooted
|
|
41
|
-
* paths the ACP backend hands them — revisit the mapping (or the ACP backend's mode) at that point.
|
|
42
|
-
*/
|
|
43
|
-
export async function startAcpServer(config, options = {}) {
|
|
44
|
-
const command = options.command ?? 'code';
|
|
45
|
-
// ACP is structurally deep-only: it calls GthDeepAgent.buildDeepAgentParams and hands the
|
|
46
|
-
// extracted params to the deepagents-acp server. There is no lean analog, so an explicit
|
|
47
|
-
// `agent.backend: 'lean'` cannot be honored here — reject it loudly rather than silently
|
|
48
|
-
// running deep despite the request (B5 selector, kept honest at the ACP entry).
|
|
49
|
-
if (config.agent?.backend === 'lean') {
|
|
50
|
-
throw new Error("agent.backend: 'lean' is not supported by the ACP server — ACP relies on the deep " +
|
|
51
|
-
'(deepagents) backend. Remove the lean setting, or use the AG-UI/api server for a lean agent.');
|
|
52
|
-
}
|
|
53
|
-
const agent = new GthDeepAgent(acpStatusUpdate, createResolvers());
|
|
54
|
-
const params = await agent.buildDeepAgentParams(command, config);
|
|
55
|
-
// gsloth's composed system prompt (backstory + guidelines + per-command mode prompt + system
|
|
56
|
-
// prompt) comes back on `params.systemPrompt` — the SAME prompt the local runner passes to
|
|
57
|
-
// createDeepAgent. ACP has no per-turn hook, so it sets the agent's `systemPrompt` here.
|
|
58
|
-
const systemPrompt = params.systemPrompt;
|
|
59
|
-
// workspaceRoot is only the startup default: startGthAcpServer re-roots the filesystem backend
|
|
60
|
-
// to each ACP session's `cwd` (the IDE's project root). Use the raw process cwd, not
|
|
61
|
-
// getCurrentWorkDir() — its INIT_CWD preference leaks stale paths into this long-lived subprocess.
|
|
62
|
-
const workspaceRoot = getProcessCwd();
|
|
63
|
-
debugLog(`Starting ACP server (command: ${command}, startup workspace: ${workspaceRoot})`);
|
|
64
|
-
// deepagents-acp renders assistant content itself: it sends a `thinking`-typed block to the ACP
|
|
65
|
-
// client's thought channel and EVERY `text`-typed block to the message channel. Gemini's thought
|
|
66
|
-
// summary is typed `text` (marked only by `thought: true`), so on this path the model's reasoning
|
|
67
|
-
// would arrive in the IDE as the assistant's answer. Nothing here goes through GthAbstractAgent,
|
|
68
|
-
// so gsloth's reasoning bridge cannot separate them — the only reliable fix is not to ask for the
|
|
69
|
-
// summary on this surface. Thinking itself stays on, and the budget is untouched.
|
|
70
|
-
const model = disableGeminiThoughtSummaries(params.model);
|
|
71
|
-
await startGthAcpServer({
|
|
72
|
-
agents: {
|
|
73
|
-
name: options.name ?? 'gaunt-sloth',
|
|
74
|
-
description: options.description ?? 'Gaunt Sloth deep coding agent',
|
|
75
|
-
model,
|
|
76
|
-
tools: params.tools,
|
|
77
|
-
systemPrompt,
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
-
middleware: params.middleware,
|
|
80
|
-
// Forward-compat: ignored by deepagents-acp 0.1.12 (the host gates fs interactively).
|
|
81
|
-
permissions: params.permissions,
|
|
82
|
-
},
|
|
83
|
-
workspaceRoot,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=acpModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acpModule.js","sourceRoot":"","sources":["../../src/modules/acpModule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWpD;;;GAGG;AACH,MAAM,eAAe,GAAyB,CAAC,MAAmB,EAAE,OAAe,EAAQ,EAAE;IAC3F,M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