@gaunt-sloth/core 2.0.0-alpha.9 → 2.0.0-beta.0
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.review.md +2 -0
- package/README.md +71 -20
- package/dist/config/colour.d.ts +38 -0
- package/dist/config/colour.js +36 -0
- package/dist/config/colour.js.map +1 -0
- package/dist/config/configDiscovery.d.ts +79 -0
- package/dist/config/configDiscovery.js +80 -0
- package/dist/config/configDiscovery.js.map +1 -0
- package/dist/config/defaults.d.ts +20 -20
- package/dist/config/defaults.js +10 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/filesystem-tools.d.ts +41 -0
- package/dist/config/filesystem-tools.js +56 -0
- package/dist/config/filesystem-tools.js.map +1 -0
- package/dist/config/loader.d.ts +171 -19
- package/dist/config/loader.js +1054 -144
- package/dist/config/loader.js.map +1 -1
- package/dist/config/mouse.d.ts +50 -0
- package/dist/config/mouse.js +44 -0
- package/dist/config/mouse.js.map +1 -0
- package/dist/config/profiles.d.ts +68 -0
- package/dist/config/profiles.js +93 -0
- package/dist/config/profiles.js.map +1 -0
- package/dist/config/providerKeys.d.ts +69 -0
- package/dist/config/providerKeys.js +69 -0
- package/dist/config/providerKeys.js.map +1 -0
- package/dist/config/schema.d.ts +2671 -138
- package/dist/config/schema.js +1361 -85
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shell-policy.d.ts +899 -111
- package/dist/config/shell-policy.js +800 -70
- package/dist/config/shell-policy.js.map +1 -1
- package/dist/config/tool-descriptions.d.ts +211 -0
- package/dist/config/tool-descriptions.js +272 -0
- package/dist/config/tool-descriptions.js.map +1 -0
- package/dist/config/types.d.ts +352 -41
- package/dist/config/types.js +1 -0
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +35 -1
- package/dist/config.js +16 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +28 -1
- package/dist/constants.js +28 -1
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +166 -11
- package/dist/core/GthAbstractAgent.js +484 -45
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +543 -57
- package/dist/core/GthAgentRunner.js +1494 -140
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.d.ts +117 -2
- package/dist/core/GthLangChainAgent.js +602 -29
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/approvals/annotations.d.ts +122 -0
- package/dist/core/approvals/annotations.js +137 -0
- package/dist/core/approvals/annotations.js.map +1 -0
- package/dist/core/approvals/grants.d.ts +216 -0
- package/dist/core/approvals/grants.js +469 -0
- package/dist/core/approvals/grants.js.map +1 -0
- package/dist/core/approvals/matcher.d.ts +202 -0
- package/dist/core/approvals/matcher.js +267 -0
- package/dist/core/approvals/matcher.js.map +1 -0
- package/dist/core/approvals/mcpSubjects.d.ts +40 -0
- package/dist/core/approvals/mcpSubjects.js +99 -0
- package/dist/core/approvals/mcpSubjects.js.map +1 -0
- package/dist/core/approvals/promptHeader.d.ts +28 -0
- package/dist/core/approvals/promptHeader.js +62 -0
- package/dist/core/approvals/promptHeader.js.map +1 -0
- package/dist/core/approvals/toolAnnotationSources.d.ts +105 -0
- package/dist/core/approvals/toolAnnotationSources.js +277 -0
- package/dist/core/approvals/toolAnnotationSources.js.map +1 -0
- package/dist/core/approvals/toolHost.d.ts +46 -0
- package/dist/core/approvals/toolHost.js +108 -0
- package/dist/core/approvals/toolHost.js.map +1 -0
- package/dist/core/debugCapture.d.ts +74 -0
- package/dist/core/debugCapture.js +100 -0
- package/dist/core/debugCapture.js.map +1 -0
- package/dist/core/gthLeanAgentFactory.d.ts +4 -4
- package/dist/core/gthLeanAgentFactory.js +4 -4
- package/dist/core/launchBanner.d.ts +127 -0
- package/dist/core/launchBanner.js +414 -0
- package/dist/core/launchBanner.js.map +1 -0
- package/dist/core/modelLabel.d.ts +19 -0
- package/dist/core/modelLabel.js +26 -0
- package/dist/core/modelLabel.js.map +1 -0
- package/dist/core/plainToolIndication.d.ts +15 -0
- package/dist/core/plainToolIndication.js +174 -0
- package/dist/core/plainToolIndication.js.map +1 -0
- package/dist/core/reasoningBlocks.d.ts +65 -0
- package/dist/core/reasoningBlocks.js +103 -0
- package/dist/core/reasoningBlocks.js.map +1 -0
- package/dist/core/refusal.d.ts +53 -0
- package/dist/core/refusal.js +133 -0
- package/dist/core/refusal.js.map +1 -0
- package/dist/core/runHeader.d.ts +38 -0
- package/dist/core/runHeader.js +42 -0
- package/dist/core/runHeader.js.map +1 -0
- package/dist/core/runStats.d.ts +14 -3
- package/dist/core/runStats.js +48 -3
- package/dist/core/runStats.js.map +1 -1
- package/dist/core/shell/ShellCommandFailedError.d.ts +3 -4
- package/dist/core/shell/ShellCommandFailedError.js +3 -4
- package/dist/core/shell/ShellCommandFailedError.js.map +1 -1
- package/dist/core/shell/abstention.d.ts +88 -0
- package/dist/core/shell/abstention.js +184 -0
- package/dist/core/shell/abstention.js.map +1 -0
- package/dist/core/shell/approvalCapture.d.ts +271 -0
- package/dist/core/shell/approvalCapture.js +108 -0
- package/dist/core/shell/approvalCapture.js.map +1 -0
- package/dist/core/shell/approvalStop.d.ts +123 -0
- package/dist/core/shell/approvalStop.js +269 -0
- package/dist/core/shell/approvalStop.js.map +1 -0
- package/dist/core/shell/arity.d.ts +6 -0
- package/dist/core/shell/arity.js +20 -6
- package/dist/core/shell/arity.js.map +1 -1
- package/dist/core/shell/denylist.d.ts +11 -0
- package/dist/core/shell/denylist.js +37 -0
- package/dist/core/shell/denylist.js.map +1 -0
- package/dist/core/shell/escalationSeverity.d.ts +141 -0
- package/dist/core/shell/escalationSeverity.js +89 -0
- package/dist/core/shell/escalationSeverity.js.map +1 -0
- package/dist/core/shell/framing.d.ts +190 -0
- package/dist/core/shell/framing.js +633 -0
- package/dist/core/shell/framing.js.map +1 -0
- package/dist/core/shell/hardline.d.ts +103 -0
- package/dist/core/shell/hardline.js +780 -0
- package/dist/core/shell/hardline.js.map +1 -0
- package/dist/core/shell/negotiation.d.ts +328 -0
- package/dist/core/shell/negotiation.js +488 -0
- package/dist/core/shell/negotiation.js.map +1 -0
- package/dist/core/shell/normalize.d.ts +44 -4
- package/dist/core/shell/normalize.js +61 -7
- package/dist/core/shell/normalize.js.map +1 -1
- package/dist/core/shell/openWorld.d.ts +263 -0
- package/dist/core/shell/openWorld.js +1188 -0
- package/dist/core/shell/openWorld.js.map +1 -0
- package/dist/core/shell/rater.d.ts +873 -0
- package/dist/core/shell/rater.js +1454 -0
- package/dist/core/shell/rater.js.map +1 -0
- package/dist/core/shell/raterModel.d.ts +41 -0
- package/dist/core/shell/raterModel.js +51 -0
- package/dist/core/shell/raterModel.js.map +1 -0
- package/dist/core/shell/raterVocabulary.d.ts +121 -0
- package/dist/core/shell/raterVocabulary.js +116 -0
- package/dist/core/shell/raterVocabulary.js.map +1 -0
- package/dist/core/shell/rejection.d.ts +69 -0
- package/dist/core/shell/rejection.js +38 -0
- package/dist/core/shell/rejection.js.map +1 -0
- package/dist/core/toolCallRepair/grammar.d.ts +41 -0
- package/dist/core/toolCallRepair/grammar.js +116 -0
- package/dist/core/toolCallRepair/grammar.js.map +1 -0
- package/dist/core/toolCallRepair/index.d.ts +2 -0
- package/dist/core/toolCallRepair/index.js +7 -0
- package/dist/core/toolCallRepair/index.js.map +1 -0
- package/dist/core/toolCallRepair/payload.d.ts +36 -0
- package/dist/core/toolCallRepair/payload.js +341 -0
- package/dist/core/toolCallRepair/payload.js.map +1 -0
- package/dist/core/toolCallRepair/promote.d.ts +45 -0
- package/dist/core/toolCallRepair/promote.js +90 -0
- package/dist/core/toolCallRepair/promote.js.map +1 -0
- package/dist/core/toolDisplay.d.ts +123 -0
- package/dist/core/toolDisplay.js +451 -0
- package/dist/core/toolDisplay.js.map +1 -0
- package/dist/core/toolOutputChannel.d.ts +95 -0
- package/dist/core/toolOutputChannel.js +165 -0
- package/dist/core/toolOutputChannel.js.map +1 -0
- package/dist/core/types.d.ts +349 -16
- package/dist/core/types.js.map +1 -1
- package/dist/history/historyFormat.d.ts +12 -3
- package/dist/history/historyFormat.js +50 -8
- package/dist/history/historyFormat.js.map +1 -1
- package/dist/history/historyStore.d.ts +77 -0
- package/dist/history/historyStore.js +173 -6
- package/dist/history/historyStore.js.map +1 -1
- package/dist/history/recordSession.d.ts +10 -1
- package/dist/history/recordSession.js +27 -0
- package/dist/history/recordSession.js.map +1 -1
- package/dist/providers/anthropic.js +12 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/configurationPassthrough.d.ts +107 -0
- package/dist/providers/configurationPassthrough.js +148 -0
- package/dist/providers/configurationPassthrough.js.map +1 -0
- package/dist/providers/geminiSchemaSanitizer.d.ts +55 -0
- package/dist/providers/geminiSchemaSanitizer.js +347 -0
- package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
- package/dist/providers/geminiThinking.d.ts +60 -0
- package/dist/providers/geminiThinking.js +92 -0
- package/dist/providers/geminiThinking.js.map +1 -0
- package/dist/providers/google-genai.js +18 -1
- package/dist/providers/google-genai.js.map +1 -1
- package/dist/providers/groq.js +12 -0
- 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 +99 -5
- package/dist/providers/modelDiscovery.js +191 -35
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.d.ts +18 -4
- package/dist/providers/ollama.js +67 -37
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.js +34 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +26 -4
- package/dist/providers/openrouter.js +83 -26
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.js +19 -1
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/providers/xai.js +20 -0
- package/dist/providers/xai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +105 -0
- package/dist/runtime/askStructured.js +120 -0
- package/dist/runtime/askStructured.js.map +1 -0
- package/dist/runtime/conversation.d.ts +64 -0
- package/dist/runtime/conversation.js +171 -0
- package/dist/runtime/conversation.js.map +1 -0
- package/dist/runtime/singleShot.d.ts +37 -6
- package/dist/runtime/singleShot.js +113 -67
- package/dist/runtime/singleShot.js.map +1 -1
- package/dist/runtime/structuredOutput.d.ts +104 -0
- package/dist/runtime/structuredOutput.js +393 -0
- package/dist/runtime/structuredOutput.js.map +1 -0
- package/dist/utils/ProgressIndicator.d.ts +21 -0
- package/dist/utils/ProgressIndicator.js +30 -3
- package/dist/utils/ProgressIndicator.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 +95 -0
- package/dist/utils/consoleUtils.js +112 -2
- package/dist/utils/consoleUtils.js.map +1 -1
- package/dist/utils/crashHandler.d.ts +87 -0
- package/dist/utils/crashHandler.js +128 -0
- package/dist/utils/crashHandler.js.map +1 -0
- package/dist/utils/debugDump.d.ts +134 -0
- package/dist/utils/debugDump.js +381 -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/displayWidth.d.ts +53 -0
- package/dist/utils/displayWidth.js +195 -0
- package/dist/utils/displayWidth.js.map +1 -0
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/globalConfigUtils.d.ts +14 -2
- package/dist/utils/globalConfigUtils.js +22 -4
- package/dist/utils/globalConfigUtils.js.map +1 -1
- package/dist/utils/llmUtils.d.ts +39 -8
- package/dist/utils/llmUtils.js +76 -8
- package/dist/utils/llmUtils.js.map +1 -1
- package/dist/utils/redactSecrets.d.ts +63 -0
- package/dist/utils/redactSecrets.js +286 -0
- package/dist/utils/redactSecrets.js.map +1 -0
- package/dist/utils/systemPromptNotes.d.ts +222 -0
- package/dist/utils/systemPromptNotes.js +338 -0
- package/dist/utils/systemPromptNotes.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +18 -1
- package/dist/utils/systemUtils.js +38 -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/dist/utils/untrustedText.d.ts +86 -0
- package/dist/utils/untrustedText.js +101 -0
- package/dist/utils/untrustedText.js.map +1 -0
- package/package.json +21 -7
- package/schema/gsloth-config.schema.json +1921 -326
- package/dist/core/shell/allowlist.d.ts +0 -75
- package/dist/core/shell/allowlist.js +0 -187
- package/dist/core/shell/allowlist.js.map +0 -1
- package/dist/core/shell/judge.d.ts +0 -161
- package/dist/core/shell/judge.js +0 -261
- package/dist/core/shell/judge.js.map +0 -1
package/dist/constants.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ export declare const GSLOTH_SETTINGS_DIR = ".gsloth-settings";
|
|
|
3
3
|
export declare const GSLOTH_AUTH = ".gsloth-auth";
|
|
4
4
|
export declare const USER_PROJECT_CONFIG_JS = ".gsloth.config.js";
|
|
5
5
|
export declare const USER_PROJECT_CONFIG_JSON = ".gsloth.config.json";
|
|
6
|
+
/**
|
|
7
|
+
* GS2-69 — the `.jsonc` filename variant. Both JSON names are parsed by the same lenient
|
|
8
|
+
* {@link import('#src/config/jsonc.js').parseJsonc}; this one just carries the conventional
|
|
9
|
+
* extension so editors/review tools expect the comments. `.json` wins when both exist.
|
|
10
|
+
*/
|
|
11
|
+
export declare const USER_PROJECT_CONFIG_JSONC = ".gsloth.config.jsonc";
|
|
6
12
|
export declare const USER_PROJECT_CONFIG_MJS = ".gsloth.config.mjs";
|
|
7
13
|
export declare const USER_PROJECT_CONFIG_TS = ".gsloth.config.ts";
|
|
8
14
|
export declare const GSLOTH_BACKSTORY = ".gsloth.backstory.md";
|
|
@@ -26,7 +32,7 @@ export declare const AIIGNORE_FILE = ".aiignore";
|
|
|
26
32
|
* The channel is **major-pinned** (`/schema/v2/…`, not `latest` or `alpha`) so a config never
|
|
27
33
|
* revalidates against a future major it was not written for. The hosted copy is kept in sync with
|
|
28
34
|
* this package's generated schema by the deploy runbook in
|
|
29
|
-
* `websites/gauntsloth
|
|
35
|
+
* `websites/gauntsloth-site/schema/README.md` (interim, hand-run) and, in time, PLAT-9's automated
|
|
30
36
|
* release step. The schema still ships inside the package (`files: ["./schema/*"]`) as an offline
|
|
31
37
|
* artifact and golden-snapshot source of truth; it is just no longer what the pointer references.
|
|
32
38
|
*/
|
|
@@ -36,3 +42,24 @@ export declare const CONFIG_SCHEMA_POINTER = "https://gauntsloth.app/schema/v2/g
|
|
|
36
42
|
* Lives under `.gsloth/.gsloth-settings/` like other project settings.
|
|
37
43
|
*/
|
|
38
44
|
export declare const SHELL_ALLOWLIST_FILE = "shell-allowlist.json";
|
|
45
|
+
/**
|
|
46
|
+
* The `additionalToolNamePrefix` handed to `MultiServerMCPClient` so every MCP tool name is
|
|
47
|
+
* namespaced. Combined with `prefixToolNameWithServerName`, the adapter emits tool names shaped
|
|
48
|
+
* `${MCP_TOOL_NAME_PREFIX}__<serverName>__<toolName>` (the `__` separator is the mcp-adapters
|
|
49
|
+
* convention). Single-sourced here so the resolver that sets the prefix (EXT-32) and any consumer
|
|
50
|
+
* that groups tools back by server (the [[TUI-C20]] MCP debug tab) can never silently drift apart.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MCP_TOOL_NAME_PREFIX = "mcp";
|
|
53
|
+
/**
|
|
54
|
+
* GS2-35 — the canonical Git co-author identity for agent-authored commits. When Gaunt Sloth writes
|
|
55
|
+
* a commit (via `run_shell_command` `git commit`) the co-author is *Gaunt Sloth itself*, NOT the
|
|
56
|
+
* underlying model: the commit was produced by the assistant, so attributing it to the model that
|
|
57
|
+
* served the session is factually wrong. The email is what makes the trailer resolve to the real
|
|
58
|
+
* Gaunt Sloth account, so it is the half that must not move. This name is the BASE the composed
|
|
59
|
+
* trailer is built from, not the whole emitted value: the resolved active model decorates it as
|
|
60
|
+
* `Gaunt Sloth (provider:model)` (EXT-83). Config (`commit.coAuthor`) overrides
|
|
61
|
+
* this; single-sourced so the config default and the prompt-guidance fallback
|
|
62
|
+
* ({@link import('#src/utils/systemPromptNotes.js').appendCommitCoAuthorNote}) can never drift.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEFAULT_COMMIT_CO_AUTHOR_NAME = "Gaunt Sloth";
|
|
65
|
+
export declare const DEFAULT_COMMIT_CO_AUTHOR_EMAIL = "code@gauntsloth.app";
|
package/dist/constants.js
CHANGED
|
@@ -3,6 +3,12 @@ export const GSLOTH_SETTINGS_DIR = '.gsloth-settings';
|
|
|
3
3
|
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
|
+
/**
|
|
7
|
+
* GS2-69 — the `.jsonc` filename variant. Both JSON names are parsed by the same lenient
|
|
8
|
+
* {@link import('#src/config/jsonc.js').parseJsonc}; this one just carries the conventional
|
|
9
|
+
* extension so editors/review tools expect the comments. `.json` wins when both exist.
|
|
10
|
+
*/
|
|
11
|
+
export const USER_PROJECT_CONFIG_JSONC = '.gsloth.config.jsonc';
|
|
6
12
|
export const USER_PROJECT_CONFIG_MJS = '.gsloth.config.mjs';
|
|
7
13
|
export const USER_PROJECT_CONFIG_TS = '.gsloth.config.ts';
|
|
8
14
|
export const GSLOTH_BACKSTORY = '.gsloth.backstory.md';
|
|
@@ -26,7 +32,7 @@ export const AIIGNORE_FILE = '.aiignore';
|
|
|
26
32
|
* The channel is **major-pinned** (`/schema/v2/…`, not `latest` or `alpha`) so a config never
|
|
27
33
|
* revalidates against a future major it was not written for. The hosted copy is kept in sync with
|
|
28
34
|
* this package's generated schema by the deploy runbook in
|
|
29
|
-
* `websites/gauntsloth
|
|
35
|
+
* `websites/gauntsloth-site/schema/README.md` (interim, hand-run) and, in time, PLAT-9's automated
|
|
30
36
|
* release step. The schema still ships inside the package (`files: ["./schema/*"]`) as an offline
|
|
31
37
|
* artifact and golden-snapshot source of truth; it is just no longer what the pointer references.
|
|
32
38
|
*/
|
|
@@ -36,4 +42,25 @@ export const CONFIG_SCHEMA_POINTER = 'https://gauntsloth.app/schema/v2/gsloth-co
|
|
|
36
42
|
* Lives under `.gsloth/.gsloth-settings/` like other project settings.
|
|
37
43
|
*/
|
|
38
44
|
export const SHELL_ALLOWLIST_FILE = 'shell-allowlist.json';
|
|
45
|
+
/**
|
|
46
|
+
* The `additionalToolNamePrefix` handed to `MultiServerMCPClient` so every MCP tool name is
|
|
47
|
+
* namespaced. Combined with `prefixToolNameWithServerName`, the adapter emits tool names shaped
|
|
48
|
+
* `${MCP_TOOL_NAME_PREFIX}__<serverName>__<toolName>` (the `__` separator is the mcp-adapters
|
|
49
|
+
* convention). Single-sourced here so the resolver that sets the prefix (EXT-32) and any consumer
|
|
50
|
+
* that groups tools back by server (the [[TUI-C20]] MCP debug tab) can never silently drift apart.
|
|
51
|
+
*/
|
|
52
|
+
export const MCP_TOOL_NAME_PREFIX = 'mcp';
|
|
53
|
+
/**
|
|
54
|
+
* GS2-35 — the canonical Git co-author identity for agent-authored commits. When Gaunt Sloth writes
|
|
55
|
+
* a commit (via `run_shell_command` `git commit`) the co-author is *Gaunt Sloth itself*, NOT the
|
|
56
|
+
* underlying model: the commit was produced by the assistant, so attributing it to the model that
|
|
57
|
+
* served the session is factually wrong. The email is what makes the trailer resolve to the real
|
|
58
|
+
* Gaunt Sloth account, so it is the half that must not move. This name is the BASE the composed
|
|
59
|
+
* trailer is built from, not the whole emitted value: the resolved active model decorates it as
|
|
60
|
+
* `Gaunt Sloth (provider:model)` (EXT-83). Config (`commit.coAuthor`) overrides
|
|
61
|
+
* this; single-sourced so the config default and the prompt-guidance fallback
|
|
62
|
+
* ({@link import('#src/utils/systemPromptNotes.js').appendCommitCoAuthorNote}) can never drift.
|
|
63
|
+
*/
|
|
64
|
+
export const DEFAULT_COMMIT_CO_AUTHOR_NAME = 'Gaunt Sloth';
|
|
65
|
+
export const DEFAULT_COMMIT_CO_AUTHOR_EMAIL = 'code@gauntsloth.app';
|
|
39
66
|
//# 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,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"}
|
|
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;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAChE,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;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;AAC3D,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { GthConfig, ServerTool } from '#src/config.js';
|
|
2
|
-
import { AgentResolvers, AgentStreamEvent, GthAgentInterface, GthCommand, GthCompiledGraph, GthRunStats, Message, PendingToolInterrupt, StatusUpdateCallback } from '#src/core/types.js';
|
|
1
|
+
import { GthConfig, ServerTool, type ApprovalRung, type DescribableTool } from '#src/config.js';
|
|
2
|
+
import { AgentResolvers, AgentStreamEvent, GthAgentInitOptions, GthAgentInterface, GthCommand, GthCompiledGraph, GthRunStats, Message, PendingToolInterrupt, StatusUpdateCallback } from '#src/core/types.js';
|
|
3
|
+
import type { GthOutputHeaderRung } from '#src/config/schema.js';
|
|
4
|
+
import type { DeclaredToolAnnotations } from '#src/core/approvals/annotations.js';
|
|
5
|
+
import type { DebugCapture, DebugRequestExtras, LastModelRequest } from '#src/core/debugCapture.js';
|
|
3
6
|
import { BaseMessage } from '@langchain/core/messages';
|
|
4
7
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
5
8
|
import { BaseToolkit, StructuredToolInterface } from '@langchain/core/tools';
|
|
6
9
|
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
7
10
|
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
11
|
+
import { type RefusalInfo } from '#src/core/refusal.js';
|
|
8
12
|
/**
|
|
9
13
|
* Shared, graph-agnostic agent plumbing.
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* build the compiled LangGraph in {@link init}; everything downstream — invoking,
|
|
15
|
+
* A backend differs from another only in how it builds the compiled LangGraph in {@link init} —
|
|
16
|
+
* today that is the lean {@link GthLangChainAgent} (`createAgent`, in core); everything downstream — invoking,
|
|
14
17
|
* streaming to the console, emitting typed {@link AgentStreamEvent}s, client-tool
|
|
15
18
|
* `interrupt()` stubbing, suspend/resume, and cleanup — is identical and lives here.
|
|
16
19
|
*
|
|
17
|
-
* The base operates solely on the structural {@link GthCompiledGraph} surface, so it
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* The base operates solely on the structural {@link GthCompiledGraph} surface, so it does NOT
|
|
21
|
+
* import a graph builder. Subclasses construct the graph and assign it to {@link agent} in their
|
|
22
|
+
* `init()`.
|
|
20
23
|
*/
|
|
21
24
|
export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
22
25
|
protected statusUpdate: StatusUpdateCallback;
|
|
@@ -24,6 +27,42 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
24
27
|
protected agent: GthCompiledGraph | null;
|
|
25
28
|
protected config: GthConfig | null;
|
|
26
29
|
protected command: GthCommand | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* GS2-95 — the name of the command the USER typed, as the run header should say it. Set from
|
|
32
|
+
* {@link GthAgentInitOptions#displayCommand} by the backend's `init`, and read by exactly one
|
|
33
|
+
* thing: {@link compactHeaderStatus}.
|
|
34
|
+
*
|
|
35
|
+
* Separate from {@link command} because that field is not a label — it selects the mode prompt,
|
|
36
|
+
* the approvals posture and the command-specific filesystem config. Naming the header off it is
|
|
37
|
+
* why `gth eval` used to open with `ask`, and moving it to fix the header would silently change
|
|
38
|
+
* which system prompt those runs execute under. Left `undefined` by every command whose init verb
|
|
39
|
+
* IS its name, which is most of them.
|
|
40
|
+
*/
|
|
41
|
+
protected displayCommand: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Opt-in debug sink for the TUI `/debug` panel. Set AFTER {@link init} via
|
|
44
|
+
* `runner.getAgent()`; read lazily inside each backend's `wrapModelCall` capture middleware
|
|
45
|
+
* so that when it is `undefined` (the normal path) the middleware is a transparent
|
|
46
|
+
* pass-through. Lives on the base so every backend supports it; the AG-UI server / non-TUI
|
|
47
|
+
* callers simply never set it, so those contracts are unchanged.
|
|
48
|
+
*/
|
|
49
|
+
debugCapture: DebugCapture | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* GS2-56 — the ALWAYS-ON snapshot of the most recent model request (extras + the as-sent,
|
|
52
|
+
* post-summarization messages), populated UNCONDITIONALLY at each backend's `wrapModelCall` feed
|
|
53
|
+
* site — NOT gated on {@link debugCapture} being attached. This is what lets `/debug-dump` render
|
|
54
|
+
* the full model input even when the TUI `/debug` panel was never opened and on non-TUI surfaces
|
|
55
|
+
* (the sink only ever fed the live `/debug` panel). O(1): a single overwritten reference retaining
|
|
56
|
+
* only the LAST call — no accumulation, so the "pay nothing until you need it" intent is kept.
|
|
57
|
+
*/
|
|
58
|
+
lastModelRequest: LastModelRequest | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* GS2-56 — stash the last model request (the as-sent messages + {@link DebugRequestExtras}).
|
|
61
|
+
* Called unconditionally from each backend's capture middleware, independent of the debug sink,
|
|
62
|
+
* so the snapshot is available to `/debug-dump` on every surface. Overwrites (retains only the
|
|
63
|
+
* most recent call). Callers already guard the invocation; kept trivial so it can never throw.
|
|
64
|
+
*/
|
|
65
|
+
protected setLastModelRequest(messages: BaseMessage[], extras?: DebugRequestExtras): void;
|
|
27
66
|
/**
|
|
28
67
|
* GS2-16 — per-run analytics tally (token usage + invoked tool names) folded from the messages
|
|
29
68
|
* flowing through {@link invoke} / the streaming paths. Reset at each turn boundary via
|
|
@@ -31,7 +70,115 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
31
70
|
* fully fail-soft (accumulation is guarded and never throws into a run).
|
|
32
71
|
*/
|
|
33
72
|
private runStatsAcc;
|
|
73
|
+
/**
|
|
74
|
+
* EXT-58 — the names of the tools registered with the graph at the last {@link init}, recorded by
|
|
75
|
+
* {@link registerApprovalsAwareTools}. Read by `GthAgentRunner` to build the rater's
|
|
76
|
+
* granted-built-in list (§4.4), so a suggestion can only ever name a tool the model actually has.
|
|
77
|
+
*/
|
|
78
|
+
private registeredToolNames;
|
|
79
|
+
/**
|
|
80
|
+
* EXT-70 §4.7.1 — what the connected MCP servers DECLARED about their own tools, captured from
|
|
81
|
+
* the same registration hook as {@link registeredToolNames} and keyed by the registered tool
|
|
82
|
+
* name. Read by `GthAgentRunner` as the `mcp` half of a `DeclaredToolAnnotationLookup`.
|
|
83
|
+
*
|
|
84
|
+
* It is a record of claims, never of decisions: no trust is applied here (that is
|
|
85
|
+
* `createEffectiveToolAnnotationSource`'s only job), and an absent tool yields the fail-closed
|
|
86
|
+
* defaults rather than "declared nothing".
|
|
87
|
+
*/
|
|
88
|
+
private declaredMcpToolAnnotations;
|
|
34
89
|
constructor(statusUpdate: StatusUpdateCallback, resolvers?: AgentResolvers);
|
|
90
|
+
/**
|
|
91
|
+
* GS2-101 — the run-header rung in force. An unset `output.header` resolves to `compact`: a run
|
|
92
|
+
* that was never configured opens with one attribution line and nothing else, and the technical
|
|
93
|
+
* preamble is opt-in via `output.header: 'debug'`.
|
|
94
|
+
*
|
|
95
|
+
* Defaulted HERE rather than in `DEFAULT_CONFIG` (the convention `injectModelContext` and
|
|
96
|
+
* `debugDump.redact` also follow) so the effective-config snapshot `gth config` prints does not
|
|
97
|
+
* grow a key nobody set.
|
|
98
|
+
*/
|
|
99
|
+
protected get headerRung(): GthOutputHeaderRung;
|
|
100
|
+
/**
|
|
101
|
+
* GS2-93 — emit one line of the technical run-header preamble (the Workdir/Model/Tools/Middleware
|
|
102
|
+
* block). Only the `debug` rung shows it; `compact` replaces the whole block with
|
|
103
|
+
* {@link compactHeaderStatus}'s single line and `none` shows nothing. A non-`debug` rung only ever
|
|
104
|
+
* reaches here in non-TUI text modes: the interactive TUI forces `debug` before init (see
|
|
105
|
+
* `createTuiSession`), and the TUI event path never goes through the interrupt-hint site, so the
|
|
106
|
+
* whole preamble stays visible there. Only INFO header lines route through this — real model/tool
|
|
107
|
+
* output, warnings and errors keep using {@link statusUpdate} directly.
|
|
108
|
+
*/
|
|
109
|
+
protected headerStatus(message: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* GS2-93 — the `compact` rung's whole output: one line naming the command and the model that
|
|
112
|
+
* served it, in place of the preamble. Called once from the backend's `init`, after the command
|
|
113
|
+
* and effective config are in place. The string is {@link runHeaderLine}'s, shared with the review
|
|
114
|
+
* document's opening line so the two writers cannot drift.
|
|
115
|
+
*
|
|
116
|
+
* **This renders; it does not decide.** The word after the product name is
|
|
117
|
+
* {@link displayCommand} when the command supplied one and the init verb otherwise — GS2-93
|
|
118
|
+
* forbids a label table inside the agent, because naming a user-facing line is the command's call,
|
|
119
|
+
* not the runtime's.
|
|
120
|
+
*
|
|
121
|
+
* Two runs deliberately emit nothing here:
|
|
122
|
+
*
|
|
123
|
+
* - **`review` and `pr`** already open with `reviewHeadingBlock`, which renders this same line.
|
|
124
|
+
* Emitting here as well would print the header twice on one screen.
|
|
125
|
+
* - **A run with no name at all** — the `pr` command's discovery sub-agent is the one such
|
|
126
|
+
* caller, and it runs inside a `pr` whose header is already on screen. The name is what this
|
|
127
|
+
* line is for, so with none there is nothing to say; inventing a word for it would be naming a
|
|
128
|
+
* user-facing surface from inside the agent.
|
|
129
|
+
*
|
|
130
|
+
* The model half is the shared {@link modelProviderLabel} spelling (DL-6), and it is dropped
|
|
131
|
+
* rather than faked when nothing resolves (DL-7), leaving the command on its own.
|
|
132
|
+
*/
|
|
133
|
+
protected compactHeaderStatus(): void;
|
|
134
|
+
/**
|
|
135
|
+
* EXT-58 (spec §4.5) — the ONE tool-registration hook both backends call with their final tool
|
|
136
|
+
* array, just before handing it to the graph builder. It does two things:
|
|
137
|
+
*
|
|
138
|
+
* 1. Appends the rung's approval sentence to every tool that is **not** auto-approved at that
|
|
139
|
+
* rung, and leaves every granted tool's description untouched (the absence of the sentence is
|
|
140
|
+
* what marks a tool free). See {@link applyRungAwareToolDescriptions}.
|
|
141
|
+
* 2. Records the registered tool names for {@link getRegisteredToolNames}, which feeds the
|
|
142
|
+
* rater's granted-alternative list (§4.4).
|
|
143
|
+
* 3. EXT-70 §4.7.1 — records what the MCP servers declared about their own tools, for
|
|
144
|
+
* {@link getDeclaredMcpToolAnnotations}. This is the ONE place a `tools/list` annotation
|
|
145
|
+
* enters the approvals stack, and it enters as a claim: nothing here decides whether it is
|
|
146
|
+
* believed.
|
|
147
|
+
*
|
|
148
|
+
* `gatedTools` MUST be the **LIVE gated set for the rung in force** — `resolveGatedToolNames` for
|
|
149
|
+
* that rung — and NOT the set the caller wires into the approval interrupt. The two are different
|
|
150
|
+
* on purpose: the interrupt is installed once, at agent init, and is deliberately
|
|
151
|
+
* rung-independent (`resolveInterruptToolNames`, the union over every rung) so that
|
|
152
|
+
* `/approvals <mode>` can move the mode underneath it for the rest of the session. Passing that
|
|
153
|
+
* wider set here would describe tools as needing approval that the live mode does not gate — and
|
|
154
|
+
* a call the live mode does not gate is auto-approved the moment it reaches the runner, so the
|
|
155
|
+
* sentence would be a promise nothing keeps.
|
|
156
|
+
*
|
|
157
|
+
* What keeps a description from promising an approval the gate will not ask for is therefore that
|
|
158
|
+
* both this and `GthAgentRunner`'s own check are projections of the SAME rule,
|
|
159
|
+
* `isToolGatedAtRung`, evaluated against the SAME live mode — §4.5's "a description that disagrees
|
|
160
|
+
* with what the gate will actually do is worse than no description at all".
|
|
161
|
+
*
|
|
162
|
+
* `additionalToolNames` covers tools the graph builder registers itself and that therefore never
|
|
163
|
+
* appear in `tools`. Their descriptions are not ours to write, so they cannot be suffixed here;
|
|
164
|
+
* they are recorded only so the rater's suggestion list reflects what the model actually has.
|
|
165
|
+
*/
|
|
166
|
+
protected registerApprovalsAwareTools<T extends DescribableTool>(tools: T[], options: {
|
|
167
|
+
rung: ApprovalRung;
|
|
168
|
+
gatedTools: readonly string[];
|
|
169
|
+
additionalToolNames?: readonly string[];
|
|
170
|
+
}): T[];
|
|
171
|
+
/**
|
|
172
|
+
* EXT-58 — the tool names registered with the graph at the last {@link init} (empty before it).
|
|
173
|
+
* The runner intersects these with the built-in summaries table to build the rater's
|
|
174
|
+
* granted-alternative list, so the rater can never name a tool this session does not have.
|
|
175
|
+
*/
|
|
176
|
+
getRegisteredToolNames(): string[];
|
|
177
|
+
/**
|
|
178
|
+
* EXT-70 §4.7.1 — what the MCP servers declared for their tools at the last {@link init}, keyed
|
|
179
|
+
* by registered tool name (empty before it, and on a session with no MCP servers).
|
|
180
|
+
*/
|
|
181
|
+
getDeclaredMcpToolAnnotations(): ReadonlyMap<string, DeclaredToolAnnotations>;
|
|
35
182
|
/**
|
|
36
183
|
* GS2-16 — clear the per-run analytics tally so the next turn starts from zero. The runner
|
|
37
184
|
* calls this at each turn boundary because it (and this agent) are reused across turns in an
|
|
@@ -50,10 +197,18 @@ export declare abstract class GthAbstractAgent implements GthAgentInterface {
|
|
|
50
197
|
*/
|
|
51
198
|
private getStateMessageCount;
|
|
52
199
|
/**
|
|
53
|
-
* Build the underlying compiled graph and assign it to {@link agent}. This is the
|
|
54
|
-
*
|
|
200
|
+
* Build the underlying compiled graph and assign it to {@link agent}. This is the part a
|
|
201
|
+
* backend implements; everything else on the base is shared.
|
|
202
|
+
*/
|
|
203
|
+
abstract init(command: GthCommand | undefined, configIn: GthConfig, checkpointer?: BaseCheckpointSaver | undefined, options?: GthAgentInitOptions): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* EXT-37 — surface a detected content-policy refusal: emit the clear, user-facing explanation at
|
|
206
|
+
* WARNING level (an empty-content refusal streams nothing, so without this the console shows
|
|
207
|
+
* nothing) and return the same message so it becomes the turn's terminal answer. Shared by the
|
|
208
|
+
* non-streaming {@link invoke} and streaming {@link streamFromInput} paths so both render a
|
|
209
|
+
* refusal identically. A refusal is a *successful* (if declined) response — never a retry.
|
|
55
210
|
*/
|
|
56
|
-
|
|
211
|
+
protected surfaceRefusal(info: RefusalInfo): string;
|
|
57
212
|
/**
|
|
58
213
|
* Invoke LLM with a message and runnable config.
|
|
59
214
|
* For streaming use {@link #stream} method, streaming is preferred if model API supports it.
|