gaunt-sloth 2.0.0-beta.4 → 2.0.0-beta.6
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/dist/cli.js +18 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/apiCommand.js +7 -4
- package/dist/commands/apiCommand.js.map +1 -1
- package/dist/commands/chatCommand.js +8 -17
- package/dist/commands/chatCommand.js.map +1 -1
- package/dist/commands/codeCommand.js +11 -15
- package/dist/commands/codeCommand.js.map +1 -1
- package/dist/commands/firstRunDialog.d.ts +4 -1
- package/dist/commands/firstRunDialog.js +23 -3
- package/dist/commands/firstRunDialog.js.map +1 -1
- package/dist/commands/historyCommand.d.ts +19 -4
- package/dist/commands/historyCommand.js +212 -12
- package/dist/commands/historyCommand.js.map +1 -1
- package/dist/commands/insightsCommand.d.ts +4 -4
- package/dist/commands/insightsCommand.js +26 -8
- package/dist/commands/insightsCommand.js.map +1 -1
- package/dist/commands/prDiscovery.js +4 -0
- package/dist/commands/prDiscovery.js.map +1 -1
- package/dist/commands/resumeOption.d.ts +28 -0
- package/dist/commands/resumeOption.js +42 -0
- package/dist/commands/resumeOption.js.map +1 -0
- package/dist/modules/sessionConfigs.d.ts +16 -0
- package/dist/modules/sessionConfigs.js +47 -0
- package/dist/modules/sessionConfigs.js.map +1 -0
- package/dist/modules/startSession.d.ts +2 -2
- package/dist/modules/startSession.js +19 -4
- package/dist/modules/startSession.js.map +1 -1
- package/dist/tui/components/App.d.ts +0 -6
- package/dist/tui/components/App.js +286 -16
- package/dist/tui/components/App.js.map +1 -1
- package/dist/tui/components/DebugPanel.d.ts +11 -0
- package/dist/tui/components/DebugPanel.js +13 -0
- package/dist/tui/components/DebugPanel.js.map +1 -1
- package/dist/tui/components/LiveTurn.d.ts +6 -0
- package/dist/tui/components/LiveTurn.js +8 -0
- package/dist/tui/components/LiveTurn.js.map +1 -1
- package/dist/tui/components/NegotiationPanel.d.ts +7 -0
- package/dist/tui/components/NegotiationPanel.js +11 -0
- package/dist/tui/components/NegotiationPanel.js.map +1 -1
- package/dist/tui/components/NoticeBar.js +10 -2
- package/dist/tui/components/NoticeBar.js.map +1 -1
- package/dist/tui/components/PromptEditor.d.ts +12 -0
- package/dist/tui/components/PromptEditor.js +20 -0
- package/dist/tui/components/PromptEditor.js.map +1 -1
- package/dist/tui/components/PromptInput.d.ts +14 -1
- package/dist/tui/components/PromptInput.js +44 -3
- package/dist/tui/components/PromptInput.js.map +1 -1
- package/dist/tui/components/SelectList.d.ts +2 -8
- package/dist/tui/components/SelectList.js +4 -18
- package/dist/tui/components/SelectList.js.map +1 -1
- package/dist/tui/components/SlashCommandMenu.d.ts +25 -2
- package/dist/tui/components/SlashCommandMenu.js +45 -8
- package/dist/tui/components/SlashCommandMenu.js.map +1 -1
- package/dist/tui/components/StatusBar.d.ts +134 -17
- package/dist/tui/components/StatusBar.js +194 -19
- package/dist/tui/components/StatusBar.js.map +1 -1
- package/dist/tui/components/TranscriptViewport.js +11 -4
- package/dist/tui/components/TranscriptViewport.js.map +1 -1
- package/dist/tui/fixtureAgent.d.ts +5 -0
- package/dist/tui/fixtureAgent.js +74 -1
- package/dist/tui/fixtureAgent.js.map +1 -1
- package/dist/tui/listWindow.d.ts +41 -0
- package/dist/tui/listWindow.js +61 -0
- package/dist/tui/listWindow.js.map +1 -0
- package/dist/tui/textRows.d.ts +6 -0
- package/dist/tui/textRows.js +135 -0
- package/dist/tui/textRows.js.map +1 -0
- package/dist/tui/transcriptWindow.d.ts +13 -0
- package/dist/tui/transcriptWindow.js +26 -4
- package/dist/tui/transcriptWindow.js.map +1 -1
- package/dist/tui/tuiSessionModule.d.ts +45 -19
- package/dist/tui/tuiSessionModule.js +250 -20
- package/dist/tui/tuiSessionModule.js.map +1 -1
- package/dist/tui/types.d.ts +69 -1
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { apiCommand } from '#src/commands/apiCommand.js';
|
|
|
13
13
|
import { getCommand } from '#src/commands/getCommand.js';
|
|
14
14
|
import { configCommand } from '#src/commands/configCommand.js';
|
|
15
15
|
import { historyCommand } from '#src/commands/historyCommand.js';
|
|
16
|
+
import { RESUMABLE_COMMANDS, resumeOption, rootResumeRefusalMessage, } from '#src/commands/resumeOption.js';
|
|
16
17
|
import { insightsCommand } from '#src/commands/insightsCommand.js';
|
|
17
18
|
import { modelsCommand } from '#src/commands/modelsCommand.js';
|
|
18
19
|
import { argv, exit, getSlothVersion, readStdin } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
@@ -42,6 +43,9 @@ program
|
|
|
42
43
|
.option('--tui', 'Force the interactive Ink TUI for chat/code sessions ' +
|
|
43
44
|
'(overrides GTH_NO_TUI, the tui config key and CI auto-off)')
|
|
44
45
|
.option('--no-tui', 'Force the plain readline session for chat/code (disable the TUI)')
|
|
46
|
+
// GS2-20 — on the root so the bare `gth` (a code session) can resume too; `chat` and `code`
|
|
47
|
+
// carry the same option themselves.
|
|
48
|
+
.addOption(resumeOption())
|
|
45
49
|
.addOption(new Option('--nopipe').hideHelp(true))
|
|
46
50
|
.addOption(new Option('--no-pipe').hideHelp(true));
|
|
47
51
|
const cliConfigOverrides = {};
|
|
@@ -114,7 +118,9 @@ getCommand(program, cliConfigOverrides);
|
|
|
114
118
|
configCommand(program, cliConfigOverrides);
|
|
115
119
|
// GS2-7 (B20) — read-only, local history/insights surfaces. They resolve their own DB path (global
|
|
116
120
|
// default or --db) and do not build the LLM, so they stay decoupled from config/provider setup.
|
|
117
|
-
|
|
121
|
+
// GS2-20 — `history resume <id>` is the exception: it starts a session, so it takes the overrides
|
|
122
|
+
// the session commands take.
|
|
123
|
+
historyCommand(program, cliConfigOverrides);
|
|
118
124
|
insightsCommand(program);
|
|
119
125
|
// GS2-6 (B16) — model catalog: lists providers/models enriched with models.dev cost/limit metadata.
|
|
120
126
|
// Read-only; enrichment never gates what `/v1/models` reports as callable.
|
|
@@ -130,6 +136,17 @@ const invokedCommand = resolveInvokedCommandName(program.commands.map((command)
|
|
|
130
136
|
if (commandSkipsStdin(invokedCommand)) {
|
|
131
137
|
program.setOptionValue('nopipe', true);
|
|
132
138
|
}
|
|
139
|
+
// GS2-20 — the root `--resume` belongs to the bare command (a code session) and rides along for
|
|
140
|
+
// `chat`/`code`; in front of any other subcommand it would be accepted and silently dropped, and a
|
|
141
|
+
// fresh `ask`/`exec` would run as though nothing had been asked. Refused here, once, before the
|
|
142
|
+
// subcommand's action can run: a typed intent is never answered with a different command.
|
|
143
|
+
const rootResume = program.getOptionValue('resume');
|
|
144
|
+
if (rootResume !== undefined &&
|
|
145
|
+
invokedCommand !== undefined &&
|
|
146
|
+
!RESUMABLE_COMMANDS.has(invokedCommand)) {
|
|
147
|
+
displayError(rootResumeRefusalMessage(invokedCommand, rootResume));
|
|
148
|
+
exit(1);
|
|
149
|
+
}
|
|
133
150
|
// CFG-35 — the config loader raises a catchable error when a provider has no resolvable API key,
|
|
134
151
|
// so programmatic callers can classify it. For a person at a terminal there is nothing to classify,
|
|
135
152
|
// so the `gth` CLI makes the terminating choice here, once, instead of in every command action.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,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G;AACnG,gGAAgG;AAChG,kGAAkG;AAClG,6BAA6B;AAC7B,cAAc,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAC5C,eAAe,CAAC,OAAO,CAAC,CAAC;AACzB,oGAAoG;AACpG,2EAA2E;AAC3E,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,8FAA8F;AAC9F,kGAAkG;AAClG,mGAAmG;AACnG,6FAA6F;AAC7F,+FAA+F;AAC/F,kGAAkG;AAClG,cAAc;AACd,MAAM,cAAc,GAAG,yBAAyB,CAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EACjD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CACpC,CAAC;AACF,IAAI,iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC;IACtC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,gGAAgG;AAChG,mGAAmG;AACnG,gGAAgG;AAChG,0FAA0F;AAC1F,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAuB,CAAC;AAC1E,IACE,UAAU,KAAK,SAAS;IACxB,cAAc,KAAK,SAAS;IAC5B,CAAC,kBAAkB,CAAC,GAAG,CAAC,cAAc,CAAC,EACvC,CAAC;IACD,YAAY,CAAC,wBAAwB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IACnE,IAAI,CAAC,CAAC,CAAC,CAAC;AACV,CAAC;AAED,iGAAiG;AACjG,oGAAoG;AACpG,gGAAgG;AAChG,MAAM,SAAS,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { initConfig } from '@gaunt-sloth/core/config.js';
|
|
2
2
|
import { displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
3
3
|
import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
4
|
+
import { parseIntOption } from '#src/commands/cliOptionParsers.js';
|
|
4
5
|
export function apiCommand(program, commandLineConfigOverrides) {
|
|
5
6
|
const api = program.command('api').description('Start an API server for Gaunt Sloth');
|
|
6
7
|
api
|
|
7
8
|
.command('ag-ui')
|
|
8
9
|
.description('Start an AG-UI protocol HTTP server')
|
|
9
|
-
|
|
10
|
+
// CFG-62: the strict parser, as on `batch -j`, so `--port abc` is refused at parse time instead
|
|
11
|
+
// of `parseInt` handing the server `NaN`, and `--port 10abc` is refused instead of becoming 10.
|
|
12
|
+
.option('--port <port>', 'Port to listen on', parseIntOption)
|
|
10
13
|
.addHelpText('after', '\n' + 'Examples:\n' + ' $ gth api ag-ui\n' + ' $ gth api ag-ui --port 4000\n')
|
|
11
14
|
.action(async (options) => {
|
|
12
15
|
try {
|
|
13
16
|
const config = await initConfig(commandLineConfigOverrides);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
// `??`, not a truthiness check: the option is a number now, and `--port 0` (let the OS pick)
|
|
18
|
+
// must stay port 0 rather than falling through to the configured port.
|
|
19
|
+
const port = options.port ?? config.commands?.api?.port ?? 3000;
|
|
17
20
|
const { startAgUiServer } = await import('@gaunt-sloth/agent/modules/apiAgUiModule.js');
|
|
18
21
|
await startAgUiServer(config, port);
|
|
19
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiCommand.js","sourceRoot":"","sources":["../../src/commands/apiCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"apiCommand.js","sourceRoot":"","sources":["../../src/commands/apiCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EA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1,30 +1,21 @@
|
|
|
1
1
|
import { startSession } from '#src/modules/startSession.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CHAT_SESSION_CONFIG } from '#src/modules/sessionConfigs.js';
|
|
3
|
+
import { resumeOption, sessionOptionsFor } from '#src/commands/resumeOption.js';
|
|
3
4
|
export function chatCommand(program, commandLineConfigOverrides) {
|
|
4
|
-
const sessionConfig = {
|
|
5
|
-
mode: 'chat',
|
|
6
|
-
readModePrompt: readChatPrompt,
|
|
7
|
-
description: 'Start an interactive chat session with Gaunt Sloth',
|
|
8
|
-
readyMessage: '\nGaunt Sloth is ready to chat. Type your prompt.',
|
|
9
|
-
// [[TUI-C79]] — this row is shared by BOTH surfaces (the Ink dock composes it with
|
|
10
|
-
// TUI_HINT_SUFFIX; the readline session prints it as-is), so every clause has to be true on
|
|
11
|
-
// both. `exit` is: it needs no condition on either surface, in any state. `Ctrl+C` no longer
|
|
12
|
-
// is — on the TUI it scraps a draft first and stops a turn second, and it only leaves from the
|
|
13
|
-
// bottom of that ladder — and no accurate short wording exists for a fixed row, so the clause
|
|
14
|
-
// is dropped rather than qualified. `/help` is the reference, and lists Ctrl+C per context.
|
|
15
|
-
exitMessage: "Type 'exit' to leave chat · /help for commands\n",
|
|
16
|
-
};
|
|
17
5
|
// Chat command (REL-3: the no-subcommand default is now `code`, registered in codeCommand)
|
|
18
6
|
program
|
|
19
7
|
.command('chat')
|
|
20
8
|
.description('Start an interactive chat session with Gaunt Sloth')
|
|
21
9
|
.argument('[message]', 'Initial message to start the chat')
|
|
10
|
+
// GS2-20 — re-enter a recorded conversation in chat mode.
|
|
11
|
+
.addOption(resumeOption())
|
|
22
12
|
.addHelpText('after', '\n' +
|
|
23
13
|
'Examples:\n' +
|
|
24
14
|
' $ gth chat\n' +
|
|
25
|
-
' $ gth chat "Let\'s discuss the architecture of this project"\n'
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
' $ gth chat "Let\'s discuss the architecture of this project"\n' +
|
|
16
|
+
' $ gth chat --resume 42\n')
|
|
17
|
+
.action(async (message, options) => {
|
|
18
|
+
await startSession(CHAT_SESSION_CONFIG, commandLineConfigOverrides, message, sessionOptionsFor(program, options));
|
|
28
19
|
});
|
|
29
20
|
}
|
|
30
21
|
//# sourceMappingURL=chatCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatCommand.js","sourceRoot":"","sources":["../../src/commands/chatCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatCommand.js","sourceRoot":"","sources":["../../src/commands/chatCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGhF,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,2FAA2F;IAC3F,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oDAAoD,CAAC;SACjE,QAAQ,CAAC,WAAW,EAAE,mCAAmC,CAAC;QAC3D,0DAA0D;SACzD,SAAS,CAAC,YAAY,EAAE,CAAC;SACzB,WAAW,CACV,OAAO,EACP,IAAI;QACF,aAAa;QACb,gBAAgB;QAChB,kEAAkE;QAClE,4BAA4B,CAC/B;SACA,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,OAA4B,EAAE,EAAE;QAC9D,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import { startSession } from '#src/modules/startSession.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CODE_SESSION_CONFIG } from '#src/modules/sessionConfigs.js';
|
|
3
|
+
import { resumeOption, sessionOptionsFor } from '#src/commands/resumeOption.js';
|
|
3
4
|
export function codeCommand(program, commandLineConfigOverrides) {
|
|
4
|
-
const sessionConfig = {
|
|
5
|
-
mode: 'code',
|
|
6
|
-
readModePrompt: readCodePrompt,
|
|
7
|
-
description: 'Interactively write code with sloth (has full file system access within your project)',
|
|
8
|
-
readyMessage: '\nGaunt Sloth is ready to code. Type your prompt.',
|
|
9
|
-
// [[TUI-C79]] — the same shared-row rule as `chatCommand`: `exit` is the one route that is true
|
|
10
|
-
// on both surfaces in every state, `Ctrl+C` is a three-meaning key on the TUI and cannot be
|
|
11
|
-
// stated accurately in a fixed row, and `/help` is where the per-context version lives.
|
|
12
|
-
exitMessage: "Type 'exit' to leave the code session · /help for commands\n",
|
|
13
|
-
};
|
|
14
5
|
// REL-3: bare `gth` (no subcommand) now defaults to the agentic code session.
|
|
6
|
+
// GS2-20 — `gth --resume <id>` is the root option (see cli.ts), read here because the bare form
|
|
7
|
+
// has no subcommand of its own to carry it.
|
|
15
8
|
program.action(async () => {
|
|
16
|
-
await startSession(
|
|
9
|
+
await startSession(CODE_SESSION_CONFIG, commandLineConfigOverrides, undefined, sessionOptionsFor(program, {}));
|
|
17
10
|
});
|
|
18
11
|
program
|
|
19
12
|
.command('code')
|
|
20
13
|
.description('Interactively write code with sloth (has full file system access within your project)')
|
|
21
14
|
.argument('[message]', 'Initial message to start the code session')
|
|
15
|
+
// GS2-20 — re-enter a recorded conversation in code mode.
|
|
16
|
+
.addOption(resumeOption())
|
|
22
17
|
.addHelpText('after', '\n' +
|
|
23
18
|
'Examples:\n' +
|
|
24
19
|
' $ gth code\n' +
|
|
25
|
-
' $ gth code "Help me refactor the authentication module"\n'
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
' $ gth code "Help me refactor the authentication module"\n' +
|
|
21
|
+
' $ gth code --resume 42\n')
|
|
22
|
+
.action(async (message, options) => {
|
|
23
|
+
await startSession(CODE_SESSION_CONFIG, commandLineConfigOverrides, message, sessionOptionsFor(program, options));
|
|
28
24
|
});
|
|
29
25
|
}
|
|
30
26
|
//# sourceMappingURL=codeCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeCommand.js","sourceRoot":"","sources":["../../src/commands/codeCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codeCommand.js","sourceRoot":"","sources":["../../src/commands/codeCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGhF,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,8EAA8E;IAC9E,gGAAgG;IAChG,4CAA4C;IAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,SAAS,EACT,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,uFAAuF,CACxF;SACA,QAAQ,CAAC,WAAW,EAAE,2CAA2C,CAAC;QACnE,0DAA0D;SACzD,SAAS,CAAC,YAAY,EAAE,CAAC;SACzB,WAAW,CACV,OAAO,EACP,IAAI;QACF,aAAa;QACb,gBAAgB;QAChB,6DAA6D;QAC7D,4BAA4B,CAC/B;SACA,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,OAA4B,EAAE,EAAE;QAC9D,MAAM,YAAY,CAChB,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { detectProviders, type DetectedProvider, type ModelDiscoveryResult, type ModelInfo, type ProviderId } from '@gaunt-sloth/core/providers/modelDiscovery.js';
|
|
2
|
+
import type { CatalogOptions } from '@gaunt-sloth/core/providers/modelCatalog.js';
|
|
2
3
|
import { ensureGslothDir } from '#src/commands/configSetup.js';
|
|
3
4
|
/**
|
|
4
5
|
* Where the first-run dialog (CFG-2) persists the chosen provider/model config.
|
|
@@ -70,7 +71,9 @@ export declare function defaultModelIndex(models: ModelInfo[]): number;
|
|
|
70
71
|
* First-run always has an explicit model chosen, so it is written into the config (unlike a bare
|
|
71
72
|
* `init <provider>` template, which omits the model to track the curated fallback, CFG-14).
|
|
72
73
|
*/
|
|
73
|
-
export declare function buildConfigContent(providerId: ProviderId, model: string
|
|
74
|
+
export declare function buildConfigContent(providerId: ProviderId, model: string, options?: {
|
|
75
|
+
catalogOptions?: CatalogOptions;
|
|
76
|
+
}): Promise<string>;
|
|
74
77
|
/**
|
|
75
78
|
* Resolves the config write path for the chosen scope (CFG-3 layering). When `identityProfile` is
|
|
76
79
|
* set, the path is the named profile's config within that scope's settings tree
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { USER_PROJECT_CONFIG_JSON } from '@gaunt-sloth/core/constants.js';
|
|
2
2
|
import { buildInitConfigContent, detectProviders, discoverModelsWithProvenance, INTERACTIVE_MODEL_FETCH_TIMEOUT_MS, } from '@gaunt-sloth/core/providers/modelDiscovery.js';
|
|
3
|
+
// EXT-161 — the seeded preventive-compaction threshold, and the window resolution behind it.
|
|
4
|
+
import { resolveContextWindow } from '@gaunt-sloth/core/core/contextWindow.js';
|
|
5
|
+
import { seedAutocompactThreshold } from '@gaunt-sloth/core/core/compactionThreshold.js';
|
|
3
6
|
import { getGlobalGslothConfigWritePath } from '@gaunt-sloth/core/utils/globalConfigUtils.js';
|
|
4
7
|
import { validateProfileName } from '@gaunt-sloth/core/config.js';
|
|
5
8
|
import { displayError, displayInfo, displaySuccess, displayWarning, } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
@@ -40,8 +43,25 @@ export function defaultModelIndex(models) {
|
|
|
40
43
|
* First-run always has an explicit model chosen, so it is written into the config (unlike a bare
|
|
41
44
|
* `init <provider>` template, which omits the model to track the curated fallback, CFG-14).
|
|
42
45
|
*/
|
|
43
|
-
export function buildConfigContent(providerId, model) {
|
|
44
|
-
|
|
46
|
+
export async function buildConfigContent(providerId, model, options = {}) {
|
|
47
|
+
// EXT-161 — seed the preventive compaction threshold from the chosen model's REAL context
|
|
48
|
+
// window. This is the one init path that has an explicit model to look up (a bare
|
|
49
|
+
// `init <provider>` deliberately omits the model to track the curated fallback), which is why
|
|
50
|
+
// the seeding lives here.
|
|
51
|
+
//
|
|
52
|
+
// `undefined` for the model instance on purpose: nothing has been constructed yet, so there is
|
|
53
|
+
// no LangChain profile to read and the resolution is the models.dev tier alone — which is the
|
|
54
|
+
// ruled-preferred source anyway. An unresolved window seeds NO key, and the runtime default then
|
|
55
|
+
// applies; it never seeds a guess.
|
|
56
|
+
// `cacheOnly: false` — unlike the runtime guard, init is an explicit interactive step that can
|
|
57
|
+
// afford the fetch, and filling the cache here is what makes every later runtime read a hit.
|
|
58
|
+
const window = await resolveContextWindow(undefined, {
|
|
59
|
+
providerId,
|
|
60
|
+
modelId: model,
|
|
61
|
+
catalogOptions: { cacheOnly: false, ...options.catalogOptions },
|
|
62
|
+
}).source();
|
|
63
|
+
const autocompact = seedAutocompactThreshold(window);
|
|
64
|
+
return `${buildInitConfigContent(providerId, model, { autocompact })}\n`;
|
|
45
65
|
}
|
|
46
66
|
/**
|
|
47
67
|
* Resolves the config write path for the chosen scope (CFG-3 layering). When `identityProfile` is
|
|
@@ -272,7 +292,7 @@ export async function runFirstRunDialog(overrides = {}, force = false, forcedSco
|
|
|
272
292
|
if (scope === 'project') {
|
|
273
293
|
deps.ensureGslothDir();
|
|
274
294
|
}
|
|
275
|
-
const writtenPath = deps.writeConfig(scope, buildConfigContent(provider.id, model));
|
|
295
|
+
const writtenPath = deps.writeConfig(scope, await buildConfigContent(provider.id, model));
|
|
276
296
|
displaySuccess(`Configured ${provider.label} / ${model} (${scope}).`);
|
|
277
297
|
displayInfo(`Config written to ${writtenPath}`);
|
|
278
298
|
if (provider.apiKeyEnvironmentVariable) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstRunDialog.js","sourceRoot":"","sources":["../../src/commands/firstRunDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,4BAA4B,EAC5B,kCAAkC,GAKnC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,eAAe,EACf,GAAG,EACH,KAAK,EACL,MAAM,GAEP,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAwDnE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,SAA6B;IAC1D,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC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yBAAyB,EAAE,CAAC;YACvC,WAAW,CAAC,sBAAsB,QAAQ,CAAC,yBAAyB,GAAG,CAAC,CAAC;QAC3E,CAAC;aAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YACjE,WAAW,CAAC,0EAA0E,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,2FAA2F;QAC3F,+FAA+F;QAC/F,+FAA+F;QAC/F,2FAA2F;QAC3F,iDAAiD;QACjD,IAAI,CAAC,YAAY,oBAAoB,EAAE,CAAC;YACtC,cAAc,CAAC,gDAAgD,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { type CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* The one sentence for "there is no store": `list`, `search`, `show` and `resume` all say it, so a
|
|
5
|
+
* person with nothing recorded yet hears the same thing whichever they typed — and is not told a
|
|
6
|
+
* conversation id is unknown when the file it would be in does not exist.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NO_HISTORY_MESSAGE: string;
|
|
9
|
+
/**
|
|
10
|
+
* GS2-7 (B20) / GS2-19 — the `gth history` command group over the local session store.
|
|
4
11
|
*
|
|
5
12
|
* - `gth history search <query...>` — FTS5 full-text search across past turns; each hit shows the
|
|
6
13
|
* parent conversation it belongs to (GS2-19).
|
|
7
14
|
* - `gth history list` — the most recent conversations (grouped, with turn count + timespan), the
|
|
8
15
|
* top-level unit since GS2-19 (was a flat per-turn list).
|
|
9
16
|
* - `gth history show <id>` — print a whole conversation thread, all turns in order (GS2-19).
|
|
17
|
+
* - `gth history resume <id>` — GS2-20: start an interactive session inside a recorded
|
|
18
|
+
* conversation, in the mode (`chat` / `code`) it was recorded under.
|
|
10
19
|
*
|
|
11
|
-
*
|
|
12
|
-
* (history
|
|
20
|
+
* The first three are READ-ONLY and fail-soft: they open the store with `create: false`, so a
|
|
21
|
+
* missing DB (nothing recorded yet, or history turned off) simply reports "no history yet" instead
|
|
22
|
+
* of materialising an empty file.
|
|
13
23
|
* (Opening still migrates a pre-GS2-19 DB in place — see {@link HistoryStore} migrate.) The DB
|
|
14
24
|
* defaults to the global `~/.gsloth/history.db`; `--db <path>` overrides it. Local only — nothing
|
|
15
25
|
* here touches the network.
|
|
26
|
+
*
|
|
27
|
+
* `resume` is the exception on both counts: it starts a session, so it loads the config the
|
|
28
|
+
* session will run under (which is also where `history.dbPath` and `history.enabled` come from —
|
|
29
|
+
* hence no `--db`: a resumed session must read the store the session itself records to) and takes
|
|
30
|
+
* the same command-line overrides the session commands take.
|
|
16
31
|
*/
|
|
17
|
-
export declare function historyCommand(program: Command): void;
|
|
32
|
+
export declare function historyCommand(program: Command, commandLineConfigOverrides?: CommandLineConfigOverrides): void;
|