@gaunt-sloth/core 2.0.0-alpha.2 → 2.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gsloth.code.md +10 -0
- package/README.md +6 -6
- package/dist/config/defaults.d.ts +85 -0
- package/dist/config/defaults.js +103 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/jsonc.d.ts +12 -0
- package/dist/config/jsonc.js +41 -0
- package/dist/config/jsonc.js.map +1 -0
- package/dist/config/loader.d.ts +169 -0
- package/dist/config/loader.js +872 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +673 -0
- package/dist/config/schema.js +524 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/shell-policy.d.ts +331 -0
- package/dist/config/shell-policy.js +238 -0
- package/dist/config/shell-policy.js.map +1 -0
- package/dist/config/types.d.ts +596 -0
- package/dist/config/types.js +13 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config.d.ts +18 -647
- package/dist/config.js +15 -516
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +42 -0
- package/dist/constants.js +42 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +85 -2
- package/dist/core/GthAbstractAgent.js +398 -28
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +158 -1
- package/dist/core/GthAgentRunner.js +367 -4
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.js +193 -16
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/debugCapture.d.ts +59 -0
- package/dist/core/debugCapture.js +101 -0
- package/dist/core/debugCapture.js.map +1 -0
- package/dist/core/gthLeanAgentFactory.d.ts +9 -0
- package/dist/core/gthLeanAgentFactory.js +10 -0
- package/dist/core/gthLeanAgentFactory.js.map +1 -0
- package/dist/core/plainToolIndication.d.ts +15 -0
- package/dist/core/plainToolIndication.js +148 -0
- package/dist/core/plainToolIndication.js.map +1 -0
- package/dist/core/runStats.d.ts +41 -0
- package/dist/core/runStats.js +73 -0
- package/dist/core/runStats.js.map +1 -0
- package/dist/core/shell/ShellCommandFailedError.d.ts +54 -0
- package/dist/core/shell/ShellCommandFailedError.js +68 -0
- package/dist/core/shell/ShellCommandFailedError.js.map +1 -0
- package/dist/core/shell/allowlist.d.ts +75 -0
- package/dist/core/shell/allowlist.js +187 -0
- package/dist/core/shell/allowlist.js.map +1 -0
- package/dist/core/shell/arity.d.ts +75 -0
- package/dist/core/shell/arity.js +313 -0
- package/dist/core/shell/arity.js.map +1 -0
- package/dist/core/shell/judge.d.ts +161 -0
- package/dist/core/shell/judge.js +261 -0
- package/dist/core/shell/judge.js.map +1 -0
- package/dist/core/shell/normalize.d.ts +27 -0
- package/dist/core/shell/normalize.js +53 -0
- package/dist/core/shell/normalize.js.map +1 -0
- package/dist/core/toolDisplay.d.ts +101 -0
- package/dist/core/toolDisplay.js +374 -0
- package/dist/core/toolDisplay.js.map +1 -0
- package/dist/core/toolOutputChannel.d.ts +68 -0
- package/dist/core/toolOutputChannel.js +112 -0
- package/dist/core/toolOutputChannel.js.map +1 -0
- package/dist/core/types.d.ts +173 -0
- package/dist/core/types.js.map +1 -1
- package/dist/history/historyFormat.d.ts +28 -0
- package/dist/history/historyFormat.js +127 -0
- package/dist/history/historyFormat.js.map +1 -0
- package/dist/history/historyStore.d.ts +198 -0
- package/dist/history/historyStore.js +482 -0
- package/dist/history/historyStore.js.map +1 -0
- package/dist/history/recordSession.d.ts +37 -0
- package/dist/history/recordSession.js +56 -0
- package/dist/history/recordSession.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +5 -10
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/deepseek.d.ts +1 -1
- package/dist/providers/deepseek.js +5 -10
- package/dist/providers/deepseek.js.map +1 -1
- package/dist/providers/geminiSchemaSanitizer.d.ts +52 -0
- package/dist/providers/geminiSchemaSanitizer.js +201 -0
- package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
- package/dist/providers/google-genai.d.ts +1 -1
- package/dist/providers/google-genai.js +9 -11
- package/dist/providers/google-genai.js.map +1 -1
- package/dist/providers/groq.d.ts +1 -1
- package/dist/providers/groq.js +5 -10
- package/dist/providers/groq.js.map +1 -1
- package/dist/providers/huggingface.d.ts +25 -0
- package/dist/providers/huggingface.js +69 -0
- package/dist/providers/huggingface.js.map +1 -0
- package/dist/providers/modelCatalog.d.ts +109 -0
- package/dist/providers/modelCatalog.js +245 -0
- package/dist/providers/modelCatalog.js.map +1 -0
- package/dist/providers/modelDiscovery.d.ts +111 -3
- package/dist/providers/modelDiscovery.js +183 -27
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.d.ts +19 -5
- package/dist/providers/ollama.js +60 -52
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +5 -10
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +12 -12
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.d.ts +1 -1
- package/dist/providers/vertexai.js +9 -11
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +5 -10
- package/dist/providers/xai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +62 -0
- package/dist/runtime/askStructured.js +76 -0
- package/dist/runtime/askStructured.js.map +1 -0
- package/dist/runtime/conversation.d.ts +59 -0
- package/dist/runtime/conversation.js +137 -0
- package/dist/runtime/conversation.js.map +1 -0
- package/dist/runtime/singleShot.d.ts +24 -5
- package/dist/runtime/singleShot.js +56 -9
- package/dist/runtime/singleShot.js.map +1 -1
- package/dist/utils/aiignoreUtils.js.map +1 -1
- package/dist/utils/binaryOutputUtils.js.map +1 -1
- package/dist/utils/consoleUtils.d.ts +22 -0
- package/dist/utils/consoleUtils.js +45 -0
- package/dist/utils/consoleUtils.js.map +1 -1
- package/dist/utils/debugDump.d.ts +57 -0
- package/dist/utils/debugDump.js +236 -0
- package/dist/utils/debugDump.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +13 -4
- package/dist/utils/debugUtils.js +36 -13
- package/dist/utils/debugUtils.js.map +1 -1
- package/dist/utils/fileUtils.d.ts +24 -2
- package/dist/utils/fileUtils.js +54 -12
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/llmUtils.js.map +1 -1
- package/dist/utils/redactSecrets.d.ts +63 -0
- package/dist/utils/redactSecrets.js +238 -0
- package/dist/utils/redactSecrets.js.map +1 -0
- package/dist/utils/systemPromptNotes.d.ts +181 -0
- package/dist/utils/systemPromptNotes.js +298 -0
- package/dist/utils/systemPromptNotes.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +32 -1
- package/dist/utils/systemUtils.js +50 -3
- package/dist/utils/systemUtils.js.map +1 -1
- package/dist/utils/toolMatching.d.ts +30 -0
- package/dist/utils/toolMatching.js +44 -0
- package/dist/utils/toolMatching.js.map +1 -0
- package/package.json +17 -8
- package/schema/gsloth-config.schema.json +2111 -0
|
@@ -2,8 +2,10 @@ import { defaultStatusCallback, display, displayError, displaySuccess, flushSess
|
|
|
2
2
|
import { getCommandOutputFilePath } from '#src/utils/fileUtils.js';
|
|
3
3
|
import { GthAgentRunner } from '#src/core/GthAgentRunner.js';
|
|
4
4
|
import { MemorySaver } from '@langchain/langgraph';
|
|
5
|
-
import { HumanMessage
|
|
5
|
+
import { HumanMessage } from '@langchain/core/messages';
|
|
6
6
|
import { ProgressIndicator } from '#src/utils/ProgressIndicator.js';
|
|
7
|
+
import { recordSessionSafe } from '#src/history/recordSession.js';
|
|
8
|
+
import { getProjectDir } from '#src/utils/systemUtils.js';
|
|
7
9
|
/**
|
|
8
10
|
* Ask a question and get an answer from the LLM.
|
|
9
11
|
*
|
|
@@ -12,28 +14,47 @@ import { ProgressIndicator } from '#src/utils/ProgressIndicator.js';
|
|
|
12
14
|
* is forwarded to the agent so it can pick the right mode prompt (e.g. exec-mode for `exec`).
|
|
13
15
|
*
|
|
14
16
|
* @param source - The source of the question (used for file naming)
|
|
15
|
-
* @param
|
|
17
|
+
* @param _preamble - Deprecated/ignored (BATCH-13): the agent composes the system prompt itself;
|
|
18
|
+
* see the body comment. Retained positionally so existing callers need no change.
|
|
16
19
|
* @param content - The content of the question
|
|
17
20
|
* @param config - The resolved config
|
|
18
21
|
* @param resolvers - Optional agent resolvers (tools/middleware)
|
|
19
22
|
* @param command - The originating command (defaults to `ask`); selects the agent mode prompt
|
|
20
|
-
* @
|
|
21
|
-
*
|
|
23
|
+
* @param agentFactory - Optional backend factory (B5). When omitted the runner uses its built-in
|
|
24
|
+
* lean {@link GthLangChainAgent} default (unchanged behavior for existing callers). The app
|
|
25
|
+
* layer passes `resolveAgentFactory(config, 'lean')` so an explicit `agent.backend` is honored.
|
|
26
|
+
* @returns A {@link SingleShotResult}: `ok` is `true` when the run completed without error, `false`
|
|
27
|
+
* when it failed (so callers such as `exec` can set a non-zero exit code); `answer`/`tokensInput`/
|
|
28
|
+
* `tokensOutput`/`tools` carry the SUT's answer text and run stats for callers that need them
|
|
29
|
+
* (e.g. `gth batch`/`gth eval`).
|
|
22
30
|
*/
|
|
23
|
-
export async function runSingleShot(source,
|
|
31
|
+
export async function runSingleShot(source,
|
|
32
|
+
// BATCH-13: `_preamble` is retained for signature stability but is NO LONGER injected as a
|
|
33
|
+
// SystemMessage. The agent backends (lean `GthLangChainAgent` since GS2-21, and `GthDeepAgent`)
|
|
34
|
+
// each COMPOSE the full system prompt themselves from the same config — backstory + guidelines +
|
|
35
|
+
// per-command mode prompt + system prompt, PLUS the model-identity (GS2-34) and MCP-instructions
|
|
36
|
+
// (EXT-32) notes — and hand it to `createAgent` as `systemPrompt`. Also passing this preamble as a
|
|
37
|
+
// leading SystemMessage produced TWO system messages, which `@langchain/anthropic` rejects
|
|
38
|
+
// ("System messages are only permitted as the first passed message"), breaking EVERY single-shot
|
|
39
|
+
// run (ask/exec/batch/eval) on Anthropic on BOTH backends (Google/OpenAI silently merged them).
|
|
40
|
+
// The agent's composed prompt is a superset of this preamble, so dropping it is content-preserving.
|
|
41
|
+
_preamble, content, config, resolvers, command = 'ask', agentFactory) {
|
|
24
42
|
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Thinking.');
|
|
25
|
-
|
|
43
|
+
// Only the human turn: the agent supplies the system prompt via `createAgent({ systemPrompt })`.
|
|
44
|
+
const messages = [new HumanMessage(content)];
|
|
26
45
|
// Resolve output path and initialize session logging if enabled
|
|
27
46
|
const filePath = getCommandOutputFilePath(config, source);
|
|
28
47
|
if (filePath) {
|
|
29
48
|
initSessionLogging(filePath, config.streamSessionInferenceLog);
|
|
30
49
|
}
|
|
31
50
|
// Run via Agent Runner (consistent with interactive session)
|
|
32
|
-
const runner = new GthAgentRunner(defaultStatusCallback, resolvers);
|
|
51
|
+
const runner = new GthAgentRunner(defaultStatusCallback, resolvers, agentFactory);
|
|
33
52
|
let succeeded = true;
|
|
53
|
+
let responseText = '';
|
|
54
|
+
const startedAt = Date.now();
|
|
34
55
|
try {
|
|
35
56
|
await runner.init(command, config, new MemorySaver());
|
|
36
|
-
await runner.processMessages(messages);
|
|
57
|
+
responseText = await runner.processMessages(messages);
|
|
37
58
|
}
|
|
38
59
|
catch (err) {
|
|
39
60
|
succeeded = false;
|
|
@@ -42,6 +63,32 @@ export async function runSingleShot(source, preamble, content, config, resolvers
|
|
|
42
63
|
finally {
|
|
43
64
|
await runner.cleanup();
|
|
44
65
|
}
|
|
66
|
+
// GS2-16: live token usage + invoked tool names for this run (fail-soft; empty when the
|
|
67
|
+
// provider reported no usage / the runner has no stats). Read post-cleanup — the runner
|
|
68
|
+
// snapshots stats at cleanup() so this still reflects the finished run.
|
|
69
|
+
let runStats = { tools: [] };
|
|
70
|
+
try {
|
|
71
|
+
const s = runner.getRunStats?.();
|
|
72
|
+
if (s)
|
|
73
|
+
runStats = s;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
/* fail-soft: analytics must never affect this run */
|
|
77
|
+
}
|
|
78
|
+
// GS2-7 (B20): opt-in, fail-soft session history. A no-op unless `history.enabled`; never throws
|
|
79
|
+
// (recordSessionSafe is fully guarded) so a DB problem can't abort or alter this run.
|
|
80
|
+
// GS2-16 threads token/tool analytics; costUsd is intentionally left unset (no reliable price).
|
|
81
|
+
recordSessionSafe(config, {
|
|
82
|
+
command,
|
|
83
|
+
project: getProjectDir(),
|
|
84
|
+
model: config.modelDisplayName,
|
|
85
|
+
prompt: content,
|
|
86
|
+
response: responseText,
|
|
87
|
+
tokensInput: runStats.tokensInput,
|
|
88
|
+
tokensOutput: runStats.tokensOutput,
|
|
89
|
+
tools: runStats.tools.length > 0 ? runStats.tools : undefined,
|
|
90
|
+
durationMs: Date.now() - startedAt,
|
|
91
|
+
});
|
|
45
92
|
progressIndicator?.stop();
|
|
46
93
|
if (config.writeOutputToFile === false) {
|
|
47
94
|
display('\n'); // something going on in some terminals, they swallow last line of output
|
|
@@ -57,6 +104,6 @@ export async function runSingleShot(source, preamble, content, config, resolvers
|
|
|
57
104
|
displayError(error instanceof Error ? error.message : String(error));
|
|
58
105
|
}
|
|
59
106
|
}
|
|
60
|
-
return succeeded;
|
|
107
|
+
return { ok: succeeded, answer: responseText, ...runStats };
|
|
61
108
|
}
|
|
62
109
|
//# sourceMappingURL=singleShot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleShot.js","sourceRoot":"","sources":["../../src/runtime/singleShot.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,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AI,CAAC,uBAAuB,WAAW,CAAC,QAAQ,QAAQ,QAAQ,EAAE,CAAC,CAAC;QACtF,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,gBAAgB,GAAG,kCAAkC,WAAW,CAAC,QAAQ,GAAG,CAAC;YACnF,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO;QACL,eAAe,EAAE,sBAAsB,CAAC,OAAO,EAAE,cAAc,CAAC;QAChE,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -18,10 +18,32 @@ export declare const resetConsoleLevel: () => void;
|
|
|
18
18
|
export declare const flushSessionLog: () => void;
|
|
19
19
|
export declare const stopSessionLogging: () => void;
|
|
20
20
|
export declare function displayError(message: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Open a warning-capture window: from now until {@link endWarningCapture}, each
|
|
23
|
+
* `displayWarning` message is buffered (IN ADDITION to being printed/logged as usual). Used by
|
|
24
|
+
* the TUI session module to grab the transient load-time config advisories and thread them into
|
|
25
|
+
* the persistent notice surface. Idempotent-ish: a second call starts a fresh buffer.
|
|
26
|
+
*/
|
|
27
|
+
export declare const beginWarningCapture: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Close the warning-capture window opened by {@link beginWarningCapture} and return everything
|
|
30
|
+
* collected (empty array if none / never opened). Always call this — a `try/finally` around the
|
|
31
|
+
* captured work — so a throw can't leak the capture state into later warnings.
|
|
32
|
+
*/
|
|
33
|
+
export declare const endWarningCapture: () => string[];
|
|
21
34
|
export declare function displayWarning(message: string): void;
|
|
22
35
|
export declare function displaySuccess(message: string): void;
|
|
23
36
|
export declare function displayInfo(message: string): void;
|
|
24
37
|
export declare function display(message: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* TUI-C30 — print one pre-styled tool-call indication block (the plain surface's compact
|
|
40
|
+
* `✓ name(args…)` + greyed preview, built by `core/plainToolIndication.ts`). Same INFO-level
|
|
41
|
+
* gate, stdout channel and session-log treatment as {@link displayInfo} — matching the stream
|
|
42
|
+
* discipline of the existing tool notices — but WITHOUT the blanket dim wrap: the block styles
|
|
43
|
+
* each line itself (diff colours, per-line dim), and an outer wrapper would be broken by the
|
|
44
|
+
* inner resets. The session log gets the ANSI-stripped text via {@link writeToSessionLog}.
|
|
45
|
+
*/
|
|
46
|
+
export declare function displayToolIndication(message: string): void;
|
|
25
47
|
export declare function formatInputPrompt(message: string): string;
|
|
26
48
|
/**
|
|
27
49
|
* Display a debug message to the console and log it.
|
|
@@ -87,9 +87,40 @@ export function displayError(message) {
|
|
|
87
87
|
writeToSessionLog(message + '\n');
|
|
88
88
|
su.log(coloredMessage);
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Optional capture buffer for warning advisories (TUI-C19). When a capture window is open
|
|
92
|
+
* (see {@link beginWarningCapture}), every {@link displayWarning} message is also collected
|
|
93
|
+
* here so a surface that takes over the screen — the Ink TUI — can re-surface warnings that
|
|
94
|
+
* would otherwise print once and scroll out of sight. `null` when no window is open, so the
|
|
95
|
+
* plain-CLI path and the session log are entirely untouched.
|
|
96
|
+
*/
|
|
97
|
+
let warningCapture = null;
|
|
98
|
+
/**
|
|
99
|
+
* Open a warning-capture window: from now until {@link endWarningCapture}, each
|
|
100
|
+
* `displayWarning` message is buffered (IN ADDITION to being printed/logged as usual). Used by
|
|
101
|
+
* the TUI session module to grab the transient load-time config advisories and thread them into
|
|
102
|
+
* the persistent notice surface. Idempotent-ish: a second call starts a fresh buffer.
|
|
103
|
+
*/
|
|
104
|
+
export const beginWarningCapture = () => {
|
|
105
|
+
warningCapture = [];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Close the warning-capture window opened by {@link beginWarningCapture} and return everything
|
|
109
|
+
* collected (empty array if none / never opened). Always call this — a `try/finally` around the
|
|
110
|
+
* captured work — so a throw can't leak the capture state into later warnings.
|
|
111
|
+
*/
|
|
112
|
+
export const endWarningCapture = () => {
|
|
113
|
+
const captured = warningCapture ?? [];
|
|
114
|
+
warningCapture = null;
|
|
115
|
+
return captured;
|
|
116
|
+
};
|
|
90
117
|
export function displayWarning(message) {
|
|
91
118
|
if (!shouldDisplayLevel(StatusLevel.WARNING))
|
|
92
119
|
return;
|
|
120
|
+
// Collect into the active capture window (if any) so the TUI can re-surface it later. Done
|
|
121
|
+
// after the level guard so a user who quieted warnings sees them neither printed nor captured.
|
|
122
|
+
if (warningCapture)
|
|
123
|
+
warningCapture.push(message);
|
|
93
124
|
const coloredMessage = colorText(message, 'yellow');
|
|
94
125
|
writeToSessionLog(message + '\n');
|
|
95
126
|
su.warn(coloredMessage);
|
|
@@ -114,6 +145,20 @@ export function display(message) {
|
|
|
114
145
|
writeToSessionLog(message + '\n');
|
|
115
146
|
su.log(message);
|
|
116
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* TUI-C30 — print one pre-styled tool-call indication block (the plain surface's compact
|
|
150
|
+
* `✓ name(args…)` + greyed preview, built by `core/plainToolIndication.ts`). Same INFO-level
|
|
151
|
+
* gate, stdout channel and session-log treatment as {@link displayInfo} — matching the stream
|
|
152
|
+
* discipline of the existing tool notices — but WITHOUT the blanket dim wrap: the block styles
|
|
153
|
+
* each line itself (diff colours, per-line dim), and an outer wrapper would be broken by the
|
|
154
|
+
* inner resets. The session log gets the ANSI-stripped text via {@link writeToSessionLog}.
|
|
155
|
+
*/
|
|
156
|
+
export function displayToolIndication(message) {
|
|
157
|
+
if (!shouldDisplayLevel(StatusLevel.INFO))
|
|
158
|
+
return;
|
|
159
|
+
writeToSessionLog(message + '\n');
|
|
160
|
+
su.info(message);
|
|
161
|
+
}
|
|
117
162
|
export function formatInputPrompt(message) {
|
|
118
163
|
return colorText(message, 'magenta');
|
|
119
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleUtils.js","sourceRoot":"","sources":["../../src/utils/consoleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WA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CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GS2-46/GS2-47 — `/debug-dump`: a live-session diagnostic archive. GS2-46 shipped it raw; GS2-47
|
|
3
|
+
* adds a shared secret-redaction pass ({@link file://./redactSecrets.ts}) that is ON BY DEFAULT and
|
|
4
|
+
* applied to EVERY artifact before it hits disk. The caller opts out via `redact: false`, in which
|
|
5
|
+
* case the archive is raw and the caller surfaces the loud "may contain secrets" warning; when
|
|
6
|
+
* redaction is on the caller shows a softened "secrets redacted; review before sharing" note.
|
|
7
|
+
*/
|
|
8
|
+
/** Input to {@link writeDebugDump}. */
|
|
9
|
+
export interface WriteDebugDumpInput {
|
|
10
|
+
/** The full transcript (all turns, tool calls + results). Opaque — serialized as JSON. */
|
|
11
|
+
transcript: unknown;
|
|
12
|
+
/** The resolved effective config (the live `GthConfig`). Opaque — serialized as JSON. */
|
|
13
|
+
config: unknown;
|
|
14
|
+
/** Model display name, already resolved by the caller. */
|
|
15
|
+
modelDisplayName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* GS2-47 — apply the shared secret-redaction pass to every artifact before writing. Defaults to
|
|
18
|
+
* ON: omitted or any value other than the literal `false` redacts (read-site `!== false`, matching
|
|
19
|
+
* the config default so an opt-out has to be explicit). `false` writes a RAW archive (the caller
|
|
20
|
+
* is then responsible for the loud "may contain secrets" warning).
|
|
21
|
+
*/
|
|
22
|
+
redact?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Working directory for git-state collection. Defaults to `process.cwd()`; overridable for
|
|
25
|
+
* tests so the "not a git repo" / "inside a git repo" paths are both exercisable without
|
|
26
|
+
* depending on where the test runner happens to execute.
|
|
27
|
+
*/
|
|
28
|
+
cwd?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WriteDebugDumpResult {
|
|
31
|
+
/** The absolute path to the archive directory just written. */
|
|
32
|
+
archiveDir: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The filesystem-safe directory-name segment for one dump: the ISO timestamp with `:` and `.`
|
|
36
|
+
* (illegal on Windows, noisy everywhere) replaced by `-`. This is the ONLY path component
|
|
37
|
+
* debugDump generates — and the only one it is responsible for sanitizing. The parent it is joined
|
|
38
|
+
* under (the global `~/.gsloth` dir) is supplied by the environment and may legitimately carry a
|
|
39
|
+
* drive-letter colon on Windows (`C:\…`), which is not ours to strip. Exported so the invariant
|
|
40
|
+
* "the generated segment is colon-free" is testable on any platform without asserting anything
|
|
41
|
+
* about the (platform-dependent) parent path (GS2-50).
|
|
42
|
+
*/
|
|
43
|
+
export declare function debugDumpDirName(date?: Date): string;
|
|
44
|
+
/**
|
|
45
|
+
* Write one timestamped `/debug-dump` archive under the GLOBAL `~/.gsloth/debug-dumps/<timestamp>/`
|
|
46
|
+
* (via `ensureGlobalGslothDir()` — mirrors how `resolveHistoryDbPath()` builds its path under the
|
|
47
|
+
* same dir — NOT the per-project cwd-relative helper of the same name elsewhere in this codebase).
|
|
48
|
+
* Contains: the full transcript, the resolved config, env/version info, the in-memory debugLog
|
|
49
|
+
* ring buffer, and (best-effort) git repo state.
|
|
50
|
+
*
|
|
51
|
+
* GS2-47 — unless `input.redact === false`, the shared secret-redaction pass
|
|
52
|
+
* ({@link file://./redactSecrets.ts}) is applied to EVERY artifact before it is written: the literal
|
|
53
|
+
* values of secret-named env vars + inline config secrets are substituted everywhere, a tight set of
|
|
54
|
+
* provider-key/auth-header patterns is masked, and the config's sensitive fields are masked in place.
|
|
55
|
+
* On opt-out the archive is raw and the caller surfaces the loud "may contain secrets" warning.
|
|
56
|
+
*/
|
|
57
|
+
export declare function writeDebugDump(input: WriteDebugDumpInput): WriteDebugDumpResult;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { inspect } from 'node:util';
|
|
5
|
+
import { ensureGlobalGslothDir } from '#src/utils/globalConfigUtils.js';
|
|
6
|
+
import { env, getSlothVersion } from '#src/utils/systemUtils.js';
|
|
7
|
+
import { getDebugLogBuffer } from '#src/utils/debugUtils.js';
|
|
8
|
+
import { REDACTED, collectSecretValues, redactText, redactValue, } from '#src/utils/redactSecrets.js';
|
|
9
|
+
/**
|
|
10
|
+
* Best-effort git repo state (branch/remote/dirty). Uses `execFileSync` — NOT the existing
|
|
11
|
+
* `execAsync` helper in systemUtils.ts (a promisified wrapper used elsewhere for `gh` calls) —
|
|
12
|
+
* because `SlashCommand.run()` is fully synchronous (no Promise support in the TUI's registry or
|
|
13
|
+
* dispatcher). Fails soft: any failure (not inside a repo, `git` missing, a detached/bare repo
|
|
14
|
+
* with no remote, etc.) returns `undefined` rather than throwing, so the command never errors —
|
|
15
|
+
* the git-state file is simply omitted from the archive.
|
|
16
|
+
*/
|
|
17
|
+
function collectGitState(cwd) {
|
|
18
|
+
try {
|
|
19
|
+
const run = (args) => execFileSync('git', args, {
|
|
20
|
+
cwd,
|
|
21
|
+
encoding: 'utf8',
|
|
22
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
23
|
+
}).trim();
|
|
24
|
+
const branch = run(['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
25
|
+
let remote;
|
|
26
|
+
try {
|
|
27
|
+
remote = run(['remote', 'get-url', 'origin']);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
remote = undefined; // no `origin` remote configured — not fatal, just omit it
|
|
31
|
+
}
|
|
32
|
+
const status = run(['status', '--porcelain']);
|
|
33
|
+
return { branch, remote, dirty: status.length > 0 };
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined; // not inside a git repo (or git unavailable) — omit the file entirely
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Serialize a value as pretty JSON, tolerating the non-JSON-safe shapes real session state can
|
|
41
|
+
* contain (e.g. the resolved `GthConfig.llm` is a live LangChain client, not plain data):
|
|
42
|
+
* functions/bigints are stringified and circular references are broken rather than throwing.
|
|
43
|
+
* Falls back to `util.inspect` if `JSON.stringify` still fails for some other reason, so writing
|
|
44
|
+
* the dump can never throw partway through the archive.
|
|
45
|
+
*
|
|
46
|
+
* QA-6: `JSON.stringify` returns `undefined` (not a string) for a handful of top-level inputs —
|
|
47
|
+
* notably `undefined` itself, which `DebugDumpInput.config` legitimately is when the caller has
|
|
48
|
+
* no resolved config (verified live via the e2e fixture harness, which wires the real writer with
|
|
49
|
+
* `config` omitted). Passing `undefined` straight to `writeFileSync` throws
|
|
50
|
+
* `ERR_INVALID_ARG_TYPE`, defeating the "never throw partway through the archive" contract this
|
|
51
|
+
* function documents. Fall back to the literal `'null'` in that case, same as `JSON.stringify`
|
|
52
|
+
* would for a *nested* `undefined` value.
|
|
53
|
+
*/
|
|
54
|
+
function safeStringify(value) {
|
|
55
|
+
const seen = new WeakSet();
|
|
56
|
+
try {
|
|
57
|
+
const json = JSON.stringify(value, (_key, val) => {
|
|
58
|
+
if (typeof val === 'function')
|
|
59
|
+
return `[Function: ${val.name || 'anonymous'}]`;
|
|
60
|
+
if (typeof val === 'bigint')
|
|
61
|
+
return val.toString();
|
|
62
|
+
if (val && typeof val === 'object') {
|
|
63
|
+
if (seen.has(val))
|
|
64
|
+
return '[Circular]';
|
|
65
|
+
seen.add(val);
|
|
66
|
+
}
|
|
67
|
+
return val;
|
|
68
|
+
}, 2);
|
|
69
|
+
return json ?? 'null';
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return inspect(value, { showHidden: false, depth: 5, colors: false });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The filesystem-safe directory-name segment for one dump: the ISO timestamp with `:` and `.`
|
|
77
|
+
* (illegal on Windows, noisy everywhere) replaced by `-`. This is the ONLY path component
|
|
78
|
+
* debugDump generates — and the only one it is responsible for sanitizing. The parent it is joined
|
|
79
|
+
* under (the global `~/.gsloth` dir) is supplied by the environment and may legitimately carry a
|
|
80
|
+
* drive-letter colon on Windows (`C:\…`), which is not ours to strip. Exported so the invariant
|
|
81
|
+
* "the generated segment is colon-free" is testable on any platform without asserting anything
|
|
82
|
+
* about the (platform-dependent) parent path (GS2-50).
|
|
83
|
+
*/
|
|
84
|
+
export function debugDumpDirName(date = new Date()) {
|
|
85
|
+
return date.toISOString().replace(/[:.]/g, '-');
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* GS2-54 (gap 3) — a live LangChain chat model is detected structurally, NOT by field name: a real
|
|
89
|
+
* `BaseChatModel` exposes `_llmType()` and `invoke()` as functions. This duck-type is the LOAD-BEARING
|
|
90
|
+
* invariant that lets us strip a *live* model to a descriptor (below) WITHOUT also flattening a plain
|
|
91
|
+
* `{ type, model, apiKey }` config object — the latter must keep flowing through {@link redactValue}'s
|
|
92
|
+
* field-masking (key kept, value masked). Do NOT "simplify" this into an unconditional strip.
|
|
93
|
+
*/
|
|
94
|
+
function isLiveChatModel(llm) {
|
|
95
|
+
if (llm == null || typeof llm !== 'object')
|
|
96
|
+
return false;
|
|
97
|
+
const m = llm;
|
|
98
|
+
return typeof m._llmType === 'function' || typeof m.invoke === 'function';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* GS2-54 (gap 3) — a short, secret-free descriptor for a live chat model, mirroring the spirit of
|
|
102
|
+
* `configCommand.ts`'s `redactConfigForPrint`. Never returns the live object or any of its internals
|
|
103
|
+
* (client instances, cached kwargs, inline keys) — only a `type` + `model` label. Each field probe
|
|
104
|
+
* is guarded so a hostile/exotic getter can't throw out of here.
|
|
105
|
+
*/
|
|
106
|
+
function describeLiveModel(config, llm) {
|
|
107
|
+
const m = llm;
|
|
108
|
+
let type = 'unknown';
|
|
109
|
+
try {
|
|
110
|
+
const t = (typeof m._llmType === 'function' ? m._llmType() : undefined) ??
|
|
111
|
+
(Array.isArray(m.lc_namespace) ? m.lc_namespace.join('/') : undefined) ??
|
|
112
|
+
(typeof config.type === 'string'
|
|
113
|
+
? config.type
|
|
114
|
+
: undefined) ??
|
|
115
|
+
m.constructor?.name;
|
|
116
|
+
if (typeof t === 'string' && t.length > 0)
|
|
117
|
+
type = t;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// keep 'unknown' — a throwing getter must not defeat the strip
|
|
121
|
+
}
|
|
122
|
+
let model = 'unknown';
|
|
123
|
+
try {
|
|
124
|
+
const md = config.modelDisplayName;
|
|
125
|
+
const mdl = (typeof md === 'string' && md.length > 0 ? md : undefined) ??
|
|
126
|
+
(typeof m.model === 'string' ? m.model : undefined) ??
|
|
127
|
+
(typeof m.modelName === 'string' ? m.modelName : undefined);
|
|
128
|
+
if (typeof mdl === 'string' && mdl.length > 0)
|
|
129
|
+
model = mdl;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// keep 'unknown'
|
|
133
|
+
}
|
|
134
|
+
return { type, model };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* GS2-54 (gap 3) — defense-in-depth for the CONFIG artifact: return a shallow clone of `config` with
|
|
138
|
+
* a *live* `llm` (a `BaseChatModel`) replaced by a `{ type, model }` descriptor, so the model's large
|
|
139
|
+
* internal surface (client objects, cached kwargs, inline keys) never reaches disk — rather than
|
|
140
|
+
* relying on {@link redactValue}'s field-masking alone. PURE: never mutates the caller's config.
|
|
141
|
+
* FAIL-SAFE: on any error, or when `llm` is absent / not a live model, return the ORIGINAL config
|
|
142
|
+
* unchanged so {@link redactValue}'s existing GS2-47 masking still applies (never less-redacted).
|
|
143
|
+
*/
|
|
144
|
+
function stripLiveModelForConfig(config) {
|
|
145
|
+
try {
|
|
146
|
+
if (config == null || typeof config !== 'object' || Array.isArray(config))
|
|
147
|
+
return config;
|
|
148
|
+
const record = config;
|
|
149
|
+
if (!('llm' in record) || !isLiveChatModel(record.llm))
|
|
150
|
+
return config;
|
|
151
|
+
return { ...record, llm: describeLiveModel(record, record.llm) };
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return config; // fail safe: fall back to redactValue over the untouched config
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* GS2-47 — render the CONFIG artifact: {@link redactValue} applies sensitive-field masking (keys
|
|
159
|
+
* kept, values masked) plus literal/pattern string redaction, then {@link safeStringify}. Fail-safe:
|
|
160
|
+
* any throw yields the fully-withheld marker rather than raw content ("redact more on error, never
|
|
161
|
+
* write a raw artifact because redaction hiccuped").
|
|
162
|
+
*
|
|
163
|
+
* GS2-54 (gap 3) — before redaction, {@link stripLiveModelForConfig} swaps a live `llm` for a
|
|
164
|
+
* `{ type, model }` descriptor so the live model's internals never serialize. This runs on a fresh
|
|
165
|
+
* clone only; the caller's config (and the {@link collectSecretValues} harvest already taken from it)
|
|
166
|
+
* is untouched, so inline secrets inside the model are still scrubbed from the OTHER artifacts.
|
|
167
|
+
*/
|
|
168
|
+
function renderConfig(config, redact, secrets) {
|
|
169
|
+
if (!redact)
|
|
170
|
+
return safeStringify(config);
|
|
171
|
+
try {
|
|
172
|
+
return safeStringify(redactValue(stripLiveModelForConfig(config), secrets));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return REDACTED;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* GS2-47 — render a non-config STRUCTURED artifact (transcript, env, git-state): stringify (never
|
|
180
|
+
* throws), then literal/pattern-redact the text. Structural field-masking is intentionally NOT
|
|
181
|
+
* applied here (config-only, per the brief) so a legitimately `token`/`secret`-named field in tool
|
|
182
|
+
* output is not blanket-masked. {@link redactText} is itself fail-safe.
|
|
183
|
+
*/
|
|
184
|
+
function renderStructured(value, redact, secrets) {
|
|
185
|
+
const raw = safeStringify(value);
|
|
186
|
+
return redact ? redactText(raw, secrets) : raw;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Write one timestamped `/debug-dump` archive under the GLOBAL `~/.gsloth/debug-dumps/<timestamp>/`
|
|
190
|
+
* (via `ensureGlobalGslothDir()` — mirrors how `resolveHistoryDbPath()` builds its path under the
|
|
191
|
+
* same dir — NOT the per-project cwd-relative helper of the same name elsewhere in this codebase).
|
|
192
|
+
* Contains: the full transcript, the resolved config, env/version info, the in-memory debugLog
|
|
193
|
+
* ring buffer, and (best-effort) git repo state.
|
|
194
|
+
*
|
|
195
|
+
* GS2-47 — unless `input.redact === false`, the shared secret-redaction pass
|
|
196
|
+
* ({@link file://./redactSecrets.ts}) is applied to EVERY artifact before it is written: the literal
|
|
197
|
+
* values of secret-named env vars + inline config secrets are substituted everywhere, a tight set of
|
|
198
|
+
* provider-key/auth-header patterns is masked, and the config's sensitive fields are masked in place.
|
|
199
|
+
* On opt-out the archive is raw and the caller surfaces the loud "may contain secrets" warning.
|
|
200
|
+
*/
|
|
201
|
+
export function writeDebugDump(input) {
|
|
202
|
+
const redact = input.redact !== false; // default ON; only an explicit `false` opts out
|
|
203
|
+
const timestamp = debugDumpDirName();
|
|
204
|
+
const archiveDir = resolve(ensureGlobalGslothDir(), 'debug-dumps', timestamp);
|
|
205
|
+
mkdirSync(archiveDir, { recursive: true });
|
|
206
|
+
// Technique 1 (load-bearing): the literal secret values to scrub across ALL artifacts, gathered
|
|
207
|
+
// from env (by secret-named var) + the config (apiKeyEnvironmentVariable's target + inline
|
|
208
|
+
// secrets). `env` is the systemUtils accessor (process.env); collection is itself fail-safe.
|
|
209
|
+
const secrets = redact ? collectSecretValues(input.config, env) : [];
|
|
210
|
+
writeFileSync(resolve(archiveDir, 'transcript.json'), renderStructured(input.transcript, redact, secrets), 'utf8');
|
|
211
|
+
writeFileSync(resolve(archiveDir, 'config.json'), renderConfig(input.config, redact, secrets), 'utf8');
|
|
212
|
+
// getSlothVersion() reads the installed package.json via the install dir set at CLI startup
|
|
213
|
+
// (setEntryPoint); guarded so a dump can never fail just because that wasn't wired (e.g. an
|
|
214
|
+
// unusual embedding), falling back to 'unknown'.
|
|
215
|
+
let gthVersion;
|
|
216
|
+
try {
|
|
217
|
+
gthVersion = getSlothVersion();
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
gthVersion = 'unknown';
|
|
221
|
+
}
|
|
222
|
+
const envInfo = {
|
|
223
|
+
gthVersion,
|
|
224
|
+
nodeVersion: process.version,
|
|
225
|
+
platform: process.platform,
|
|
226
|
+
model: input.modelDisplayName ?? 'unknown',
|
|
227
|
+
};
|
|
228
|
+
writeFileSync(resolve(archiveDir, 'env.json'), renderStructured(envInfo, redact, secrets), 'utf8');
|
|
229
|
+
writeFileSync(resolve(archiveDir, 'debug-log.txt'), redact ? redactText(getDebugLogBuffer().join('\n'), secrets) : getDebugLogBuffer().join('\n'), 'utf8');
|
|
230
|
+
const gitState = collectGitState(input.cwd ?? process.cwd());
|
|
231
|
+
if (gitState) {
|
|
232
|
+
writeFileSync(resolve(archiveDir, 'git-state.json'), renderStructured(gitState, redact, secrets), 'utf8');
|
|
233
|
+
}
|
|
234
|
+
return { archiveDir };
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=debugDump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugDump.js","sourceRoot":"","sources":["../../src/utils/debugDump.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,WAAW,GACZ,MAAM,6BAA6B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AM,CAAC,CAAC,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAC7F,MAAM,CACP,CAAC;IAEF,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7D,IAAI,QAAQ,EAAE,CAAC;QACb,aAAa,CACX,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,EACrC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAC3C,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GS2-46 — read the current debug-log ring buffer (oldest first). Returns a copy so callers
|
|
3
|
+
* (e.g. the `/debug-dump` writer) can't mutate the live buffer.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getDebugLogBuffer(): string[];
|
|
1
6
|
/**
|
|
2
7
|
* Initialize debug logging based on config
|
|
3
8
|
*/
|
|
4
9
|
export declare function initDebugLogging(enabled: boolean): void;
|
|
5
10
|
/**
|
|
6
|
-
* Log a debug message
|
|
11
|
+
* Log a debug message. Always pushed into the in-memory ring buffer (GS2-46); only appended to
|
|
12
|
+
* the on-disk log file when debug logging is enabled.
|
|
7
13
|
*/
|
|
8
14
|
export declare function debugLog(message: string): void;
|
|
9
15
|
/**
|
|
10
|
-
* Log multiple lines with proper formatting
|
|
16
|
+
* Log multiple lines with proper formatting. Always buffered (GS2-46); delegates to `debugLog`
|
|
17
|
+
* for the on-disk gating.
|
|
11
18
|
*/
|
|
12
19
|
export declare function debugLogMultiline(title: string, content: string): void;
|
|
13
20
|
/**
|
|
14
|
-
* Log an object using Node.js inspect with reasonable depth
|
|
21
|
+
* Log an object using Node.js inspect with reasonable depth. Always buffered (GS2-46); delegates
|
|
22
|
+
* to `debugLogMultiline`/`debugLog` for the on-disk gating.
|
|
15
23
|
*/
|
|
16
24
|
export declare function debugLogObject(title: string, obj: unknown): void;
|
|
17
25
|
/**
|
|
18
|
-
* Log error with stack trace
|
|
26
|
+
* Log error with stack trace. Always buffered (GS2-46); delegates to `debugLog` for the on-disk
|
|
27
|
+
* gating.
|
|
19
28
|
*/
|
|
20
29
|
export declare function debugLogError(context: string, error: unknown): void;
|