@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.
Files changed (154) hide show
  1. package/README.md +43 -18
  2. package/dist/config/colour.d.ts +38 -0
  3. package/dist/config/colour.js +36 -0
  4. package/dist/config/colour.js.map +1 -0
  5. package/dist/config/defaults.d.ts +6 -7
  6. package/dist/config/defaults.js +4 -8
  7. package/dist/config/defaults.js.map +1 -1
  8. package/dist/config/loader.d.ts +50 -3
  9. package/dist/config/loader.js +345 -29
  10. package/dist/config/loader.js.map +1 -1
  11. package/dist/config/mouse.d.ts +50 -0
  12. package/dist/config/mouse.js +44 -0
  13. package/dist/config/mouse.js.map +1 -0
  14. package/dist/config/profiles.d.ts +68 -0
  15. package/dist/config/profiles.js +93 -0
  16. package/dist/config/profiles.js.map +1 -0
  17. package/dist/config/schema.d.ts +2441 -116
  18. package/dist/config/schema.js +930 -19
  19. package/dist/config/schema.js.map +1 -1
  20. package/dist/config/shell-policy.d.ts +466 -116
  21. package/dist/config/shell-policy.js +273 -62
  22. package/dist/config/shell-policy.js.map +1 -1
  23. package/dist/config/tool-descriptions.d.ts +165 -0
  24. package/dist/config/tool-descriptions.js +229 -0
  25. package/dist/config/tool-descriptions.js.map +1 -0
  26. package/dist/config/types.d.ts +139 -6
  27. package/dist/config/types.js.map +1 -1
  28. package/dist/config.d.ts +4 -0
  29. package/dist/config.js +4 -0
  30. package/dist/config.js.map +1 -1
  31. package/dist/core/GthAbstractAgent.d.ts +85 -2
  32. package/dist/core/GthAbstractAgent.js +194 -1
  33. package/dist/core/GthAbstractAgent.js.map +1 -1
  34. package/dist/core/GthAgentRunner.d.ts +341 -58
  35. package/dist/core/GthAgentRunner.js +857 -149
  36. package/dist/core/GthAgentRunner.js.map +1 -1
  37. package/dist/core/GthLangChainAgent.d.ts +99 -0
  38. package/dist/core/GthLangChainAgent.js +388 -3
  39. package/dist/core/GthLangChainAgent.js.map +1 -1
  40. package/dist/core/approvals/annotations.d.ts +122 -0
  41. package/dist/core/approvals/annotations.js +137 -0
  42. package/dist/core/approvals/annotations.js.map +1 -0
  43. package/dist/core/approvals/grants.d.ts +216 -0
  44. package/dist/core/approvals/grants.js +469 -0
  45. package/dist/core/approvals/grants.js.map +1 -0
  46. package/dist/core/approvals/matcher.d.ts +202 -0
  47. package/dist/core/approvals/matcher.js +267 -0
  48. package/dist/core/approvals/matcher.js.map +1 -0
  49. package/dist/core/approvals/mcpSubjects.d.ts +40 -0
  50. package/dist/core/approvals/mcpSubjects.js +99 -0
  51. package/dist/core/approvals/mcpSubjects.js.map +1 -0
  52. package/dist/core/approvals/toolAnnotationSources.d.ts +105 -0
  53. package/dist/core/approvals/toolAnnotationSources.js +277 -0
  54. package/dist/core/approvals/toolAnnotationSources.js.map +1 -0
  55. package/dist/core/approvals/toolHost.d.ts +46 -0
  56. package/dist/core/approvals/toolHost.js +108 -0
  57. package/dist/core/approvals/toolHost.js.map +1 -0
  58. package/dist/core/debugCapture.d.ts +16 -0
  59. package/dist/core/debugCapture.js.map +1 -1
  60. package/dist/core/launchBanner.d.ts +120 -0
  61. package/dist/core/launchBanner.js +399 -0
  62. package/dist/core/launchBanner.js.map +1 -0
  63. package/dist/core/plainToolIndication.js +61 -35
  64. package/dist/core/plainToolIndication.js.map +1 -1
  65. package/dist/core/refusal.d.ts +53 -0
  66. package/dist/core/refusal.js +129 -0
  67. package/dist/core/refusal.js.map +1 -0
  68. package/dist/core/shell/approvalStop.d.ts +75 -0
  69. package/dist/core/shell/approvalStop.js +108 -0
  70. package/dist/core/shell/approvalStop.js.map +1 -0
  71. package/dist/core/shell/arity.d.ts +6 -0
  72. package/dist/core/shell/arity.js +20 -6
  73. package/dist/core/shell/arity.js.map +1 -1
  74. package/dist/core/shell/denylist.d.ts +11 -0
  75. package/dist/core/shell/denylist.js +37 -0
  76. package/dist/core/shell/denylist.js.map +1 -0
  77. package/dist/core/shell/normalize.d.ts +41 -1
  78. package/dist/core/shell/normalize.js +58 -4
  79. package/dist/core/shell/normalize.js.map +1 -1
  80. package/dist/core/shell/openWorld.d.ts +138 -0
  81. package/dist/core/shell/openWorld.js +523 -0
  82. package/dist/core/shell/openWorld.js.map +1 -0
  83. package/dist/core/shell/rater.d.ts +560 -0
  84. package/dist/core/shell/rater.js +895 -0
  85. package/dist/core/shell/rater.js.map +1 -0
  86. package/dist/core/shell/raterModel.d.ts +41 -0
  87. package/dist/core/shell/raterModel.js +51 -0
  88. package/dist/core/shell/raterModel.js.map +1 -0
  89. package/dist/core/shell/rejection.d.ts +66 -0
  90. package/dist/core/shell/rejection.js +38 -0
  91. package/dist/core/shell/rejection.js.map +1 -0
  92. package/dist/core/toolCallRepair/grammar.d.ts +41 -0
  93. package/dist/core/toolCallRepair/grammar.js +116 -0
  94. package/dist/core/toolCallRepair/grammar.js.map +1 -0
  95. package/dist/core/toolCallRepair/index.d.ts +2 -0
  96. package/dist/core/toolCallRepair/index.js +7 -0
  97. package/dist/core/toolCallRepair/index.js.map +1 -0
  98. package/dist/core/toolCallRepair/payload.d.ts +36 -0
  99. package/dist/core/toolCallRepair/payload.js +341 -0
  100. package/dist/core/toolCallRepair/payload.js.map +1 -0
  101. package/dist/core/toolCallRepair/promote.d.ts +45 -0
  102. package/dist/core/toolCallRepair/promote.js +90 -0
  103. package/dist/core/toolCallRepair/promote.js.map +1 -0
  104. package/dist/core/toolDisplay.d.ts +14 -1
  105. package/dist/core/toolDisplay.js +69 -12
  106. package/dist/core/toolDisplay.js.map +1 -1
  107. package/dist/core/toolOutputChannel.d.ts +33 -6
  108. package/dist/core/toolOutputChannel.js +61 -8
  109. package/dist/core/toolOutputChannel.js.map +1 -1
  110. package/dist/core/types.d.ts +71 -9
  111. package/dist/core/types.js.map +1 -1
  112. package/dist/providers/geminiSchemaSanitizer.d.ts +6 -3
  113. package/dist/providers/geminiSchemaSanitizer.js +152 -6
  114. package/dist/providers/geminiSchemaSanitizer.js.map +1 -1
  115. package/dist/providers/modelDiscovery.d.ts +18 -4
  116. package/dist/providers/modelDiscovery.js +67 -17
  117. package/dist/providers/modelDiscovery.js.map +1 -1
  118. package/dist/providers/openai.js +34 -0
  119. package/dist/providers/openai.js.map +1 -1
  120. package/dist/runtime/askStructured.d.ts +8 -7
  121. package/dist/runtime/askStructured.js +8 -7
  122. package/dist/runtime/askStructured.js.map +1 -1
  123. package/dist/runtime/conversation.js +89 -76
  124. package/dist/runtime/conversation.js.map +1 -1
  125. package/dist/runtime/singleShot.js +71 -60
  126. package/dist/runtime/singleShot.js.map +1 -1
  127. package/dist/utils/ProgressIndicator.d.ts +21 -0
  128. package/dist/utils/ProgressIndicator.js +30 -3
  129. package/dist/utils/ProgressIndicator.js.map +1 -1
  130. package/dist/utils/consoleUtils.d.ts +30 -0
  131. package/dist/utils/consoleUtils.js +27 -2
  132. package/dist/utils/consoleUtils.js.map +1 -1
  133. package/dist/utils/crashHandler.d.ts +87 -0
  134. package/dist/utils/crashHandler.js +128 -0
  135. package/dist/utils/crashHandler.js.map +1 -0
  136. package/dist/utils/debugDump.d.ts +58 -0
  137. package/dist/utils/debugDump.js +149 -15
  138. package/dist/utils/debugDump.js.map +1 -1
  139. package/dist/utils/llmUtils.d.ts +22 -8
  140. package/dist/utils/llmUtils.js +48 -8
  141. package/dist/utils/llmUtils.js.map +1 -1
  142. package/dist/utils/redactSecrets.js +68 -20
  143. package/dist/utils/redactSecrets.js.map +1 -1
  144. package/dist/utils/systemUtils.d.ts +17 -0
  145. package/dist/utils/systemUtils.js +17 -0
  146. package/dist/utils/systemUtils.js.map +1 -1
  147. package/package.json +5 -2
  148. package/schema/gsloth-config.schema.json +1484 -466
  149. package/dist/core/shell/allowlist.d.ts +0 -75
  150. package/dist/core/shell/allowlist.js +0 -187
  151. package/dist/core/shell/allowlist.js.map +0 -1
  152. package/dist/core/shell/judge.d.ts +0 -161
  153. package/dist/core/shell/judge.js +0 -261
  154. 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
- Core utilities and types for Gaunt Sloth.
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
- ## Contents
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
- - Configuration system (`GthConfig`, `RawGthConfig`, config loading and post-processing)
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 not direct dependencies. Each vendor package is an optional peer dependency, resolved at runtime by whichever consumer (e.g. `gaunt-sloth`) pulls them in.
17
+ AI vendor packages are optional peer dependencies install the provider(s) your configuration
18
+ uses alongside core:
15
19
 
16
- ## Dependencies
17
-
18
- No other `@gaunt-sloth/*` packages.
20
+ ```bash
21
+ npm install @gaunt-sloth/core @langchain/anthropic
22
+ ```
19
23
 
20
- ## Exports
24
+ ## Embedding: resolve config into a live model
21
25
 
22
- All modules are exported via the `./` export map pattern (`./*.js`), e.g.:
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 { GthAgentRunner } from '@gaunt-sloth/core/agentRunner.js';
26
- import { display } from '@gaunt-sloth/core/utils/consoleUtils.js';
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 and Q&A modules with standalone CLI ([source](https://github.com/pukeko-robotics/gaunt-sloth/tree/main/packages/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: {
@@ -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
- * Path to project-specific guidelines.
16
- * The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
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,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa,EAAE,MAAM;IACrB,iBAAiB,EAAE,MAAM;IACzB;;;;OAIG;IACH,iBAAiB,EAAE,kBAAkB;IACrC;;OAEG;IACH,iCAAiC,EAAE,KAAK;IACxC,yBAAyB,EAAE,2BAA2B;IACtD,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,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"}
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"}
@@ -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 (a pure transform). It deep-merges defaults, applies CLI overrides,
111
- * resolves the numeric `consoleLevel` (warning + defaulting to INFO on an invalid value), and
112
- * computes `canInterruptInferenceWithEsc`. The process-global setters (`setUseColour` /
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>;