@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
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The agent runtime for Gaunt Sloth: built-in tools and toolkits (filesystem, dev/shell, web
|
|
4
4
|
fetch, custom), the middleware registry, MCP client + OAuth provider, A2A client and tools, the
|
|
5
|
-
AG-UI server (`startAgUiServer`), the
|
|
5
|
+
AG-UI server (`startAgUiServer`), the interactive session
|
|
6
6
|
module, and the `createResolvers` tool/middleware resolver wiring. It builds on
|
|
7
7
|
[`@gaunt-sloth/core`](https://www.npmjs.com/package/@gaunt-sloth/core) (config, provider
|
|
8
8
|
factory, lean agent runtime).
|
|
@@ -45,19 +45,18 @@ not expose it to public networks. Port and CORS come from `commands.api.*` in th
|
|
|
45
45
|
|
|
46
46
|
- **`gaunt-sloth-api`** — starts the AG-UI server standalone (the code above as a command):
|
|
47
47
|
`gaunt-sloth-api` (defaults to the `ag-ui` server on `commands.api.port`, 3000 by default).
|
|
48
|
-
- **`gaunt-sloth-acp`** —
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
for setup and a Zed `settings.json` example.
|
|
48
|
+
- **`gaunt-sloth-acp`** — serves the [Agent Client Protocol](https://agentclientprotocol.com/) over
|
|
49
|
+
stdio, for an editor that spawns the agent as a subprocess. **ACP v2 only**; a v1-only host
|
|
50
|
+
cannot connect. Takes no arguments, and roots the session at the working directory the host
|
|
51
|
+
supplies. Gated tools are escalated to the host as `session/request_permission`. The same server
|
|
52
|
+
is reachable programmatically as `startAcpServer()`, and as `createAcpAgentApp()` when you want
|
|
53
|
+
to serve it over a transport of your own.
|
|
55
54
|
|
|
56
55
|
## Exports
|
|
57
56
|
|
|
58
|
-
- `@gaunt-sloth/agent` (the root export) is the public API: the AG-UI
|
|
57
|
+
- `@gaunt-sloth/agent` (the root export) is the public API: the AG-UI and interactive-session
|
|
59
58
|
modules, A2A client and tool, MCP utilities and OAuth provider, built-in tools config, the
|
|
60
|
-
middleware registry, the
|
|
59
|
+
middleware registry, the agent-backend seam (`resolveAgentFactory`), and `createResolvers`.
|
|
61
60
|
- `@gaunt-sloth/agent/<path>.js` deep paths mirror the internal `dist/` layout 1:1 and are
|
|
62
61
|
deliberately kept open for reach-in (the fat CLI imports e.g.
|
|
63
62
|
`@gaunt-sloth/agent/resolvers.js`). They are supported at your own risk: internal files can
|
package/cli-acp.js
CHANGED
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* ACP (Agent Client Protocol) server entry
|
|
4
|
+
* ACP (Agent Client Protocol) server entry.
|
|
5
5
|
* Usage: gaunt-sloth-acp
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Serves ACP v2 over stdio, for an editor that spawns the agent as a subprocess (Zed, and any
|
|
8
|
+
* other v2 client). The whole startup — including redirecting ordinary console output away from
|
|
9
|
+
* stdout, which the protocol owns — lives in `startAcpServer`, shared with
|
|
10
|
+
* `gaunt-sloth --acp-agent` so the two doors cannot drift.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* writes the protocol via process.stdout.write directly and is unaffected; console.warn/error
|
|
14
|
-
* already go to stderr.
|
|
12
|
+
* A failure before the transport is up is written to stderr, never stdout: to a host, stdout is
|
|
13
|
+
* the JSON-RPC framing channel, so prose there is a protocol error rather than a message anyone
|
|
14
|
+
* reads.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
17
|
+
import { setEntryPoint } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
18
|
+
import { startAcpServer } from '#src/modules/acp/acpStdio.js';
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import
|
|
20
|
+
// The install dir is what `getSlothVersion()` reads, and the initialize handshake reports the
|
|
21
|
+
// version. Set from THIS file so it resolves the agent package's own manifest.
|
|
22
|
+
setEntryPoint(import.meta.url);
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
24
|
+
try {
|
|
25
|
+
await startAcpServer();
|
|
26
|
+
} catch (err) {
|
|
27
|
+
process.stderr.write(
|
|
28
|
+
`Gaunt Sloth ACP agent failed to start: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\n`
|
|
29
|
+
);
|
|
30
|
+
process.exit(1);
|
|
33
31
|
}
|
|
34
|
-
|
|
35
|
-
main();
|
|
@@ -27,8 +27,8 @@ export declare const AVAILABLE_BUILT_IN_TOOLS: {
|
|
|
27
27
|
/**
|
|
28
28
|
* Content-search (grep) tool: ripgrep-backed regex search over file CONTENTS, with an
|
|
29
29
|
* in-process JS fallback when `rg` is absent. Permission-light (no shell approval) and
|
|
30
|
-
* available in every mode. Named `gth_grep`
|
|
31
|
-
* built-in
|
|
30
|
+
* available in every mode. Named `gth_grep` rather than `grep` so it cannot collide with a
|
|
31
|
+
* built-in a graph builder registers under that name. Enabled by default (see {@link DEFAULT_CONFIG.builtInTools}, GS2-51); disable
|
|
32
32
|
* with `{ "builtInTools": { "gth_grep": { "enabled": false } } }`. Its searched corpus is
|
|
33
33
|
* selectable via the `fileSet` tool-config key (`gitignore` default / `all`).
|
|
34
34
|
*/
|
|
@@ -34,8 +34,8 @@ export const AVAILABLE_BUILT_IN_TOOLS = {
|
|
|
34
34
|
/**
|
|
35
35
|
* Content-search (grep) tool: ripgrep-backed regex search over file CONTENTS, with an
|
|
36
36
|
* in-process JS fallback when `rg` is absent. Permission-light (no shell approval) and
|
|
37
|
-
* available in every mode. Named `gth_grep`
|
|
38
|
-
* built-in
|
|
37
|
+
* available in every mode. Named `gth_grep` rather than `grep` so it cannot collide with a
|
|
38
|
+
* built-in a graph builder registers under that name. Enabled by default (see {@link DEFAULT_CONFIG.builtInTools}, GS2-51); disable
|
|
39
39
|
* with `{ "builtInTools": { "gth_grep": { "enabled": false } } }`. Its searched corpus is
|
|
40
40
|
* selectable via the `fileSet` tool-config key (`gitignore` default / `all`).
|
|
41
41
|
*/
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
|
-
* The debug-capture contract
|
|
4
|
-
* ({@link import('@gaunt-sloth/core/core/GthLangChainAgent.js').GthLangChainAgent})
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
* `@gaunt-sloth/agent/core/debugCapture.js` importers (the TUI debug panel) are unaffected.
|
|
3
|
+
* The debug-capture contract lives in `@gaunt-sloth/core`, beside the agent
|
|
4
|
+
* ({@link import('@gaunt-sloth/core/core/GthLangChainAgent.js').GthLangChainAgent}) that installs
|
|
5
|
+
* the `wrapModelCall` capture middleware. This module re-exports it so
|
|
6
|
+
* `@gaunt-sloth/agent/core/debugCapture.js` importers (the TUI debug panel) resolve it here too.
|
|
8
7
|
*/
|
|
9
8
|
export type { DebugRequestExtras, DebugToolDef, DebugCapture, LastModelRequest, } from '@gaunt-sloth/core/core/debugCapture.js';
|
|
10
9
|
export { extractDebugRequestExtras } from '@gaunt-sloth/core/core/debugCapture.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugCapture.js","sourceRoot":"","sources":["../../src/core/debugCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debugCapture.js","sourceRoot":"","sources":["../../src/core/debugCapture.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { GthAgentFactory } from '@gaunt-sloth/core/core/types.js';
|
|
2
2
|
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
3
3
|
/**
|
|
4
|
-
* Resolve the agent backend factory from config (B5).
|
|
5
|
-
* otherwise `defaultBackend` is used — the per-command default. Every command now defaults to
|
|
6
|
-
* `'lean'`; `'deep'` is the experimental, opt-in backend (selecting it emits a warning).
|
|
4
|
+
* Resolve the agent backend factory from config (B5).
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* it
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* There is one backend — the lean {@link gthLeanAgentFactory} — so every call resolves to it, and
|
|
7
|
+
* `agent.backend` can only name it. The seam is kept rather than inlined at the ten call sites
|
|
8
|
+
* because it is the single place a backend choice is made: reinstating a choice (EXT-46's ACP
|
|
9
|
+
* rebuild, or any later runtime) is an edit here, not an edit spread across every command.
|
|
10
|
+
*
|
|
11
|
+
* The parameters are accepted and ignored for the same reason. `defaultBackend` is each caller's
|
|
12
|
+
* per-command default, and every caller passes `'lean'`; typing it as the literal keeps a caller
|
|
13
|
+
* that means something else from compiling silently.
|
|
13
14
|
*/
|
|
14
|
-
export declare function resolveAgentFactory(
|
|
15
|
+
export declare function resolveAgentFactory(_config: GthConfig, _defaultBackend?: 'lean'): GthAgentFactory;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { gthLeanAgentFactory } from '@gaunt-sloth/core/core/gthLeanAgentFactory.js';
|
|
2
|
-
import { gthDeepAgentFactory } from '#src/core/gthDeepAgentFactory.js';
|
|
3
2
|
/**
|
|
4
|
-
* Resolve the agent backend factory from config (B5).
|
|
5
|
-
* otherwise `defaultBackend` is used — the per-command default. Every command now defaults to
|
|
6
|
-
* `'lean'`; `'deep'` is the experimental, opt-in backend (selecting it emits a warning).
|
|
3
|
+
* Resolve the agent backend factory from config (B5).
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* it
|
|
11
|
-
*
|
|
12
|
-
*
|
|
5
|
+
* There is one backend — the lean {@link gthLeanAgentFactory} — so every call resolves to it, and
|
|
6
|
+
* `agent.backend` can only name it. The seam is kept rather than inlined at the ten call sites
|
|
7
|
+
* because it is the single place a backend choice is made: reinstating a choice (EXT-46's ACP
|
|
8
|
+
* rebuild, or any later runtime) is an edit here, not an edit spread across every command.
|
|
9
|
+
*
|
|
10
|
+
* The parameters are accepted and ignored for the same reason. `defaultBackend` is each caller's
|
|
11
|
+
* per-command default, and every caller passes `'lean'`; typing it as the literal keeps a caller
|
|
12
|
+
* that means something else from compiling silently.
|
|
13
13
|
*/
|
|
14
|
-
export function resolveAgentFactory(
|
|
15
|
-
|
|
16
|
-
return backend === 'deep' ? gthDeepAgentFactory : gthLeanAgentFactory;
|
|
14
|
+
export function resolveAgentFactory(_config, _defaultBackend = 'lean') {
|
|
15
|
+
return gthLeanAgentFactory;
|
|
17
16
|
}
|
|
18
17
|
//# sourceMappingURL=resolveAgentFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAgentFactory.js","sourceRoot":"","sources":["../../src/core/resolveAgentFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveAgentFactory.js","sourceRoot":"","sources":["../../src/core/resolveAgentFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAkB,EAClB,eAAe,GAAW,MAAM;IAEhC,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from '#src/modules/apiAgUiModule.js';
|
|
2
|
-
export * from '#src/modules/acpModule.js';
|
|
3
2
|
export * from '#src/modules/interactiveSessionModule.js';
|
|
4
3
|
export * from '#src/modules/a2a/A2AClientWrapper.js';
|
|
5
4
|
export * from '#src/tools/A2AAgentTool.js';
|
|
@@ -8,7 +7,6 @@ export * from '#src/utils/mcpUtils.js';
|
|
|
8
7
|
export { createResolvers } from '#src/resolvers.js';
|
|
9
8
|
export * from '#src/builtInToolsConfig.js';
|
|
10
9
|
export { resolveMiddleware } from '#src/middleware/registry.js';
|
|
11
|
-
export { GthDeepAgent, type GthDeepAgentParams } from '#src/core/GthDeepAgent.js';
|
|
12
|
-
export * from '#src/core/deepAgentPermissions.js';
|
|
13
|
-
export { gthDeepAgentFactory } from '#src/core/gthDeepAgentFactory.js';
|
|
14
10
|
export { resolveAgentFactory } from '#src/core/resolveAgentFactory.js';
|
|
11
|
+
export { startAcpServer } from '#src/modules/acp/acpStdio.js';
|
|
12
|
+
export { createAcpAgentApp } from '#src/modules/acp/acpAgentApp.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from '#src/modules/apiAgUiModule.js';
|
|
2
|
-
export * from '#src/modules/acpModule.js';
|
|
3
2
|
export * from '#src/modules/interactiveSessionModule.js';
|
|
4
3
|
export * from '#src/modules/a2a/A2AClientWrapper.js';
|
|
5
4
|
export * from '#src/tools/A2AAgentTool.js';
|
|
@@ -9,9 +8,9 @@ export { createResolvers } from '#src/resolvers.js';
|
|
|
9
8
|
// Tools + middleware (formerly @gaunt-sloth/tools)
|
|
10
9
|
export * from '#src/builtInToolsConfig.js';
|
|
11
10
|
export { resolveMiddleware } from '#src/middleware/registry.js';
|
|
12
|
-
//
|
|
13
|
-
export { GthDeepAgent } from '#src/core/GthDeepAgent.js';
|
|
14
|
-
export * from '#src/core/deepAgentPermissions.js';
|
|
15
|
-
export { gthDeepAgentFactory } from '#src/core/gthDeepAgentFactory.js';
|
|
11
|
+
// The agent-backend seam every command resolves its factory through.
|
|
16
12
|
export { resolveAgentFactory } from '#src/core/resolveAgentFactory.js';
|
|
13
|
+
// The ACP (Agent Client Protocol) v2 agent, and the stdio starter both ACP bins run.
|
|
14
|
+
export { startAcpServer } from '#src/modules/acp/acpStdio.js';
|
|
15
|
+
export { createAcpAgentApp } from '#src/modules/acp/acpAgentApp.js';
|
|
17
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,mDAAmD;AACnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,qEAAqE;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -38,8 +38,9 @@ export interface FrontendImageInjectionOptions {
|
|
|
38
38
|
* - **ollama** → `{ type:'image_url', image_url:'<data-URL string>' }`. ChatOllama's
|
|
39
39
|
* `convertToOllamaMessages` only handles `image_url` blocks (extractBase64FromDataUrl); the
|
|
40
40
|
* LangChain standard `source_type` block throws "Unsupported content type: image".
|
|
41
|
-
* - **OpenAI-compatible** (`openai`, `openrouter`, `deepseek`, `xai`, `groq` —
|
|
42
|
-
*
|
|
41
|
+
* - **OpenAI-compatible** (`openai`, `openrouter`, `deepseek`, `xai`, `groq` — served by an
|
|
42
|
+
* OpenAI-compatible Chat Completions API, whichever LangChain class fronts it) →
|
|
43
|
+
* `{ type:'image_url', image_url:{ url:'<data-URL>' } }`.
|
|
43
44
|
* This native OpenAI shape is correct on BOTH the Completions API AND the Responses API (GS2-74
|
|
44
45
|
* flips reasoning-capable openai models to Responses). A raw `source_type` standard block
|
|
45
46
|
* serialises to an *invalid* image part on the Responses path, so we emit the provider-native
|
|
@@ -24,8 +24,9 @@ export const DEFAULT_CAPTURE_TOOL_NAME = 'capture_image';
|
|
|
24
24
|
* - **ollama** → `{ type:'image_url', image_url:'<data-URL string>' }`. ChatOllama's
|
|
25
25
|
* `convertToOllamaMessages` only handles `image_url` blocks (extractBase64FromDataUrl); the
|
|
26
26
|
* LangChain standard `source_type` block throws "Unsupported content type: image".
|
|
27
|
-
* - **OpenAI-compatible** (`openai`, `openrouter`, `deepseek`, `xai`, `groq` —
|
|
28
|
-
*
|
|
27
|
+
* - **OpenAI-compatible** (`openai`, `openrouter`, `deepseek`, `xai`, `groq` — served by an
|
|
28
|
+
* OpenAI-compatible Chat Completions API, whichever LangChain class fronts it) →
|
|
29
|
+
* `{ type:'image_url', image_url:{ url:'<data-URL>' } }`.
|
|
29
30
|
* This native OpenAI shape is correct on BOTH the Completions API AND the Responses API (GS2-74
|
|
30
31
|
* flips reasoning-capable openai models to Responses). A raw `source_type` standard block
|
|
31
32
|
* serialises to an *invalid* image part on the Responses path, so we emit the provider-native
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontendImageInjectionMiddleware.js","sourceRoot":"","sources":["../../src/middleware/frontendImageInjectionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAavE,6FAA6F;AAC7F,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAkBzD
|
|
1
|
+
{"version":3,"file":"frontendImageInjectionMiddleware.js","sourceRoot":"","sources":["../../src/middleware/frontendImageInjectionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAavE,6FAA6F;AAC7F,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAkBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,QAAgB,EAAE,IAAY;IAC5E,MAAM,OAAO,GAAG,QAAQ,QAAQ,WAAW,IAAI,EAAE,CAAC;IAClD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,WAAoB,EAAE,S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,CAAC;gBACvC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;oBAClB,oEAAoE;oBACpE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;oBACpB,WAAW,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,uBAAuB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;oBACxF,SAAS;gBACX,CAAC;gBACD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;oBACrC,0FAA0F;oBAC1F,uFAAuF;oBACvF,mFAAmF;oBACnF,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;oBACpB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;oBAC3E,WAAW,CAAC,IAAI,CACd,IAAI,YAAY,CAAC;wBACf,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,EAAE,EAAE,KAAK,CAAmB;qBACrF,CAAC,CACH,CAAC;gBACJ,CAAC;gBACD,yFAAyF;YAC3F,CAAC;YAED,6FAA6F;YAC7F,2FAA2F;YAC3F,OAAO,WAAW,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACtF,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,9 +14,22 @@ import { createFrontendImageInjectionMiddleware } from '#src/middleware/frontend
|
|
|
14
14
|
* Derive the provider string the vision middleware maps to a per-provider block shape. Prefers the
|
|
15
15
|
* loader-stashed raw `llm.type` ({@link GthConfig.modelProviderType}) — the exact gth provider
|
|
16
16
|
* namespace (`anthropic`/`openrouter`/`deepseek`/`xai`/`groq`/`ollama`/`google-genai`/`vertexai`/…)
|
|
17
|
-
* — and falls back to the live model's `_llmType()` only when it is absent (module configs).
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* — and falls back to the live model's `_llmType()` only when it is absent (module configs).
|
|
18
|
+
* `_llmType()` is the model class's own label rather than the gth provider namespace, so the two
|
|
19
|
+
* only mostly agree. Where they do: `openrouter`/`deepseek`/`xai`/`groq`/`ollama`/`anthropic` each
|
|
20
|
+
* report their own name, which `imageBlockFor` matches directly, and both Gemini providers report
|
|
21
|
+
* `google`, which lands on the default branch — the same standard block its `google-genai`/
|
|
22
|
+
* `vertexai` cases return.
|
|
23
|
+
*
|
|
24
|
+
* Two labels do NOT agree, and this fallback is the only path either can arrive on:
|
|
25
|
+
* - `huggingface` reports `openai`, so the fallback emits `image_url:{url}` where the configured
|
|
26
|
+
* `type` would take the default standard block. Which of the two the HF router actually accepts
|
|
27
|
+
* is unmeasured — see [[CFG-45]]. Do not add a branch by analogy.
|
|
28
|
+
* - `ChatXAIResponses` reports `xai-responses`, which matches no case and so takes the default
|
|
29
|
+
* standard block — while `imageBlockFor`'s own docstring records that a standard block
|
|
30
|
+
* serialises to an INVALID image part on the Responses path. gth itself only ever constructs
|
|
31
|
+
* `ChatXAI`, so this is reachable only from a module config that builds the Responses class
|
|
32
|
+
* itself.
|
|
20
33
|
*/
|
|
21
34
|
function resolveVisionProvider(gthConfig) {
|
|
22
35
|
if (gthConfig.modelProviderType)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/middleware/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EACL,gCAAgC,EAChC,uBAAuB,GAExB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,sCAAsC,GAEvC,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,sCA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SAAS,CAAC,CAAC,CAAC;YAC/E,CAAC;YACD,mDAAmD;iBAC9C,CAAC;gBACJ,QAAQ,CAAC,0BAA0B,CAAC,CAAC;gBACrC,UAAU,CAAC,IAAI,CAAC,MAAyB,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,cAAc,CACZ,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACzF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,0BAA0B,CACvC,IAAY,EACZ,QAAiC,EACjC,SAAoB;IAEpB,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,OAAO,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Gaunt Sloth's ACP (Agent Client Protocol) **v2** agent, built on the official SDK's
|
|
4
|
+
* `experimental/v2` surface.
|
|
5
|
+
*
|
|
6
|
+
* ## v2 only, on purpose
|
|
7
|
+
*
|
|
8
|
+
* The SDK still ships v1 as its stable entry point and the migration guide advises serving both.
|
|
9
|
+
* This agent serves **v2 alone**. Zed — the editor this surface exists for — speaks v2, and the
|
|
10
|
+
* suite here drives a client we write ourselves, so nothing about proving this code works depends
|
|
11
|
+
* on a third party. A v1-only client failing to connect is a known consequence, not a defect: the
|
|
12
|
+
* cost of the compatibility layer is a second protocol to keep correct forever, and it would be
|
|
13
|
+
* carried on speculation about clients nobody here has.
|
|
14
|
+
*
|
|
15
|
+
* ## Shape
|
|
16
|
+
*
|
|
17
|
+
* v2's agent side is a fluent app builder: `acp.agent()` returns an {@link AgentApp} on which
|
|
18
|
+
* typed handlers are registered by ACP method name, and `connect()` serves a client — either over
|
|
19
|
+
* a transport stream or, for tests, directly against a `ClientApp`. Nothing about it resembles the
|
|
20
|
+
* v1 code this replaces, which subclassed a third party's server and monkey-patched an instance
|
|
21
|
+
* method before start; that is why this targets v2 directly rather than porting the old shape.
|
|
22
|
+
*
|
|
23
|
+
* ## The prompt lifecycle is the part that looks wrong until you read the spec
|
|
24
|
+
*
|
|
25
|
+
* `session/prompt` returns `{}` **as soon as the prompt is accepted** — not when the turn finishes.
|
|
26
|
+
* Progress, tool calls and the final stop reason all arrive as `session/update` notifications, and
|
|
27
|
+
* the turn is over when an idle `state_update` carrying a stop reason lands. That is what makes
|
|
28
|
+
* cancellation expressible at all: a cancelled turn reports `cancelled` on a `state_update`, while
|
|
29
|
+
* the prompt request it belongs to was answered long before. A client that waited on the prompt
|
|
30
|
+
* response for the result would hang through every tool call.
|
|
31
|
+
*
|
|
32
|
+
* ## Why a runner and not an agent
|
|
33
|
+
*
|
|
34
|
+
* Each session drives a {@link GthAgentRunner}, not a bare agent. The runner is where the
|
|
35
|
+
* tool-approval gate lives, so this is also the surface where `session/request_permission` is
|
|
36
|
+
* wired — see `acpPermissions.ts` for why that is not optional.
|
|
37
|
+
*
|
|
38
|
+
* ## One workspace per process
|
|
39
|
+
*
|
|
40
|
+
* Config discovery, the filesystem tools' allowed root, grep and the shell tool ALL resolve
|
|
41
|
+
* through `getCurrentWorkDir()`, a process-global. So the workspace is bound by the first
|
|
42
|
+
* `session/new` and a later `session/new` naming a different `cwd` is refused rather than served
|
|
43
|
+
* from the wrong root. An editor spawns one agent process per project, which is exactly the shape
|
|
44
|
+
* this serves; the alternative — letting the second session silently re-root the first session's
|
|
45
|
+
* tools — is the kind of quiet wrongness that is worse than an error a host can report.
|
|
46
|
+
*/
|
|
47
|
+
import * as acp from '@agentclientprotocol/sdk/experimental/v2';
|
|
48
|
+
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
49
|
+
import type { AgentResolvers } from '@gaunt-sloth/core/core/types.js';
|
|
50
|
+
import type { GthAgentFactory } from '@gaunt-sloth/core/core/types.js';
|
|
51
|
+
/** How this agent identifies itself in the `initialize` response. */
|
|
52
|
+
export declare const ACP_AGENT_NAME = "gaunt-sloth";
|
|
53
|
+
/** Human-facing name for the same, used where a client shows a title rather than an id. */
|
|
54
|
+
export declare const ACP_AGENT_TITLE = "Gaunt Sloth";
|
|
55
|
+
/**
|
|
56
|
+
* Whether two already-resolved absolute paths name the same workspace.
|
|
57
|
+
*
|
|
58
|
+
* **Case-insensitive on win32 and nowhere else**, because that is where the answer differs: NTFS is
|
|
59
|
+
* case-insensitive and case-preserving, so `C:\Foo` and `c:\foo` are one directory and an exact
|
|
60
|
+
* string compare calls them two — a client that re-sends its own `cwd` with different casing would
|
|
61
|
+
* be told to start a second agent process for the project it is already in. On POSIX the two really
|
|
62
|
+
* are different directories and must keep comparing unequal, so the platform is the whole
|
|
63
|
+
* distinction rather than a workaround for one.
|
|
64
|
+
*
|
|
65
|
+
* `platform` is a parameter with the live value as its default so both arms are testable on any
|
|
66
|
+
* host. Every other bug of this shape in this repo (OPS-27, EXT-38, GS2-42, EXT-16) was a POSIX-only
|
|
67
|
+
* assertion that passed everywhere except the Windows cell, and a test that can only run on win32
|
|
68
|
+
* would have the same blind spot pointed the other way.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isSameWorkspace(a: string, b: string, platform?: NodeJS.Platform): boolean;
|
|
71
|
+
/** Seams the tests replace; production leaves every one of them at its default. */
|
|
72
|
+
export interface AcpAgentAppOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Loads the effective gth config for a session rooted at `cwd`. Defaults to pointing config
|
|
75
|
+
* discovery at the session workspace and running the normal loader.
|
|
76
|
+
*/
|
|
77
|
+
loadConfig?: (cwd: string) => Promise<GthConfig>;
|
|
78
|
+
/**
|
|
79
|
+
* The agent backend for a session. Defaults to {@link resolveAgentFactory}, i.e. the lean agent
|
|
80
|
+
* — the same backend every other command resolves, reached through the same seam rather than
|
|
81
|
+
* named here, so a future backend choice stays a single edit.
|
|
82
|
+
*/
|
|
83
|
+
agentFactory?: (config: GthConfig) => GthAgentFactory;
|
|
84
|
+
/** Tool/content resolvers handed to the runner. Defaults to {@link createResolvers}. */
|
|
85
|
+
resolvers?: AgentResolvers;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Builds the ACP v2 agent app. Register-and-return only: nothing is connected and no config is
|
|
89
|
+
* read until a client connects and creates a session.
|
|
90
|
+
*/
|
|
91
|
+
export declare function createAcpAgentApp(options?: AcpAgentAppOptions): acp.AgentApp;
|
|
92
|
+
/** Kept for the entry points, which announce themselves on stderr before serving. */
|
|
93
|
+
export declare function announceAcpStart(): void;
|