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.
Files changed (36) hide show
  1. package/cli.js +1 -1
  2. package/dist/cli.js +5 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/askCommand.d.ts +15 -2
  5. package/dist/commands/askCommand.js +75 -40
  6. package/dist/commands/askCommand.js.map +1 -1
  7. package/dist/commands/batchCommand.d.ts +4 -0
  8. package/dist/commands/batchCommand.js +3 -2
  9. package/dist/commands/batchCommand.js.map +1 -1
  10. package/dist/commands/chatCommand.js.map +1 -1
  11. package/dist/commands/codeCommand.js.map +1 -1
  12. package/dist/commands/evalCommand.js +1 -0
  13. package/dist/commands/evalCommand.js.map +1 -1
  14. package/dist/commands/execCommand.d.ts +14 -2
  15. package/dist/commands/execCommand.js +122 -57
  16. package/dist/commands/execCommand.js.map +1 -1
  17. package/dist/commands/historyCommand.d.ts +16 -8
  18. package/dist/commands/historyCommand.js +175 -69
  19. package/dist/commands/historyCommand.js.map +1 -1
  20. package/dist/commands/insightsCommand.d.ts +4 -2
  21. package/dist/commands/insightsCommand.js +10 -7
  22. package/dist/commands/insightsCommand.js.map +1 -1
  23. package/dist/commands/resumeOption.d.ts +19 -9
  24. package/dist/commands/resumeOption.js +29 -17
  25. package/dist/commands/resumeOption.js.map +1 -1
  26. package/dist/commands/singleShotResume.d.ts +19 -0
  27. package/dist/commands/singleShotResume.js +37 -0
  28. package/dist/commands/singleShotResume.js.map +1 -0
  29. package/dist/tui/components/App.js +6 -2
  30. package/dist/tui/components/App.js.map +1 -1
  31. package/dist/tui/debugRender.js +1 -0
  32. package/dist/tui/debugRender.js.map +1 -1
  33. package/dist/tui/tuiSessionModule.js +2 -2
  34. package/dist/tui/tuiSessionModule.js.map +1 -1
  35. package/dist/tui/types.d.ts +2 -1
  36. package/package.json +5 -5
@@ -1,12 +1,13 @@
1
- import { initConfig } from '@gaunt-sloth/core/config.js';
2
- import { openHistoryStore, resolveHistoryDbPath } from '@gaunt-sloth/core/history/historyStore.js';
1
+ import { initConfig, loadConfiguredHistoryDbPath, } from '@gaunt-sloth/core/config.js';
2
+ import { openHistoryStore, rebuildHistoryIndexSafe, resolveHistoryDbPath, } from '@gaunt-sloth/core/history/historyStore.js';
3
3
  import { isHistoryEnabled } from '@gaunt-sloth/core/history/historyEnabled.js';
4
- import { lookupConversationSafe } from '@gaunt-sloth/core/history/recordSession.js';
4
+ import { lookupConversationSafe, resolveConversationRefSafe, } from '@gaunt-sloth/core/history/recordSession.js';
5
+ import { formatConversationRef, parseConversationRef, } from '@gaunt-sloth/core/history/conversationRef.js';
5
6
  import { formatConversationList, formatConversationThread, formatPrunePlan, formatPruneResult, formatSearchResults, formatStoreSizeLine, } from '@gaunt-sloth/core/history/historyFormat.js';
6
7
  import { openCheckpointMaintenance, } from '@gaunt-sloth/core/history/checkpointRetention.js';
7
- import { display, displayInfo, displaySuccess, displayWarning, } from '@gaunt-sloth/core/utils/consoleUtils.js';
8
- import { statSync } from 'node:fs';
9
- import { parseResumeId } from '@gaunt-sloth/agent/modules/sessionResume.js';
8
+ import { display, displayInfo, displayNotice, displaySuccess, displayWarning, } from '@gaunt-sloth/core/utils/consoleUtils.js';
9
+ import { getStringFromStdin, setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
10
+ import { resumeMatrixVerdict } from '@gaunt-sloth/core/history/resumeMatrix.js';
10
11
  /**
11
12
  * The one sentence for "there is no store": `list`, `search`, `show` and `resume` all say it, so a
12
13
  * person with nothing recorded yet hears the same thing whichever they typed — and is not told a
@@ -16,6 +17,19 @@ export const NO_HISTORY_MESSAGE = 'No session history found. Recording is on by
16
17
  'config turns it off.';
17
18
  import { startSession } from '#src/modules/startSession.js';
18
19
  import { sessionConfigFor } from '#src/modules/sessionConfigs.js';
20
+ /** The `--db` help text every read-only history command shares. */
21
+ const DB_OPTION_HELP = 'path to the history store (defaults to `history.dbPath` from your config, then ' +
22
+ '~/.gsloth/history.db)';
23
+ /**
24
+ * GS2-119 — the store a read-only history command opens: `--db`, then `history.dbPath` from the
25
+ * config these overrides select, then the default. The same precedence as every recorder, which is
26
+ * what makes `history list` show the store a run wrote. Exported for `gth insights`.
27
+ */
28
+ export async function resolveHistoryCommandStore(db, commandLineConfigOverrides) {
29
+ if (db !== undefined && db.trim().length > 0)
30
+ return resolveHistoryDbPath(db);
31
+ return resolveHistoryDbPath(await loadConfiguredHistoryDbPath(commandLineConfigOverrides));
32
+ }
19
33
  /**
20
34
  * GS2-7 (B20) / GS2-19 — the `gth history` command group over the local session store.
21
35
  *
@@ -24,17 +38,19 @@ import { sessionConfigFor } from '#src/modules/sessionConfigs.js';
24
38
  * - `gth history list` — the most recent conversations (grouped, with turn count + timespan), the
25
39
  * top-level unit since GS2-19 (was a flat per-turn list).
26
40
  * - `gth history show <id>` — print a whole conversation thread, all turns in order (GS2-19).
27
- * - `gth history resume <id>` — GS2-20: start an interactive session inside a recorded
28
- * conversation, in the mode (`chat` / `code`) it was recorded under.
41
+ * - `gth history resume <id> [message]` — GS2-20: continue a recorded conversation as the command
42
+ * it was recorded under: an interactive session for `chat` / `code`, and (GS2-106) one more `ask`
43
+ * or `exec` run, with the new message, for a single-shot one.
29
44
  *
30
45
  * The first three are READ-ONLY and fail-soft: they open the store with `create: false`, so a
31
- * missing DB (nothing recorded yet, or history turned off) simply reports "no history yet" instead
32
- * of materialising an empty file.
33
- * (Opening still migrates a pre-GS2-19 DB in place — see {@link @gaunt-sloth/core!history/historyStore.HistoryStore | HistoryStore} migrate.) The DB
34
- * defaults to the global `~/.gsloth/history.db`; `--db <path>` overrides it. Local only — nothing
35
- * here touches the network.
46
+ * missing store (nothing recorded yet, or history turned off) simply reports "no history yet"
47
+ * instead of materialising an empty one. (Opening still migrates the store: a single-file store
48
+ * from an earlier release is split on first open — see `historyLayout.ts` in core.) The store is
49
+ * `--db <path>`, then `history.dbPath` from the config, then the global `~/.gsloth/history.db`
50
+ * (GS2-119). `history.enabled: false` does not stop them reading a store that exists: the switch
51
+ * governs recording. Local only — nothing here touches the network.
36
52
  *
37
- * `resume` is the exception on both counts: it starts a session, so it loads the config the
53
+ * `resume` is the exception on both counts: it starts a session, so it loads the whole config the
38
54
  * session will run under (which is also where `history.dbPath` and `history.enabled` come from —
39
55
  * hence no `--db`: a resumed session must read the store the session itself records to) and takes
40
56
  * the same command-line overrides the session commands take.
@@ -48,15 +64,18 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
48
64
  ' $ gth history list\n' +
49
65
  ' $ gth history search vertexai timeout\n' +
50
66
  ' $ gth history show 42\n' +
51
- ' $ gth history resume 42\n');
67
+ ' $ gth history resume 42\n' +
68
+ ' $ gth history resume 43 "and now the tests"\n' +
69
+ ' $ gth history rebuild\n');
52
70
  history
53
71
  .command('search')
54
72
  .description('Full-text search past sessions (SQLite FTS5)')
55
73
  .argument('<query...>', 'search terms')
56
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
74
+ .option('--db <path>', DB_OPTION_HELP)
57
75
  .option('--limit <n>', 'maximum results', '20')
58
- .action((queryParts, options) => {
59
- const store = openHistoryStore(resolveHistoryDbPath(options.db), { create: false });
76
+ .action(async (queryParts, options) => {
77
+ const storePath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
78
+ const store = openHistoryStore(storePath, { create: false });
60
79
  if (!store) {
61
80
  displayWarning(NO_HISTORY_MESSAGE);
62
81
  return;
@@ -75,10 +94,10 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
75
94
  history
76
95
  .command('list')
77
96
  .description('List the most recent recorded conversations')
78
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
97
+ .option('--db <path>', DB_OPTION_HELP)
79
98
  .option('--limit <n>', 'maximum results', '20')
80
- .action((options) => {
81
- const dbPath = resolveHistoryDbPath(options.db);
99
+ .action(async (options) => {
100
+ const dbPath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
82
101
  const store = openHistoryStore(dbPath, { create: false });
83
102
  if (!store) {
84
103
  displayWarning(NO_HISTORY_MESSAGE);
@@ -88,8 +107,12 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
88
107
  const limit = clampLimit(options.limit);
89
108
  const conversations = store.listConversations(limit);
90
109
  displayInfo('Recent conversations:');
91
- for (const line of formatConversationList(conversations))
110
+ // GS2-106 — with the run id beside each integer, so a person can copy the id that stays
111
+ // correct after the database is recreated. Only here: the in-session lists keep the short
112
+ // form, where the integer is what `/resume` is typed with.
113
+ for (const line of formatConversationList(conversations, { showRunId: true })) {
92
114
  display(line);
115
+ }
93
116
  }
94
117
  finally {
95
118
  store.close();
@@ -101,7 +124,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
101
124
  if (!maintenance)
102
125
  return;
103
126
  try {
104
- const stats = maintenance.stats(dbPath);
127
+ const stats = maintenance.stats();
105
128
  // GS2-111 — checkpoints are not the whole store. A dropped `put` leaves a thread holding
106
129
  // pending writes and no checkpoint: real bytes on disk that only `gth history prune` takes
107
130
  // back. A guard on the checkpoint count alone made the one screen that reports the store's
@@ -117,18 +140,27 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
117
140
  history
118
141
  .command('show')
119
142
  .description('Print a whole conversation thread (all turns in order)')
120
- .argument('<id>', 'conversation id (from `history list` / `history search`)')
121
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
122
- .action((idArg, options) => {
123
- const store = openHistoryStore(resolveHistoryDbPath(options.db), { create: false });
143
+ .argument('<id>', 'conversation id or run id (from `history list` / `history search`)')
144
+ .option('--db <path>', DB_OPTION_HELP)
145
+ .action(async (idArg, options) => {
146
+ // GS2-106 — the shared parser, so `12abc` is refused rather than read as 12, and a run id is
147
+ // accepted here exactly as `history resume` accepts it.
148
+ const ref = parseConversationRef(idArg);
149
+ if (ref === null) {
150
+ displayWarning(`Invalid conversation id "${idArg}".`);
151
+ return;
152
+ }
153
+ const storePath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
154
+ const store = openHistoryStore(storePath, { create: false });
124
155
  if (!store) {
125
156
  displayWarning(NO_HISTORY_MESSAGE);
126
157
  return;
127
158
  }
128
159
  try {
129
- const id = Number.parseInt(idArg, 10);
130
- if (!Number.isFinite(id) || id <= 0) {
131
- displayWarning(`Invalid conversation id "${idArg}".`);
160
+ const id = store.resolveConversationRef(ref);
161
+ if (id === null) {
162
+ displayWarning(`No conversation ${formatConversationRef(ref)} in the history store. Run ` +
163
+ '`gth history list` to see the ids.');
132
164
  return;
133
165
  }
134
166
  const turns = store.getConversationThread(id);
@@ -149,7 +181,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
149
181
  // GS2-20 was built to ("resume sheds nothing") forbids;
150
182
  // - it prints the plan and removes nothing until `--yes`. The dry run is the default because the
151
183
  // second layer of it matters more than the keystroke: an invocation that forgets `--db` resolves
152
- // to the developer's own `~/.gsloth/history.db`;
184
+ // to the configured store or the developer's own `~/.gsloth/history.db`;
153
185
  // - it prunes WHOLE conversations. A count bound here means "keep the N most recent
154
186
  // conversations", never "keep the last N super-steps of a thread" — a checkpoint chain is not
155
187
  // safe to truncate in the middle as a policy, whatever one graph's channel schema allows today.
@@ -159,7 +191,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
159
191
  .option('--older-than <days>', 'prune conversations with no activity for this many days')
160
192
  .option('--keep-last <n>', 'keep the N most recently active conversations, prune the rest')
161
193
  .option('--yes', 'actually remove; without it this prints the plan and changes nothing')
162
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
194
+ .option('--db <path>', DB_OPTION_HELP)
163
195
  .addHelpText('after', '\n' +
164
196
  'A pruned conversation keeps its transcript — `gth history show <id>` still prints it —\n' +
165
197
  'and loses only the state a resume needs. Threads no conversation names are reclaimed\n' +
@@ -171,7 +203,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
171
203
  'Examples:\n' +
172
204
  ' $ gth history prune --older-than 30\n' +
173
205
  ' $ gth history prune --keep-last 20 --yes\n')
174
- .action((options) => {
206
+ .action(async (options) => {
175
207
  const olderThanDays = parseBound(options.olderThan, 'older-than');
176
208
  const keepLast = parseBound(options.keepLast, 'keep-last');
177
209
  if (olderThanDays === 'invalid' || keepLast === 'invalid')
@@ -182,7 +214,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
182
214
  'never picks one for you.');
183
215
  return;
184
216
  }
185
- const dbPath = resolveHistoryDbPath(options.db);
217
+ const dbPath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
186
218
  const maintenance = openCheckpointMaintenance(dbPath);
187
219
  if (!maintenance) {
188
220
  displayWarning(NO_HISTORY_MESSAGE);
@@ -211,15 +243,17 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
211
243
  displayWarning('Nothing was removed. Re-run with `--yes` to remove it.');
212
244
  return;
213
245
  }
214
- const before = fileBytes(dbPath);
246
+ const before = maintenance.diskBytes();
247
+ // GS2-121 — each thread's state is its own file, and removing it deletes that file, so the
248
+ // space comes back thread by thread with no store-wide VACUUM. Transcripts are in the
249
+ // conversations' record files, which this never touches.
215
250
  const removed = maintenance.remove([
216
251
  ...candidates.map((c) => c.threadId),
217
252
  ...unaddressable,
218
253
  ...writeOnly,
219
254
  ]);
220
- const vacuumed = maintenance.vacuum();
221
- const after = fileBytes(dbPath);
222
- for (const line of formatPruneResult(removed, before, after, vacuumed))
255
+ const after = maintenance.diskBytes();
256
+ for (const line of formatPruneResult(removed, before, after, true))
223
257
  display(line);
224
258
  displaySuccess('History prune complete.');
225
259
  }
@@ -227,25 +261,64 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
227
261
  maintenance.close();
228
262
  }
229
263
  });
264
+ // GS2-121 — the index is a cache of the files under `threads/`, and this rebuilds it from them
265
+ // alone: what a person runs when `index.db` is damaged or was deleted, or when files were copied in
266
+ // from elsewhere. A missing index is rebuilt on its own at the next open; this also replaces one
267
+ // that is there. Conversations keep their ids.
268
+ history
269
+ .command('rebuild')
270
+ .description("Rebuild the history index from the store's thread and conversation files")
271
+ .option('--db <path>', DB_OPTION_HELP)
272
+ .addHelpText('after', '\n' +
273
+ 'Run it with no session open: a session that writes during the rebuild writes to the\n' +
274
+ 'index being replaced.\n')
275
+ .action(async (options) => {
276
+ const storePath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
277
+ const summary = rebuildHistoryIndexSafe(storePath);
278
+ if (!summary) {
279
+ displayWarning(NO_HISTORY_MESSAGE);
280
+ setExitCode(1);
281
+ return;
282
+ }
283
+ display(`Rebuilt the index from ${summary.threadFiles} ` +
284
+ `${summary.threadFiles === 1 ? 'file' : 'files'}: ${summary.conversations} ` +
285
+ `${summary.conversations === 1 ? 'conversation' : 'conversations'}, ${summary.turns} ` +
286
+ `${summary.turns === 1 ? 'turn' : 'turns'}.`);
287
+ if (summary.unreadable > 0) {
288
+ displayWarning(`${summary.unreadable} ${summary.unreadable === 1 ? 'file' : 'files'} in the store ` +
289
+ 'could not be read and were left as they are.');
290
+ }
291
+ displaySuccess('History rebuild complete.');
292
+ });
230
293
  // GS2-20 — the third spelling of a resume. The mode comes from the ROW, not from the person: a
231
- // conversation recorded by `gth chat` resumes as a chat session and one recorded by `gth code`
232
- // as a code session, because the other mode's tools and prompt would make it a different
233
- // conversation. Everything past picking the mode is `startSession` with `--resume`, so the
234
- // five checks and their sentences are the seam's, made once. What is decided HERE is only what
235
- // has to be decided before a session can start: is there such a row, and was it interactive.
294
+ // conversation recorded by `gth chat` resumes as a chat session, one recorded by `gth code` as a
295
+ // code session, and (GS2-106) one recorded by `gth ask` or `gth exec` runs as that command again
296
+ // with the new message. This spelling never switches command; `gth <command> --resume` is the one
297
+ // that does. Everything past picking the command is that command's own path with its resume, so
298
+ // the checks and their sentences are the seam's, made once. What is decided HERE is only what has
299
+ // to be decided before a command can start: is there such a row, and does the matrix let it be
300
+ // resumed at all.
301
+ //
302
+ // Every refusal here exits 1 (GS2-106): the person asked for something to run and it did not.
236
303
  history
237
304
  .command('resume')
238
- .description('Pick up a recorded conversation where it left off, in the mode it was recorded under')
239
- .argument('<id>', 'conversation id (from `history list`)')
240
- .action(async (idArg) => {
241
- const id = parseResumeId(idArg);
242
- if (id === null) {
243
- displayWarning(`Invalid conversation id "${idArg}".`);
305
+ .description('Pick up a recorded conversation where it left off, as the command it was recorded under')
306
+ .argument('<id>', 'conversation id or run id (from `history list`)')
307
+ .argument('[message]', 'the new message: required for an ask or exec conversation (or pipe it on stdin), ' +
308
+ 'optional for chat or code')
309
+ .action(async (idArg, message) => {
310
+ const refuse = (sentence) => {
311
+ displayWarning(sentence);
312
+ setExitCode(1);
313
+ };
314
+ const ref = parseConversationRef(idArg);
315
+ if (ref === null) {
316
+ refuse(`Invalid conversation id "${idArg}".`);
244
317
  return;
245
318
  }
246
319
  const config = await initConfig(commandLineConfigOverrides);
247
320
  if (!isHistoryEnabled(config)) {
248
- displayWarning('History is off: `history.enabled: false` in your config turns recording off, and only ' +
321
+ refuse('History is off: `history.enabled: false` in your config turns recording off, and only ' +
249
322
  'a recorded conversation can be resumed.');
250
323
  return;
251
324
  }
@@ -255,24 +328,66 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
255
328
  create: false,
256
329
  });
257
330
  if (!store) {
258
- displayWarning(NO_HISTORY_MESSAGE);
331
+ refuse(NO_HISTORY_MESSAGE);
259
332
  return;
260
333
  }
261
334
  store.close();
262
- const stored = lookupConversationSafe(config, id);
263
- if (!stored) {
264
- displayWarning(`No conversation #${id} in the history store. Run \`gth history list\` to see the ids.`);
335
+ // GS2-106 — resolved to the integer HERE, through the same exact-match lookup the resume seam
336
+ // uses, because the row's command has to be read before a command can be started for it.
337
+ const id = resolveConversationRefSafe(config, ref);
338
+ const stored = id === null ? null : lookupConversationSafe(config, id);
339
+ if (id === null || !stored) {
340
+ refuse(`No conversation ${formatConversationRef(ref)} in the history store. Run ` +
341
+ '`gth history list` to see the ids.');
342
+ return;
343
+ }
344
+ // GS2-106 — the matrix is asked BEFORE the message is demanded, so a fan-out cell or a
345
+ // `review` row is refused for what it is rather than for a missing message. The sentence is
346
+ // the seam's own, so this refusal reads exactly as `ask --resume` would say it.
347
+ const verdict = resumeMatrixVerdict(stored.summary, 'history');
348
+ if (!verdict.ok) {
349
+ const { resumeRefusalNotice } = await import('@gaunt-sloth/agent/modules/sessionResume.js');
350
+ const notice = resumeRefusalNotice({
351
+ kind: 'not-resumable',
352
+ id,
353
+ reason: verdict.reason,
354
+ command: stored.summary.command,
355
+ ...(verdict.reason === 'fan-out' ? { origin: verdict.origin } : {}),
356
+ });
357
+ displayNotice(notice.title, [...notice.lines, 'Nothing was run.'], { tone: 'warn' });
358
+ setExitCode(1);
265
359
  return;
266
360
  }
267
361
  const command = stored.summary.command;
268
- const sessionConfig = sessionConfigFor(command);
269
- if (!sessionConfig) {
270
- displayWarning(`Conversation #${id} was recorded by \`gth ${command ?? 'ask'}\`, a single-shot run ` +
271
- 'that keeps no conversation state, so there is nothing to resume it into. ' +
272
- `\`gth history show ${id}\` prints it.`);
362
+ if (command === 'ask' || command === 'exec') {
363
+ // A single-shot conversation needs something new to say: from the positional, or from
364
+ // stdin the way `ask` reads a pipe. It is the whole new user message either way.
365
+ const text = message ?? getStringFromStdin();
366
+ if (!text) {
367
+ refuse(`Conversation #${id} was recorded by \`gth ${command}\`, so resuming it needs a new ` +
368
+ `message: \`gth history resume ${id} "…"\`, or pipe one on stdin. Nothing was run.`);
369
+ return;
370
+ }
371
+ if (command === 'ask') {
372
+ const { runAskCommand } = await import('#src/commands/askCommand.js');
373
+ await runAskCommand(text, {}, commandLineConfigOverrides, {
374
+ ref: id,
375
+ surface: 'history',
376
+ });
377
+ }
378
+ else {
379
+ const { runExecCommand } = await import('#src/commands/execCommand.js');
380
+ await runExecCommand(undefined, { message: text }, commandLineConfigOverrides, {
381
+ ref: id,
382
+ surface: 'history',
383
+ });
384
+ }
273
385
  return;
274
386
  }
275
- await startSession(sessionConfig, commandLineConfigOverrides, undefined, {
387
+ // chat / code: the matrix allowed it, so there is a session config for it. The message, if
388
+ // any, is the session's first input, which both session commands already accept.
389
+ const sessionConfig = sessionConfigFor(command);
390
+ await startSession(sessionConfig, commandLineConfigOverrides, message, {
276
391
  resumeConversationId: id,
277
392
  });
278
393
  });
@@ -300,15 +415,6 @@ function parseBound(raw, flag) {
300
415
  }
301
416
  return n;
302
417
  }
303
- /** The database file's size on disk, or 0 when it cannot be read. */
304
- function fileBytes(dbPath) {
305
- try {
306
- return statSync(dbPath).size;
307
- }
308
- catch {
309
- return 0;
310
- }
311
- }
312
418
  /** Parse and bound a `--limit` option (1..500); falls back to 20 on a bad value. */
313
419
  function clampLimit(raw) {
314
420
  const n = Number.parseInt(raw ?? '', 10);
@@ -1 +1 @@
1
- {"version":3,"file":"historyCommand.js","sourceRoot":"","sources":["../../src/commands/historyCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAmC,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,yBAAyB,GAE1B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,yFAAyF;IACzF,sBAAsB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,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,CAAC,CAAC,CAAC,eAAe,GAAG,CACzD,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,qEAAqE;AACrE,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,SAAS,UAAU,CAAC,GAAuB;IACzC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"historyCommand.js","sourceRoot":"","sources":["../../src/commands/historyCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,2BAA2B,GAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,yBAAyB,GAE1B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,OAAO,E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CAAE,CAAC;QACjD,MAAM,YAAY,CAAC,aAAa,EAAE,0BAA0B,EAAE,OAAO,EAAE;YACrE,oBAAoB,EAAE,EAAE;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,GAAuB,EAAE,IAAY;IACvD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,gGAAgG;IAChG,gGAAgG;IAChG,8FAA8F;IAC9F,kEAAkE;IAClE,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,cAAc,CACZ,4BAA4B,IAAI,IAAI,GAAG,uCAAuC;YAC5E,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,GAAG,CACzD,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,oFAAoF;AACpF,SAAS,UAAU,CAAC,GAAuB;IACzC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { Command } from 'commander';
2
+ import type { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
2
3
  /**
3
4
  * GS2-7 (B20) — `gth insights`: lightweight, LOCAL analytics over the session store (token/cost
4
5
  * totals, a top-tool tally, and a per-command breakdown). Read-only and fail-soft: opens with
5
6
  * `create: false`, so a missing DB just prints "no history yet" rather than creating one. Nothing
6
- * leaves the machine. `--db <path>` overrides the default `~/.gsloth/history.db`.
7
+ * leaves the machine. The store is `--db <path>`, then `history.dbPath` from the config, then the
8
+ * default `~/.gsloth/history.db` — the precedence every history command shares (GS2-119).
7
9
  */
8
- export declare function insightsCommand(program: Command): void;
10
+ export declare function insightsCommand(program: Command, commandLineConfigOverrides?: CommandLineConfigOverrides): void;
@@ -1,21 +1,24 @@
1
- import { openHistoryStore, resolveHistoryDbPath } from '@gaunt-sloth/core/history/historyStore.js';
1
+ import { openHistoryStore } from '@gaunt-sloth/core/history/historyStore.js';
2
2
  import { formatCheckpointStoreStats, formatInsightsSummary, } from '@gaunt-sloth/core/history/historyFormat.js';
3
3
  import { openCheckpointMaintenance } from '@gaunt-sloth/core/history/checkpointRetention.js';
4
4
  import { display, displayInfo, displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
5
+ import { resolveHistoryCommandStore } from '#src/commands/historyCommand.js';
5
6
  /**
6
7
  * GS2-7 (B20) — `gth insights`: lightweight, LOCAL analytics over the session store (token/cost
7
8
  * totals, a top-tool tally, and a per-command breakdown). Read-only and fail-soft: opens with
8
9
  * `create: false`, so a missing DB just prints "no history yet" rather than creating one. Nothing
9
- * leaves the machine. `--db <path>` overrides the default `~/.gsloth/history.db`.
10
+ * leaves the machine. The store is `--db <path>`, then `history.dbPath` from the config, then the
11
+ * default `~/.gsloth/history.db` — the precedence every history command shares (GS2-119).
10
12
  */
11
- export function insightsCommand(program) {
13
+ export function insightsCommand(program, commandLineConfigOverrides = {}) {
12
14
  program
13
15
  .command('insights')
14
16
  .description('Show local analytics over recorded session history (local only)')
15
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
17
+ .option('--db <path>', 'path to the history store (defaults to `history.dbPath` from your config, then ' +
18
+ '~/.gsloth/history.db)')
16
19
  .addHelpText('after', '\n' + 'Examples:\n' + ' $ gth insights\n' + ' $ gth insights --db ./project-history.db\n')
17
- .action((options) => {
18
- const dbPath = resolveHistoryDbPath(options.db);
20
+ .action(async (options) => {
21
+ const dbPath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
19
22
  const store = openHistoryStore(dbPath, { create: false });
20
23
  if (!store) {
21
24
  displayWarning('No session history found. Recording is on by default; `history.enabled: false` in your ' +
@@ -40,7 +43,7 @@ export function insightsCommand(program) {
40
43
  return;
41
44
  try {
42
45
  displayInfo('Conversation store (local only):');
43
- for (const line of formatCheckpointStoreStats(maintenance.stats(dbPath)))
46
+ for (const line of formatCheckpointStoreStats(maintenance.stats()))
44
47
  display(line);
45
48
  }
46
49
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"insightsCommand.js","sourceRoot":"","sources":["../../src/commands/insightsCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACnG,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,aAAa,EAAE,2DAA2D,CAAC;SAClF,WAAW,CACV,OAAO,EACP,IAAI,GAAG,aAAa,GAAG,oBAAoB,GAAG,8CAA8C,CAC7F;SACA,MAAM,CAAC,CAAC,OAAwB,EAAE,EAAE;QACnC,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,gBA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C,KAAK,EAAE,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC;gBAAS,CAAC;YACT,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,22 +1,32 @@
1
1
  import { Option, type Command } from 'commander';
2
+ import { type ConversationRef } from '@gaunt-sloth/core/history/conversationRef.js';
2
3
  import type { InteractiveSessionOptions } from '@gaunt-sloth/agent/modules/interactiveSessionModule.js';
3
4
  /**
4
- * GS2-20 — the `--resume <id>` flag, defined once and attached three times: on `chat`, on `code`,
5
- * and on the root program for the bare `gth` that starts a code session. The value is validated
5
+ * GS2-20 — the `--resume <id>` flag, defined once and attached on `chat`, on `code`, on the root
6
+ * program for the bare `gth` that starts a code session, and (GS2-106) on `ask` and `exec`. The value is validated
6
7
  * here, where commander reports a bad one in its own voice and exits before any config is loaded,
7
8
  * so a typo never reaches the session.
9
+ *
10
+ * GS2-106 — it parses to a reference, not an integer: the run id cannot be resolved to a row here,
11
+ * because the store's path comes from the config and this runs before it is loaded. The session
12
+ * resolves the reference through the resume seam, exactly as it resolves an integer.
8
13
  */
9
14
  export declare function resumeOption(): Option;
10
- /** The subcommands a root `--resume` can ride along with; the bare command is a `code` session. */
15
+ /**
16
+ * The subcommands a root `--resume` can ride along with; the bare command is a `code` session.
17
+ *
18
+ * GS2-106 — derived from the resume matrix's subcommand map in core, the one table every resume
19
+ * surface reads, so a subcommand gains or loses `--resume` in one place.
20
+ */
11
21
  export declare const RESUMABLE_COMMANDS: ReadonlySet<string>;
12
22
  /**
13
23
  * GS2-20 — the sentence for a root `--resume` typed in front of a subcommand that cannot take it
14
- * (`gth --resume 12 ask "…"`). Commander accepts the root option before every subcommand, and only
15
- * the session commands read it, so without this the intent would be dropped and a fresh `ask`
16
- * would run as if nothing had been asked. Same register as the ordered checks: what applies, what
17
- * does not yet, and that nothing ran.
24
+ * (`gth --resume 12 review`). Commander accepts the root option before every subcommand, and only
25
+ * the resumable ones read it, so without this the intent would be dropped and a fresh run of the
26
+ * other command would start as if nothing had been asked. Same register as the ordered checks:
27
+ * what applies, and that nothing ran.
18
28
  */
19
- export declare function rootResumeRefusalMessage(subcommand: string, id: number): string;
29
+ export declare function rootResumeRefusalMessage(subcommand: string, ref: ConversationRef | number): string;
20
30
  /**
21
31
  * The session options a command starts with: `{ resumeConversationId }` when `--resume` was given
22
32
  * — on the subcommand itself or on the root program, so `gth chat --resume 12` and
@@ -24,5 +34,5 @@ export declare function rootResumeRefusalMessage(subcommand: string, id: number)
24
34
  * without the flag is started exactly as it always was.
25
35
  */
26
36
  export declare function sessionOptionsFor(program: Command, own: {
27
- resume?: number;
37
+ resume?: ConversationRef;
28
38
  }): InteractiveSessionOptions | undefined;
@@ -1,33 +1,45 @@
1
1
  import { InvalidArgumentError, Option } from 'commander';
2
- import { parseResumeId } from '@gaunt-sloth/agent/modules/sessionResume.js';
2
+ import { formatConversationRef, parseConversationRef, } from '@gaunt-sloth/core/history/conversationRef.js';
3
+ import { RESUME_SURFACE_OF_SUBCOMMAND } from '@gaunt-sloth/core/history/resumeMatrix.js';
3
4
  /**
4
- * GS2-20 — the `--resume <id>` flag, defined once and attached three times: on `chat`, on `code`,
5
- * and on the root program for the bare `gth` that starts a code session. The value is validated
5
+ * GS2-20 — the `--resume <id>` flag, defined once and attached on `chat`, on `code`, on the root
6
+ * program for the bare `gth` that starts a code session, and (GS2-106) on `ask` and `exec`. The value is validated
6
7
  * here, where commander reports a bad one in its own voice and exits before any config is loaded,
7
8
  * so a typo never reaches the session.
9
+ *
10
+ * GS2-106 — it parses to a reference, not an integer: the run id cannot be resolved to a row here,
11
+ * because the store's path comes from the config and this runs before it is loaded. The session
12
+ * resolves the reference through the resume seam, exactly as it resolves an integer.
8
13
  */
9
14
  export function resumeOption() {
10
15
  return new Option('--resume <id>', 'Pick up a saved conversation where it left off (the id from `gth history list`)').argParser((raw) => {
11
- const id = parseResumeId(raw);
12
- if (id === null) {
13
- throw new InvalidArgumentError('Expected a conversation id — a positive whole number, as printed by `gth history list`.');
16
+ const ref = parseConversationRef(raw);
17
+ if (ref === null) {
18
+ throw new InvalidArgumentError('Expected a conversation id — a positive whole number or a run id, as printed by ' +
19
+ '`gth history list`.');
14
20
  }
15
- return id;
21
+ return ref;
16
22
  });
17
23
  }
18
- /** The subcommands a root `--resume` can ride along with; the bare command is a `code` session. */
19
- export const RESUMABLE_COMMANDS = new Set(['chat', 'code']);
24
+ /**
25
+ * The subcommands a root `--resume` can ride along with; the bare command is a `code` session.
26
+ *
27
+ * GS2-106 — derived from the resume matrix's subcommand map in core, the one table every resume
28
+ * surface reads, so a subcommand gains or loses `--resume` in one place.
29
+ */
30
+ export const RESUMABLE_COMMANDS = new Set(Object.keys(RESUME_SURFACE_OF_SUBCOMMAND));
20
31
  /**
21
32
  * GS2-20 — the sentence for a root `--resume` typed in front of a subcommand that cannot take it
22
- * (`gth --resume 12 ask "…"`). Commander accepts the root option before every subcommand, and only
23
- * the session commands read it, so without this the intent would be dropped and a fresh `ask`
24
- * would run as if nothing had been asked. Same register as the ordered checks: what applies, what
25
- * does not yet, and that nothing ran.
33
+ * (`gth --resume 12 review`). Commander accepts the root option before every subcommand, and only
34
+ * the resumable ones read it, so without this the intent would be dropped and a fresh run of the
35
+ * other command would start as if nothing had been asked. Same register as the ordered checks:
36
+ * what applies, and that nothing ran.
26
37
  */
27
- export function rootResumeRefusalMessage(subcommand, id) {
28
- return (`Cannot resume into \`gth ${subcommand}\`: \`--resume\` applies to \`gth chat\`, \`gth code\` ` +
29
- 'and the bare `gth` command. Resuming a conversation into `ask` or `exec` is not available ' +
30
- `yet (GS2-106). Nothing was run, and conversation #${id} was not touched.`);
38
+ export function rootResumeRefusalMessage(subcommand, ref) {
39
+ const commands = [...RESUMABLE_COMMANDS].map((c) => `\`gth ${c}\``).join(', ');
40
+ return (`Cannot resume into \`gth ${subcommand}\`: \`--resume\` applies to ${commands} and the bare ` +
41
+ `\`gth\` command. Nothing was run, and conversation ${formatConversationRef(ref)} was not ` +
42
+ 'touched.');
31
43
  }
32
44
  /**
33
45
  * The session options a command starts with: `{ resumeConversationId }` when `--resume` was given