Commit 6234eb6
authored
feat(parser): add Shelley (exe.dev) agent support (#718)
Adds first-class support for **Shelley**, the exe.dev / boldsoftware coding agent ([github.com/boldsoftware/shelley](https://github.com/boldsoftware/shelley)), so its sessions appear alongside every other agent.
## Storage model
Shelley stores all conversations in a single SQLite DB at `~/.config/shelley/shelley.db` (`conversations` + `messages` tables). This is structurally identical to Zed, so the parser and sync wiring mirror the Zed single-DB pattern: a virtual source path (`shelley.db#<conversationID>`), classification before the `pathExists` guard, a WAL/SHM composite mtime, per-session `forceReplace` on parse, and a `SourceMtime` branch for the live per-session watcher. No `ResyncAll` `oldFileSessions` accounting is needed (that path is specific to the OpenCode-format storage agents) — Shelley re-parses fresh from the present DB, and vanished conversations are preserved via the generic orphan-copy.
## Extraction
`messages.llm_data` is a serialized `llm.Message` with PascalCase keys and integer enums. The content `Type` integers start at 2 (text=2, thinking=3, tool_use=5, tool_result=6) because `ContentType` shares an `iota` const block with `MessageRole` and `iota` does not reset between the two groups; this was verified against a real `shelley.db`. Tool results are stored as `user`-role messages (Anthropic-style) and pair into the originating tool call. All generations are included, ordered by `sequence_id` (monotonic and unique per conversation), so a context-reset / compaction boundary never hides earlier history.
## Tokens & cost
`usage_data` already uses the canonical Anthropic token keys, so the raw blob is stored verbatim and cost is catalog-priced. Token usage is also captured on errored assistant turns (stored as `type="error"`). The exact gateway `cost_usd` is present in the payload but is currently 0 from the exe.dev gateway; capturing it without double-counting the catalog-priced per-message tokens is left as a follow-up.
## Where to look
- `internal/parser/shelley.go` — parser, virtual-path / read-only store helpers, content and token extraction.
- `internal/sync/engine.go` — the Shelley sites mirroring Zed (classify, composite mtime, `processShelley`, dispatch, `SourceMtime`, cache-skip).
- `internal/parser/types.go` — the `AgentShelley` registry entry.
## Limitations
- Exact `cost_usd` capture is deferred (see above); standard gateway models are priced correctly by the catalog.
- Validated against real `shelley.db` data; tool-name categories cover the current Shelley tool set (`bash`, `patch`, `keyword_search`, `browser*`, `subagent`, …).
Co-authored-by: Matthew Jacobs <mjacobs@users.noreply.github.com>1 parent 546db04 commit 6234eb6
21 files changed
Lines changed: 3004 additions & 54 deletions
File tree
- frontend/src/lib/components/settings
- internal
- db
- duckdb
- parser
- postgres
- sessionwatch
- sync
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1183 | 1182 | | |
1184 | 1183 | | |
1185 | 1184 | | |
| |||
1221 | 1220 | | |
1222 | 1221 | | |
1223 | 1222 | | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1224 | 1237 | | |
1225 | 1238 | | |
1226 | 1239 | | |
| |||
1241 | 1254 | | |
1242 | 1255 | | |
1243 | 1256 | | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1244 | 1260 | | |
1245 | 1261 | | |
1246 | 1262 | | |
| |||
1253 | 1269 | | |
1254 | 1270 | | |
1255 | 1271 | | |
1256 | | - | |
| 1272 | + | |
| 1273 | + | |
1257 | 1274 | | |
1258 | 1275 | | |
1259 | 1276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1323 | 1323 | | |
1324 | 1324 | | |
1325 | 1325 | | |
1326 | | - | |
1327 | | - | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1328 | 1350 | | |
1329 | 1351 | | |
1330 | | - | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1331 | 1355 | | |
1332 | | - | |
| 1356 | + | |
| 1357 | + | |
1333 | 1358 | | |
1334 | 1359 | | |
1335 | | - | |
| 1360 | + | |
1336 | 1361 | | |
1337 | 1362 | | |
1338 | 1363 | | |
1339 | | - | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1340 | 1369 | | |
1341 | 1370 | | |
1342 | 1371 | | |
| |||
1517 | 1546 | | |
1518 | 1547 | | |
1519 | 1548 | | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1520 | 1568 | | |
1521 | 1569 | | |
1522 | 1570 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | | - | |
| 406 | + | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | | - | |
| 410 | + | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
415 | 417 | | |
416 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
417 | 427 | | |
418 | 428 | | |
419 | 429 | | |
| |||
0 commit comments