@gaunt-sloth/core 2.0.0-alpha.2 → 2.0.0-alpha.21
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/.gsloth.code.md +10 -0
- package/README.md +6 -6
- package/dist/config/defaults.d.ts +85 -0
- package/dist/config/defaults.js +103 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/jsonc.d.ts +12 -0
- package/dist/config/jsonc.js +41 -0
- package/dist/config/jsonc.js.map +1 -0
- package/dist/config/loader.d.ts +169 -0
- package/dist/config/loader.js +872 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +673 -0
- package/dist/config/schema.js +524 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/shell-policy.d.ts +331 -0
- package/dist/config/shell-policy.js +238 -0
- package/dist/config/shell-policy.js.map +1 -0
- package/dist/config/types.d.ts +596 -0
- package/dist/config/types.js +13 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config.d.ts +18 -647
- package/dist/config.js +15 -516
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +42 -0
- package/dist/constants.js +42 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +85 -2
- package/dist/core/GthAbstractAgent.js +398 -28
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +158 -1
- package/dist/core/GthAgentRunner.js +367 -4
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.js +193 -16
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/debugCapture.d.ts +59 -0
- package/dist/core/debugCapture.js +101 -0
- package/dist/core/debugCapture.js.map +1 -0
- package/dist/core/gthLeanAgentFactory.d.ts +9 -0
- package/dist/core/gthLeanAgentFactory.js +10 -0
- package/dist/core/gthLeanAgentFactory.js.map +1 -0
- package/dist/core/plainToolIndication.d.ts +15 -0
- package/dist/core/plainToolIndication.js +148 -0
- package/dist/core/plainToolIndication.js.map +1 -0
- package/dist/core/runStats.d.ts +41 -0
- package/dist/core/runStats.js +73 -0
- package/dist/core/runStats.js.map +1 -0
- package/dist/core/shell/ShellCommandFailedError.d.ts +54 -0
- package/dist/core/shell/ShellCommandFailedError.js +68 -0
- package/dist/core/shell/ShellCommandFailedError.js.map +1 -0
- package/dist/core/shell/allowlist.d.ts +75 -0
- package/dist/core/shell/allowlist.js +187 -0
- package/dist/core/shell/allowlist.js.map +1 -0
- package/dist/core/shell/arity.d.ts +75 -0
- package/dist/core/shell/arity.js +313 -0
- package/dist/core/shell/arity.js.map +1 -0
- package/dist/core/shell/judge.d.ts +161 -0
- package/dist/core/shell/judge.js +261 -0
- package/dist/core/shell/judge.js.map +1 -0
- package/dist/core/shell/normalize.d.ts +27 -0
- package/dist/core/shell/normalize.js +53 -0
- package/dist/core/shell/normalize.js.map +1 -0
- package/dist/core/toolDisplay.d.ts +101 -0
- package/dist/core/toolDisplay.js +374 -0
- package/dist/core/toolDisplay.js.map +1 -0
- package/dist/core/toolOutputChannel.d.ts +68 -0
- package/dist/core/toolOutputChannel.js +112 -0
- package/dist/core/toolOutputChannel.js.map +1 -0
- package/dist/core/types.d.ts +173 -0
- package/dist/core/types.js.map +1 -1
- package/dist/history/historyFormat.d.ts +28 -0
- package/dist/history/historyFormat.js +127 -0
- package/dist/history/historyFormat.js.map +1 -0
- package/dist/history/historyStore.d.ts +198 -0
- package/dist/history/historyStore.js +482 -0
- package/dist/history/historyStore.js.map +1 -0
- package/dist/history/recordSession.d.ts +37 -0
- package/dist/history/recordSession.js +56 -0
- package/dist/history/recordSession.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +5 -10
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/deepseek.d.ts +1 -1
- package/dist/providers/deepseek.js +5 -10
- package/dist/providers/deepseek.js.map +1 -1
- package/dist/providers/geminiSchemaSanitizer.d.ts +52 -0
- package/dist/providers/geminiSchemaSanitizer.js +201 -0
- package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
- package/dist/providers/google-genai.d.ts +1 -1
- package/dist/providers/google-genai.js +9 -11
- package/dist/providers/google-genai.js.map +1 -1
- package/dist/providers/groq.d.ts +1 -1
- package/dist/providers/groq.js +5 -10
- package/dist/providers/groq.js.map +1 -1
- package/dist/providers/huggingface.d.ts +25 -0
- package/dist/providers/huggingface.js +69 -0
- package/dist/providers/huggingface.js.map +1 -0
- package/dist/providers/modelCatalog.d.ts +109 -0
- package/dist/providers/modelCatalog.js +245 -0
- package/dist/providers/modelCatalog.js.map +1 -0
- package/dist/providers/modelDiscovery.d.ts +111 -3
- package/dist/providers/modelDiscovery.js +183 -27
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.d.ts +19 -5
- package/dist/providers/ollama.js +60 -52
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +5 -10
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +12 -12
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.d.ts +1 -1
- package/dist/providers/vertexai.js +9 -11
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +5 -10
- package/dist/providers/xai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +62 -0
- package/dist/runtime/askStructured.js +76 -0
- package/dist/runtime/askStructured.js.map +1 -0
- package/dist/runtime/conversation.d.ts +59 -0
- package/dist/runtime/conversation.js +137 -0
- package/dist/runtime/conversation.js.map +1 -0
- package/dist/runtime/singleShot.d.ts +24 -5
- package/dist/runtime/singleShot.js +56 -9
- package/dist/runtime/singleShot.js.map +1 -1
- package/dist/utils/aiignoreUtils.js.map +1 -1
- package/dist/utils/binaryOutputUtils.js.map +1 -1
- package/dist/utils/consoleUtils.d.ts +22 -0
- package/dist/utils/consoleUtils.js +45 -0
- package/dist/utils/consoleUtils.js.map +1 -1
- package/dist/utils/debugDump.d.ts +57 -0
- package/dist/utils/debugDump.js +236 -0
- package/dist/utils/debugDump.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +13 -4
- package/dist/utils/debugUtils.js +36 -13
- package/dist/utils/debugUtils.js.map +1 -1
- package/dist/utils/fileUtils.d.ts +24 -2
- package/dist/utils/fileUtils.js +54 -12
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/llmUtils.js.map +1 -1
- package/dist/utils/redactSecrets.d.ts +63 -0
- package/dist/utils/redactSecrets.js +238 -0
- package/dist/utils/redactSecrets.js.map +1 -0
- package/dist/utils/systemPromptNotes.d.ts +181 -0
- package/dist/utils/systemPromptNotes.js +298 -0
- package/dist/utils/systemPromptNotes.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +32 -1
- package/dist/utils/systemUtils.js +50 -3
- package/dist/utils/systemUtils.js.map +1 -1
- package/dist/utils/toolMatching.d.ts +30 -0
- package/dist/utils/toolMatching.js +44 -0
- package/dist/utils/toolMatching.js.map +1 -0
- package/package.json +17 -8
- package/schema/gsloth-config.schema.json +2111 -0
package/dist/constants.js
CHANGED
|
@@ -4,6 +4,7 @@ export const GSLOTH_AUTH = '.gsloth-auth';
|
|
|
4
4
|
export const USER_PROJECT_CONFIG_JS = '.gsloth.config.js';
|
|
5
5
|
export const USER_PROJECT_CONFIG_JSON = '.gsloth.config.json';
|
|
6
6
|
export const USER_PROJECT_CONFIG_MJS = '.gsloth.config.mjs';
|
|
7
|
+
export const USER_PROJECT_CONFIG_TS = '.gsloth.config.ts';
|
|
7
8
|
export const GSLOTH_BACKSTORY = '.gsloth.backstory.md';
|
|
8
9
|
export const PROJECT_GUIDELINES = '.gsloth.guidelines.md';
|
|
9
10
|
export const PROJECT_REVIEW_INSTRUCTIONS = '.gsloth.review.md';
|
|
@@ -12,4 +13,45 @@ export const GSLOTH_CHAT_PROMPT = '.gsloth.chat.md';
|
|
|
12
13
|
export const GSLOTH_CODE_PROMPT = '.gsloth.code.md';
|
|
13
14
|
export const GSLOTH_EXEC_PROMPT = '.gsloth.exec.md';
|
|
14
15
|
export const AIIGNORE_FILE = '.aiignore';
|
|
16
|
+
/**
|
|
17
|
+
* `$schema` pointer written into a generated `.gsloth.config.json` (GS2-1) so editors offer
|
|
18
|
+
* autocomplete + validation. The **hosted, major-pinned** URL is used rather than a relative
|
|
19
|
+
* `node_modules` path because the relative path only resolves when `@gaunt-sloth/core` sits in a
|
|
20
|
+
* `node_modules` beside the config, which is NOT the case for a globally-installed CLI
|
|
21
|
+
* (`npm i -g`): the schema lands in the global prefix, not next to the user's project config, so
|
|
22
|
+
* a relative pointer would silently fail to resolve. A hosted URL resolves for every install mode
|
|
23
|
+
* (global, npx, local, or a hand-written config with nothing installed) and is the standard
|
|
24
|
+
* convention editors fetch + cache.
|
|
25
|
+
*
|
|
26
|
+
* The channel is **major-pinned** (`/schema/v2/…`, not `latest` or `alpha`) so a config never
|
|
27
|
+
* revalidates against a future major it was not written for. The hosted copy is kept in sync with
|
|
28
|
+
* this package's generated schema by the deploy runbook in
|
|
29
|
+
* `websites/gauntsloth-site/schema/README.md` (interim, hand-run) and, in time, PLAT-9's automated
|
|
30
|
+
* release step. The schema still ships inside the package (`files: ["./schema/*"]`) as an offline
|
|
31
|
+
* artifact and golden-snapshot source of truth; it is just no longer what the pointer references.
|
|
32
|
+
*/
|
|
33
|
+
export const CONFIG_SCHEMA_POINTER = 'https://gauntsloth.app/schema/v2/gsloth-config.schema.json';
|
|
34
|
+
/**
|
|
35
|
+
* EXT-9 Tier-2: project-scoped persisted shell allow-list (`always` approvals).
|
|
36
|
+
* Lives under `.gsloth/.gsloth-settings/` like other project settings.
|
|
37
|
+
*/
|
|
38
|
+
export const SHELL_ALLOWLIST_FILE = 'shell-allowlist.json';
|
|
39
|
+
/**
|
|
40
|
+
* The `additionalToolNamePrefix` handed to `MultiServerMCPClient` so every MCP tool name is
|
|
41
|
+
* namespaced. Combined with `prefixToolNameWithServerName`, the adapter emits tool names shaped
|
|
42
|
+
* `${MCP_TOOL_NAME_PREFIX}__<serverName>__<toolName>` (the `__` separator is the mcp-adapters
|
|
43
|
+
* convention). Single-sourced here so the resolver that sets the prefix (EXT-32) and any consumer
|
|
44
|
+
* that groups tools back by server (the [[TUI-C20]] MCP debug tab) can never silently drift apart.
|
|
45
|
+
*/
|
|
46
|
+
export const MCP_TOOL_NAME_PREFIX = 'mcp';
|
|
47
|
+
/**
|
|
48
|
+
* GS2-35 — the canonical Git co-author identity for agent-authored commits. When Gaunt Sloth writes
|
|
49
|
+
* a commit (via `run_shell_command` `git commit`) the co-author is *Gaunt Sloth itself*, NOT the
|
|
50
|
+
* underlying model — attributing the commit to the model name (e.g. `Claude`, `GPT`) is factually
|
|
51
|
+
* wrong. Config (`commit.coAuthor`) overrides this; single-sourced so the config default and the
|
|
52
|
+
* prompt-guidance fallback ({@link import('#src/utils/systemPromptNotes.js').appendCommitCoAuthorNote})
|
|
53
|
+
* can never drift.
|
|
54
|
+
*/
|
|
55
|
+
export const DEFAULT_COMMIT_CO_AUTHOR_NAME = 'Gaunt Sloth';
|
|
56
|
+
export const DEFAULT_COMMIT_CO_AUTHOR_EMAIL = 'code@gauntsloth.app';
|
|
15
57
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AACzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,4DAA4D,CAAC;AAClG;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;AAC3D,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import { GthConfig, ServerTool } from '#src/config.js';
|
|
2
|
-
import { AgentResolvers, AgentStreamEvent, GthAgentInterface, GthCommand, GthCompiledGraph, Message, StatusUpdateCallback } from '#src/core/types.js';
|
|
3
|
-
import {
|
|
2
|
+
import { AgentResolvers, AgentStreamEvent, GthAgentInterface, GthCommand, GthCompiledGraph, GthRunStats, Message, PendingToolInterrupt, StatusUpdateCallback } from '#src/core/types.js';
|
|
3
|
+
import type { DebugCapture } from '#src/core/debugCapture.js';
|
|
4
|
+
import { AIMessageChunk, BaseMessage } from '@langchain/core/messages';
|
|
4
5
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
5
6
|
import { BaseToolkit, StructuredToolInterface } from '@langchain/core/tools';
|
|
6
7
|
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
7
8
|
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
9
|
+
/**
|
|
10
|
+
* TUI-C29 — return a chunk fit for `concat`-aggregation with OpenRouter's raw response stripped.
|
|
11
|
+
*
|
|
12
|
+
* The openrouter provider enables `__includeRawResponse` (TUI-C22), which stashes the *full* raw
|
|
13
|
+
* provider response under `additional_kwargs.__raw_response` so {@link pickReasoningDelta} can lift
|
|
14
|
+
* a top-level `reasoning` delta the ChatOpenAI converter otherwise drops. Reasoning is only ever
|
|
15
|
+
* read off the **per-chunk** `additional_kwargs`, never off the aggregate — yet `AIMessageChunk.concat`
|
|
16
|
+
* deep-merges `additional_kwargs` (`_mergeDicts`), so leaving `__raw_response` on the chunk makes the
|
|
17
|
+
* aggregate accumulate a linearly-growing, unused copy of it for the whole stream.
|
|
18
|
+
*
|
|
19
|
+
* Strip it on a **shallow clone** so the ORIGINAL chunk the reasoning path reads (line ~697) stays
|
|
20
|
+
* untouched (approach A — no mutation of the stream-owned object). The clone preserves the chunk's
|
|
21
|
+
* prototype (so it keeps a working `.concat` when it becomes the first aggregate) and every field
|
|
22
|
+
* `concat` reads (content, tool_call_chunks, tool_calls, response_metadata, usage_metadata, id),
|
|
23
|
+
* overriding only `additional_kwargs`. When the key is absent (every non-OpenRouter provider) the
|
|
24
|
+
* chunk is returned as-is, so those paths are byte-for-byte unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function stripRawResponseForAggregation(chunk: AIMessageChunk): AIMessageChunk;
|
|
8
27
|
/**
|
|
9
28
|
* Shared, graph-agnostic agent plumbing.
|
|
10
29
|
*
|
|
@@ -24,7 +43,48 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
24
43
|
protected agent: GthCompiledGraph | null;
|
|
25
44
|
protected config: GthConfig | null;
|
|
26
45
|
protected command: GthCommand | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Opt-in debug sink for the TUI `/debug` panel. Set AFTER {@link init} via
|
|
48
|
+
* `runner.getAgent()`; read lazily inside each backend's `wrapModelCall` capture middleware
|
|
49
|
+
* so that when it is `undefined` (the normal path) the middleware is a transparent
|
|
50
|
+
* pass-through. Lives on the base so BOTH the lean and deep backends support it; the AG-UI
|
|
51
|
+
* server / non-TUI callers simply never set it, so those contracts are unchanged.
|
|
52
|
+
*/
|
|
53
|
+
debugCapture: DebugCapture | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* GS2-16 — per-run analytics tally (token usage + invoked tool names) folded from the messages
|
|
56
|
+
* flowing through {@link invoke} / the streaming paths. Reset at each turn boundary via
|
|
57
|
+
* {@link resetRunStats} (the runner is reused across turns), read via {@link getRunStats}, and
|
|
58
|
+
* fully fail-soft (accumulation is guarded and never throws into a run).
|
|
59
|
+
*/
|
|
60
|
+
private runStatsAcc;
|
|
27
61
|
constructor(statusUpdate: StatusUpdateCallback, resolvers?: AgentResolvers);
|
|
62
|
+
/**
|
|
63
|
+
* GS2-63 — emit one line of the technical run-header preamble (the Workdir/Model/Tools/Middleware
|
|
64
|
+
* block) UNLESS it is opted out via `output.header: false`. The opt-out only ever reaches here in
|
|
65
|
+
* non-TUI text modes: the interactive TUI forces `output.header` on before init (see
|
|
66
|
+
* `createTuiSession`), and the TUI event path never goes through the interrupt-hint site, so the
|
|
67
|
+
* whole preamble stays visible there. Only INFO header lines route through this — real model/tool
|
|
68
|
+
* output, warnings and errors keep using {@link statusUpdate} directly.
|
|
69
|
+
*/
|
|
70
|
+
protected headerStatus(message: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* GS2-16 — clear the per-run analytics tally so the next turn starts from zero. The runner
|
|
73
|
+
* calls this at each turn boundary because it (and this agent) are reused across turns in an
|
|
74
|
+
* interactive session.
|
|
75
|
+
*/
|
|
76
|
+
resetRunStats(): void;
|
|
77
|
+
/** GS2-16 — the analytics harvested since the last {@link resetRunStats}. Never throws. */
|
|
78
|
+
getRunStats(): GthRunStats;
|
|
79
|
+
/** GS2-16 — fold one message (or chunk) into the run tally. Fully guarded (fail-soft). */
|
|
80
|
+
protected recordRunStats(message: unknown): void;
|
|
81
|
+
/**
|
|
82
|
+
* GS2-16 — best-effort count of messages already in the checkpointed thread state, used by
|
|
83
|
+
* {@link invoke} as the baseline so it harvests only THIS turn's new messages rather than the
|
|
84
|
+
* whole accumulated conversation a checkpointer returns. Fail-soft: a missing `getState`, an odd
|
|
85
|
+
* state shape, or any error yields 0 (worst case a one-turn over-count, never a throw).
|
|
86
|
+
*/
|
|
87
|
+
private getStateMessageCount;
|
|
28
88
|
/**
|
|
29
89
|
* Build the underlying compiled graph and assign it to {@link agent}. This is the only
|
|
30
90
|
* part that differs between the lean and deep agents.
|
|
@@ -42,6 +102,19 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
42
102
|
* When stream is not appropriate use {@link invoke}.
|
|
43
103
|
*/
|
|
44
104
|
stream(messages: Message[], runConfig: RunnableConfig): Promise<IterableReadableStream<string>>;
|
|
105
|
+
/**
|
|
106
|
+
* Resume a graph suspended on a human-in-the-loop `interrupt()` and stream the continuation
|
|
107
|
+
* as text. Identical plumbing to {@link stream} (Esc-to-interrupt, binary handling), except
|
|
108
|
+
* the graph input is a `Command({ resume })` instead of fresh `messages` — so the suspended
|
|
109
|
+
* tool-approval interrupt is answered and the run continues on the same thread.
|
|
110
|
+
*/
|
|
111
|
+
streamResume(resumeValue: unknown, runConfig: RunnableConfig): Promise<IterableReadableStream<string>>;
|
|
112
|
+
/**
|
|
113
|
+
* Shared body for {@link stream} / {@link streamResume}: drive the compiled graph from
|
|
114
|
+
* `input` (fresh `{ messages }` or a resume `Command`) and surface AI text deltas as a
|
|
115
|
+
* string stream, with Esc-to-interrupt and binary-output materialization.
|
|
116
|
+
*/
|
|
117
|
+
private streamFromInput;
|
|
45
118
|
/**
|
|
46
119
|
* Stream agent events as typed AgentStreamEvent objects.
|
|
47
120
|
* Yields text deltas, tool call lifecycle events, and tool results.
|
|
@@ -61,6 +134,16 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
61
134
|
* the client sends in `forwardedProps.command.resume`.
|
|
62
135
|
*/
|
|
63
136
|
streamWithEventsResume(resumeValue: unknown, runConfig: RunnableConfig, queuedMessages?: BaseMessage[], signal?: AbortSignal): AsyncGenerator<AgentStreamEvent>;
|
|
137
|
+
/**
|
|
138
|
+
* Inspect the checkpointed state for the thread and return the tool calls currently pending
|
|
139
|
+
* human approval (empty array when the run finished normally). A LangGraph
|
|
140
|
+
* `humanInTheLoopMiddleware` interrupt parks one `HITLRequest` per suspended super-step in
|
|
141
|
+
* `state.tasks[].interrupts[].value.actionRequests` (each `{ name, args }`); this flattens
|
|
142
|
+
* those into {@link PendingToolInterrupt}s. Defensive throughout — a graph without
|
|
143
|
+
* `getState`, or any unexpected shape, yields `[]` rather than throwing, so a missing HITL
|
|
144
|
+
* setup degrades to "no approval needed" instead of breaking the run.
|
|
145
|
+
*/
|
|
146
|
+
getPendingToolInterrupts(runConfig: RunnableConfig): Promise<PendingToolInterrupt[]>;
|
|
64
147
|
protected processEventStream(stream: IterableReadableStream<[BaseMessage, Record<string, unknown>]>): AsyncGenerator<AgentStreamEvent>;
|
|
65
148
|
cleanup(): Promise<void>;
|
|
66
149
|
getEffectiveConfig(config: GthConfig, command: GthCommand | undefined): GthConfig;
|