@gaunt-sloth/core 2.0.0-alpha.23 → 2.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -18
- 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/defaults.d.ts +6 -7
- package/dist/config/defaults.js +4 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/loader.d.ts +50 -3
- package/dist/config/loader.js +345 -29
- 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/schema.d.ts +2441 -116
- package/dist/config/schema.js +930 -19
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shell-policy.d.ts +466 -116
- package/dist/config/shell-policy.js +273 -62
- package/dist/config/shell-policy.js.map +1 -1
- package/dist/config/tool-descriptions.d.ts +165 -0
- package/dist/config/tool-descriptions.js +229 -0
- package/dist/config/tool-descriptions.js.map +1 -0
- package/dist/config/types.d.ts +139 -6
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +85 -2
- package/dist/core/GthAbstractAgent.js +194 -1
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +341 -58
- package/dist/core/GthAgentRunner.js +857 -149
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.d.ts +99 -0
- package/dist/core/GthLangChainAgent.js +388 -3
- 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/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 +16 -0
- package/dist/core/debugCapture.js.map +1 -1
- package/dist/core/launchBanner.d.ts +120 -0
- package/dist/core/launchBanner.js +399 -0
- package/dist/core/launchBanner.js.map +1 -0
- package/dist/core/plainToolIndication.js +61 -35
- package/dist/core/plainToolIndication.js.map +1 -1
- package/dist/core/refusal.d.ts +53 -0
- package/dist/core/refusal.js +129 -0
- package/dist/core/refusal.js.map +1 -0
- package/dist/core/shell/approvalStop.d.ts +75 -0
- package/dist/core/shell/approvalStop.js +108 -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/normalize.d.ts +41 -1
- package/dist/core/shell/normalize.js +58 -4
- package/dist/core/shell/normalize.js.map +1 -1
- package/dist/core/shell/openWorld.d.ts +138 -0
- package/dist/core/shell/openWorld.js +523 -0
- package/dist/core/shell/openWorld.js.map +1 -0
- package/dist/core/shell/rater.d.ts +560 -0
- package/dist/core/shell/rater.js +895 -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/rejection.d.ts +66 -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 +14 -1
- package/dist/core/toolDisplay.js +69 -12
- package/dist/core/toolDisplay.js.map +1 -1
- package/dist/core/toolOutputChannel.d.ts +33 -6
- package/dist/core/toolOutputChannel.js +61 -8
- package/dist/core/toolOutputChannel.js.map +1 -1
- package/dist/core/types.d.ts +71 -9
- package/dist/core/types.js.map +1 -1
- package/dist/providers/geminiSchemaSanitizer.d.ts +6 -3
- package/dist/providers/geminiSchemaSanitizer.js +152 -6
- package/dist/providers/geminiSchemaSanitizer.js.map +1 -1
- package/dist/providers/modelDiscovery.d.ts +18 -4
- package/dist/providers/modelDiscovery.js +67 -17
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/openai.js +34 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +8 -7
- package/dist/runtime/askStructured.js +8 -7
- package/dist/runtime/askStructured.js.map +1 -1
- package/dist/runtime/conversation.js +89 -76
- package/dist/runtime/conversation.js.map +1 -1
- package/dist/runtime/singleShot.js +71 -60
- package/dist/runtime/singleShot.js.map +1 -1
- 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/consoleUtils.d.ts +30 -0
- package/dist/utils/consoleUtils.js +27 -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 +58 -0
- package/dist/utils/debugDump.js +149 -15
- package/dist/utils/debugDump.js.map +1 -1
- package/dist/utils/llmUtils.d.ts +22 -8
- package/dist/utils/llmUtils.js +48 -8
- package/dist/utils/llmUtils.js.map +1 -1
- package/dist/utils/redactSecrets.js +68 -20
- package/dist/utils/redactSecrets.js.map +1 -1
- package/dist/utils/systemUtils.d.ts +17 -0
- package/dist/utils/systemUtils.js +17 -0
- package/dist/utils/systemUtils.js.map +1 -1
- package/package.json +5 -2
- package/schema/gsloth-config.schema.json +1484 -466
- 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/README.md
CHANGED
|
@@ -1,35 +1,60 @@
|
|
|
1
1
|
# @gaunt-sloth/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The foundation layer of Gaunt Sloth: the configuration system (`GthConfig`, config discovery and
|
|
4
|
+
loading, the JSON schema), the LLM provider factory (anthropic, deepseek, google-genai, groq,
|
|
5
|
+
huggingface, ollama, openai, openrouter, vertexai, xai, fake), the lean LangChain agent runtime
|
|
6
|
+
(`GthAgentRunner`), session history, and the shared utility modules (`consoleUtils`,
|
|
7
|
+
`systemUtils`, `fileUtils`, `llmUtils`, …).
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
**When to depend on this package** — you are embedding a piece of Gaunt Sloth (or building your
|
|
10
|
+
own front-end on its infrastructure) and need its config resolution and provider wiring without
|
|
11
|
+
the CLI. Every other `@gaunt-sloth/*` package builds on it. If you just want to use Gaunt Sloth
|
|
12
|
+
from the terminal, install the [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) app
|
|
13
|
+
instead.
|
|
6
14
|
|
|
7
|
-
|
|
8
|
-
- Agent infrastructure: `GthLangChainAgent`, `GthAgentRunner`
|
|
9
|
-
- LLM provider wrappers: anthropic, deepseek, google-genai, groq, openai, openrouter, vertexai, xai, fake
|
|
10
|
-
- Utility modules: `consoleUtils`, `debugUtils`, `fileUtils`, `llmUtils`, `systemUtils`, `stringUtils`, `aiignoreUtils`, `binaryOutputUtils`, `vertexaiUtils`, `globalConfigUtils`, `ProgressIndicator`
|
|
11
|
-
- State and artifact storage: `artifactStore`
|
|
12
|
-
- Shared constants and types
|
|
15
|
+
## Installation
|
|
13
16
|
|
|
14
|
-
AI vendor packages are
|
|
17
|
+
AI vendor packages are optional peer dependencies — install the provider(s) your configuration
|
|
18
|
+
uses alongside core:
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
```bash
|
|
21
|
+
npm install @gaunt-sloth/core @langchain/anthropic
|
|
22
|
+
```
|
|
19
23
|
|
|
20
|
-
##
|
|
24
|
+
## Embedding: resolve config into a live model
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
I want my script to honour the user's `.gsloth.config.*` (provider, model, API keys) instead of
|
|
27
|
+
hard-coding a vendor SDK. With a `.gsloth.config.json` such as
|
|
28
|
+
`{ "llm": { "type": "anthropic", "model": "claude-sonnet-4-5" } }` in the working directory:
|
|
23
29
|
|
|
24
30
|
```js
|
|
25
|
-
import {
|
|
26
|
-
|
|
31
|
+
import { initConfig } from '@gaunt-sloth/core';
|
|
32
|
+
|
|
33
|
+
const config = await initConfig({}); // discovers .gsloth.config.* up-tree from cwd
|
|
34
|
+
// config.llm is a live LangChain chat model built from that config
|
|
35
|
+
const response = await config.llm.invoke('Say hello');
|
|
36
|
+
console.log(response.text);
|
|
27
37
|
```
|
|
28
38
|
|
|
39
|
+
All config keys (providers, prompts, tools, per-command settings) are documented in
|
|
40
|
+
[the configuration guide](https://github.com/pukeko-robotics/gaunt-sloth/blob/main/docs/configuration/index.md).
|
|
41
|
+
|
|
42
|
+
## Exports
|
|
43
|
+
|
|
44
|
+
- `@gaunt-sloth/core` (the root export) is the public API: config
|
|
45
|
+
(`initConfig`, `GthConfig`, defaults), constants, core types, the lean agent factory, model
|
|
46
|
+
discovery, and session history.
|
|
47
|
+
- `@gaunt-sloth/core/<path>.js` deep paths (e.g. `@gaunt-sloth/core/config.js`,
|
|
48
|
+
`@gaunt-sloth/core/utils/consoleUtils.js`) mirror the internal `dist/` layout 1:1 and are a
|
|
49
|
+
deliberate part of the contract — the other `@gaunt-sloth/*` packages and downstream consumers
|
|
50
|
+
import them directly. They are supported at your own risk: internal files can move between
|
|
51
|
+
alpha/minor versions without a deprecation cycle. Prefer the root export where it suffices.
|
|
52
|
+
|
|
53
|
+
This package ships no binaries.
|
|
54
|
+
|
|
29
55
|
## Related packages
|
|
30
56
|
|
|
31
|
-
- [`@gaunt-sloth/core`](https://www.npmjs.com/package/@gaunt-sloth/core) — Core utilities, config, and agent infrastructure (this package) ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/core))
|
|
32
57
|
- [`@gaunt-sloth/agent`](https://www.npmjs.com/package/@gaunt-sloth/agent) — Agent runtime: built-in tools, filesystem toolkit, middleware registry, API server, AG-UI, MCP, and A2A integration ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/agent))
|
|
33
|
-
- [`@gaunt-sloth/review`](https://www.npmjs.com/package/@gaunt-sloth/review) — Review
|
|
58
|
+
- [`@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))
|
|
34
59
|
- [`@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))
|
|
35
60
|
- [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth) — Main CLI application ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/app))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG-30 — the single place that decides whether Gaunt Sloth emits ANSI colour.
|
|
3
|
+
*
|
|
4
|
+
* Everything this decision depends on arrives as an argument: no `process.env`, no `stdout`, no
|
|
5
|
+
* config merge. That keeps the ladder unit-testable rung by rung without touching process globals,
|
|
6
|
+
* and keeps the one mutation site ({@link setUseColour}, called from `mergeConfig`) unchanged.
|
|
7
|
+
*/
|
|
8
|
+
/** Everything the colour decision depends on. See {@link resolveUseColour}. */
|
|
9
|
+
export interface UseColourInput {
|
|
10
|
+
/**
|
|
11
|
+
* Raw `FORCE_COLOR` environment value; `undefined` when the variable is not set at all.
|
|
12
|
+
* The empty string is a SET value (`FORCE_COLOR=` on the command line) and means colour on.
|
|
13
|
+
*/
|
|
14
|
+
forceColor?: string;
|
|
15
|
+
/** Raw `NO_COLOR` environment value; `undefined` when the variable is not set at all. */
|
|
16
|
+
noColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* `useColour` as the user actually wrote it — read from the RAW config, BEFORE `DEFAULT_CONFIG`
|
|
19
|
+
* is merged in. `undefined` means the user set nothing, which is what rung 3 tests for; after the
|
|
20
|
+
* default merge an explicit `true` is indistinguishable from the default `true`, so this value
|
|
21
|
+
* must be captured pre-merge or the rung collapses.
|
|
22
|
+
*/
|
|
23
|
+
explicitUseColour?: boolean;
|
|
24
|
+
/** Whether stdout is a terminal. Rung 4's auto-detection; stdout, not stdin. */
|
|
25
|
+
stdoutIsTTY: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the effective colour setting from the four-rung precedence ladder, highest wins:
|
|
29
|
+
*
|
|
30
|
+
* 1. `FORCE_COLOR` is set — `"0"` or `"false"` turn colour OFF, ANY other value (including the
|
|
31
|
+
* empty string) turns it ON. This rung outranks everything below it, `NO_COLOR` included.
|
|
32
|
+
* 2. `NO_COLOR` is set and non-empty — colour OFF (the no-color.org convention: the variable's
|
|
33
|
+
* presence is the signal, its value is not, but an empty value does not count as set).
|
|
34
|
+
* 3. `useColour` was set explicitly in config — use it verbatim.
|
|
35
|
+
* 4. Otherwise auto-detect — colour ON when stdout is a terminal, OFF when it is piped or
|
|
36
|
+
* redirected, so captured output stays clean without any configuration.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveUseColour(input: UseColourInput): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG-30 — the single place that decides whether Gaunt Sloth emits ANSI colour.
|
|
3
|
+
*
|
|
4
|
+
* Everything this decision depends on arrives as an argument: no `process.env`, no `stdout`, no
|
|
5
|
+
* config merge. That keeps the ladder unit-testable rung by rung without touching process globals,
|
|
6
|
+
* and keeps the one mutation site ({@link setUseColour}, called from `mergeConfig`) unchanged.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the effective colour setting from the four-rung precedence ladder, highest wins:
|
|
10
|
+
*
|
|
11
|
+
* 1. `FORCE_COLOR` is set — `"0"` or `"false"` turn colour OFF, ANY other value (including the
|
|
12
|
+
* empty string) turns it ON. This rung outranks everything below it, `NO_COLOR` included.
|
|
13
|
+
* 2. `NO_COLOR` is set and non-empty — colour OFF (the no-color.org convention: the variable's
|
|
14
|
+
* presence is the signal, its value is not, but an empty value does not count as set).
|
|
15
|
+
* 3. `useColour` was set explicitly in config — use it verbatim.
|
|
16
|
+
* 4. Otherwise auto-detect — colour ON when stdout is a terminal, OFF when it is piped or
|
|
17
|
+
* redirected, so captured output stays clean without any configuration.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveUseColour(input) {
|
|
20
|
+
// Rung 1 — FORCE_COLOR, the deliberate "I know what I am doing" override. Checked first so a
|
|
21
|
+
// user can force colour through a NO_COLOR inherited from their shell profile or a CI image.
|
|
22
|
+
if (input.forceColor !== undefined) {
|
|
23
|
+
return !(input.forceColor === '0' || input.forceColor === 'false');
|
|
24
|
+
}
|
|
25
|
+
// Rung 2 — NO_COLOR (no-color.org), honoured by chalk, ripgrep, fd and delta.
|
|
26
|
+
if (input.noColor !== undefined && input.noColor !== '') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Rung 3 — the user's own config. Only reachable with an explicit value, never the default.
|
|
30
|
+
if (input.explicitUseColour !== undefined) {
|
|
31
|
+
return input.explicitUseColour;
|
|
32
|
+
}
|
|
33
|
+
// Rung 4 — auto-detect.
|
|
34
|
+
return input.stdoutIsTTY;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=colour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colour.js","sourceRoot":"","sources":["../../src/config/colour.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,6FAA6F;IAC7F,6FAA6F;IAC7F,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,8EAA8E;IAC9E,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4FAA4F;IAC5F,IAAI,KAAK,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,iBAAiB,CAAC;IACjC,CAAC;IAED,wBAAwB;IACxB,OAAO,KAAK,CAAC,WAAW,CAAC;AAC3B,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Default Gaunt Sloth configuration ({@link DEFAULT_CONFIG}). Extracted verbatim from
|
|
4
|
+
* the former `config.ts` god-file; values are unchanged.
|
|
5
|
+
*/
|
|
1
6
|
import { StatusLevel } from '#src/core/types.js';
|
|
2
7
|
/**
|
|
3
8
|
* Default config
|
|
@@ -5,17 +10,10 @@ import { StatusLevel } from '#src/core/types.js';
|
|
|
5
10
|
export declare const DEFAULT_CONFIG: {
|
|
6
11
|
readonly contentSource: 'file';
|
|
7
12
|
readonly requirementSource: 'file';
|
|
8
|
-
/**
|
|
9
|
-
* Path to project-specific guidelines.
|
|
10
|
-
* The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
|
|
11
|
-
* for example, to AGENTS.md
|
|
12
|
-
*/
|
|
13
|
-
readonly projectGuidelines: ".gsloth.guidelines.md";
|
|
14
13
|
/**
|
|
15
14
|
* Whether to include the current date in the project review instructions or not.
|
|
16
15
|
*/
|
|
17
16
|
readonly includeCurrentDateAfterGuidelines: false;
|
|
18
|
-
readonly projectReviewInstructions: ".gsloth.review.md";
|
|
19
17
|
readonly filesystem: 'none';
|
|
20
18
|
readonly builtInTools: string[];
|
|
21
19
|
readonly debugLog: false;
|
|
@@ -76,6 +74,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
76
74
|
readonly writeOutputToFile: false;
|
|
77
75
|
readonly writeBinaryOutputsToFile: true;
|
|
78
76
|
readonly useColour: true;
|
|
77
|
+
readonly useMouse: true;
|
|
79
78
|
readonly streamSessionInferenceLog: true;
|
|
80
79
|
readonly canInterruptInferenceWithEsc: true;
|
|
81
80
|
readonly aiignore: {
|
package/dist/config/defaults.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Default Gaunt Sloth configuration ({@link DEFAULT_CONFIG}). Extracted verbatim from
|
|
4
4
|
* the former `config.ts` god-file; values are unchanged.
|
|
5
5
|
*/
|
|
6
|
-
import { PROJECT_GUIDELINES, PROJECT_REVIEW_INSTRUCTIONS } from '#src/constants.js';
|
|
7
6
|
import { StatusLevel } from '#src/core/types.js';
|
|
8
7
|
/**
|
|
9
8
|
* Default config
|
|
@@ -11,17 +10,13 @@ import { StatusLevel } from '#src/core/types.js';
|
|
|
11
10
|
export const DEFAULT_CONFIG = {
|
|
12
11
|
contentSource: 'file',
|
|
13
12
|
requirementSource: 'file',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* for example, to AGENTS.md
|
|
18
|
-
*/
|
|
19
|
-
projectGuidelines: PROJECT_GUIDELINES,
|
|
13
|
+
// GS2-43: prompt segments (backstory/guidelines/system/chat/code/exec/review) are configured
|
|
14
|
+
// via the optional `prompts` object and DEFAULTED AT THE READ SITE (`readPromptSegment` falls
|
|
15
|
+
// back to each segment's default-named file), so `prompts` is intentionally absent here.
|
|
20
16
|
/**
|
|
21
17
|
* Whether to include the current date in the project review instructions or not.
|
|
22
18
|
*/
|
|
23
19
|
includeCurrentDateAfterGuidelines: false,
|
|
24
|
-
projectReviewInstructions: PROJECT_REVIEW_INSTRUCTIONS,
|
|
25
20
|
filesystem: 'none',
|
|
26
21
|
// Enabled built-in tools. `gth_checklist` (the lean agent's planning/todo tool) and `gth_grep`
|
|
27
22
|
// (the permission-light content-search tool, GS2-51) are on by default across commands; a user
|
|
@@ -87,6 +82,7 @@ export const DEFAULT_CONFIG = {
|
|
|
87
82
|
writeOutputToFile: false,
|
|
88
83
|
writeBinaryOutputsToFile: true,
|
|
89
84
|
useColour: true,
|
|
85
|
+
useMouse: true,
|
|
90
86
|
streamSessionInferenceLog: true,
|
|
91
87
|
canInterruptInferenceWithEsc: true,
|
|
92
88
|
aiignore: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa,EAAE,MAAM;IACrB,iBAAiB,EAAE,MAAM;IACzB,6FAA6F;IAC7F,8FAA8F;IAC9F,yFAAyF;IACzF;;OAEG;IACH,iCAAiC,EAAE,KAAK;IACxC,UAAU,EAAE,MAAM;IAClB,+FAA+F;IAC/F,+FAA+F;IAC/F,6FAA6F;IAC7F,6FAA6F;IAC7F,0BAA0B;IAC1B,YAAY,EAAE,CAAC,eAAe,EAAE,UAAU,CAAa;IACvD,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,WAAW,CAAC,IAAI,EAAE,mCAAmC;IACnE;;;;;;;;OAQG;IACH,QAAQ,EAAE;QACR,EAAE,EAAE;YACF,aAAa,EAAE,QAAQ;YACvB,iBAAiB,EAAE,QAAQ;YAC3B,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,CAAC;gBAChB,SAAS,EAAE,CAAC;gBACZ,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,IAAI;aACxB;SACF;QACD,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,CAAC;gBAChB,SAAS,EAAE,CAAC;gBACZ,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,IAAI;aACxB;SACF;QACD,GAAG,EAAE;YACH,UAAU,EAAE,MAAM;SACnB;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,MAAM;SACnB;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,KAAK;SAClB;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,KAAK;SAClB;QACD,GAAG,EAAE;YACH,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE;gBACJ,WAAW,EAAE,uBAAuB;gBACpC,YAAY,EAAE,oBAAoB;gBAClC,YAAY,EAAE,sBAAsB;aACrC;SACF;KACF;IACD,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,KAAK;IACxB,wBAAwB,EAAE,IAAI;IAC9B,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,yBAAyB,EAAE,IAAI;IAC/B,4BAA4B,EAAE,IAAI;IAClC,QAAQ,EAAE;QACR,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,SAAS;KACpB;CACO,CAAC;AAEX;;;GAGG;AACH,oEAAoE;AACpE,cAA2B,CAAC"}
|
package/dist/config/loader.d.ts
CHANGED
|
@@ -66,6 +66,40 @@ export declare function resolveIdentityProfileConfigPath(identityProfile: string
|
|
|
66
66
|
* @returns The raw global config object, or `undefined` when no global config exists.
|
|
67
67
|
*/
|
|
68
68
|
export declare function loadGlobalRawConfig(): Promise<Partial<RawGthConfig> | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* GS2-41 — resolve a named profile's `extends` inheritance into a single composed raw config,
|
|
71
|
+
* riding the SAME GS2-1 deep-merge the config LAYERS use (NO second merge engine). When the given
|
|
72
|
+
* profile config declares `extends: "<base>"`, the base profile's config resolves FIRST
|
|
73
|
+
* (recursively — a base may itself extend another, so base-of-base resolves first), then this
|
|
74
|
+
* profile's own fields merge on top with last-wins semantics: the child overrides the base, nested
|
|
75
|
+
* objects merge, arrays REPLACE except the additive-array fields (`allowDirs`, `aiignore.patterns`
|
|
76
|
+
* and the three `approvals` rule lists, see {@link isAdditiveArrayField}) which accumulate
|
|
77
|
+
* base+child. The `extends` key itself is consumed and never leaks into the composed output.
|
|
78
|
+
*
|
|
79
|
+
* A config WITHOUT `extends` is returned UNCHANGED — every non-inheriting config (the vast
|
|
80
|
+
* majority) is untouched and behaves exactly as before.
|
|
81
|
+
*
|
|
82
|
+
* Composition is CONFINED to the profile-dir layer: it produces the single raw config that then
|
|
83
|
+
* acts as the project-file layer the global config underlays and CLI flags overlay, preserving
|
|
84
|
+
* GS2-33's outer precedence `CLI flags > profile (base+child composed) > global > defaults`. It is
|
|
85
|
+
* therefore invoked in {@link initConfig} on the loaded project/profile config BEFORE
|
|
86
|
+
* {@link applyGlobalConfigBase}.
|
|
87
|
+
*
|
|
88
|
+
* The base profile is discovered with {@link resolveIdentityProfileConfigPath} (the SAME strict
|
|
89
|
+
* up-tree profile walk `--profile` uses), so `extends` names a profile exactly as a user selects
|
|
90
|
+
* one; a name with no config dir is a hard, clearly-named error.
|
|
91
|
+
*
|
|
92
|
+
* CYCLE GUARD: the chain of profile NAMES is tracked (seeded with the selected profile's own name);
|
|
93
|
+
* because `extends` is single-valued the chain is linear, so a repeated name — `A extends B extends
|
|
94
|
+
* A`, or a self-extend — is an unambiguous cycle and fails fast with a clear error NAMING the cycle,
|
|
95
|
+
* never infinite-looping / stack-overflowing. A hard {@link MAX_EXTENDS_CHAIN_DEPTH} cap backstops
|
|
96
|
+
* it regardless of how the base path was derived.
|
|
97
|
+
*
|
|
98
|
+
* @param rawConfig the just-loaded, schema-validated raw config that MAY declare `extends`.
|
|
99
|
+
* @param profileLabel the selected profile's own name (for cycle detection + messages); undefined
|
|
100
|
+
* for a plain (non-profile) project config.
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolveConfigExtends(rawConfig: Record<string, unknown>, profileLabel: string | undefined): Promise<Record<string, unknown>>;
|
|
69
103
|
/**
|
|
70
104
|
* ORDERING INVARIANT (GS2-11): detection ({@link hasProjectConfig}/{@link hasAnyConfig}) MUST run
|
|
71
105
|
* before {@link initConfig} in a given process. Both resolve cwd-level candidates via
|
|
@@ -107,11 +141,18 @@ export declare function initConfig(commandLineConfigOverrides: CommandLineConfig
|
|
|
107
141
|
export declare function tryJsonConfig(jsonConfig: RawGthConfig, commandLineConfigOverrides: CommandLineConfigOverrides): Promise<GthConfig>;
|
|
108
142
|
/**
|
|
109
143
|
* Resolve a fully-merged {@link GthConfig} from a partial config + CLI overrides WITHOUT
|
|
110
|
-
* any global side effects
|
|
111
|
-
*
|
|
112
|
-
*
|
|
144
|
+
* any global side effects. It deep-merges defaults, applies CLI overrides, resolves the numeric
|
|
145
|
+
* `consoleLevel` (warning + defaulting to INFO on an invalid value), and computes
|
|
146
|
+
* `canInterruptInferenceWithEsc` and `useColour`. The process-global setters (`setUseColour` /
|
|
113
147
|
* `setConsoleLevel`) are applied separately by {@link mergeConfig}, so this function can be
|
|
114
148
|
* reasoned about and reused without touching global state.
|
|
149
|
+
*
|
|
150
|
+
* It WRITES nothing globally, but it does READ the environment: `canInterruptInferenceWithEsc`
|
|
151
|
+
* consults stdin's TTY status, and (CFG-30) `useColour` consults `FORCE_COLOR`, `NO_COLOR` and
|
|
152
|
+
* stdout's TTY status. So it is deterministic for a given environment rather than a pure function
|
|
153
|
+
* of its arguments — a test that pins a resolved config should declare the terminal and the colour
|
|
154
|
+
* environment it expects in its setup. The ladder itself is a pure helper
|
|
155
|
+
* ({@link resolveUseColour}) so it can be tested rung by rung without process globals.
|
|
115
156
|
*/
|
|
116
157
|
export declare function resolveConfig(partialConfig: Omit<Partial<GthConfig>, 'consoleLevel'> & {
|
|
117
158
|
consoleLevel?: ConsoleLevelInput;
|
|
@@ -165,5 +206,11 @@ export interface ConfigValidationReport {
|
|
|
165
206
|
* global (no layer added) but is surfaced with a `displayWarning` — exactly as a run does (it
|
|
166
207
|
* warns the user while ignoring the broken global's value) — see {@link
|
|
167
208
|
* loadGlobalRawConfigUnvalidated}.
|
|
209
|
+
*
|
|
210
|
+
* GS2-73 — for the PROJECT layer it also walks the GS2-41 profile `extends` chain (via the SAME
|
|
211
|
+
* {@link composeExtends}/{@link resolveExtendsChain} the run path uses), so a cycle or a missing
|
|
212
|
+
* base — which fail a real run — is reported here as a not-ok layer instead of passing OK and only
|
|
213
|
+
* failing at run time. The GLOBAL layer is NOT walked, mirroring the run (`resolveConfigExtends`
|
|
214
|
+
* runs on the project/profile layer only).
|
|
168
215
|
*/
|
|
169
216
|
export declare function validateConfig(commandLineConfigOverrides: CommandLineConfigOverrides): Promise<ConfigValidationReport>;
|