gaunt-sloth 2.0.0-beta.9 → 2.0.1

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 (118) hide show
  1. package/.gsloth.review-discovery.md +19 -0
  2. package/cli.js +49 -0
  3. package/dist/cli.js +42 -7
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/adkEvalRunner.d.ts +7 -6
  6. package/dist/commands/adkEvalRunner.js +3 -3
  7. package/dist/commands/adkEvalRunner.js.map +1 -1
  8. package/dist/commands/agUiEvalRunner.d.ts +4 -4
  9. package/dist/commands/agUiEvalRunner.js +8 -7
  10. package/dist/commands/agUiEvalRunner.js.map +1 -1
  11. package/dist/commands/askCommand.d.ts +15 -2
  12. package/dist/commands/askCommand.js +75 -32
  13. package/dist/commands/askCommand.js.map +1 -1
  14. package/dist/commands/batchCommand.d.ts +6 -2
  15. package/dist/commands/batchCommand.js +13 -7
  16. package/dist/commands/batchCommand.js.map +1 -1
  17. package/dist/commands/chatCommand.js.map +1 -1
  18. package/dist/commands/codeCommand.js.map +1 -1
  19. package/dist/commands/commandIntrospection.d.ts +1 -1
  20. package/dist/commands/commandIntrospection.js +6 -3
  21. package/dist/commands/commandIntrospection.js.map +1 -1
  22. package/dist/commands/configCommand.d.ts +1 -1
  23. package/dist/commands/configCommand.js +1 -1
  24. package/dist/commands/configSetup.d.ts +1 -1
  25. package/dist/commands/discoveryConfigSchemaAgreement.d.ts +45 -0
  26. package/dist/commands/discoveryConfigSchemaAgreement.js +2 -0
  27. package/dist/commands/discoveryConfigSchemaAgreement.js.map +1 -0
  28. package/dist/commands/evalCommand.d.ts +27 -1
  29. package/dist/commands/evalCommand.js +156 -13
  30. package/dist/commands/evalCommand.js.map +1 -1
  31. package/dist/commands/execCommand.d.ts +15 -3
  32. package/dist/commands/execCommand.js +123 -51
  33. package/dist/commands/execCommand.js.map +1 -1
  34. package/dist/commands/firstRunDialog.d.ts +3 -3
  35. package/dist/commands/firstRunDialog.js +2 -2
  36. package/dist/commands/getCommand.js +10 -1
  37. package/dist/commands/getCommand.js.map +1 -1
  38. package/dist/commands/historyCommand.d.ts +16 -8
  39. package/dist/commands/historyCommand.js +190 -72
  40. package/dist/commands/historyCommand.js.map +1 -1
  41. package/dist/commands/insightsCommand.d.ts +4 -2
  42. package/dist/commands/insightsCommand.js +10 -7
  43. package/dist/commands/insightsCommand.js.map +1 -1
  44. package/dist/commands/prCommand.js +45 -16
  45. package/dist/commands/prCommand.js.map +1 -1
  46. package/dist/commands/prDiscovery.d.ts +24 -25
  47. package/dist/commands/prDiscovery.js +55 -132
  48. package/dist/commands/prDiscovery.js.map +1 -1
  49. package/dist/commands/requirementsDiscovery.d.ts +82 -0
  50. package/dist/commands/requirementsDiscovery.js +127 -0
  51. package/dist/commands/requirementsDiscovery.js.map +1 -0
  52. package/dist/commands/resumeOption.d.ts +19 -9
  53. package/dist/commands/resumeOption.js +29 -17
  54. package/dist/commands/resumeOption.js.map +1 -1
  55. package/dist/commands/reviewCommand.js +75 -8
  56. package/dist/commands/reviewCommand.js.map +1 -1
  57. package/dist/commands/reviewDiscovery.d.ts +96 -0
  58. package/dist/commands/reviewDiscovery.js +180 -0
  59. package/dist/commands/reviewDiscovery.js.map +1 -0
  60. package/dist/commands/singleShotResume.d.ts +19 -0
  61. package/dist/commands/singleShotResume.js +37 -0
  62. package/dist/commands/singleShotResume.js.map +1 -0
  63. package/dist/tui/approvalBridges.d.ts +86 -0
  64. package/dist/tui/approvalBridges.js +147 -0
  65. package/dist/tui/approvalBridges.js.map +1 -0
  66. package/dist/tui/components/App.js +278 -29
  67. package/dist/tui/components/App.js.map +1 -1
  68. package/dist/tui/components/DebugPanel.d.ts +6 -3
  69. package/dist/tui/components/DebugPanel.js +32 -10
  70. package/dist/tui/components/DebugPanel.js.map +1 -1
  71. package/dist/tui/components/FetchProgress.d.ts +1 -1
  72. package/dist/tui/components/LaunchBanner.d.ts +4 -3
  73. package/dist/tui/components/LaunchBanner.js +8 -6
  74. package/dist/tui/components/LaunchBanner.js.map +1 -1
  75. package/dist/tui/components/LiveTurn.d.ts +15 -9
  76. package/dist/tui/components/LiveTurn.js +15 -14
  77. package/dist/tui/components/LiveTurn.js.map +1 -1
  78. package/dist/tui/components/PromptInput.d.ts +2 -2
  79. package/dist/tui/components/PromptInput.js +11 -6
  80. package/dist/tui/components/PromptInput.js.map +1 -1
  81. package/dist/tui/components/ResumePicker.d.ts +69 -0
  82. package/dist/tui/components/ResumePicker.js +93 -0
  83. package/dist/tui/components/ResumePicker.js.map +1 -0
  84. package/dist/tui/components/SelectList.d.ts +1 -1
  85. package/dist/tui/components/SelectList.js +1 -1
  86. package/dist/tui/components/SlashCommandMenu.d.ts +1 -1
  87. package/dist/tui/components/SlashCommandMenu.js +1 -1
  88. package/dist/tui/components/StatusBar.d.ts +27 -1
  89. package/dist/tui/components/StatusBar.js +13 -2
  90. package/dist/tui/components/StatusBar.js.map +1 -1
  91. package/dist/tui/debugRender.d.ts +26 -3
  92. package/dist/tui/debugRender.js +233 -2
  93. package/dist/tui/debugRender.js.map +1 -1
  94. package/dist/tui/fixtureAgent.d.ts +2 -2
  95. package/dist/tui/fixtureAgent.js +2 -2
  96. package/dist/tui/keyBindings.js +7 -1
  97. package/dist/tui/keyBindings.js.map +1 -1
  98. package/dist/tui/keyGuards.d.ts +1 -1
  99. package/dist/tui/keyGuards.js +1 -1
  100. package/dist/tui/ruleWidth.d.ts +1 -1
  101. package/dist/tui/ruleWidth.js +1 -1
  102. package/dist/tui/selectCancelled.d.ts +1 -1
  103. package/dist/tui/selectCancelled.js +1 -1
  104. package/dist/tui/transcriptWindow.js +7 -1
  105. package/dist/tui/transcriptWindow.js.map +1 -1
  106. package/dist/tui/tuiSessionModule.js +91 -192
  107. package/dist/tui/tuiSessionModule.js.map +1 -1
  108. package/dist/tui/types.d.ts +79 -19
  109. package/dist/tui/useMouse.d.ts +1 -1
  110. package/dist/tui/useMouse.js +1 -1
  111. package/dist/tui/useSlothAnimation.d.ts +1 -1
  112. package/dist/tui/viewModel.d.ts +64 -12
  113. package/dist/tui/viewModel.js +38 -11
  114. package/dist/tui/viewModel.js.map +1 -1
  115. package/dist/utils/configErrorGuard.d.ts +11 -3
  116. package/dist/utils/configErrorGuard.js +11 -3
  117. package/dist/utils/configErrorGuard.js.map +1 -1
  118. package/package.json +19 -19
@@ -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 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,9 +124,14 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
101
124
  if (!maintenance)
102
125
  return;
103
126
  try {
104
- const stats = maintenance.stats(dbPath);
105
- if (stats.checkpointCount > 0)
127
+ const stats = maintenance.stats();
128
+ // GS2-111 — checkpoints are not the whole store. A dropped `put` leaves a thread holding
129
+ // pending writes and no checkpoint: real bytes on disk that only `gth history prune` takes
130
+ // back. A guard on the checkpoint count alone made the one screen that reports the store's
131
+ // size silent about them (DL-1), so this is the pair GS2-108 settled on for `gth insights`.
132
+ if (stats.checkpointCount > 0 || stats.writeOnlyThreadCount > 0) {
106
133
  display(formatStoreSizeLine(stats));
134
+ }
107
135
  }
108
136
  finally {
109
137
  maintenance.close();
@@ -112,18 +140,27 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
112
140
  history
113
141
  .command('show')
114
142
  .description('Print a whole conversation thread (all turns in order)')
115
- .argument('<id>', 'conversation id (from `history list` / `history search`)')
116
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
117
- .action((idArg, options) => {
118
- 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 });
119
155
  if (!store) {
120
156
  displayWarning(NO_HISTORY_MESSAGE);
121
157
  return;
122
158
  }
123
159
  try {
124
- const id = Number.parseInt(idArg, 10);
125
- if (!Number.isFinite(id) || id <= 0) {
126
- 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.');
127
164
  return;
128
165
  }
129
166
  const turns = store.getConversationThread(id);
@@ -144,7 +181,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
144
181
  // GS2-20 was built to ("resume sheds nothing") forbids;
145
182
  // - it prints the plan and removes nothing until `--yes`. The dry run is the default because the
146
183
  // second layer of it matters more than the keystroke: an invocation that forgets `--db` resolves
147
- // to the developer's own `~/.gsloth/history.db`;
184
+ // to the configured store or the developer's own `~/.gsloth/history.db`;
148
185
  // - it prunes WHOLE conversations. A count bound here means "keep the N most recent
149
186
  // conversations", never "keep the last N super-steps of a thread" — a checkpoint chain is not
150
187
  // safe to truncate in the middle as a policy, whatever one graph's channel schema allows today.
@@ -154,7 +191,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
154
191
  .option('--older-than <days>', 'prune conversations with no activity for this many days')
155
192
  .option('--keep-last <n>', 'keep the N most recently active conversations, prune the rest')
156
193
  .option('--yes', 'actually remove; without it this prints the plan and changes nothing')
157
- .option('--db <path>', 'path to the history DB (defaults to ~/.gsloth/history.db)')
194
+ .option('--db <path>', DB_OPTION_HELP)
158
195
  .addHelpText('after', '\n' +
159
196
  'A pruned conversation keeps its transcript — `gth history show <id>` still prints it —\n' +
160
197
  'and loses only the state a resume needs. Threads no conversation names are reclaimed\n' +
@@ -166,7 +203,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
166
203
  'Examples:\n' +
167
204
  ' $ gth history prune --older-than 30\n' +
168
205
  ' $ gth history prune --keep-last 20 --yes\n')
169
- .action((options) => {
206
+ .action(async (options) => {
170
207
  const olderThanDays = parseBound(options.olderThan, 'older-than');
171
208
  const keepLast = parseBound(options.keepLast, 'keep-last');
172
209
  if (olderThanDays === 'invalid' || keepLast === 'invalid')
@@ -177,7 +214,7 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
177
214
  'never picks one for you.');
178
215
  return;
179
216
  }
180
- const dbPath = resolveHistoryDbPath(options.db);
217
+ const dbPath = await resolveHistoryCommandStore(options.db, commandLineConfigOverrides);
181
218
  const maintenance = openCheckpointMaintenance(dbPath);
182
219
  if (!maintenance) {
183
220
  displayWarning(NO_HISTORY_MESSAGE);
@@ -190,24 +227,33 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
190
227
  // is how a person finds out how much of the store was never reachable in the first place.
191
228
  const unaddressable = maintenance.unaddressable();
192
229
  const unaddressableBytes = maintenance.bytesOf(unaddressable);
230
+ // GS2-108 — and so does the write-only set: threads whose pending writes outlived the
231
+ // checkpoint they belonged to. This is the ONLY command that reaches them, because they
232
+ // carry no checkpoint to read an age from and the automatic pass reclaims nothing it
233
+ // cannot date. The reasoning is at `findWriteOnlyThreads`.
234
+ const writeOnly = maintenance.writeOnly();
235
+ const writeOnlyBytes = maintenance.bytesOf(writeOnly);
193
236
  displayInfo('History prune:');
194
- for (const line of formatPrunePlan(candidates, unaddressable.length, unaddressableBytes)) {
237
+ for (const line of formatPrunePlan(candidates, unaddressable.length, unaddressableBytes, writeOnly.length, writeOnlyBytes)) {
195
238
  display(line);
196
239
  }
197
- if (candidates.length === 0 && unaddressable.length === 0)
240
+ if (candidates.length === 0 && unaddressable.length === 0 && writeOnly.length === 0)
198
241
  return;
199
242
  if (!options.yes) {
200
243
  displayWarning('Nothing was removed. Re-run with `--yes` to remove it.');
201
244
  return;
202
245
  }
203
- 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.
204
250
  const removed = maintenance.remove([
205
251
  ...candidates.map((c) => c.threadId),
206
252
  ...unaddressable,
253
+ ...writeOnly,
207
254
  ]);
208
- const vacuumed = maintenance.vacuum();
209
- const after = fileBytes(dbPath);
210
- for (const line of formatPruneResult(removed, before, after, vacuumed))
255
+ const after = maintenance.diskBytes();
256
+ for (const line of formatPruneResult(removed, before, after, true))
211
257
  display(line);
212
258
  displaySuccess('History prune complete.');
213
259
  }
@@ -215,25 +261,64 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
215
261
  maintenance.close();
216
262
  }
217
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
+ });
218
293
  // GS2-20 — the third spelling of a resume. The mode comes from the ROW, not from the person: a
219
- // conversation recorded by `gth chat` resumes as a chat session and one recorded by `gth code`
220
- // as a code session, because the other mode's tools and prompt would make it a different
221
- // conversation. Everything past picking the mode is `startSession` with `--resume`, so the
222
- // five checks and their sentences are the seam's, made once. What is decided HERE is only what
223
- // 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.
224
303
  history
225
304
  .command('resume')
226
- .description('Pick up a recorded conversation where it left off, in the mode it was recorded under')
227
- .argument('<id>', 'conversation id (from `history list`)')
228
- .action(async (idArg) => {
229
- const id = parseResumeId(idArg);
230
- if (id === null) {
231
- 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}".`);
232
317
  return;
233
318
  }
234
319
  const config = await initConfig(commandLineConfigOverrides);
235
320
  if (!isHistoryEnabled(config)) {
236
- 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 ' +
237
322
  'a recorded conversation can be resumed.');
238
323
  return;
239
324
  }
@@ -243,24 +328,66 @@ export function historyCommand(program, commandLineConfigOverrides = {}) {
243
328
  create: false,
244
329
  });
245
330
  if (!store) {
246
- displayWarning(NO_HISTORY_MESSAGE);
331
+ refuse(NO_HISTORY_MESSAGE);
247
332
  return;
248
333
  }
249
334
  store.close();
250
- const stored = lookupConversationSafe(config, id);
251
- if (!stored) {
252
- 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);
253
359
  return;
254
360
  }
255
361
  const command = stored.summary.command;
256
- const sessionConfig = sessionConfigFor(command);
257
- if (!sessionConfig) {
258
- displayWarning(`Conversation #${id} was recorded by \`gth ${command ?? 'ask'}\`, a single-shot run ` +
259
- 'that keeps no conversation state, so there is nothing to resume it into. ' +
260
- `\`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
+ }
261
385
  return;
262
386
  }
263
- 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, {
264
391
  resumeConversationId: id,
265
392
  });
266
393
  });
@@ -288,15 +415,6 @@ function parseBound(raw, flag) {
288
415
  }
289
416
  return n;
290
417
  }
291
- /** The database file's size on disk, or 0 when it cannot be read. */
292
- function fileBytes(dbPath) {
293
- try {
294
- return statSync(dbPath).size;
295
- }
296
- catch {
297
- return 0;
298
- }
299
- }
300
418
  /** Parse and bound a `--limit` option (1..500); falls back to 20 on a bad value. */
301
419
  function clampLimit(raw) {
302
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,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,0BAA0B,GAA+B,EAAE;IAE3D,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAA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AC,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,EACP,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,yFAAyF;IACzF,sBAAsB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,mEAAmE;AACnE,MAAM,cAAc,GAClB,iFAAiF;IACjF,uBAAuB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,EAAsB,EACtB,0BAAsD;IAEtD,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAA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AG,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,EA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