agentel 0.2.0 → 0.2.2

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.
@@ -34,7 +34,8 @@ Exports:
34
34
  records sorted newest first, including derived raw source archive paths when
35
35
  present.
36
36
  - `normalizeMessages(messages)`: normalizes raw messages into indexed,
37
- timestamped transcript records.
37
+ timestamped transcript records; `writeSession` adds per-message visible-token
38
+ estimates before archiving.
38
39
  - `objectPathForSession(session, env)`: computes the archive directory for one
39
40
  session using repo/scope, provider, and date.
40
41
  - `readTranscript(file)`: reads transcript JSONL into message objects.
@@ -118,12 +119,15 @@ Exports:
118
119
 
119
120
  ## `src/parser-versions.js`
120
121
 
121
- Central semantic parser-version table used by import fingerprints, archive
122
- metadata, and canonical events.
122
+ Central package-prefixed parser-version table used by import fingerprints,
123
+ archive metadata, and canonical events.
123
124
 
124
125
  Exports:
125
126
 
126
- - `PARSER_VERSIONS`: source-type to parser-version string map.
127
+ - `PACKAGE_VERSION`: package version prefix used by parser versions.
128
+ - `PARSER_VERSION_SUFFIXES`: source-type to development suffix map.
129
+ - `PARSER_VERSIONS`: source-type to `<package-version>.<suffix>` parser-version
130
+ string map.
127
131
  - `SOURCE_TYPE_ALIASES`: compatibility aliases for older source labels.
128
132
  - `canonicalSourceType(sourceType)`: resolves an alias to the canonical source
129
133
  type.
@@ -185,17 +189,26 @@ Command handlers:
185
189
  discovery, optional imports, and next-step output.
186
190
  - `startCommand(env)`: starts the supervisor, detached unless `--foreground`
187
191
  already routed to the foreground runner.
192
+ - `watcherCommand(args, flags, env)`: canonical watcher command group for
193
+ start, stop, status, logs, and login startup.
188
194
  - `stopCommand(env)`: stops the supervisor process.
189
195
  - `statusCommand(flags, env)`: prints or returns home, storage, supervisor,
190
196
  session, index, collector, sync, and recent archive state.
191
197
  - `recentArchivedSessions(env, limit)`: returns recently written session
192
198
  metadata for status output.
193
- - `configCommand(args, env)`: handles `config get` and `config set`.
194
- - `migrateCommand(flags, env)`: updates storage backend configuration.
195
- - `syncCommand(flags, env)`: runs archive sync with configured or flag-provided
196
- remote settings.
197
- - `autostartCommand(action)`: enables, disables, or reports autostart.
199
+ - `configCommand(args, flags, env)`: handles config summaries, path display,
200
+ `get`/`set`, the no-import setup flow, and watcher source list updates
201
+ without rerunning init.
202
+ - `migrateCommand(flags, env)`: compatibility alias for remote sync
203
+ configuration.
204
+ - `syncCommand(args, flags, env)`: runs normal archive sync or the explicit
205
+ remote configure, snapshot, replace, or upload flow with configured or
206
+ flag-provided remote settings.
207
+ - `autostartCommand(action)`: compatibility helper behind
208
+ `agentlog watcher login`.
198
209
  - `resetCommand(flags, env)`: removes agentlog local state and archive objects.
210
+ - `updateCommand(flags, env)`: preserves preferences, removes derived local
211
+ archive/import state, reimports configured sources, and rebuilds the index.
199
212
  - `uninstallCommand(flags, env)`: stops services, removes autostart, and
200
213
  optionally removes data.
201
214
  - `revealCommand(sessionId, env)`: prints unredacted reveal-cache JSONL.
@@ -203,6 +216,9 @@ Command handlers:
203
216
  - `indexCommand(action, env)`: pauses, resumes, rebuilds, or reports the search
204
217
  index.
205
218
  - `doctorCommand(flags, env)`: runs diagnostics.
219
+ - `integrationsCommand(args, env)`: canonical integration command group for
220
+ recall surfaces.
221
+ - `mcpCommand(args, flags, env)`: canonical MCP server command group.
206
222
  - `importCommand(args, flags, env)`: imports local sources or web export files.
207
223
  - `recallCommand(args, env)`: handles recall server/install/show/reindex flows.
208
224
  - `showRecallSession(sessionId, env)`: prints a session through the recall path.
@@ -227,7 +243,8 @@ Reset and process helpers:
227
243
  - `pidAlive(pid)`: checks whether a process id is alive.
228
244
  - `sleep(ms)`: promise-based timeout.
229
245
  - `resetTargets(env)`: lists filesystem targets removed by reset.
230
- - `coalesceTargets(targets)`: removes duplicate/nested reset targets.
246
+ - `updateTargets(env)`: lists derived filesystem targets removed by update.
247
+ - `coalesceTargets(targets)`: removes duplicate/nested filesystem targets.
231
248
  - `isSameOrInside(value, parent)`: checks path containment.
232
249
  - `assertSafeResetTarget(targetPath)`: prevents reset from deleting unsafe
233
250
  filesystem roots.
@@ -236,7 +253,11 @@ Session display and API helpers:
236
253
 
237
254
  - `readSessionMarkdown(sessionId, env)`: finds a session and returns its
238
255
  Markdown, metadata, and transcript.
239
- - `sessionViewPayload(view)`: builds the web/API payload for one session.
256
+ - `readSessionView(sessionId, env)`: finds a session without reading rendered
257
+ Markdown, for fast readable-view API loads.
258
+ - `sessionViewPayload(view, env, options)`: builds the web/API payload for one
259
+ session, optionally omitting Markdown and compacting duplicate tool/event
260
+ bodies for browser loads.
240
261
  - `dedupeTranscriptMessages(messages)`: removes duplicate messages for readable
241
262
  view payloads.
242
263
  - `normalizedTranscriptContent(value)`: whitespace-normalizes transcript content.
@@ -260,7 +281,8 @@ Session display and API helpers:
260
281
  - `parseFilterExpression(filter)`: parses combined filter expressions.
261
282
  - `clampLimit(value, fallback)`: bounds list/search limits.
262
283
  - `historyTitle(base, filters)`: formats terminal history subtitles.
263
- - `writeJsonResponse(res, payload, status)`: writes a JSON HTTP response.
284
+ - `writeJsonResponse(res, payload, status, options)`: writes a compact JSON
285
+ HTTP response unless `options.pretty` is set.
264
286
 
265
287
  Recall integration helpers:
266
288
 
@@ -363,15 +385,25 @@ Embedded history web app functions:
363
385
  - `formatWhen(value)`: browser-side timestamp formatting.
364
386
  - `renderTree(payload)`: renders the session tree.
365
387
  - `renderSearchResults(items)`: renders search result rows.
366
- - `sessionNode(item, includeExcerpt)`: creates one session button.
388
+ - `sessionNode(item, includeExcerpt)`: creates one session/search-result
389
+ button; search rows render as title/date plus folder/provider.
390
+ - `searchResultFolderPath(item)`: chooses the visible folder path for a search
391
+ result row.
392
+ - `compactBrowserPath(value)`: shortens `/Users/<name>` paths in browser UI.
367
393
  - `loadMoreNode(group)`: creates a repo/group pagination button.
368
394
  - `loadMoreRepo(repoKey, marker)`: loads more sessions for one group.
369
- - `loadSession(id)`: fetches and renders one session.
370
- - `setLoadingSession(id)`: shows loading state in the detail pane.
395
+ - `fetchSessionPayload(id)`: fetches one compact session payload with a small
396
+ ETag-backed browser cache for revisits and live refresh polling.
397
+ - `loadSession(id, options)`: fetches and renders one session; search rows can
398
+ preserve the current transcript until the new payload is ready.
399
+ - `setLoadingSession(id)`: schedules a delayed loading state in the detail pane.
371
400
  - `setEmptySession(message)`: shows empty/error state in the detail pane.
372
401
  - `renderSession(payload)`: renders session header, Markdown, messages, and
373
402
  copy controls.
374
- - `renderMessages(messages)`: renders readable transcript messages.
403
+ - `ensureMarkdownLoaded()`: lazily fetches rendered Markdown when source view is
404
+ opened.
405
+ - `renderMessages(messages)`: renders readable transcript messages in small
406
+ browser chunks so very large sessions can paint progressively.
375
407
  - `messageElement(message)`: creates one readable message row.
376
408
  - `copyIconSvg()`: returns the copy icon SVG.
377
409
  - `messageCopyButton(content)`: creates per-message copy controls.
@@ -404,6 +436,7 @@ Embedded history web app functions:
404
436
  - `copySessionDetails()`: copies session metadata for pasting into agents.
405
437
  - `loadTree()`: fetches and renders the tree.
406
438
  - `search()`: runs a search and renders results.
439
+ - `scheduleSearch()`: debounces search input for search-as-you-type.
407
440
  - `setupCustomSelects()`: wires custom select dropdown behavior.
408
441
  - `setSidebarCollapsed(collapsed)`: collapses or expands the tree pane.
409
442
 
@@ -423,7 +456,7 @@ Compatibility command for MCP startup.
423
456
  Exports:
424
457
 
425
458
  - `serverCommand(flags, env, deps)`: runs the same MCP stdio server used by
426
- `agentlog recall start`.
459
+ `agentlog mcp serve`.
427
460
 
428
461
  ## `src/collector.js`
429
462
 
@@ -467,7 +500,9 @@ Diagnostic checks for installation, dependencies, config, and source coverage.
467
500
 
468
501
  Export:
469
502
 
470
- - `runDoctor(env)`: returns checks, warnings, and source coverage details.
503
+ - `runDoctor(env, options)`: returns checks, warnings, parser-version drift,
504
+ source coverage details, and actionable recommendations. `options.onProgress`
505
+ receives discovery-style progress events during long scans.
471
506
 
472
507
  Internal helpers:
473
508
 
@@ -564,8 +599,10 @@ Generic parsing helpers:
564
599
  summary for tool-call metadata.
565
600
  - `normalizeWebConversations(provider, data)`: normalizes web export
566
601
  conversations.
567
- - `chatgptMessages(conversation)`: parses ChatGPT export conversation nodes.
568
- - `claudeMessages(conversation)`: parses Claude.ai export messages.
602
+ - `chatgptMessages(conversation)`: parses ChatGPT export conversation nodes
603
+ and attaches provider or estimated message usage.
604
+ - `claudeMessages(conversation)`: parses Claude.ai export messages, separating
605
+ thinking parts and attaching provider or estimated message usage.
569
606
  - `genericConversationMessages(conversation, source)`: fallback web-export
570
607
  parser.
571
608
 
@@ -753,11 +790,20 @@ Cline helpers:
753
790
 
754
791
  OpenCode helpers:
755
792
 
793
+ - `openCodeDatabaseFiles(env)`: resolves normalized OpenCode `opencode.db`
794
+ files from data-root defaults and database override env vars.
756
795
  - `openCodeStorageRoots(env)`: resolves global and project-scoped OpenCode
757
796
  `storage` directories, plus override env vars.
797
+ - `readOpenCodeSqliteSessionsFromDb(dbPath)`: reads the `session`, `message`,
798
+ `part`, and `project` tables from `opencode.db` and emits
799
+ `opencode-sqlite-history` sessions.
758
800
  - `openCodeSessionFiles(root)`: finds session JSON files.
801
+ - `openCodeMessageSessionIds(root)`: finds message-only OpenCode session
802
+ directories when session metadata is missing.
759
803
  - `parseOpenCodeSessionFile(file, storageRoot)`: normalizes one OpenCode
760
804
  session plus its messages, parts, project metadata, and session diff.
805
+ - `parseOpenCodeMessageOnlySession(storageRoot, sessionId)`: reconstructs a
806
+ best-effort OpenCode session from message/part files without session metadata.
761
807
  - `openCodeMessageFiles(storageRoot, sessionId)`: finds message JSON files for
762
808
  a session.
763
809
  - `openCodePartFiles(storageRoot, messageId)`: finds part JSON files for a
@@ -803,6 +849,8 @@ Devin helpers:
803
849
  alternate branches.
804
850
  - `devinMessagesFromNode(row)`: parses `chat_message` JSON into agentlog
805
851
  messages.
852
+ - `devinUsage(message)`: normalizes Devin `chat_message.metadata.metrics`
853
+ token counts into agentlog usage metadata.
806
854
  - `devinVisibleContent(content, toolCalls)`: keeps visible prose while dropping
807
855
  Devin's `none` placeholders for tool-only assistant nodes.
808
856
  - `devinIsContextUserMessage(role, content)`: skips injected Devin context.
@@ -835,13 +883,19 @@ Gemini and Antigravity helpers:
835
883
  - `parseGeminiCliJsonl(text, options)` and `parseGeminiCliJson(data, options)`:
836
884
  normalize Gemini role/parts history, function calls/results, shell/code
837
885
  execution parts, native `toolCalls[].result` entries, usage metadata, and
838
- checkpoint events.
886
+ checkpoint events, and derive session titles from Gemini `Update Topic
887
+ Context` tool-call arguments.
839
888
  - `parseGenericJsonHistory(file, source, fallbackTime)`: generic JSON parser.
840
889
  - `parseMarkdownChatFile(file, source, fallbackTime)`: Markdown chat parser.
890
+ - `importWindsurfTrajectoryExport(target, options, env)`: imports downloaded
891
+ Windsurf "Download trajectory" Markdown exports.
892
+ - `readWindsurfTrajectoryExport(target, options)`: reads Windsurf trajectory
893
+ Markdown files from a user-selected file or folder.
841
894
  - `readWindsurfSessions(options)`: disabled experimental helper retained for
842
895
  future Windsurf decoder work.
843
- - `readAntigravitySessions(options, env)`: reads Antigravity Markdown artifacts and
844
- counts binary stores.
896
+ - `readAntigravitySessions(options, env)`: reads Antigravity Markdown artifacts,
897
+ imports partial trajectory summaries from Antigravity global state when
898
+ artifacts are absent, and counts binary stores.
845
899
  - `readMarkdownArtifactSessions({ ... })`: common Markdown artifact reader.
846
900
  - `markdownArtifactSession(provider, dir, artifactNames, sourceType, detailKey)`:
847
901
  converts one artifact directory into a session.
@@ -914,8 +968,10 @@ Exports:
914
968
  - `ensureDir(dir)`: creates one directory recursively.
915
969
  - `homeDir(env)`: resolves `AGENTLOG_HOME` or `~/.agentlog`.
916
970
  - `paths(env)`: returns all important agentlog paths.
971
+ - `paths(env).ftsIndex`: SQLite FTS5 sidecar used by web search.
917
972
  - `readJson(file, fallback)`: reads JSON with fallback for missing files.
918
- - `writeJson(file, value)`: writes pretty JSON with private file mode.
973
+ - `writeJson(file, value, options)`: writes private JSON files, pretty by
974
+ default and compact when `options.pretty === false`.
919
975
 
920
976
  ## `src/redaction.js`
921
977
 
@@ -925,13 +981,14 @@ Exports:
925
981
 
926
982
  - `loadEnvValues(cwd, names, env)`: loads configured env values from process env
927
983
  and `.env` files.
928
- - `loadRedactionConfig(env)`: reads `~/.agentlog/redaction.yaml`.
984
+ - `loadRedactionConfig(env)`: reads opt-in `~/.agentlog/redaction.yaml`;
985
+ missing config disables redaction.
929
986
  - `mergeSummaries(target, source)`: merges redaction count summaries.
930
987
  - `parseRedactionYaml(text)`: parses the small supported YAML subset.
931
- - `redactText(input, options)`: applies built-in, env, high-entropy, and custom
932
- redactions.
933
- - `styleRedactionMarkersForMarkdown(input)`: turns `[REDACTED:...]` markers into
934
- styled Markdown HTML.
988
+ - `redactText(input, options)`: when enabled, applies configured built-in, env,
989
+ high-entropy, and custom redactions.
990
+ - `styleRedactionMarkersForMarkdown(input)`: turns `[REDACTED ...]` markers
991
+ into styled Markdown HTML, with legacy `[REDACTED:...]` support.
935
992
 
936
993
  Internal helpers:
937
994
 
@@ -973,16 +1030,23 @@ Recall search, history listing, filters, and the event-first keyword index.
973
1030
  Exports:
974
1031
 
975
1032
  - `buildIndex(env)`: reads canonical events when present, falls back to
976
- transcripts, chunks searchable text, and writes the search index.
1033
+ transcripts, chunks searchable text, and writes the BM25 JSON index plus the
1034
+ SQLite FTS5 sidecar when `sqlite3` is available.
977
1035
  - `chunkText(text, maxTokens, overlap)`: chunks long content for indexing.
978
1036
  - `listHistorySessions(options, env)`: returns filtered archived session rows.
979
1037
  - `listRecentSessions(limit, options, env)`: returns recent session rows.
980
- - `loadIndex(env)`: loads or rebuilds the index.
1038
+ - `loadIndex(env, options)`: loads or rebuilds the index; `noRebuild` returns
1039
+ `null` for missing/stale/incompatible indexes without parsing obsolete JSON.
1040
+ - `readIndexSummary(indexPath)`: reads only the JSON index header fields needed
1041
+ for status displays.
981
1042
  - `reindexIfNeeded(env)`: rebuilds the index when stale and not paused.
982
1043
  - `sessionHistoryTime(session)`: returns display-safe session times, including
983
1044
  hiding Cursor raw-salvage timestamps that were synthesized from SQLite mtimes.
984
1045
  - `searchPastSessions(query, options, env)`: searches the event index first,
985
- then legacy markdown/transcript fallback.
1046
+ then legacy markdown/transcript fallback. Interactive callers can pass
1047
+ `noRebuild`, `skipJsonIndex`, `allowStaleFts`, and `skipMarkdownFallback` to
1048
+ avoid synchronous index rebuilds, large BM25 JSON parses, or full-archive
1049
+ Markdown scans during typing.
986
1050
  - `tokenize(text)`: lowercases and tokenizes searchable text.
987
1051
 
988
1052
  Internal helpers:
@@ -991,16 +1055,27 @@ Internal helpers:
991
1055
  documents with event ids, event kinds, message indexes, and rendered text.
992
1056
  - `docsForTranscript(session, messages)`: builds legacy transcript index
993
1057
  documents when no event file exists.
1058
+ - `buildFtsIndex(index, env)`: writes the SQLite FTS5 sidecar from indexed
1059
+ chunks, skipping the optional sidecar when `sqlite3` is unavailable.
1060
+ - `ftsIndexAvailable(env, options)`: validates FTS5 sidecar version/freshness
1061
+ without loading the JSON index.
994
1062
  - `searchMarkdownSessions(query, options, env)`: legacy conversation Markdown
995
1063
  search with `rg`/JS fallback.
996
1064
  - `searchIndexedSessions(query, options, env)`: searches the event/transcript
997
- JSON index and aggregates hits by session.
1065
+ FTS5 sidecar or JSON index and aggregates hits by session.
1066
+ - `searchFtsSessions(query, queryTokens, context, env)`: searches the SQLite
1067
+ FTS5 sidecar with prefix matching and returns session-shaped results.
1068
+ - `candidateDocsForQuery(index, queryTokens, phrase)`: reads term postings to
1069
+ narrow scoring to matching index documents.
998
1070
  - `ripgrepMatches(queryTokens, files)`: runs `rg --json`.
999
1071
  - `jsLineMatches(queryTokens, files)`: slow in-process line search fallback.
1000
1072
  - `readLineWindow(file, lineNumber, radius)`: reads context around a match.
1001
1073
  - `inferRoleFromMarkdown(file, lineNumber)`: finds nearest message heading.
1002
1074
  - `escapeRegex(value)`: escapes query tokens for regex.
1003
- - `bm25Score(doc, queryTokens, index)`: scores one indexed chunk.
1075
+ - `bm25Score(doc, queryTokens, index, docIndex, termFrequencies)`: scores one
1076
+ indexed chunk.
1077
+ - `termFrequencyForDoc(doc, token, docIndex, termFrequencies)`: reads query
1078
+ term frequency from postings-backed candidates.
1004
1079
  - `excerpt(text, queryTokens)`: builds a compact result excerpt.
1005
1080
  - `inferCallingRepo(cwd)`: infers repo key from caller cwd.
1006
1081
  - `displayRepoLabel(session)`: chooses repo/scope/path display text.
@@ -1064,6 +1139,8 @@ Exports:
1064
1139
  - `hasRemoteTarget(cfg, env)`: reports whether a remote target is configured.
1065
1140
  - `listLocalArchiveObjects(env, prefix)`: lists local archive objects as remote
1066
1141
  keys with hashes.
1142
+ - `listRemoteSnapshots(options, env)`: lists snapshot folders and object counts
1143
+ for the configured/flag remote target.
1067
1144
  - `parseListBucketResult(xml)`: parses S3 ListObjectsV2 XML.
1068
1145
  - `remoteTargetFromFlags(flags, cfg, env, options)`: resolves a remote target
1069
1146
  from flags, config, and env.
@@ -1071,14 +1148,23 @@ Exports:
1071
1148
  snapshot-scoped remote key prefix.
1072
1149
  - `snapshotArchive(options, env)`: uploads a point-in-time copy to the configured
1073
1150
  remote target.
1151
+ - `replaceRemoteArchive(options, env)`: explicit remote repair path that deletes
1152
+ the current device namespace and uploads the current local archive.
1074
1153
  - `syncArchive(options, env)`: syncs archive objects to configured/flag target.
1075
1154
  - `syncArchiveIfConfigured(env, options)`: no-ops unless a remote target exists.
1155
+ - `wipeRemoteArchive(options, env)`: delete-only remote repair path scoped to
1156
+ this device namespace, one snapshot, all snapshots, the configured prefix, or
1157
+ the entire bucket.
1076
1158
 
1077
1159
  Internal helpers:
1078
1160
 
1079
1161
  - `syncArchiveToS3(target, options, env)`: uploads changed objects to S3/R2.
1080
1162
  - `syncArchiveToDirectory(target, options, env)`: copies changed objects to a
1081
1163
  local/file URL target.
1164
+ - `replaceRemoteS3(target, options, env)`: deletes the current device-scoped
1165
+ remote prefix from S3/R2 and then force-uploads local archive objects.
1166
+ - `replaceRemoteDirectory(target, options, env)`: removes a file:// device
1167
+ namespace and then recopies local archive objects.
1082
1168
  - `listS3Objects(target, prefix)`: lists existing remote S3 objects.
1083
1169
  - `putS3Object(target, key, body)`: uploads one S3 object.
1084
1170
  - `s3Request(target, request)`: signs and sends one S3-compatible HTTP request.