gaunt-sloth 2.0.0 → 2.1.0
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/cli.js +1 -1
- package/dist/cli.js +5 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/askCommand.d.ts +15 -2
- package/dist/commands/askCommand.js +75 -40
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/batchCommand.d.ts +4 -0
- package/dist/commands/batchCommand.js +3 -2
- package/dist/commands/batchCommand.js.map +1 -1
- package/dist/commands/chatCommand.js.map +1 -1
- package/dist/commands/codeCommand.js.map +1 -1
- package/dist/commands/evalCommand.js +1 -0
- package/dist/commands/evalCommand.js.map +1 -1
- package/dist/commands/execCommand.d.ts +14 -2
- package/dist/commands/execCommand.js +122 -57
- package/dist/commands/execCommand.js.map +1 -1
- package/dist/commands/historyCommand.d.ts +16 -8
- package/dist/commands/historyCommand.js +175 -69
- package/dist/commands/historyCommand.js.map +1 -1
- package/dist/commands/insightsCommand.d.ts +4 -2
- package/dist/commands/insightsCommand.js +10 -7
- package/dist/commands/insightsCommand.js.map +1 -1
- package/dist/commands/resumeOption.d.ts +19 -9
- package/dist/commands/resumeOption.js +29 -17
- package/dist/commands/resumeOption.js.map +1 -1
- package/dist/commands/singleShotResume.d.ts +19 -0
- package/dist/commands/singleShotResume.js +37 -0
- package/dist/commands/singleShotResume.js.map +1 -0
- package/dist/tui/components/App.js +6 -2
- package/dist/tui/components/App.js.map +1 -1
- package/dist/tui/debugRender.js +1 -0
- package/dist/tui/debugRender.js.map +1 -1
- package/dist/tui/tuiSessionModule.js +2 -2
- package/dist/tui/tuiSessionModule.js.map +1 -1
- package/dist/tui/types.d.ts +2 -1
- package/package.json +5 -5
|
@@ -4,6 +4,7 @@ import { getStringFromStdin, setExitCode } from '@gaunt-sloth/core/utils/systemU
|
|
|
4
4
|
import { displayError, displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
5
5
|
import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
6
6
|
import { readMultipleFilesFromProjectDir } from '@gaunt-sloth/core/utils/fileUtils.js';
|
|
7
|
+
import { resumeOption } from '#src/commands/resumeOption.js';
|
|
7
8
|
/**
|
|
8
9
|
* Build the effective, non-interactive config for an `exec` run.
|
|
9
10
|
*
|
|
@@ -70,67 +71,131 @@ export function execCommand(program, commandLineConfigOverrides) {
|
|
|
70
71
|
' $ gth exec -m "Summarize CHANGELOG.md in three bullets" -t 0\n' +
|
|
71
72
|
' $ cat scripts/lint-summary.md | gth exec\n' +
|
|
72
73
|
' $ gth exec scripts/build-fix.md -f error.log package.json\n' +
|
|
73
|
-
' $ gth exec scripts/release-notes.md -w RELEASE_NOTES.md\n'
|
|
74
|
+
' $ gth exec scripts/release-notes.md -w RELEASE_NOTES.md\n' +
|
|
75
|
+
' $ gth exec --resume 42 -m "now do the same for the tests"\n')
|
|
76
|
+
.addOption(resumeOption())
|
|
74
77
|
.action(async (script, options) => {
|
|
75
|
-
// -
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// the user's `recap` rung, `off` by default.
|
|
125
|
-
{ announceOutstandingWork: true, announceRunRecap: true }));
|
|
78
|
+
// GS2-106 — `--resume` on `exec` itself, or the root `gth --resume <id> exec …`.
|
|
79
|
+
const ref = options.resume ?? program.getOptionValue('resume');
|
|
80
|
+
await runExecCommand(script, options, commandLineConfigOverrides, ref === undefined ? undefined : { ref, surface: 'exec' });
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* GS2-106 — the input refusal for `exec --resume`, or `null` when the input is acceptable.
|
|
85
|
+
*
|
|
86
|
+
* A resumed `exec` takes its new input from `-m` and nothing else. What `exec` should do when its
|
|
87
|
+
* FILE input is the same as the original run's is undecided on the node, so a script path, `-f`
|
|
88
|
+
* and a script piped on stdin are all refused rather than guessed at. With `-m` given, stdin is
|
|
89
|
+
* ignored exactly as a plain `exec -m` ignores it, so it is refused only where it would have been
|
|
90
|
+
* the script.
|
|
91
|
+
*/
|
|
92
|
+
function execResumeInputRefusal(script, options) {
|
|
93
|
+
const why = (what) => `\`gth exec --resume\` takes its new input only from -m; ${what} cannot be given with it. ` +
|
|
94
|
+
'Nothing was run.';
|
|
95
|
+
if (script)
|
|
96
|
+
return why('a script path');
|
|
97
|
+
if (options.file && options.file.length > 0)
|
|
98
|
+
return why('-f files');
|
|
99
|
+
if (options.message === undefined && getStringFromStdin())
|
|
100
|
+
return why('a script piped on stdin');
|
|
101
|
+
if (options.message === undefined) {
|
|
102
|
+
return ('`gth exec --resume` needs the new message as -m, for example ' +
|
|
103
|
+
'`gth exec --resume <id> -m "…"`. Nothing was run.');
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The body of `gth exec`, shared with `gth history resume` for a conversation recorded by `exec`
|
|
109
|
+
* (GS2-106), so both spellings run exactly one implementation.
|
|
110
|
+
*
|
|
111
|
+
* `resume`, when given, continues that conversation with `-m` as the new user message; see
|
|
112
|
+
* `execResumeInputRefusal` for the input it refuses. The seam resolves and checks the
|
|
113
|
+
* conversation first, and a refusal ends the command with exit status 1 and nothing run.
|
|
114
|
+
*/
|
|
115
|
+
export async function runExecCommand(script, options, commandLineConfigOverrides, resume) {
|
|
116
|
+
// -m and a positional script path are mutually exclusive: keep path-vs-text unambiguous.
|
|
117
|
+
if (script && options.message !== undefined) {
|
|
118
|
+
throw new Error('Pass either a [script] path or -m/--message inline text, not both.');
|
|
119
|
+
}
|
|
120
|
+
if (resume) {
|
|
121
|
+
// Refused before any config is loaded: the input is wrong whatever the conversation is.
|
|
122
|
+
const refusal = execResumeInputRefusal(script, options);
|
|
123
|
+
if (refusal) {
|
|
124
|
+
displayError(refusal);
|
|
125
|
+
setExitCode(1);
|
|
126
|
+
return;
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
}
|
|
129
|
+
const config = await initConfig(commandLineConfigOverrides);
|
|
130
|
+
const content = [];
|
|
131
|
+
// Extra context files are prepended (same convention as `ask`).
|
|
132
|
+
if (options.file) {
|
|
133
|
+
const fileContent = readMultipleFilesFromProjectDir(options.file);
|
|
134
|
+
if (fileContent) {
|
|
135
|
+
content.push(fileContent);
|
|
130
136
|
}
|
|
131
|
-
|
|
137
|
+
}
|
|
138
|
+
// The script itself, in precedence order:
|
|
139
|
+
// 1. -m/--message inline text (explicit; wins over stdin)
|
|
140
|
+
// 2. a [script] file path argument
|
|
141
|
+
// 3. stdin (pipe)
|
|
142
|
+
const stringFromStdin = getStringFromStdin();
|
|
143
|
+
if (options.message !== undefined) {
|
|
144
|
+
content.push(wrapContent(options.message, 'script', 'prompt-executable script', true));
|
|
145
|
+
}
|
|
146
|
+
else if (script) {
|
|
147
|
+
const scriptContent = readMultipleFilesFromProjectDir([script]);
|
|
148
|
+
content.push(wrapContent(scriptContent, 'script', 'prompt-executable script', true));
|
|
149
|
+
}
|
|
150
|
+
else if (stringFromStdin) {
|
|
151
|
+
content.push(wrapContent(stringFromStdin, 'script', 'prompt-executable script', true));
|
|
152
|
+
}
|
|
153
|
+
if (content.length === 0) {
|
|
154
|
+
throw new Error('A script is required: pass a .md path, inline text with -m, pipe it on stdin, or supply it with -f');
|
|
155
|
+
}
|
|
156
|
+
if (options.allowDir && options.allowDir.length > 0) {
|
|
157
|
+
displayWarning(`--allow-dir has no effect in this release: ${options.allowDir.join(', ')} stays ` +
|
|
158
|
+
'outside the sandbox. The agent reads and writes within the working directory only.');
|
|
159
|
+
}
|
|
160
|
+
const execConfig = buildExecConfig(config, options, commandLineConfigOverrides);
|
|
161
|
+
let target;
|
|
162
|
+
if (resume) {
|
|
163
|
+
const { resolveSingleShotResume } = await import('#src/commands/singleShotResume.js');
|
|
164
|
+
const resolved = await resolveSingleShotResume(execConfig, resume.ref, resume.surface);
|
|
165
|
+
if (!resolved) {
|
|
166
|
+
// Refused by the seam, which has said why. Nothing ran.
|
|
132
167
|
setExitCode(1);
|
|
168
|
+
return;
|
|
133
169
|
}
|
|
134
|
-
|
|
170
|
+
target = resolved;
|
|
171
|
+
}
|
|
172
|
+
const { runSingleShot } = await import('@gaunt-sloth/core/runtime/singleShot.js');
|
|
173
|
+
const { createResolvers } = await import('@gaunt-sloth/agent/resolvers.js');
|
|
174
|
+
const { resolveAgentFactory } = await import('@gaunt-sloth/agent/core/resolveAgentFactory.js');
|
|
175
|
+
let ok = false;
|
|
176
|
+
try {
|
|
177
|
+
({ ok } = await runSingleShot('EXEC', getExecSystemPrompt(execConfig), content.join('\n'), execConfig, createResolvers(), 'exec',
|
|
178
|
+
// exec asks for the lean backend, the only one shipped; config.agent.backend names no other.
|
|
179
|
+
resolveAgentFactory(execConfig, 'lean'),
|
|
180
|
+
// [[EXT-158]] — the same reading as `ask`: a person is watching this verb. The notice
|
|
181
|
+
// goes to stderr, so a script piping `exec`'s stdout sees byte-for-byte what it did.
|
|
182
|
+
//
|
|
183
|
+
// [[EXT-178]] — and eligible for the end-of-run recap, which shares that property: it is
|
|
184
|
+
// rendered on stderr and the answer on stdout is untouched. Whether one is produced is
|
|
185
|
+
// the user's `recap` rung, `off` by default.
|
|
186
|
+
{
|
|
187
|
+
announceOutstandingWork: true,
|
|
188
|
+
announceRunRecap: true,
|
|
189
|
+
announceResumeHint: true,
|
|
190
|
+
...(target ? { resume: target } : {}),
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
displayError(error instanceof Error ? error.message : String(error));
|
|
195
|
+
ok = false;
|
|
196
|
+
}
|
|
197
|
+
if (!ok) {
|
|
198
|
+
setExitCode(1);
|
|
199
|
+
}
|
|
135
200
|
}
|
|
136
201
|
//# sourceMappingURL=execCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execCommand.js","sourceRoot":"","sources":["../../src/commands/execCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"execCommand.js","sourceRoot":"","sources":["../../src/commands/execCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,+BAA+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E,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,gDAAgD,CAAC,CAAC;IAE/F,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,IAAI,CAAC;QACH,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,aAAa,CAC3B,MAAM,EACN,mBAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAClB,UAAU,EACV,eAAe,EAAE,EACjB,MAAM;QACN,6FAA6F;QAC7F,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC;QACvC,sFAAsF;QACtF,qFAAqF;QACrF,EAAE;QACF,yFAAyF;QACzF,uFAAuF;QACvF,6CAA6C;QAC7C;YACE,uBAAuB,EAAE,IAAI;YAC7B,gBAAgB,EAAE,IAAI;YACtB,kBAAkB,EAAE,IAAI;YACxB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtC,CACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,EAAE,GAAG,KAAK,CAAC;IACb,CAAC;IAED,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -6,6 +6,12 @@ import { type CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
|
|
|
6
6
|
* conversation id is unknown when the file it would be in does not exist.
|
|
7
7
|
*/
|
|
8
8
|
export declare const NO_HISTORY_MESSAGE: string;
|
|
9
|
+
/**
|
|
10
|
+
* GS2-119 — the store a read-only history command opens: `--db`, then `history.dbPath` from the
|
|
11
|
+
* config these overrides select, then the default. The same precedence as every recorder, which is
|
|
12
|
+
* what makes `history list` show the store a run wrote. Exported for `gth insights`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveHistoryCommandStore(db: string | undefined, commandLineConfigOverrides: CommandLineConfigOverrides): Promise<string>;
|
|
9
15
|
/**
|
|
10
16
|
* GS2-7 (B20) / GS2-19 — the `gth history` command group over the local session store.
|
|
11
17
|
*
|
|
@@ -14,17 +20,19 @@ export declare const NO_HISTORY_MESSAGE: string;
|
|
|
14
20
|
* - `gth history list` — the most recent conversations (grouped, with turn count + timespan), the
|
|
15
21
|
* top-level unit since GS2-19 (was a flat per-turn list).
|
|
16
22
|
* - `gth history show <id>` — print a whole conversation thread, all turns in order (GS2-19).
|
|
17
|
-
* - `gth history resume <id
|
|
18
|
-
*
|
|
23
|
+
* - `gth history resume <id> [message]` — GS2-20: continue a recorded conversation as the command
|
|
24
|
+
* it was recorded under: an interactive session for `chat` / `code`, and (GS2-106) one more `ask`
|
|
25
|
+
* or `exec` run, with the new message, for a single-shot one.
|
|
19
26
|
*
|
|
20
27
|
* The first three are READ-ONLY and fail-soft: they open the store with `create: false`, so a
|
|
21
|
-
* missing
|
|
22
|
-
* of materialising an empty file
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
28
|
+
* missing store (nothing recorded yet, or history turned off) simply reports "no history yet"
|
|
29
|
+
* instead of materialising an empty one. (Opening still migrates the store: a single-file store
|
|
30
|
+
* from an earlier release is split on first open — see `historyLayout.ts` in core.) The store is
|
|
31
|
+
* `--db <path>`, then `history.dbPath` from the config, then the global `~/.gsloth/history.db`
|
|
32
|
+
* (GS2-119). `history.enabled: false` does not stop them reading a store that exists: the switch
|
|
33
|
+
* governs recording. Local only — nothing here touches the network.
|
|
26
34
|
*
|
|
27
|
-
* `resume` is the exception on both counts: it starts a session, so it loads the config the
|
|
35
|
+
* `resume` is the exception on both counts: it starts a session, so it loads the whole config the
|
|
28
36
|
* session will run under (which is also where `history.dbPath` and `history.enabled` come from —
|
|
29
37
|
* hence no `--db`: a resumed session must read the store the session itself records to) and takes
|
|
30
38
|
* the same command-line overrides the session commands take.
|