agentel 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -68
- package/docs/code-reference.md +121 -37
- package/docs/history-source-handling.md +555 -124
- package/docs/release.md +35 -8
- package/npm-shrinkwrap.json +478 -0
- package/package.json +18 -5
- package/scripts/postinstall.js +156 -0
- package/src/archive.js +1174 -65
- package/src/canonical-events.js +346 -35
- package/src/cli.js +7121 -819
- package/src/collector.js +42 -4
- package/src/config.js +15 -4
- package/src/diffs.js +156 -0
- package/src/doctor.js +48 -5
- package/src/importers/claude.js +51 -4
- package/src/importers/copilot.js +385 -0
- package/src/importers/cursor-recovery.js +22 -0
- package/src/importers/factory.js +396 -0
- package/src/importers/gemini.js +39 -0
- package/src/importers/grok.js +367 -0
- package/src/importers/pi.js +422 -0
- package/src/importers/providers.js +64 -5
- package/src/importers.js +4524 -383
- package/src/mcp.js +1 -0
- package/src/memory-sources.js +671 -0
- package/src/memory-store.js +0 -0
- package/src/parser-versions.js +13 -0
- package/src/pricing.js +84 -0
- package/src/search.js +256 -70
- package/src/session-store.js +405 -0
- package/src/source-watch.js +293 -0
- package/src/sources.js +60 -11
- package/src/supervisor.js +197 -9
- package/src/sync.js +6 -0
- package/src/unavailable-sources.js +358 -0
package/docs/code-reference.md
CHANGED
|
@@ -17,6 +17,13 @@ binary.
|
|
|
17
17
|
|
|
18
18
|
Runs the recall command surface used by installed skills and slash commands.
|
|
19
19
|
|
|
20
|
+
### `scripts/postinstall.js`
|
|
21
|
+
|
|
22
|
+
Runs the install-time onboarding helper for direct installs. It skips CI,
|
|
23
|
+
`npx`/`npm exec`, and indirect dependency installs; when npm provides an
|
|
24
|
+
interactive terminal, it offers `agentlog update` for existing configs and
|
|
25
|
+
`agentlog init` for new installs.
|
|
26
|
+
|
|
20
27
|
## `src/archive.js`
|
|
21
28
|
|
|
22
29
|
Archive storage, transcript normalization, canonical event persistence,
|
|
@@ -30,9 +37,13 @@ Exports:
|
|
|
30
37
|
- `encodeSegment(value)`: URL-encodes an archive path segment.
|
|
31
38
|
- `ensureConversationMarkdown(session, env)`: materializes a missing
|
|
32
39
|
`conversation.md` from an existing transcript JSONL.
|
|
33
|
-
- `listSessions(env)`:
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
- `listSessions(env)`: returns archived session records sorted newest first,
|
|
41
|
+
using the persisted session-list index when available and rebuilding it from
|
|
42
|
+
metadata files when missing or invalid.
|
|
43
|
+
- `listSessionsSnapshot(env)`: returns `{ sessions, fingerprint, count }` for
|
|
44
|
+
list-derived web endpoints and ETags.
|
|
45
|
+
- `rebuildSessionListIndex(env)`: re-derives `agentlog/indexes/sessions` from
|
|
46
|
+
archived metadata files.
|
|
36
47
|
- `normalizeMessages(messages)`: normalizes raw messages into indexed,
|
|
37
48
|
timestamped transcript records; `writeSession` adds per-message visible-token
|
|
38
49
|
estimates before archiving.
|
|
@@ -50,9 +61,10 @@ Exports:
|
|
|
50
61
|
deterministic fallback session id.
|
|
51
62
|
- `toIso(value)`: converts date-ish values to ISO strings.
|
|
52
63
|
- `walk(dir, visit)`: recursively walks a directory tree.
|
|
53
|
-
- `writeSession(input, env)`: redacts, normalizes, writes, indexes,
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
- `writeSession(input, env)`: redacts, normalizes, writes, indexes, stamps the
|
|
65
|
+
configured device identity into session metadata, computes stats metadata
|
|
66
|
+
(`messageCount`, `userMessageCount`, `usage`, `models`), and copies declared
|
|
67
|
+
raw source files for one archived session.
|
|
56
68
|
|
|
57
69
|
Internal helpers:
|
|
58
70
|
|
|
@@ -99,12 +111,14 @@ low-signal filtering.
|
|
|
99
111
|
Exports:
|
|
100
112
|
|
|
101
113
|
- `CANONICAL_EVENT_SCHEMA_VERSION`: current event schema id,
|
|
102
|
-
`agentlog.events.
|
|
114
|
+
`agentlog.events.v5`.
|
|
103
115
|
- `EVENT_KINDS`: constants for `session.started`, `prompt.submitted`,
|
|
104
|
-
`response.generated`, `tool.called`,
|
|
116
|
+
`response.generated`, `tool.called`, `tool.completed`, `memory.read`,
|
|
117
|
+
`memory.write`, and `memory.loaded`.
|
|
105
118
|
- `normalizeSessionEvents(session, messages, options)`: maps transcript
|
|
106
119
|
messages into canonical events and links `tool.completed` events to matching
|
|
107
|
-
`tool.called` parents.
|
|
120
|
+
`tool.called` parents. Memory tool completions additionally emit
|
|
121
|
+
`memory.*` events that the viewer can render as memory activity.
|
|
108
122
|
- `messageToCanonicalEvents(message, session, options)`: maps one message into
|
|
109
123
|
zero or more canonical events.
|
|
110
124
|
- `stableEventId(sessionId, messageIndex, kind, ordinal, content)`: creates a
|
|
@@ -208,8 +222,14 @@ Command handlers:
|
|
|
208
222
|
- `autostartCommand(action)`: compatibility helper behind
|
|
209
223
|
`agentlog watcher login`.
|
|
210
224
|
- `resetCommand(flags, env)`: removes agentlog local state and archive objects.
|
|
211
|
-
- `updateCommand(flags, env)`: preserves preferences
|
|
212
|
-
archive/import state, reimports configured
|
|
225
|
+
- `updateCommand(flags, env)`: preserves preferences and unrecoverable local
|
|
226
|
+
archives, removes derived local archive/import state, reimports configured
|
|
227
|
+
sources, restores sessions whose original source files are gone, and rebuilds
|
|
228
|
+
the index.
|
|
229
|
+
- `statsPayload(filters, env, sessionsInput)`: builds normalized stats totals
|
|
230
|
+
and range-shaped chart series; default web payloads include the current chart
|
|
231
|
+
window and recent activity, while all-time daily series are requested
|
|
232
|
+
explicitly.
|
|
213
233
|
- `uninstallCommand(flags, env)`: stops services, removes autostart, and
|
|
214
234
|
optionally removes data.
|
|
215
235
|
- `revealCommand(sessionId, env)`: prints unredacted reveal-cache JSONL.
|
|
@@ -289,24 +309,44 @@ Session display and API helpers:
|
|
|
289
309
|
|
|
290
310
|
Recall integration helpers:
|
|
291
311
|
|
|
292
|
-
- `addRecallToAgent(target, env)`: installs MCP config
|
|
293
|
-
for one agent.
|
|
312
|
+
- `addRecallToAgent(target, env)`: installs MCP config plus recall and
|
|
313
|
+
continue-from command files for one agent.
|
|
294
314
|
- `installRecallSurface(target, env, options)`: installs slash-command/skill
|
|
295
|
-
recall surfaces.
|
|
315
|
+
recall and continue-from surfaces.
|
|
296
316
|
- `normalizeRecallTarget(target)`: maps common source/client aliases to recall
|
|
297
317
|
installer targets.
|
|
298
318
|
- `writeTextFile(file, text)`: writes a text file after ensuring its directory.
|
|
299
319
|
- `genericRecallInstructions()`: common recall workflow text for agents.
|
|
320
|
+
- `genericContinueFromInstructions()`: common continue-from workflow text for
|
|
321
|
+
agents.
|
|
300
322
|
- `claudeRecallCommand()`: generated Claude `/recall` command body.
|
|
323
|
+
- `claudeContinueFromCommand()`: generated Claude `/continue-from` command body.
|
|
301
324
|
- `geminiRecallCommand()`: generated Gemini recall command config.
|
|
325
|
+
- `geminiContinueFromCommand()`: generated Gemini continue-from command config.
|
|
302
326
|
- `antigravityRecallSkill()`: generated Antigravity recall skill body.
|
|
327
|
+
- `antigravityContinueFromSkill()`: generated Antigravity continue-from skill
|
|
328
|
+
body.
|
|
303
329
|
- `cursorRecallCommand()`: generated Cursor project `/recall` command body.
|
|
304
330
|
- `cursorRecallRule()`: generated Cursor rule that advertises agentlog recall.
|
|
331
|
+
- `cursorContinueFromCommand()`: generated Cursor project `/continue-from`
|
|
332
|
+
command body.
|
|
333
|
+
- `cursorContinueFromRule()`: generated Cursor rule that advertises agentlog
|
|
334
|
+
continue-from.
|
|
305
335
|
- `devinRecallSkill()`: generated Devin `/recall` skill body.
|
|
336
|
+
- `devinContinueFromSkill()`: generated Devin `/continue-from` skill body.
|
|
306
337
|
- `opencodeRecallCommand()`: generated OpenCode `/recall` command body.
|
|
338
|
+
- `opencodeContinueFromCommand()`: generated OpenCode `/continue-from` command
|
|
339
|
+
body.
|
|
307
340
|
- `clineRecallWorkflow()`: generated Cline `/recall.md` workflow body.
|
|
341
|
+
- `clineContinueFromWorkflow()`: generated Cline `/continue-from.md` workflow
|
|
342
|
+
body.
|
|
308
343
|
- `aiderRecallInstructions()`: generated Aider loadable recall instructions.
|
|
344
|
+
- `aiderContinueFromInstructions()`: generated Aider loadable continue-from
|
|
345
|
+
instructions.
|
|
309
346
|
- `codexRecallSkill()`: generated Codex skill body.
|
|
347
|
+
- `codexContinueFromSkill()`: generated Codex continue-from skill body.
|
|
348
|
+
- `continueFromSurfaceTemplates()`: returns generated continue-from
|
|
349
|
+
command/skill templates.
|
|
310
350
|
- `recallArchiveHints()`: shared archive path and filter hints.
|
|
311
351
|
- `commandOnPath(command)`: finds an executable on `PATH`.
|
|
312
352
|
- `shellQuote(value)`: quotes a shell argument.
|
|
@@ -482,6 +522,19 @@ Internal helpers:
|
|
|
482
522
|
- `safeJson(body)`: parses JSON or wraps raw text.
|
|
483
523
|
- `looksLikeJson(body)`: cheaply detects JSON-looking request bodies.
|
|
484
524
|
|
|
525
|
+
## `src/pricing.js`
|
|
526
|
+
|
|
527
|
+
Versioned model pricing lookup used by stats spend estimates. Provider-reported
|
|
528
|
+
costs remain authoritative; this module only prices known token splits when no
|
|
529
|
+
actual cost is archived.
|
|
530
|
+
|
|
531
|
+
Exports:
|
|
532
|
+
|
|
533
|
+
- `PRICING_SOURCE`: stable label for the bundled pricing table.
|
|
534
|
+
- `PRICING_VERSION`: version stamp emitted in stats payloads.
|
|
535
|
+
- `pricingForSession(provider, model)`: returns per-million-token input,
|
|
536
|
+
output, cache-read, and cache-write rates for known models.
|
|
537
|
+
|
|
485
538
|
## `src/config.js`
|
|
486
539
|
|
|
487
540
|
Config defaults, persistence, and key access.
|
|
@@ -901,14 +954,19 @@ Gemini and Antigravity helpers:
|
|
|
901
954
|
- `parseGenericJsonHistory(file, source, fallbackTime)`: generic JSON parser.
|
|
902
955
|
- `parseMarkdownChatFile(file, source, fallbackTime)`: Markdown chat parser.
|
|
903
956
|
- `importWindsurfTrajectoryExport(target, options, env)`: imports downloaded
|
|
904
|
-
Windsurf "Download trajectory" Markdown exports.
|
|
957
|
+
Windsurf "Download trajectory" Markdown exports. With `options.claim`, a
|
|
958
|
+
single Markdown export replaces the matching zero-message Windsurf protobuf
|
|
959
|
+
repair stub.
|
|
905
960
|
- `readWindsurfTrajectoryExport(target, options)`: reads Windsurf trajectory
|
|
906
961
|
Markdown files from a user-selected file or folder.
|
|
907
|
-
- `readWindsurfSessions(options)`:
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
962
|
+
- `readWindsurfSessions(options, env)`: reads local Windsurf Cascade brain
|
|
963
|
+
artifacts from `.codeium/windsurf/brain`, preserves matching Cascade
|
|
964
|
+
protobufs as raw files when present, enriches session IDs from Windsurf's ACP
|
|
965
|
+
metadata cache, and emits binary-only protobuf stores as repair stubs.
|
|
966
|
+
- `readAntigravitySessions(options, env)`: reads Antigravity transcript logs and
|
|
967
|
+
Markdown artifacts, links `INVOKE_SUBAGENT` child transcripts into
|
|
968
|
+
`antigravitySubagentRuns`, imports partial trajectory summaries from
|
|
969
|
+
Antigravity global state when artifacts are absent, and counts binary stores.
|
|
912
970
|
- `readMarkdownArtifactSessions({ ... })`: common Markdown artifact reader.
|
|
913
971
|
- `markdownArtifactSession(provider, dir, artifactNames, sourceType, detailKey)`:
|
|
914
972
|
converts one artifact directory into a session.
|
|
@@ -1042,9 +1100,11 @@ Recall search, history listing, filters, and the event-first keyword index.
|
|
|
1042
1100
|
|
|
1043
1101
|
Exports:
|
|
1044
1102
|
|
|
1045
|
-
- `buildIndex(env)`: reads canonical events
|
|
1046
|
-
|
|
1047
|
-
|
|
1103
|
+
- `buildIndex(env)`: reads canonical events, chunks searchable text, and writes
|
|
1104
|
+
the compatibility BM25 JSON index plus the SQLite FTS5 sidecar. The index is
|
|
1105
|
+
keyed by the session-list fingerprint.
|
|
1106
|
+
- `buildIndexSummary(env)`: writes the normal summary JSON index and SQLite FTS5
|
|
1107
|
+
sidecar without retaining all docs/postings in the parent process.
|
|
1048
1108
|
- `chunkText(text, maxTokens, overlap)`: chunks long content for indexing.
|
|
1049
1109
|
- `listHistorySessions(options, env)`: returns filtered archived session rows.
|
|
1050
1110
|
- `listRecentSessions(limit, options, env)`: returns recent session rows.
|
|
@@ -1052,30 +1112,33 @@ Exports:
|
|
|
1052
1112
|
`null` for missing/stale/incompatible indexes without parsing obsolete JSON.
|
|
1053
1113
|
- `readIndexSummary(indexPath)`: reads only the JSON index header fields needed
|
|
1054
1114
|
for status displays.
|
|
1115
|
+
- `rebuildIndexSummary(env)`: rebuilds the summary/FTS index, usually in a
|
|
1116
|
+
short-lived child process.
|
|
1055
1117
|
- `reindexIfNeeded(env)`: rebuilds the index when stale and not paused.
|
|
1056
1118
|
- `sessionHistoryTime(session)`: returns display-safe session times, including
|
|
1057
1119
|
hiding Cursor raw-salvage timestamps that were synthesized from SQLite mtimes.
|
|
1058
|
-
- `searchPastSessions(query, options, env)`: searches the event index
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1120
|
+
- `searchPastSessions(query, options, env)`: searches the canonical event index.
|
|
1121
|
+
Legacy BM25 JSON search requires `legacyJsonIndex`/`allowJsonIndex`, and
|
|
1122
|
+
legacy markdown/transcript scanning requires `markdownFallback`; interactive
|
|
1123
|
+
callers pass `noRebuild`, `skipJsonIndex`, `allowStaleFts`, and
|
|
1124
|
+
`skipMarkdownFallback` to keep typing paths bounded.
|
|
1063
1125
|
- `tokenize(text)`: lowercases and tokenizes searchable text.
|
|
1064
1126
|
|
|
1065
1127
|
Internal helpers:
|
|
1066
1128
|
|
|
1067
1129
|
- `docsForEvents(session, events)`: converts canonical events into index
|
|
1068
1130
|
documents with event ids, event kinds, message indexes, and rendered text.
|
|
1069
|
-
- `docsForTranscript(session, messages)`: builds legacy transcript
|
|
1070
|
-
|
|
1131
|
+
- `docsForTranscript(session, messages)`: builds legacy transcript documents for
|
|
1132
|
+
explicit markdown/transcript recovery paths.
|
|
1071
1133
|
- `buildFtsIndex(index, env)`: writes the SQLite FTS5 sidecar from indexed
|
|
1072
1134
|
chunks, skipping the optional sidecar when `sqlite3` is unavailable.
|
|
1073
1135
|
- `ftsIndexAvailable(env, options)`: validates FTS5 sidecar version/freshness
|
|
1074
1136
|
without loading the JSON index.
|
|
1075
|
-
- `searchMarkdownSessions(query, options, env)`: legacy conversation
|
|
1076
|
-
search with `rg`/JS fallback.
|
|
1077
|
-
- `searchIndexedSessions(query, options, env)`: searches the event
|
|
1078
|
-
FTS5 sidecar
|
|
1137
|
+
- `searchMarkdownSessions(query, options, env)`: explicit legacy conversation
|
|
1138
|
+
Markdown search with `rg`/JS fallback.
|
|
1139
|
+
- `searchIndexedSessions(query, options, env)`: searches the canonical-event
|
|
1140
|
+
FTS5 sidecar, optionally falling back to the legacy JSON index when requested,
|
|
1141
|
+
and aggregates hits by session.
|
|
1079
1142
|
- `searchFtsSessions(query, queryTokens, context, env)`: searches the SQLite
|
|
1080
1143
|
FTS5 sidecar with prefix matching and returns session-shaped results.
|
|
1081
1144
|
- `candidateDocsForQuery(index, queryTokens, phrase)`: reads term postings to
|
|
@@ -1128,7 +1191,11 @@ Exports:
|
|
|
1128
1191
|
log lines.
|
|
1129
1192
|
- `stopSupervisor(env)`: sends SIGTERM to the recorded supervisor process.
|
|
1130
1193
|
- `supervisorStatus(env)`: reports supervisor PID and running state.
|
|
1131
|
-
- `tick(env)`: runs one import, reindex, and sync cycle.
|
|
1194
|
+
- `tick(env, state)`: runs one import, reindex, and sync cycle.
|
|
1195
|
+
- `applyWatchedSourceImportOutcome(sourceState, now)`: rests a watched source
|
|
1196
|
+
until the 15-minute heartbeat after an import.
|
|
1197
|
+
- `sourceEligibleForImport(sourceState, pending, now)`: pending filesystem
|
|
1198
|
+
activity bypasses idle/heartbeat scheduling but not error backoff.
|
|
1132
1199
|
|
|
1133
1200
|
Internal helpers:
|
|
1134
1201
|
|
|
@@ -1136,6 +1203,23 @@ Internal helpers:
|
|
|
1136
1203
|
- `isAlive(pid)`: checks whether a PID is alive.
|
|
1137
1204
|
- `log(message, env)`: appends to supervisor log.
|
|
1138
1205
|
|
|
1206
|
+
## `src/source-watch.js`
|
|
1207
|
+
|
|
1208
|
+
Filesystem-event layer for the supervisor. Maps each import source to its
|
|
1209
|
+
on-disk history roots (mirroring importer path resolution and env overrides
|
|
1210
|
+
without loading `src/importers.js`) and watches them with `fs.watch`.
|
|
1211
|
+
|
|
1212
|
+
Exports:
|
|
1213
|
+
|
|
1214
|
+
- `watchRootsForSource(source, env)`: watch roots
|
|
1215
|
+
(`{ dir, recursive, filter, coalesceMs }`) for a source; empty for sources
|
|
1216
|
+
that stay on polling (for example Aider project folders).
|
|
1217
|
+
- `startSourceWatchers(sources, env, onSourceDirty, options)`: dedupes shared
|
|
1218
|
+
roots into one OS watch each, coalesces events per source in a fixed-delay
|
|
1219
|
+
window (3s default, 20s for SQLite-backed stores), retries missing or dead
|
|
1220
|
+
watches every 5 minutes, and reports dirty sources. Returns
|
|
1221
|
+
`{ isWatched, activeWatchCount, refresh, close }`.
|
|
1222
|
+
|
|
1139
1223
|
## `src/sync.js`
|
|
1140
1224
|
|
|
1141
1225
|
Remote archive sync to file targets or S3-compatible object storage. Sync is
|
|
@@ -1150,8 +1234,8 @@ Exports:
|
|
|
1150
1234
|
- `configureRemoteFromFlags(flags, env)`: persists remote sync settings from CLI
|
|
1151
1235
|
flags.
|
|
1152
1236
|
- `hasRemoteTarget(cfg, env)`: reports whether a remote target is configured.
|
|
1153
|
-
- `listLocalArchiveObjects(env, prefix)`: lists local archive objects
|
|
1154
|
-
keys with hashes.
|
|
1237
|
+
- `listLocalArchiveObjects(env, prefix)`: lists canonical local archive objects
|
|
1238
|
+
as remote keys with hashes, excluding derived `indexes/` caches.
|
|
1155
1239
|
- `listRemoteSnapshots(options, env)`: lists snapshot folders and object counts
|
|
1156
1240
|
for the configured/flag remote target.
|
|
1157
1241
|
- `parseListBucketResult(xml)`: parses S3 ListObjectsV2 XML.
|