@gaunt-sloth/core 2.0.0-alpha.35 → 2.0.0-alpha.37

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 (95) hide show
  1. package/dist/config/configDiscovery.d.ts +79 -0
  2. package/dist/config/configDiscovery.js +80 -0
  3. package/dist/config/configDiscovery.js.map +1 -0
  4. package/dist/config/loader.d.ts +6 -5
  5. package/dist/config/loader.js +229 -92
  6. package/dist/config/loader.js.map +1 -1
  7. package/dist/config/schema.d.ts +3 -2
  8. package/dist/config/schema.js +57 -9
  9. package/dist/config/schema.js.map +1 -1
  10. package/dist/config/shell-policy.d.ts +58 -26
  11. package/dist/config/shell-policy.js +60 -27
  12. package/dist/config/shell-policy.js.map +1 -1
  13. package/dist/config/tool-descriptions.d.ts +6 -6
  14. package/dist/config/tool-descriptions.js +7 -7
  15. package/dist/config/tool-descriptions.js.map +1 -1
  16. package/dist/config/types.d.ts +34 -31
  17. package/dist/config/types.js.map +1 -1
  18. package/dist/config.d.ts +3 -0
  19. package/dist/config.js +3 -0
  20. package/dist/config.js.map +1 -1
  21. package/dist/core/GthAbstractAgent.d.ts +11 -13
  22. package/dist/core/GthAbstractAgent.js +9 -11
  23. package/dist/core/GthAbstractAgent.js.map +1 -1
  24. package/dist/core/GthAgentRunner.d.ts +17 -33
  25. package/dist/core/GthAgentRunner.js +31 -41
  26. package/dist/core/GthAgentRunner.js.map +1 -1
  27. package/dist/core/GthLangChainAgent.js +25 -34
  28. package/dist/core/GthLangChainAgent.js.map +1 -1
  29. package/dist/core/approvals/toolAnnotationSources.d.ts +4 -4
  30. package/dist/core/approvals/toolAnnotationSources.js +8 -8
  31. package/dist/core/debugCapture.d.ts +2 -3
  32. package/dist/core/debugCapture.js +1 -2
  33. package/dist/core/debugCapture.js.map +1 -1
  34. package/dist/core/gthLeanAgentFactory.d.ts +4 -4
  35. package/dist/core/gthLeanAgentFactory.js +4 -4
  36. package/dist/core/launchBanner.d.ts +10 -0
  37. package/dist/core/launchBanner.js +6 -1
  38. package/dist/core/launchBanner.js.map +1 -1
  39. package/dist/core/reasoningBlocks.d.ts +7 -2
  40. package/dist/core/reasoningBlocks.js +7 -2
  41. package/dist/core/reasoningBlocks.js.map +1 -1
  42. package/dist/core/shell/ShellCommandFailedError.d.ts +3 -4
  43. package/dist/core/shell/ShellCommandFailedError.js +3 -4
  44. package/dist/core/shell/ShellCommandFailedError.js.map +1 -1
  45. package/dist/core/shell/approvalStop.d.ts +68 -29
  46. package/dist/core/shell/approvalStop.js +178 -28
  47. package/dist/core/shell/approvalStop.js.map +1 -1
  48. package/dist/core/shell/hardline.d.ts +22 -0
  49. package/dist/core/shell/hardline.js +81 -0
  50. package/dist/core/shell/hardline.js.map +1 -1
  51. package/dist/core/shell/negotiation.d.ts +81 -2
  52. package/dist/core/shell/negotiation.js +144 -11
  53. package/dist/core/shell/negotiation.js.map +1 -1
  54. package/dist/core/shell/rater.d.ts +7 -69
  55. package/dist/core/shell/rater.js +5 -24
  56. package/dist/core/shell/rater.js.map +1 -1
  57. package/dist/core/shell/raterVocabulary.d.ts +119 -0
  58. package/dist/core/shell/raterVocabulary.js +114 -0
  59. package/dist/core/shell/raterVocabulary.js.map +1 -0
  60. package/dist/core/types.d.ts +17 -3
  61. package/dist/providers/anthropic.js +12 -0
  62. package/dist/providers/anthropic.js.map +1 -1
  63. package/dist/providers/configurationPassthrough.d.ts +107 -0
  64. package/dist/providers/configurationPassthrough.js +148 -0
  65. package/dist/providers/configurationPassthrough.js.map +1 -0
  66. package/dist/providers/geminiThinking.d.ts +8 -0
  67. package/dist/providers/geminiThinking.js +33 -13
  68. package/dist/providers/geminiThinking.js.map +1 -1
  69. package/dist/providers/google-genai.js +11 -0
  70. package/dist/providers/google-genai.js.map +1 -1
  71. package/dist/providers/groq.js +12 -0
  72. package/dist/providers/groq.js.map +1 -1
  73. package/dist/providers/ollama.js +12 -0
  74. package/dist/providers/ollama.js.map +1 -1
  75. package/dist/providers/openrouter.d.ts +23 -0
  76. package/dist/providers/openrouter.js +71 -4
  77. package/dist/providers/openrouter.js.map +1 -1
  78. package/dist/providers/vertexai.js +12 -0
  79. package/dist/providers/vertexai.js.map +1 -1
  80. package/dist/providers/xai.js +20 -0
  81. package/dist/providers/xai.js.map +1 -1
  82. package/dist/runtime/conversation.d.ts +2 -2
  83. package/dist/runtime/conversation.js +19 -4
  84. package/dist/runtime/conversation.js.map +1 -1
  85. package/dist/runtime/singleShot.d.ts +2 -3
  86. package/dist/runtime/singleShot.js +22 -7
  87. package/dist/runtime/singleShot.js.map +1 -1
  88. package/dist/utils/systemPromptNotes.d.ts +17 -20
  89. package/dist/utils/systemPromptNotes.js +22 -24
  90. package/dist/utils/systemPromptNotes.js.map +1 -1
  91. package/dist/utils/untrustedText.d.ts +24 -4
  92. package/dist/utils/untrustedText.js +25 -4
  93. package/dist/utils/untrustedText.js.map +1 -1
  94. package/package.json +4 -4
  95. package/schema/gsloth-config.schema.json +0 -1
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * The catchable error a config **load** raises when the configuration itself cannot be used. The
4
+ * cases, all one class on purpose:
5
+ *
6
+ * - an explicitly-named identity profile (or an `extends` base) that resolves to no config;
7
+ * - a `--config` path that does not exist;
8
+ * - a config layer present but malformed — a removed pre-2.0 shape, a bad approvals rule grammar,
9
+ * a schema mismatch, an unresolvable `approvals.rater`;
10
+ * - a config that read fine but names no usable model — no `llm` block, no `llm.type`, an
11
+ * `llm.type` with no provider module, or a provider module that cannot build from a JSON spec;
12
+ * - a provider instance that could not be constructed for a reason other than a missing API key
13
+ * (that one is {@link MissingProviderKeyError}, which carries the key details);
14
+ * - no configuration file anywhere at all.
15
+ *
16
+ * Deliberately dependency-free (no imports beyond types) so the config barrel, the loader and
17
+ * downstream consumers can all reach it without an import cycle — the same shape
18
+ * `providerKeys.ts` uses for {@link MissingProviderKeyError}.
19
+ *
20
+ * **Why this is an error object and not a process exit.** Loading configuration is a *library*
21
+ * operation, and a library that terminates the process denies every caller the chance to classify
22
+ * the failure. `gth eval` in particular distinguishes a **harness** error (exit 2 — the suite could
23
+ * not be evaluated) from a **product** failure (exit 1 — the SUT ran and failed); a `process.exit(1)`
24
+ * inside config discovery collapses that contract, reporting a typo in `--judge` exactly as it
25
+ * reports a genuine regression. Callers that legitimately want to terminate — the CLI entry points —
26
+ * catch it at their top level, where the exit code is chosen deliberately.
27
+ *
28
+ * One class covers every case above on purpose: no caller needs to tell them apart (all of them mean
29
+ * "this configuration cannot be used"), and the fields carry whichever detail applies. Sub-classing
30
+ * per case would only push the callers back to the marker-list problem this class exists to end —
31
+ * a consumer that wants the underlying failure reads `cause`.
32
+ */
33
+ /** What a config load knows about the configuration it could not use. */
34
+ export interface ConfigDiscoveryDetails {
35
+ /**
36
+ * The explicitly-requested identity profile that did not resolve, when that is the failure.
37
+ * Undefined for a malformed-config failure, which is about a file rather than a profile name.
38
+ */
39
+ identityProfile?: string | undefined;
40
+ /**
41
+ * Human-readable source of the offending config layer (e.g. `.gsloth.config.json`,
42
+ * `.gsloth.config.json (global)`, `<name> (extends base)`), when a layer was read and rejected.
43
+ */
44
+ sourceLabel?: string | undefined;
45
+ }
46
+ /**
47
+ * A configuration could not be used: a named identity profile has no config, or a config layer is
48
+ * malformed.
49
+ *
50
+ * Thrown (never exited on) by the config loader, so `gth eval`, `gth batch`, the AG-UI/ACP servers
51
+ * and any embedding consumer can classify the failure and choose their own exit code.
52
+ */
53
+ export declare class ConfigDiscoveryError extends Error implements ConfigDiscoveryDetails {
54
+ /** Duck-typed marker so {@link isConfigDiscoveryError} works across duplicated module copies. */
55
+ readonly gthConfigDiscoveryError: true;
56
+ readonly identityProfile: string | undefined;
57
+ readonly sourceLabel: string | undefined;
58
+ constructor(message: string, details?: ConfigDiscoveryDetails, options?: {
59
+ cause?: unknown;
60
+ });
61
+ /**
62
+ * Serialize the machine-readable half. `JSON.stringify(error)` would otherwise drop `message`
63
+ * (an Error's `message` is a non-enumerable own property), which is exactly the field a report
64
+ * consumer shows a human next to the profile or the file that failed.
65
+ */
66
+ toJSON(): {
67
+ name: string;
68
+ message: string;
69
+ } & ConfigDiscoveryDetails;
70
+ }
71
+ /**
72
+ * True when `value` is a {@link ConfigDiscoveryError}.
73
+ *
74
+ * Duck-typed on the marker property rather than `instanceof` on purpose: a consumer that ends up
75
+ * with two copies of `@gaunt-sloth/core` on disk (a `file:` dep, a hoisting split) would fail an
76
+ * `instanceof` check against a genuinely-correct error and mis-handle a config failure as an
77
+ * unexpected crash — exactly the distinction this error exists to make.
78
+ */
79
+ export declare function isConfigDiscoveryError(value: unknown): value is ConfigDiscoveryError;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * The catchable error a config **load** raises when the configuration itself cannot be used. The
4
+ * cases, all one class on purpose:
5
+ *
6
+ * - an explicitly-named identity profile (or an `extends` base) that resolves to no config;
7
+ * - a `--config` path that does not exist;
8
+ * - a config layer present but malformed — a removed pre-2.0 shape, a bad approvals rule grammar,
9
+ * a schema mismatch, an unresolvable `approvals.rater`;
10
+ * - a config that read fine but names no usable model — no `llm` block, no `llm.type`, an
11
+ * `llm.type` with no provider module, or a provider module that cannot build from a JSON spec;
12
+ * - a provider instance that could not be constructed for a reason other than a missing API key
13
+ * (that one is {@link MissingProviderKeyError}, which carries the key details);
14
+ * - no configuration file anywhere at all.
15
+ *
16
+ * Deliberately dependency-free (no imports beyond types) so the config barrel, the loader and
17
+ * downstream consumers can all reach it without an import cycle — the same shape
18
+ * `providerKeys.ts` uses for {@link MissingProviderKeyError}.
19
+ *
20
+ * **Why this is an error object and not a process exit.** Loading configuration is a *library*
21
+ * operation, and a library that terminates the process denies every caller the chance to classify
22
+ * the failure. `gth eval` in particular distinguishes a **harness** error (exit 2 — the suite could
23
+ * not be evaluated) from a **product** failure (exit 1 — the SUT ran and failed); a `process.exit(1)`
24
+ * inside config discovery collapses that contract, reporting a typo in `--judge` exactly as it
25
+ * reports a genuine regression. Callers that legitimately want to terminate — the CLI entry points —
26
+ * catch it at their top level, where the exit code is chosen deliberately.
27
+ *
28
+ * One class covers every case above on purpose: no caller needs to tell them apart (all of them mean
29
+ * "this configuration cannot be used"), and the fields carry whichever detail applies. Sub-classing
30
+ * per case would only push the callers back to the marker-list problem this class exists to end —
31
+ * a consumer that wants the underlying failure reads `cause`.
32
+ */
33
+ /** Marker property carried by every {@link ConfigDiscoveryError}; see {@link isConfigDiscoveryError}. */
34
+ const CONFIG_DISCOVERY_MARKER = 'gthConfigDiscoveryError';
35
+ /**
36
+ * A configuration could not be used: a named identity profile has no config, or a config layer is
37
+ * malformed.
38
+ *
39
+ * Thrown (never exited on) by the config loader, so `gth eval`, `gth batch`, the AG-UI/ACP servers
40
+ * and any embedding consumer can classify the failure and choose their own exit code.
41
+ */
42
+ export class ConfigDiscoveryError extends Error {
43
+ /** Duck-typed marker so {@link isConfigDiscoveryError} works across duplicated module copies. */
44
+ gthConfigDiscoveryError = true;
45
+ identityProfile;
46
+ sourceLabel;
47
+ constructor(message, details = {}, options) {
48
+ super(message, options);
49
+ this.name = 'ConfigDiscoveryError';
50
+ this.identityProfile = details.identityProfile;
51
+ this.sourceLabel = details.sourceLabel;
52
+ }
53
+ /**
54
+ * Serialize the machine-readable half. `JSON.stringify(error)` would otherwise drop `message`
55
+ * (an Error's `message` is a non-enumerable own property), which is exactly the field a report
56
+ * consumer shows a human next to the profile or the file that failed.
57
+ */
58
+ toJSON() {
59
+ return {
60
+ name: this.name,
61
+ message: this.message,
62
+ identityProfile: this.identityProfile,
63
+ sourceLabel: this.sourceLabel,
64
+ };
65
+ }
66
+ }
67
+ /**
68
+ * True when `value` is a {@link ConfigDiscoveryError}.
69
+ *
70
+ * Duck-typed on the marker property rather than `instanceof` on purpose: a consumer that ends up
71
+ * with two copies of `@gaunt-sloth/core` on disk (a `file:` dep, a hoisting split) would fail an
72
+ * `instanceof` check against a genuinely-correct error and mis-handle a config failure as an
73
+ * unexpected crash — exactly the distinction this error exists to make.
74
+ */
75
+ export function isConfigDiscoveryError(value) {
76
+ return (typeof value === 'object' &&
77
+ value !== null &&
78
+ value[CONFIG_DISCOVERY_MARKER] === true);
79
+ }
80
+ //# sourceMappingURL=configDiscovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configDiscovery.js","sourceRoot":"","sources":["../../src/config/configDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,yGAAyG;AACzG,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAgB1D;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,iGAAiG;IACxF,uBAAuB,GAAG,IAAa,CAAC;IACxC,eAAe,CAAqB;IACpC,WAAW,CAAqB;IAEzC,YACE,OAAe,EACf,OAAO,GAA2B,EAAE,EACpC,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,uBAAuB,CAAC,KAAK,IAAI,CACrE,CAAC;AACJ,CAAC"}
@@ -38,11 +38,12 @@ export declare function findProjectConfigPath(commandLineConfigOverrides: Comman
38
38
  * config happens to be present / a global config exists," a distinction the loader's fall-through
39
39
  * deliberately blurs.
40
40
  *
41
- * PURE PREDICATE — never throws, never calls `exit` (contrast the loader's interactive-CLI
42
- * `exit(1)` safety net in {@link initConfig}). So batch/eval code (e.g. `gth eval --judge <profile>`
43
- * and BATCH-12's identity matrix) can pre-check an explicitly-requested profile and raise its OWN
44
- * catchable error / graceful exit code instead of dying on an uncatchable `process.exit`. A
45
- * blank/whitespace-only name counts as "no profile" → `undefined`.
41
+ * PURE PREDICATE — never throws, never calls `exit`, so it can be asked the question without
42
+ * committing to an outcome. {@link initConfig} uses it to enforce that an explicitly-named profile
43
+ * really exists (raising a catchable {@link ConfigDiscoveryError} when it does not), and callers
44
+ * that want to CLASSIFY rather than fail BATCH-12's identity matrix checks every declared identity
45
+ * up front so one message can name them all — ask it directly. A blank/whitespace-only name counts
46
+ * as "no profile" → `undefined`.
46
47
  *
47
48
  * @param identityProfile The explicitly-requested identity profile name.
48
49
  * @returns The resolved profile config path, or `undefined` when the profile has no config.