@gaunt-sloth/agent 2.0.0-alpha.23 → 2.0.0-alpha.24

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 (53) hide show
  1. package/README.md +73 -24
  2. package/dist/core/GthDeepAgent.js +49 -2
  3. package/dist/core/GthDeepAgent.js.map +1 -1
  4. package/dist/core/debugCapture.d.ts +1 -1
  5. package/dist/core/debugCapture.js.map +1 -1
  6. package/dist/core/subagentProfiles.d.ts +50 -0
  7. package/dist/core/subagentProfiles.js +81 -0
  8. package/dist/core/subagentProfiles.js.map +1 -0
  9. package/dist/middleware/binaryContentInjectionMiddleware.d.ts +8 -1
  10. package/dist/middleware/binaryContentInjectionMiddleware.js +11 -2
  11. package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -1
  12. package/dist/middleware/frontendImageInjectionMiddleware.d.ts +80 -0
  13. package/dist/middleware/frontendImageInjectionMiddleware.js +146 -0
  14. package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -0
  15. package/dist/middleware/registry.js +36 -1
  16. package/dist/middleware/registry.js.map +1 -1
  17. package/dist/middleware/types.d.ts +16 -2
  18. package/dist/modules/a2a/A2AClientWrapper.d.ts +1 -1
  19. package/dist/modules/a2a/A2AClientWrapper.js +19 -5
  20. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
  21. package/dist/modules/apiAgUiModule.d.ts +68 -0
  22. package/dist/modules/apiAgUiModule.js +95 -4
  23. package/dist/modules/apiAgUiModule.js.map +1 -1
  24. package/dist/modules/interactiveSessionModule.js +110 -34
  25. package/dist/modules/interactiveSessionModule.js.map +1 -1
  26. package/dist/modules/slashCommands.d.ts +328 -0
  27. package/dist/modules/slashCommands.js +598 -0
  28. package/dist/modules/slashCommands.js.map +1 -0
  29. package/dist/resolvers.js +15 -0
  30. package/dist/resolvers.js.map +1 -1
  31. package/dist/tools/GthCustomToolkit.js +72 -3
  32. package/dist/tools/GthCustomToolkit.js.map +1 -1
  33. package/dist/tools/GthDevToolkit.d.ts +5 -2
  34. package/dist/tools/GthDevToolkit.js +28 -7
  35. package/dist/tools/GthDevToolkit.js.map +1 -1
  36. package/dist/tools/GthFileSystemToolkit.d.ts +16 -0
  37. package/dist/tools/GthFileSystemToolkit.js +218 -110
  38. package/dist/tools/GthFileSystemToolkit.js.map +1 -1
  39. package/dist/tools/McpResourceTool.d.ts +31 -0
  40. package/dist/tools/McpResourceTool.js +106 -0
  41. package/dist/tools/McpResourceTool.js.map +1 -0
  42. package/dist/tools/shell/hardline.js +3 -3
  43. package/dist/tools/shell/hardline.js.map +1 -1
  44. package/package.json +2 -2
  45. package/dist/tools/shell/allowlist.d.ts +0 -11
  46. package/dist/tools/shell/allowlist.js +0 -12
  47. package/dist/tools/shell/allowlist.js.map +0 -1
  48. package/dist/tools/shell/arity.d.ts +0 -11
  49. package/dist/tools/shell/arity.js +0 -12
  50. package/dist/tools/shell/arity.js.map +0 -1
  51. package/dist/tools/shell/normalize.d.ts +0 -10
  52. package/dist/tools/shell/normalize.js +0 -11
  53. package/dist/tools/shell/normalize.js.map +0 -1
package/README.md CHANGED
@@ -1,26 +1,75 @@
1
1
  # @gaunt-sloth/agent
2
2
 
3
- The deep-agent runtime for Gaunt Sloth. Consolidates what were previously
4
- `@gaunt-sloth/tools` and `@gaunt-sloth/api`:
5
-
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 ACP (Agent Client Protocol) server (`startAcpServer`), exposed as the
12
- `gaunt-sloth-acp` binary
13
- - The `createResolvers` tool/middleware resolver wiring
14
-
15
- It builds on `@gaunt-sloth/core` (config, provider factory, lean langchain runtime).
16
-
17
- > **Running the ACP server:** prefer `gaunt-sloth --acp-agent` from the
18
- > [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) app, not the standalone
19
- > `gaunt-sloth-acp` binary. The LLM providers are `peerDependencies` of `@gaunt-sloth/core` that
20
- > only the app declares, so a bare `@gaunt-sloth/agent` install has no providers to construct a
21
- > model from. See the
22
- > [app README ACP server](https://github.com/pukeko-robotics/gaunt-sloth/blob/main/packages/app/README.md#acp-server-editor-integration)
23
- > for setup and a Zed `settings.json` example.
24
-
25
- > `@gaunt-sloth/tools` and `@gaunt-sloth/api` are deprecated and now re-export
26
- > from this package.
3
+ The agent runtime for Gaunt Sloth: built-in tools and toolkits (filesystem, dev/shell, web
4
+ fetch, custom), the middleware registry, MCP client + OAuth provider, A2A client and tools, the
5
+ AG-UI server (`startAgUiServer`), the ACP server (`startAcpServer`), the interactive session
6
+ module, and the `createResolvers` tool/middleware resolver wiring. It builds on
7
+ [`@gaunt-sloth/core`](https://www.npmjs.com/package/@gaunt-sloth/core) (config, provider
8
+ factory, lean agent runtime).
9
+
10
+ **When to depend on this package** you are embedding the running agent: serving it to a web
11
+ client over AG-UI, wiring its tools/middleware into your own host, or talking to MCP/A2A
12
+ services. The fat [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) CLI wires this same
13
+ runtime into `gth chat` / `gth code` / `gth api`; install that instead if you want the terminal
14
+ experience rather than a library.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @gaunt-sloth/agent @langchain/anthropic
20
+ ```
21
+
22
+ AI providers are optional peer dependencies of `@gaunt-sloth/core` — install the one(s) your
23
+ config uses (see the core README's provider list).
24
+
25
+ ## Embedding: serve the agent over AG-UI
26
+
27
+ I want a local web client to talk to the configured Gaunt Sloth agent over the
28
+ [AG-UI protocol](https://github.com/ag-ui-protocol/ag-ui). With a `.gsloth.config.*` in the
29
+ working directory:
30
+
31
+ ```js
32
+ import { initConfig } from '@gaunt-sloth/core';
33
+ import { startAgUiServer } from '@gaunt-sloth/agent';
34
+
35
+ const config = await initConfig({});
36
+ await startAgUiServer(config, config.commands?.api?.port ?? 3000);
37
+ // POST /agents/:agentId/run now streams typed AG-UI SSE events
38
+ ```
39
+
40
+ The server is intended for **local clients only** (a local web UI talking to a local agent); do
41
+ not expose it to public networks. Port and CORS come from `commands.api.*` in the config — see
42
+ [docs/CONFIGURATION.md](https://github.com/pukeko-robotics/gaunt-sloth/blob/main/docs/CONFIGURATION.md).
43
+
44
+ ## Binaries
45
+
46
+ - **`gaunt-sloth-api`** — starts the AG-UI server standalone (the code above as a command):
47
+ `gaunt-sloth-api` (defaults to the `ag-ui` server on `commands.api.port`, 3000 by default).
48
+ - **`gaunt-sloth-acp`** — runs the [Agent Client Protocol](https://agentclientprotocol.com/)
49
+ server over stdio, for ACP hosts (Zed, JetBrains). Prefer `gaunt-sloth --acp-agent` from the
50
+ [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) app instead: the LLM providers are
51
+ `peerDependencies` of `@gaunt-sloth/core` that only the app declares, so a bare
52
+ `@gaunt-sloth/agent` install has no providers to construct a model from. See the
53
+ [app README → ACP server](https://github.com/pukeko-robotics/gaunt-sloth/blob/main/packages/app/README.md#acp-server-editor-integration)
54
+ for setup and a Zed `settings.json` example.
55
+
56
+ ## Exports
57
+
58
+ - `@gaunt-sloth/agent` (the root export) is the public API: the AG-UI/ACP/interactive-session
59
+ modules, A2A client and tool, MCP utilities and OAuth provider, built-in tools config, the
60
+ middleware registry, the deep-agent factory, and `createResolvers`.
61
+ - `@gaunt-sloth/agent/<path>.js` deep paths mirror the internal `dist/` layout 1:1 and are
62
+ deliberately kept open for reach-in (the fat CLI imports e.g.
63
+ `@gaunt-sloth/agent/resolvers.js`). They are supported at your own risk: internal files can
64
+ move between alpha/minor versions without a deprecation cycle. Prefer the root export where it
65
+ suffices.
66
+
67
+ > `@gaunt-sloth/tools` and `@gaunt-sloth/api` are deprecated and now re-export from this
68
+ > package.
69
+
70
+ ## Related packages
71
+
72
+ - [`@gaunt-sloth/core`](https://www.npmjs.com/package/@gaunt-sloth/core) — Core utilities, config, and agent infrastructure ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/core))
73
+ - [`@gaunt-sloth/review`](https://www.npmjs.com/package/@gaunt-sloth/review) — Review engine with content/requirement sources (GitHub, Jira, file, text) and standalone CLI ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/review))
74
+ - [`@gaunt-sloth/batch`](https://www.npmjs.com/package/@gaunt-sloth/batch) — Batch / eval / workflow runtime ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/batch))
75
+ - [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) — Main CLI application ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/app))
@@ -3,7 +3,9 @@ import { GthAbstractAgent } from '@gaunt-sloth/core/core/GthAbstractAgent.js';
3
3
  import { StatusLevel } from '@gaunt-sloth/core/core/types.js';
4
4
  import { debugLog, debugLogObject } from '@gaunt-sloth/core/utils/debugUtils.js';
5
5
  import { buildSystemMessages, formatToolCalls, readChatPrompt, readCodePrompt, readExecPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
6
- import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
6
+ import { getCurrentWorkDir, getProjectDir, getUseColour, setProjectDir, setUseColour, } from '@gaunt-sloth/core/utils/systemUtils.js';
7
+ import { getConsoleLevel, setConsoleLevel } from '@gaunt-sloth/core/utils/consoleUtils.js';
8
+ import { buildProfileSubagents } from '#src/core/subagentProfiles.js';
7
9
  import { isToolAllowed } from '@gaunt-sloth/core/utils/toolMatching.js';
8
10
  // GS2-27: the OS/shell-dialect and real-cwd notes are backend-agnostic (both backends expose
9
11
  // run_shell_command and run on the real-fs cwd), so their canonical source moved to core so the
@@ -90,11 +92,24 @@ export class GthDeepAgent extends GthAbstractAgent {
90
92
  name: 'GthMiddlewareDebugCapture',
91
93
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
94
  wrapModelCall: async (request, handler) => {
95
+ // GS2-56: stash the always-on last-model-request snapshot (extras + as-sent messages)
96
+ // UNCONDITIONALLY — before the `capture` short-circuit — so `/debug-dump` has the full
97
+ // model input even when no TUI `/debug` sink is attached (a non-TUI surface, or `/debug`
98
+ // never opened). Guarded: snapshotting must never break the run. The computed extras are
99
+ // reused for the sink below so extraction runs once. Symmetric with the lean backend.
100
+ let extras;
101
+ try {
102
+ extras = extractDebugRequestExtras(request);
103
+ this.setLastModelRequest(request.messages, extras);
104
+ }
105
+ catch {
106
+ /* the always-on snapshot must never break the run */
107
+ }
93
108
  const capture = getDebugCapture();
94
109
  if (!capture)
95
110
  return handler(request);
96
111
  try {
97
- capture.onRequest?.(request.messages, extractDebugRequestExtras(request));
112
+ capture.onRequest?.(request.messages, extras);
98
113
  }
99
114
  catch {
100
115
  /* a debug sink must never break the run */
@@ -209,9 +224,41 @@ export class GthDeepAgent extends GthAbstractAgent {
209
224
  ? []
210
225
  : (this.resolvers?.getMcpServerInstructions?.() ?? []);
211
226
  const systemPrompt = appendMcpServerInstructionsNote(modelContextPrompt, mcpInstructions);
227
+ // GS2-33 — resolve profile-backed subagents (config `subagents`). Runner-only, like the
228
+ // cwd/model-context notes above: it lives in init() (NOT the transport-agnostic
229
+ // buildDeepAgentParams), so the deepagents-acp path is unaffected and the child-config
230
+ // resolution's process-global side effects stay on the local-runner path. Each declared
231
+ // subagent's CHILD resolves its named profile through the GS2-1 cascade, so the deepagents `task`
232
+ // tool can dispatch it under that profile's own model + tools + prompt (e.g. a cheap flash-lite
233
+ // profile for recall/search while the parent runs on a strong model). Because resolving a child
234
+ // goes through initConfig — which mutates projectDir/consoleLevel/useColour exactly as the parent
235
+ // run's own initConfig did — snapshot and restore those globals so a child profile's console
236
+ // level / colour can never leak into the parent run.
237
+ let subagents;
238
+ const subagentSpecs = this.config?.subagents;
239
+ if (Array.isArray(subagentSpecs) && subagentSpecs.length > 0) {
240
+ const savedProjectDir = getProjectDir();
241
+ const savedConsoleLevel = getConsoleLevel();
242
+ const savedUseColour = getUseColour();
243
+ try {
244
+ subagents = await buildProfileSubagents(subagentSpecs, {
245
+ command: this.command,
246
+ resolveTools: this.resolvers?.resolveTools?.bind(this.resolvers),
247
+ });
248
+ this.headerStatus(`Loaded profile subagents: ${subagents.map((s) => s.name).join(', ')}`);
249
+ }
250
+ finally {
251
+ setProjectDir(savedProjectDir);
252
+ setConsoleLevel(savedConsoleLevel);
253
+ setUseColour(savedUseColour);
254
+ }
255
+ }
212
256
  this.agent = createDeepAgent({
213
257
  model: params.model,
214
258
  tools: params.tools,
259
+ // GS2-33 — profile-backed subagents (undefined when none configured → deepagents' default
260
+ // general-purpose subagent only, unchanged behaviour).
261
+ subagents,
215
262
  // gsloth's composed prompt, combined ADDITIVELY by deepagents with its base + fs prompts
216
263
  // into a single system message (avoids the two-system-message Anthropic rejection).
217
264
  systemPrompt,
@@ -1 +1 @@
1
- {"version":3,"file":"GthDeepAgent.js","sourceRoot":"","sources":["../../src/core/GthDeepAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAmB,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,6FAA6F;AAC7F,gGAAgG;AAChG,oGAAoG;AACpG,iEAAiE;AACjE,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,wBA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gGAAgG;IAChG,wFAAwF;IACxF,gGAAgG;IAChG,gGAAgG;IAChG,4EAA4E;IAC5E,8FAA8F;IAC9F,kFAAkF;IAClF,4FAA4F;IAC5F,gGAAgG;IAChG,+FAA+F;IAC/F,6BAA6B,CAAC;AAEhC;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,YAAgC;IACnE,MAAM,IAAI,GAAG,wCAAwC,uBAAuB,EAAE,CAAC;IAC/E,OAAO,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uCAAuC,CAAC,gBAAyB;IAC/E,OAAO,gBAAgB,CAAC;QACtB,IAAI,EAAE,gCAAgC;QACtC,8DAA8D;QAC9D,aAAa,EAAE,KAAK,EAAE,OAAY,EAAE,OAAY,EAAE,EAAE;YAClD,IAAI,CAAC,gBAAgB,IAAI,CAAC,OAAO,EAAE,aAAa;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;YAC1E,MAAM,UAAU,GACd,0FAA0F;gBAC1F,iEAAiE,uBAAuB,EAAE,CAAC;YAC7F,OAAO,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,iGAAiG;AACjG,iGAAiG;AACjG,iFAAiF"}
@@ -6,5 +6,5 @@
6
6
  * `wrapModelCall` capture middleware. This module re-exports it so existing
7
7
  * `@gaunt-sloth/agent/core/debugCapture.js` importers (the TUI debug panel) are unaffected.
8
8
  */
9
- export type { DebugRequestExtras, DebugToolDef, DebugCapture, } from '@gaunt-sloth/core/core/debugCapture.js';
9
+ export type { DebugRequestExtras, DebugToolDef, DebugCapture, LastModelRequest, } from '@gaunt-sloth/core/core/debugCapture.js';
10
10
  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":"AAaA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"debugCapture.js","sourceRoot":"","sources":["../../src/core/debugCapture.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,50 @@
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[]>;
@@ -0,0 +1,81 @@
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, readChatPrompt, readCodePrompt, readExecPrompt, } 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 modePrompt = command === 'code'
42
+ ? readCodePrompt(config)
43
+ : command === 'exec'
44
+ ? readExecPrompt(config)
45
+ : readChatPrompt(config);
46
+ const systemMessages = buildSystemMessages(config, modePrompt);
47
+ return typeof systemMessages[0]?.content === 'string' ? systemMessages[0].content : undefined;
48
+ }
49
+ /**
50
+ * Turn each {@link SubagentProfileSpec} into a deepagents {@link SubAgent} whose model + tools +
51
+ * prompt come from the named profile's resolved config. The returned specs are handed to
52
+ * `createDeepAgent({ subagents })`; the model — the whole point — is the child profile's `llm`,
53
+ * distinct from the parent's.
54
+ */
55
+ export async function buildProfileSubagents(specs, options) {
56
+ const subagents = [];
57
+ for (const spec of specs) {
58
+ debugLog(`Resolving subagent "${spec.name}" under profile "${spec.profile}"`);
59
+ const childConfig = await resolveSubagentProfileConfig(spec.profile);
60
+ // Resolve the child's tools from ITS profile config, filesystem disabled (deepagents provides
61
+ // fs for the subagent). An empty allowedTools allow-list disables every tool.
62
+ const allowedTools = childConfig.allowedTools;
63
+ const toolsDisabled = Array.isArray(allowedTools) && allowedTools.length === 0;
64
+ let tools = [];
65
+ if (!toolsDisabled && options.resolveTools) {
66
+ const resolved = await options.resolveTools({ ...childConfig, filesystem: 'none' }, options.command);
67
+ tools = resolved;
68
+ }
69
+ const systemPrompt = composeChildSystemPrompt(childConfig, options.command) ??
70
+ `You are the ${spec.name} subagent.`;
71
+ subagents.push({
72
+ name: spec.name,
73
+ description: spec.description ?? `Runs under the "${spec.profile}" config profile.`,
74
+ systemPrompt,
75
+ model: childConfig.llm,
76
+ tools,
77
+ });
78
+ }
79
+ return subagents;
80
+ }
81
+ //# sourceMappingURL=subagentProfiles.js.map
@@ -0,0 +1 @@
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,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAIjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAAe;IAChE,OAAO,UAAU,CAAC,EAAE,eAAe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WAAW,EAAE,UAAU,EAAE,MAAe,EAAE,EAC/C,OAAO,CAAC,OAAO,CAChB,CAAC;YACF,KAAK,GAAG,QAAuC,CAAC;QAClD,CAAC;QAED,MAAM,YAAY,GAChB,wBAAwB,CAAC,WAAW,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"}
@@ -18,5 +18,12 @@ import { type AgentMiddleware } from 'langchain';
18
18
  import type { GthConfig } from '@gaunt-sloth/core/config.js';
19
19
  export interface BinaryContentInjectionMiddlewareSettings {
20
20
  name?: 'binary-content-injection';
21
+ /**
22
+ * The gth provider string selecting the per-provider image-block shape (see
23
+ * {@link imageBlockFor}). Derived by the registry factory via `resolveVisionProvider(gthConfig)`;
24
+ * may be `''`/absent, in which case the standard base64 image block is emitted. Only affects the
25
+ * `image` format — file/video/audio blocks are provider-agnostic.
26
+ */
27
+ provider?: string;
21
28
  }
22
- export declare function createBinaryContentInjectionMiddleware(_settings: BinaryContentInjectionMiddlewareSettings, _gthConfig: GthConfig): Promise<AgentMiddleware>;
29
+ export declare function createBinaryContentInjectionMiddleware(settings: BinaryContentInjectionMiddlewareSettings, _gthConfig: GthConfig): Promise<AgentMiddleware>;
@@ -18,6 +18,7 @@ import { createMiddleware } from 'langchain';
18
18
  import path from 'node:path';
19
19
  import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
20
20
  import { ToolMessage, HumanMessage } from '@langchain/core/messages';
21
+ import { imageBlockFor } from '#src/middleware/frontendImageInjectionMiddleware.js';
21
22
  /**
22
23
  * Parse the special binary format string returned by gth_read_binary tool.
23
24
  * Format: gth_read_binary;type:${type};path:${encodedPath};data:${media_type};base64,${data}
@@ -73,8 +74,10 @@ function getFormatLabel(formatType) {
73
74
  };
74
75
  return labels[formatType] || 'file';
75
76
  }
76
- export function createBinaryContentInjectionMiddleware(_settings, _gthConfig) {
77
+ export function createBinaryContentInjectionMiddleware(settings, _gthConfig) {
77
78
  debugLog('Creating binary content injection middleware');
79
+ // The provider selecting the image-block shape; '' falls to the standard base64 block.
80
+ const provider = settings.provider ?? '';
78
81
  return Promise.resolve(createMiddleware({
79
82
  name: 'binary-content-injection',
80
83
  // Before next model call, detect and inject HumanMessage with binary content
@@ -100,7 +103,13 @@ export function createBinaryContentInjectionMiddleware(_settings, _gthConfig) {
100
103
  const newMessages = [...messages];
101
104
  for (const { binaryData } of binaryMessages) {
102
105
  const formatLabel = getFormatLabel(binaryData.formatType);
103
- const contentBlock = createContentBlock(binaryData);
106
+ // Images go through the per-provider builder so OpenAI reasoning models (Responses API,
107
+ // GS2-74) get a valid `image_url` block instead of the standard `source_type` data block,
108
+ // which @langchain/openai mis-serialises to an invalid Responses image part (GS2-75).
109
+ // file/video/audio keep the standard block (they already convert correctly).
110
+ const contentBlock = binaryData.formatType === 'image'
111
+ ? imageBlockFor(provider, binaryData.media_type, binaryData.data)
112
+ : createContentBlock(binaryData);
104
113
  const humanMessage = new HumanMessage({
105
114
  content: [
106
115
  {
@@ -1 +1 @@
1
- {"version":3,"file":"binaryContentInjectionMiddleware.js","sourceRoot":"","sources":["../../src/middleware/binaryContentInjectionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,WAAW,CAAC;AACnE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;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,aAAa,EAAE,CAAC;wBAClB,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC;oBACnE,CAAC;gBACH,CAAC;YACH,CAAC;YAED,qDAAqD;YACrD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,QAAQ,CAAC,aAAa,cAAc,CAAC,MAAM,sCAAsC,CAAC,CAAC;gBAEnF,MAAM,WAAW,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;gBAElC,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,cAAc,EAAE,CAAC;oBAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC1D,MAAM,YAAY,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;oBAEpD,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC;wBACpC,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,eAAe,WAAW,yBAAyB;6BAC1D;4BACD,YAAY;yBACK;qBACpB,CAAC,CAAC;oBAEH,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACjC,CAAC;gBAED,8CAA8C;gBAC9C,OAAO;oBACL,QAAQ,EAAE,WAAW;iBACtB,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"binaryContentInjectionMiddleware.js","sourceRoot":"","sources":["../../src/middleware/binaryContentInjectionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,WAAW,CAAC;AACnE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,WAAW,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AED,kCAAkC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Opt-in middleware that turns a frontend "capture image" tool result into a vision message the
4
+ * model can actually see.
5
+ *
6
+ * A browser/frontend tool such as CopilotKit's `capture_image` fulfils client-side and posts its
7
+ * result back to gth's AG-UI server as a trailing `tool`-role message whose content is a JSON
8
+ * string `{"mimeType":"image/...","data":"<base64>"}`. gth hands that to the model as a plain-string
9
+ * ToolMessage — no vision block — so the model literally cannot see the photo. This middleware
10
+ * detects that ToolMessage in `beforeModel`, parses the envelope, and injects a `HumanMessage`
11
+ * carrying a provider-appropriate vision block before the next model call.
12
+ *
13
+ * Strictly opt-in: it fires ONLY when referenced by name in `config.middleware`
14
+ * (`"middleware": ["frontend-image-injection"]`), never auto-injected. Promoted from
15
+ * pukeko-robot-controller's proven middleware (RC-21), minus the robot-specific motion-tool coupling.
16
+ */
17
+ import { type AgentMiddleware } from 'langchain';
18
+ /** Default frontend capture tool name. Overridable via the `toolName` middleware setting. */
19
+ export declare const DEFAULT_CAPTURE_TOOL_NAME = "capture_image";
20
+ export interface FrontendImageInjectionOptions {
21
+ /**
22
+ * Provider selecting the vision-block shape. Derived by the registry factory from
23
+ * `gthConfig.modelProviderType` (the raw `llm.type`), falling back to `llm._llmType()`. One of
24
+ * gth's provider strings (`anthropic`, `openai`, `openrouter`, `deepseek`, `xai`, `groq`,
25
+ * `ollama`, `google-genai`, `vertexai`, `huggingface`, …); unknown values fall to the standard
26
+ * base64 block.
27
+ */
28
+ provider: string;
29
+ /**
30
+ * Tool name whose `{mimeType,data}` result is converted into a vision message. Defaults to
31
+ * {@link DEFAULT_CAPTURE_TOOL_NAME} (`capture_image`).
32
+ */
33
+ toolName?: string;
34
+ }
35
+ /**
36
+ * A vision content block the target provider's `@langchain` converter actually decodes. Verified
37
+ * against the installed converters (RC-21):
38
+ * - **ollama** → `{ type:'image_url', image_url:'<data-URL string>' }`. ChatOllama's
39
+ * `convertToOllamaMessages` only handles `image_url` blocks (extractBase64FromDataUrl); the
40
+ * LangChain standard `source_type` block throws "Unsupported content type: image".
41
+ * - **OpenAI-compatible** (`openai`, `openrouter`, `deepseek`, `xai`, `groq` — all extend
42
+ * `ChatOpenAI` / report `_llmType()==='openai'`) → `{ type:'image_url', image_url:{ url:'<data-URL>' } }`.
43
+ * This native OpenAI shape is correct on BOTH the Completions API AND the Responses API (GS2-74
44
+ * flips reasoning-capable openai models to Responses). A raw `source_type` standard block
45
+ * serialises to an *invalid* image part on the Responses path, so we emit the provider-native
46
+ * shape rather than lean on `@langchain/core`'s (deprecated, internal) auto-conversion.
47
+ * - **anthropic / google-genai / vertexai** (and any unknown/default) → the LangChain standard
48
+ * base64 data content block `{ type:'image', source_type:'base64', mime_type, data }`, which
49
+ * those native converters decode directly and which is the most broadly decodable fallback.
50
+ *
51
+ * Pure and exported so each provider branch can be unit-tested directly.
52
+ */
53
+ export declare function imageBlockFor(provider: string, mimeType: string, data: string): {
54
+ type: 'image_url';
55
+ image_url: string;
56
+ source_type?: undefined;
57
+ mime_type?: undefined;
58
+ data?: undefined;
59
+ } | {
60
+ type: 'image_url';
61
+ image_url: {
62
+ url: string;
63
+ };
64
+ source_type?: undefined;
65
+ mime_type?: undefined;
66
+ data?: undefined;
67
+ } | {
68
+ image_url?: undefined;
69
+ type: 'image';
70
+ source_type: 'base64';
71
+ mime_type: string;
72
+ data: string;
73
+ };
74
+ /**
75
+ * Create the frontend-image-injection middleware.
76
+ *
77
+ * @param opts.provider - provider string selecting the vision-block shape (see {@link imageBlockFor}).
78
+ * @param opts.toolName - capture tool name (default {@link DEFAULT_CAPTURE_TOOL_NAME}).
79
+ */
80
+ export declare function createFrontendImageInjectionMiddleware(opts: FrontendImageInjectionOptions): AgentMiddleware;