chompyy 0.5.0 → 0.6.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 (154) hide show
  1. package/README.md +11 -0
  2. package/dist/agentlimits.js +77 -0
  3. package/dist/agentusage.js +96 -0
  4. package/dist/appstate.js +63 -3
  5. package/dist/away.js +44 -5
  6. package/dist/blueprint.js +3 -7
  7. package/dist/board.js +1 -0
  8. package/dist/cli.js +263 -5
  9. package/dist/codexquota.js +106 -0
  10. package/dist/codexusage.js +10 -0
  11. package/dist/config.js +2 -0
  12. package/dist/context.js +30 -0
  13. package/dist/costs.js +1 -0
  14. package/dist/demon.js +20 -0
  15. package/dist/label.js +33 -0
  16. package/dist/menu.js +17 -0
  17. package/dist/nightcap.js +60 -0
  18. package/dist/nudge.js +47 -18
  19. package/dist/pacing.js +16 -1
  20. package/dist/questions.js +71 -0
  21. package/dist/recap.js +74 -0
  22. package/dist/receipt.js +48 -0
  23. package/dist/recipe.js +79 -0
  24. package/dist/stamps.js +14 -0
  25. package/dist/triggers.js +5 -0
  26. package/dist/usage.js +21 -1
  27. package/dist/vendor/codeburn/antigravity.js +309 -0
  28. package/dist/vendor/codeburn/codex.js +429 -0
  29. package/dist/vendor/codeburn/copilot.js +292 -0
  30. package/dist/vendor/codeburn/gemini.js +195 -0
  31. package/dist/vendor/codeburn/grokbot.js +182 -0
  32. package/dist/vendor/codeburn/kimi.js +178 -0
  33. package/dist/vendor/codeburn/shims/chalk.js +14 -0
  34. package/dist/vendor/codeburn/shims/strip-ansi.js +6 -0
  35. package/dist/vendor/codeburn/src/act/backup.js +83 -0
  36. package/dist/vendor/codeburn/src/act/model-defaults.js +151 -0
  37. package/dist/vendor/codeburn/src/act/types.js +37 -0
  38. package/dist/vendor/codeburn/src/bash-utils.js +204 -0
  39. package/dist/vendor/codeburn/src/behavioral-weight.js +47 -0
  40. package/dist/vendor/codeburn/src/cache-dir.js +26 -0
  41. package/dist/vendor/codeburn/src/cache-refresh-lock.js +543 -0
  42. package/dist/vendor/codeburn/src/cache-sweep.js +67 -0
  43. package/dist/vendor/codeburn/src/classifier.js +209 -0
  44. package/dist/vendor/codeburn/src/claude-identity.js +223 -0
  45. package/dist/vendor/codeburn/src/codex-cache.js +377 -0
  46. package/dist/vendor/codeburn/src/codex-fork-replay.js +232 -0
  47. package/dist/vendor/codeburn/src/codex-jsonl-fields.js +99 -0
  48. package/dist/vendor/codeburn/src/codex-session-index.js +113 -0
  49. package/dist/vendor/codeburn/src/codex-throughput.js +544 -0
  50. package/dist/vendor/codeburn/src/compare-stats.js +405 -0
  51. package/dist/vendor/codeburn/src/config.js +145 -0
  52. package/dist/vendor/codeburn/src/content-utils.js +56 -0
  53. package/dist/vendor/codeburn/src/context-tree-codex.js +329 -0
  54. package/dist/vendor/codeburn/src/context-tree.js +664 -0
  55. package/dist/vendor/codeburn/src/copilot-aiu.js +16 -0
  56. package/dist/vendor/codeburn/src/currency.js +189 -0
  57. package/dist/vendor/codeburn/src/cursor-cache.js +238 -0
  58. package/dist/vendor/codeburn/src/cursor-import.js +402 -0
  59. package/dist/vendor/codeburn/src/cursor-sync.js +256 -0
  60. package/dist/vendor/codeburn/src/daily-cache.js +2036 -0
  61. package/dist/vendor/codeburn/src/data/litellm-snapshot.json +1 -0
  62. package/dist/vendor/codeburn/src/data/pricing-fallback.json +1 -0
  63. package/dist/vendor/codeburn/src/day-aggregator.js +327 -0
  64. package/dist/vendor/codeburn/src/editor-data-dir.js +11 -0
  65. package/dist/vendor/codeburn/src/fetch-utils.js +18 -0
  66. package/dist/vendor/codeburn/src/format.js +118 -0
  67. package/dist/vendor/codeburn/src/fs-utils.js +270 -0
  68. package/dist/vendor/codeburn/src/git-origin.js +334 -0
  69. package/dist/vendor/codeburn/src/granular-history.js +328 -0
  70. package/dist/vendor/codeburn/src/hermes-session-ledger.js +512 -0
  71. package/dist/vendor/codeburn/src/launcher-homes.js +142 -0
  72. package/dist/vendor/codeburn/src/live-sessions.js +358 -0
  73. package/dist/vendor/codeburn/src/math-utils.js +8 -0
  74. package/dist/vendor/codeburn/src/menubar-json.js +294 -0
  75. package/dist/vendor/codeburn/src/models.js +1879 -0
  76. package/dist/vendor/codeburn/src/optimize-one-hour-cache.js +92 -0
  77. package/dist/vendor/codeburn/src/optimize.js +4110 -0
  78. package/dist/vendor/codeburn/src/parse-workers.js +219 -0
  79. package/dist/vendor/codeburn/src/parser.js +6953 -0
  80. package/dist/vendor/codeburn/src/path-privacy.js +26 -0
  81. package/dist/vendor/codeburn/src/plans.js +135 -0
  82. package/dist/vendor/codeburn/src/pr-signals.js +132 -0
  83. package/dist/vendor/codeburn/src/project-filter-warnings.js +33 -0
  84. package/dist/vendor/codeburn/src/provider-issues.js +30 -0
  85. package/dist/vendor/codeburn/src/providers/amp.js +286 -0
  86. package/dist/vendor/codeburn/src/providers/antigravity.js +1731 -0
  87. package/dist/vendor/codeburn/src/providers/claude.js +551 -0
  88. package/dist/vendor/codeburn/src/providers/cline-cli.js +401 -0
  89. package/dist/vendor/codeburn/src/providers/cline.js +63 -0
  90. package/dist/vendor/codeburn/src/providers/codebuff.js +336 -0
  91. package/dist/vendor/codeburn/src/providers/codewhale.js +442 -0
  92. package/dist/vendor/codeburn/src/providers/codex.js +1720 -0
  93. package/dist/vendor/codeburn/src/providers/command-code.js +196 -0
  94. package/dist/vendor/codeburn/src/providers/copilot.js +3278 -0
  95. package/dist/vendor/codeburn/src/providers/crush.js +226 -0
  96. package/dist/vendor/codeburn/src/providers/cursor-agent.js +837 -0
  97. package/dist/vendor/codeburn/src/providers/cursor.js +1163 -0
  98. package/dist/vendor/codeburn/src/providers/devin.js +569 -0
  99. package/dist/vendor/codeburn/src/providers/droid.js +324 -0
  100. package/dist/vendor/codeburn/src/providers/dsh.js +690 -0
  101. package/dist/vendor/codeburn/src/providers/forge.js +245 -0
  102. package/dist/vendor/codeburn/src/providers/gemini.js +230 -0
  103. package/dist/vendor/codeburn/src/providers/goose.js +252 -0
  104. package/dist/vendor/codeburn/src/providers/grok.js +581 -0
  105. package/dist/vendor/codeburn/src/providers/grokbot.js +290 -0
  106. package/dist/vendor/codeburn/src/providers/hermes.js +771 -0
  107. package/dist/vendor/codeburn/src/providers/ibm-bob.js +53 -0
  108. package/dist/vendor/codeburn/src/providers/index.js +360 -0
  109. package/dist/vendor/codeburn/src/providers/kilo-code.js +50 -0
  110. package/dist/vendor/codeburn/src/providers/kimi.js +363 -0
  111. package/dist/vendor/codeburn/src/providers/kimicode.js +402 -0
  112. package/dist/vendor/codeburn/src/providers/kiro.js +1174 -0
  113. package/dist/vendor/codeburn/src/providers/lingtai-tui.js +372 -0
  114. package/dist/vendor/codeburn/src/providers/mistral-vibe-unified.js +236 -0
  115. package/dist/vendor/codeburn/src/providers/mistral-vibe.js +405 -0
  116. package/dist/vendor/codeburn/src/providers/mux.js +242 -0
  117. package/dist/vendor/codeburn/src/providers/open-design.js +217 -0
  118. package/dist/vendor/codeburn/src/providers/openclaude.js +309 -0
  119. package/dist/vendor/codeburn/src/providers/openclaw.js +442 -0
  120. package/dist/vendor/codeburn/src/providers/opencode-file-parser.js +131 -0
  121. package/dist/vendor/codeburn/src/providers/opencode.js +91 -0
  122. package/dist/vendor/codeburn/src/providers/pi.js +429 -0
  123. package/dist/vendor/codeburn/src/providers/quickdesk.js +491 -0
  124. package/dist/vendor/codeburn/src/providers/qwen.js +193 -0
  125. package/dist/vendor/codeburn/src/providers/session-message.js +118 -0
  126. package/dist/vendor/codeburn/src/providers/sqlite-session-parser.js +457 -0
  127. package/dist/vendor/codeburn/src/providers/types.js +5 -0
  128. package/dist/vendor/codeburn/src/providers/vercel-gateway.js +135 -0
  129. package/dist/vendor/codeburn/src/providers/vscode-cline-parser.js +212 -0
  130. package/dist/vendor/codeburn/src/providers/warp.js +575 -0
  131. package/dist/vendor/codeburn/src/providers/zcode.js +249 -0
  132. package/dist/vendor/codeburn/src/providers/zed.js +187 -0
  133. package/dist/vendor/codeburn/src/providers/zerostack.js +139 -0
  134. package/dist/vendor/codeburn/src/quota/antigravity.js +310 -0
  135. package/dist/vendor/codeburn/src/quota/claude.js +244 -0
  136. package/dist/vendor/codeburn/src/quota/cursor.js +301 -0
  137. package/dist/vendor/codeburn/src/quota/security.js +299 -0
  138. package/dist/vendor/codeburn/src/quota/types.js +1 -0
  139. package/dist/vendor/codeburn/src/scan-facts.js +99 -0
  140. package/dist/vendor/codeburn/src/session-cache.js +3040 -0
  141. package/dist/vendor/codeburn/src/session-count-label.js +14 -0
  142. package/dist/vendor/codeburn/src/session-output.js +139 -0
  143. package/dist/vendor/codeburn/src/session-population.js +30 -0
  144. package/dist/vendor/codeburn/src/sessions-report.js +1342 -0
  145. package/dist/vendor/codeburn/src/sqlite.js +528 -0
  146. package/dist/vendor/codeburn/src/sync/otlp.js +420 -0
  147. package/dist/vendor/codeburn/src/telemetry-snapshot.js +244 -0
  148. package/dist/vendor/codeburn/src/token-estimate.js +5 -0
  149. package/dist/vendor/codeburn/src/types.js +16 -0
  150. package/dist/vendor/codeburn/src/work-units.js +126 -0
  151. package/dist/vendor/codeburn/src/workflow-insights.js +228 -0
  152. package/dist/vendor/codeburn/src/wsl.js +198 -0
  153. package/dist/vendor/codeburn/src/yield.js +666 -0
  154. package/package.json +1 -1
@@ -0,0 +1,324 @@
1
+ // @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
2
+ import { readdir, stat, readFile } from 'fs/promises';
3
+ import { join } from 'path';
4
+ import { homedir } from 'os';
5
+ import { readSessionFile, readSessionLines } from '../fs-utils.js';
6
+ import { calculateCost, getShortModelName, ownValue } from '../models.js';
7
+ import { extractBashCommands } from '../bash-utils.js';
8
+ import { normalizeContentBlocks } from '../content-utils.js';
9
+ const toolNameMap = {
10
+ Read: 'Read',
11
+ Create: 'Create',
12
+ Edit: 'Edit',
13
+ MultiEdit: 'MultiEdit',
14
+ LS: 'LS',
15
+ Glob: 'Glob',
16
+ Grep: 'Grep',
17
+ Execute: 'Bash',
18
+ AskUser: 'AskUser',
19
+ TodoWrite: 'TodoWrite',
20
+ Skill: 'Skill',
21
+ Task: 'Agent',
22
+ WebSearch: 'WebSearch',
23
+ FetchUrl: 'FetchUrl',
24
+ GenerateDroid: 'GenerateDroid',
25
+ ExitSpecMode: 'ExitSpecMode',
26
+ };
27
+ function getFactoryDir() {
28
+ return process.env['FACTORY_DIR'] ?? join(homedir(), '.factory');
29
+ }
30
+ // Strip Droid-specific wrapper to get the model's display name.
31
+ // e.g. "custom:GLM-5.1-[Proxy]-0" -> "GLM-5.1"
32
+ // Cost lookup is handled by codeburn's existing calculateCost/getCanonicalName
33
+ // which normalizes case and strips date suffixes automatically.
34
+ // Only a custom model carries a trailing index; elsewhere `-6` is a version
35
+ // and only a real YYYYMMDD date comes off.
36
+ function stripDateSuffix(name) {
37
+ const m = /-(\d{4})(\d{2})(\d{2})$/.exec(name);
38
+ if (!m)
39
+ return name;
40
+ const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
41
+ const date = new Date(Date.UTC(y, mo - 1, d));
42
+ const real = y >= 2020 && y <= 2035 && date.getUTCMonth() === mo - 1 && date.getUTCDate() === d;
43
+ return real ? name.slice(0, m.index) : name;
44
+ }
45
+ function stripModelPrefix(raw) {
46
+ const name = raw.replace(/^custom:/, '').replace(/\[.*?\]/g, '');
47
+ return (raw.startsWith('custom:') ? name.replace(/-\d+$/, '') : stripDateSuffix(name))
48
+ .replace(/-+$/, '')
49
+ .replace(/^-/, '');
50
+ }
51
+ function parseModelForDisplay(raw) {
52
+ const stripped = stripModelPrefix(raw);
53
+ const lower = stripped.toLowerCase();
54
+ if (lower.includes('opus'))
55
+ return getShortModelName(stripped);
56
+ if (lower.includes('sonnet'))
57
+ return getShortModelName(stripped);
58
+ if (lower.includes('haiku'))
59
+ return getShortModelName(stripped);
60
+ if (lower.startsWith('gpt-'))
61
+ return getShortModelName(stripped);
62
+ if (lower.startsWith('o3') || lower.startsWith('o4'))
63
+ return getShortModelName(stripped);
64
+ if (lower.startsWith('gemini'))
65
+ return getShortModelName(stripped);
66
+ return stripped;
67
+ }
68
+ /**
69
+ * Extract meaningful shell command names from a Droid Execute call.
70
+ * Droid frequently passes multi-line scripts (python -c "...", heredocs, etc.)
71
+ * where splitting on ;/&&/| produces noise tokens like '}', 'await', 'import'.
72
+ * Instead, extract only the primary command from each logical line.
73
+ */
74
+ function extractDroidBashCommands(command) {
75
+ if (!command || !command.trim())
76
+ return [];
77
+ const firstLine = command.split('\n')[0].trim();
78
+ return extractBashCommands(firstLine);
79
+ }
80
+ function createParser(source, seenKeys) {
81
+ return {
82
+ async *parse() {
83
+ const content = await readSessionFile(source.path);
84
+ if (content === null)
85
+ return;
86
+ // Read the companion settings file for token usage
87
+ const settingsPath = source.path.replace(/\.jsonl$/, '.settings.json');
88
+ let settings = {};
89
+ try {
90
+ const raw = await readFile(settingsPath, 'utf-8');
91
+ settings = JSON.parse(raw);
92
+ }
93
+ catch {
94
+ // No settings file or parse error
95
+ }
96
+ const lines = content.split('\n').filter(l => l.trim());
97
+ let sessionId = '';
98
+ let sessionModelDisplay = settings.model ? stripModelPrefix(settings.model) : 'unknown';
99
+ let currentUserMessage = '';
100
+ // Collect all assistant messages with their tools
101
+ const assistantCalls = [];
102
+ let pendingTools = [];
103
+ let pendingBashCommands = [];
104
+ for (const line of lines) {
105
+ let entry;
106
+ try {
107
+ entry = JSON.parse(line);
108
+ }
109
+ catch {
110
+ continue;
111
+ }
112
+ if (entry.type === 'session_start') {
113
+ sessionId = entry.id ?? '';
114
+ continue;
115
+ }
116
+ if (entry.type !== 'message' || !entry.message)
117
+ continue;
118
+ const msg = entry.message;
119
+ if (msg.role === 'user') {
120
+ // Extract user text from content
121
+ const texts = normalizeContentBlocks(msg.content)
122
+ .filter(c => c.type === 'text' && c.text)
123
+ .map(c => c.text)
124
+ .filter(Boolean);
125
+ // Skip system-reminder-only messages
126
+ const nonSystemTexts = texts.filter(t => !t.startsWith('<system-reminder>'));
127
+ if (nonSystemTexts.length > 0) {
128
+ currentUserMessage = nonSystemTexts.join(' ').slice(0, 500);
129
+ }
130
+ continue;
131
+ }
132
+ if (msg.role === 'assistant') {
133
+ const toolUses = normalizeContentBlocks(msg.content).filter(c => c.type === 'tool_use');
134
+ for (const tu of toolUses) {
135
+ const toolName = tu.name ?? '';
136
+ pendingTools.push(ownValue(toolNameMap, toolName) ?? toolName);
137
+ if (toolName === 'Execute' && tu.input && typeof tu.input['command'] === 'string') {
138
+ pendingBashCommands.push(...extractDroidBashCommands(tu.input['command']));
139
+ }
140
+ }
141
+ // Check if this assistant message has any text content (non-thinking)
142
+ const hasText = normalizeContentBlocks(msg.content).some(c => c.type === 'text' && c.text);
143
+ // Only emit a call entry if there are tools or substantial text
144
+ if (pendingTools.length > 0 || hasText) {
145
+ assistantCalls.push({
146
+ id: entry.id ?? `msg-${assistantCalls.length}`,
147
+ timestamp: entry.timestamp ?? '',
148
+ tools: [...pendingTools],
149
+ bashCommands: [...pendingBashCommands],
150
+ });
151
+ pendingTools = [];
152
+ pendingBashCommands = [];
153
+ }
154
+ continue;
155
+ }
156
+ }
157
+ if (assistantCalls.length === 0)
158
+ return;
159
+ // KNOWN LIMITATION: Droid records token usage only at session level
160
+ // (settings.tokenUsage), not per-message. We split evenly across the
161
+ // emitted assistant calls and price all of them at settings.model
162
+ // (the latest model the session used). For sessions where the user
163
+ // switched models mid-stream, costs are approximate — we have no
164
+ // ground-truth breakdown to attribute tokens per model.
165
+ const totalTokens = settings.tokenUsage;
166
+ if (!totalTokens)
167
+ return;
168
+ const totalInput = totalTokens.inputTokens ?? 0;
169
+ const totalOutput = totalTokens.outputTokens ?? 0;
170
+ const totalCacheCreation = totalTokens.cacheCreationTokens ?? 0;
171
+ const totalCacheRead = totalTokens.cacheReadTokens ?? 0;
172
+ const totalThinking = totalTokens.thinkingTokens ?? 0;
173
+ const numCalls = assistantCalls.length;
174
+ // Distribute evenly across calls
175
+ const inputPerCall = Math.floor(totalInput / numCalls);
176
+ const outputPerCall = Math.floor(totalOutput / numCalls);
177
+ const cacheCreationPerCall = Math.floor(totalCacheCreation / numCalls);
178
+ const cacheReadPerCall = Math.floor(totalCacheRead / numCalls);
179
+ const thinkingPerCall = Math.floor(totalThinking / numCalls);
180
+ for (let i = 0; i < assistantCalls.length; i++) {
181
+ const call = assistantCalls[i];
182
+ // Assign remainder to the last call
183
+ const isLast = i === assistantCalls.length - 1;
184
+ const inputTokens = isLast
185
+ ? totalInput - inputPerCall * (numCalls - 1)
186
+ : inputPerCall;
187
+ const outputTokens = isLast
188
+ ? totalOutput - outputPerCall * (numCalls - 1)
189
+ : outputPerCall;
190
+ const cacheCreationTokens = isLast
191
+ ? totalCacheCreation - cacheCreationPerCall * (numCalls - 1)
192
+ : cacheCreationPerCall;
193
+ const cacheReadTokens = isLast
194
+ ? totalCacheRead - cacheReadPerCall * (numCalls - 1)
195
+ : cacheReadPerCall;
196
+ const thinkingTokens = isLast
197
+ ? totalThinking - thinkingPerCall * (numCalls - 1)
198
+ : thinkingPerCall;
199
+ const dedupKey = `droid:${sessionId}:${call.id}`;
200
+ if (seenKeys.has(dedupKey))
201
+ continue;
202
+ seenKeys.add(dedupKey);
203
+ const costUSD = calculateCost(sessionModelDisplay.toLowerCase(), inputTokens, outputTokens + thinkingTokens, cacheCreationTokens, cacheReadTokens, 0);
204
+ // Use the call's timestamp, or session_start timestamp
205
+ const timestamp = call.timestamp || '';
206
+ yield {
207
+ provider: 'droid',
208
+ model: sessionModelDisplay,
209
+ inputTokens,
210
+ outputTokens,
211
+ cacheCreationInputTokens: cacheCreationTokens,
212
+ cacheReadInputTokens: cacheReadTokens,
213
+ cachedInputTokens: cacheReadTokens,
214
+ reasoningTokens: thinkingTokens,
215
+ webSearchRequests: 0,
216
+ costUSD,
217
+ tools: call.tools,
218
+ bashCommands: call.bashCommands,
219
+ timestamp,
220
+ speed: 'standard',
221
+ deduplicationKey: dedupKey,
222
+ userMessage: i === 0 ? currentUserMessage : '',
223
+ sessionId,
224
+ };
225
+ }
226
+ },
227
+ };
228
+ }
229
+ function isInternalSession(cwd, factoryDir) {
230
+ // Skip sessions whose cwd is the .factory directory itself (internal housekeeping)
231
+ const normalized = cwd.replace(/\/+$/, '');
232
+ return normalized === factoryDir;
233
+ }
234
+ function deriveProjectName(cwd) {
235
+ const normalized = cwd.replace(/\/+$/, '');
236
+ const home = homedir();
237
+ // Strip home directory prefix
238
+ let relative = normalized.startsWith(home)
239
+ ? normalized.slice(home.length).replace(/^\/+/, '')
240
+ : normalized.replace(/^\/+/, '');
241
+ if (!relative)
242
+ relative = '~';
243
+ // Walk from the right: use the "projects/<name>" segment if present,
244
+ // otherwise the last meaningful path component.
245
+ const parts = relative.split('/');
246
+ const projectsIdx = parts.lastIndexOf('projects');
247
+ if (projectsIdx !== -1 && projectsIdx + 1 < parts.length) {
248
+ return parts.slice(projectsIdx + 1).join('/');
249
+ }
250
+ return parts.join('/');
251
+ }
252
+ async function readFirstJsonlLine(filePath) {
253
+ for await (const line of readSessionLines(filePath)) {
254
+ return line;
255
+ }
256
+ return null;
257
+ }
258
+ async function discoverSessionsInDir(sessionsDir, factoryDir) {
259
+ const sources = [];
260
+ let entries;
261
+ try {
262
+ entries = await readdir(sessionsDir);
263
+ }
264
+ catch {
265
+ return sources;
266
+ }
267
+ for (const entry of entries) {
268
+ const subDir = join(sessionsDir, entry);
269
+ const s = await stat(subDir).catch(() => null);
270
+ if (!s?.isDirectory())
271
+ continue;
272
+ const files = await readdir(subDir).catch(() => []);
273
+ for (const file of files) {
274
+ if (!file.endsWith('.jsonl'))
275
+ continue;
276
+ const filePath = join(subDir, file);
277
+ const firstLine = await readFirstJsonlLine(filePath);
278
+ if (!firstLine?.trim())
279
+ continue;
280
+ let startEntry;
281
+ try {
282
+ startEntry = JSON.parse(firstLine);
283
+ }
284
+ catch {
285
+ continue;
286
+ }
287
+ if (startEntry.type !== 'session_start')
288
+ continue;
289
+ const cwd = startEntry.cwd ?? entry;
290
+ if (isInternalSession(cwd, factoryDir))
291
+ continue;
292
+ sources.push({
293
+ path: filePath,
294
+ project: deriveProjectName(cwd),
295
+ provider: 'droid',
296
+ });
297
+ }
298
+ }
299
+ return sources;
300
+ }
301
+ export function createDroidProvider(factoryDir) {
302
+ const base = factoryDir ?? getFactoryDir();
303
+ const sessionsDir = join(base, 'sessions');
304
+ return {
305
+ name: 'droid',
306
+ displayName: 'Droid',
307
+ modelDisplayName(model) {
308
+ return parseModelForDisplay(model);
309
+ },
310
+ toolDisplayName(rawTool) {
311
+ return ownValue(toolNameMap, rawTool) ?? rawTool;
312
+ },
313
+ async probeRoots() {
314
+ return [{ path: sessionsDir, label: 'sessions' }];
315
+ },
316
+ async discoverSessions() {
317
+ return discoverSessionsInDir(sessionsDir, base);
318
+ },
319
+ createSessionParser(source, seenKeys) {
320
+ return createParser(source, seenKeys);
321
+ },
322
+ };
323
+ }
324
+ export const droid = createDroidProvider();