devin-internals-spec 0.3.0__tar.gz
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.
- devin_internals_spec-0.3.0/LICENSE +21 -0
- devin_internals_spec-0.3.0/PKG-INFO +217 -0
- devin_internals_spec-0.3.0/README.md +204 -0
- devin_internals_spec-0.3.0/pyproject.toml +25 -0
- devin_internals_spec-0.3.0/setup.cfg +4 -0
- devin_internals_spec-0.3.0/src/devin_internals/__init__.py +20 -0
- devin_internals_spec-0.3.0/src/devin_internals/cli.py +339 -0
- devin_internals_spec-0.3.0/src/devin_internals/commits.py +100 -0
- devin_internals_spec-0.3.0/src/devin_internals/contract.py +231 -0
- devin_internals_spec-0.3.0/src/devin_internals/fixtures.py +365 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/__init__.py +35 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/_common.py +37 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/acp_messages.py +123 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/sessions.py +282 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/state_vscdb.py +74 -0
- devin_internals_spec-0.3.0/src/devin_internals/parsers/vscdb_scan.py +108 -0
- devin_internals_spec-0.3.0/src/devin_internals/projects.py +79 -0
- devin_internals_spec-0.3.0/src/devin_internals/schema.py +111 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/PKG-INFO +217 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/SOURCES.txt +30 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/dependency_links.txt +1 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/entry_points.txt +2 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/requires.txt +3 -0
- devin_internals_spec-0.3.0/src/devin_internals_spec.egg-info/top_level.txt +1 -0
- devin_internals_spec-0.3.0/tests/test_cli.py +120 -0
- devin_internals_spec-0.3.0/tests/test_commits_projects.py +95 -0
- devin_internals_spec-0.3.0/tests/test_fixtures.py +144 -0
- devin_internals_spec-0.3.0/tests/test_offline_core.py +74 -0
- devin_internals_spec-0.3.0/tests/test_parsers.py +198 -0
- devin_internals_spec-0.3.0/tests/test_schema.py +84 -0
- devin_internals_spec-0.3.0/tests/test_smoke.py +4 -0
- devin_internals_spec-0.3.0/tests/test_vscdb_scan.py +67 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Icaro0310
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devin-internals-spec
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Documented internals of Devin Desktop/CLI session stores, schema-version detection and test fixtures (unofficial)
|
|
5
|
+
Author: Icaro0310
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
<div align="center">
|
|
15
|
+
|
|
16
|
+
<img src="assets/banner.svg" alt="devin-internals-spec" width="100%"/>
|
|
17
|
+
|
|
18
|
+
<a href="https://github.com/Icaro0310/devin-internals-spec/actions/workflows/tests.yml"><img src="https://github.com/Icaro0310/devin-internals-spec/actions/workflows/tests.yml/badge.svg" alt="tests"/></a>
|
|
19
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/Icaro0310/devin-internals-spec"><img src="https://api.scorecard.dev/projects/github.com/Icaro0310/devin-internals-spec/badge" alt="OpenSSF Scorecard"/></a>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
# devin-internals-spec
|
|
25
|
+
|
|
26
|
+
> **Unofficial community project.** Not affiliated with, endorsed by, or
|
|
27
|
+
> sponsored by Cognition AI. "Devin" is a trademark of Cognition AI.
|
|
28
|
+
|
|
29
|
+
**[Português (BR)](README.pt-BR.md)** · English
|
|
30
|
+
|
|
31
|
+
A documented map of Devin's local session stores — the CLI `sessions.db`, the
|
|
32
|
+
Desktop GUI `acp-messages/*.db` and `state.vscdb` — plus a schema-version
|
|
33
|
+
detector and deterministic synthetic fixtures, so tooling fails loudly instead
|
|
34
|
+
of silently misreading your data.
|
|
35
|
+
|
|
36
|
+
## The problem
|
|
37
|
+
|
|
38
|
+
Everything Devin stores on your disk is kept in undocumented SQLite databases
|
|
39
|
+
whose schema **changes without notice**: `sessions.db` has already gone through
|
|
40
|
+
**17 migrations** (v1–v15 on 2026-05-06, v16 on 2026-07-05, v17 on 2026-09-14).
|
|
41
|
+
Any tool that reads these stores has to reverse-engineer the format — and when
|
|
42
|
+
Cognition ships the next migration, those tools break *silently*: wrong counts,
|
|
43
|
+
missed rows, or corrupted interpretation, with no error raised.
|
|
44
|
+
|
|
45
|
+
The Devin Desktop app is worse off than the CLI: its stores
|
|
46
|
+
(`acp-messages/*.db`, `state.vscdb`, session locks, the
|
|
47
|
+
`refinery_schema_history` migration ledger) are not documented anywhere.
|
|
48
|
+
|
|
49
|
+
## Prior art
|
|
50
|
+
|
|
51
|
+
Session-log tooling exists for other agent CLIs — e.g. **tokmesh** and
|
|
52
|
+
**UniSessions** document and parse Devin's CLI `sessions.db`. This project does
|
|
53
|
+
not reinvent that: it borrows the same idea (SQLite schema → typed parsing) and
|
|
54
|
+
extends it to what those tools don't cover — the Desktop GUI stores — and adds
|
|
55
|
+
the piece they lack: an explicit **schema-version gate** so a parser refuses to
|
|
56
|
+
run against a schema it has never seen.
|
|
57
|
+
|
|
58
|
+
## What makes it Devin-native
|
|
59
|
+
|
|
60
|
+
The differentiator, in one sentence: *it's the map of what Devin keeps on your
|
|
61
|
+
disk — and it warns you when that changes.*
|
|
62
|
+
|
|
63
|
+
1. **Side-by-side:** it covers `acp-messages/*.db`, `state.vscdb`
|
|
64
|
+
(`windsurfSpace.*` keys) and `refinery_schema_history`, which no existing
|
|
65
|
+
tool documents.
|
|
66
|
+
2. **No-Devin:** remove Devin and there is no store to document — the extra
|
|
67
|
+
disappears entirely.
|
|
68
|
+
3. **Loud failure:** `detect_schema_version()` returns a version contract and
|
|
69
|
+
raises on anything unknown, instead of guessing at bytes.
|
|
70
|
+
|
|
71
|
+
## Install
|
|
72
|
+
|
|
73
|
+
Python ≥ 3.10 and `pipx` are required. **Windows (PowerShell):** install `pipx` with `py -m pip install --user pipx`, run `py -m pipx ensurepath`, then reopen the terminal. **Linux (Debian/Ubuntu):** run `sudo apt install pipx python3-venv` and `pipx ensurepath`; reopen the terminal. Other Linux distributions should install `pipx` using their package manager.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pipx install "devin-internals-spec @ git+https://github.com/Icaro0310/devin-internals-spec.git"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For development:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install -e ".[dev]"
|
|
83
|
+
pytest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
devin-inspect schema <sessions.db> # schema-detection contract (JSON)
|
|
90
|
+
devin-inspect sessions <sessions.db> # list sessions (id, title, cwd, …)
|
|
91
|
+
devin-inspect health <devin-data-dir> # locate + check all three stores
|
|
92
|
+
devin-inspect contract <devin-data-dir> # unified drift check: schema +
|
|
93
|
+
# acp meta + usage shape, one report
|
|
94
|
+
devin-inspect make-fixture <out> # deterministic synthetic stores
|
|
95
|
+
# for tests/demos (--kind, --seed,
|
|
96
|
+
# --schema-version, --n-sessions)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`contract` is the single drift boundary for the whole catalog: it reports
|
|
100
|
+
`sessions.db` schema version, `acp-messages` meta `schema_version` (observed:
|
|
101
|
+
6; 1 on legacy DBs) and unexpected meta keys, and the verified usage shape
|
|
102
|
+
(no cost persisted — `num_tokens_preceding` only). On Linux it resolves the
|
|
103
|
+
split layout automatically (`~/.local/share/devin` data root +
|
|
104
|
+
`~/.config/Devin` GUI root). Exit code is non-zero on any drift.
|
|
105
|
+
|
|
106
|
+
`AcpMessagesStore.typed_meta()` decodes the `meta` table into a typed
|
|
107
|
+
view (`schema_version` normalized to int, `message_count`, `truncated`,
|
|
108
|
+
`title` from the `info` JSON blob) with `raw` as fallback.
|
|
109
|
+
`devin_internals.projects` gives the canonical project key/path used to
|
|
110
|
+
join sessions across tools, and `devin_internals.commits.commit_references()`
|
|
111
|
+
extracts git commit SHAs (40-hex + `/commit/<sha>` URLs, with repo context)
|
|
112
|
+
from `tool_call_state` payloads — short SHAs are ignored on purpose
|
|
113
|
+
(precision over recall for graph joins).
|
|
114
|
+
|
|
115
|
+
Every subcommand is read-only and accepts `--json`. The Python library is the
|
|
116
|
+
supported interface — the CLI is a thin wrapper:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
import os
|
|
120
|
+
import sys
|
|
121
|
+
from pathlib import Path
|
|
122
|
+
from devin_internals import detect_schema_version
|
|
123
|
+
from devin_internals.parsers import SessionsStore
|
|
124
|
+
|
|
125
|
+
if os.name == "nt":
|
|
126
|
+
root = Path(os.environ["APPDATA"]) / "devin"
|
|
127
|
+
elif sys.platform == "darwin":
|
|
128
|
+
root = Path.home() / "Library" / "Application Support" / "devin"
|
|
129
|
+
else:
|
|
130
|
+
data_home = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local/share"))
|
|
131
|
+
root = data_home / "devin"
|
|
132
|
+
sessions_db = root / "cli" / "sessions.db"
|
|
133
|
+
|
|
134
|
+
detect_schema_version(sessions_db)
|
|
135
|
+
# {"schema_version": 17, "known": True, "min_supported": 15, ...}
|
|
136
|
+
|
|
137
|
+
with SessionsStore(sessions_db) as store:
|
|
138
|
+
store.sessions() # typed dataclasses
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Works with Devin alone (Devin-only mode)
|
|
142
|
+
|
|
143
|
+
The spec is documentation plus a small local validation library: it reads
|
|
144
|
+
Devin's stores to report the schema version and gates tools when the version
|
|
145
|
+
is newer than what is known — it stops loudly instead of misparsing. Purely
|
|
146
|
+
local; nothing external is needed.
|
|
147
|
+
|
|
148
|
+
## Platform support
|
|
149
|
+
|
|
150
|
+
Pure stdlib Python — identical behavior on Windows, Linux and macOS. CI runs
|
|
151
|
+
the suite on `windows-latest` + `ubuntu-latest`; the target file or
|
|
152
|
+
directory is always an explicit argument, so there are no
|
|
153
|
+
platform-specific paths.
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### `vscdb-scan` — shape-only audit (IS-1)
|
|
157
|
+
|
|
158
|
+
`devin-internals vscdb-scan <state.vscdb>` audits the GUI key/value store
|
|
159
|
+
and reports, per key: name, value *shape* (json-object/array/string/…),
|
|
160
|
+
length, top-level JSON keys and risk flags (`sensitive-key-name`,
|
|
161
|
+
`looks-like-jwt`, `large-blob`). **Values are never printed** — flags are
|
|
162
|
+
heuristic and recall-biased; a real audit confirmed `state.vscdb` can
|
|
163
|
+
hold auth tokens and PII. `--fail-on-flags` exits 1 for CI.
|
|
164
|
+
|
|
165
|
+
## Limitations
|
|
166
|
+
|
|
167
|
+
- **Private, volatile internals.** These stores are implementation details of
|
|
168
|
+
Devin; the schema can change in any release. Only what is marked "verified"
|
|
169
|
+
in `docs/SPEC.md` should be relied on.
|
|
170
|
+
- **Verified against schema v17** only (the latest at time of writing). The
|
|
171
|
+
detector *refuses* versions it doesn't know — that's a feature, but it means
|
|
172
|
+
new Devin releases will break detection until the spec is updated.
|
|
173
|
+
- **Read-only.** This project never writes to Devin's databases.
|
|
174
|
+
- **Not a session exporter.** It documents and guards the format; it does not
|
|
175
|
+
dump your conversations (that is `devin-history`'s job).
|
|
176
|
+
- Fixtures contain **synthetic data only** — no real session content is ever
|
|
177
|
+
copied, by design.
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pip install -e ".[dev]"
|
|
183
|
+
pytest
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Ground rules in [CONTRIBUTING.md](CONTRIBUTING.md): fixtures before parsers,
|
|
187
|
+
small commits, bilingual docs.
|
|
188
|
+
|
|
189
|
+
## When to use this
|
|
190
|
+
|
|
191
|
+
- You are building a tool that reads Devin's local stores and need the documented schema, not reverse-engineering.
|
|
192
|
+
- You want a schema-version gate: `detect_schema_version()` refuses loudly on unknown versions instead of misparsing.
|
|
193
|
+
- You need deterministic synthetic fixtures to test parsers — no real session data required.
|
|
194
|
+
- You need typed, read-only access to `sessions.db` via `SessionsStore` in Python.
|
|
195
|
+
|
|
196
|
+
## When NOT to use this
|
|
197
|
+
|
|
198
|
+
- You want to export or dump sessions — this documents and guards the format; `devin-history` does the exporting.
|
|
199
|
+
- Your Devin release ships a schema newer than v17 — the detector refuses by design until the spec catches up.
|
|
200
|
+
- You need writes — every parser and subcommand is strictly read-only.
|
|
201
|
+
|
|
202
|
+
## FAQ
|
|
203
|
+
|
|
204
|
+
**What data does Devin store locally, and where?** Per this spec: a versioned `sessions.db` under `cli/` (sessions, tool-call state, transcripts), one `acp-messages/*.db` per GUI session, a `state.vscdb` KV store with `windsurfSpace.*` keys, `credentials.toml`, and a `refinery_schema_history` migration ledger. The verified details live in `docs/SPEC.md`.
|
|
205
|
+
|
|
206
|
+
**What happens when Devin ships a new schema version?** Tools using this library fail loudly, not silently. `detect_schema_version()` returns a contract (`known`, `min_supported`) and raises on versions it does not recognize — verified against schema v17 at time of writing.
|
|
207
|
+
|
|
208
|
+
**How is this different from other sessions.db parsers?** It also documents the Desktop GUI stores (`acp-messages/*.db`, `state.vscdb`, session locks, the migration ledger) that other tools don't cover, and adds the explicit schema-version gate. The library is the supported interface; `devin-inspect` is a thin CLI wrapper.
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
MIT — see [LICENSE](LICENSE).
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
If this saved you debugging time, a ⭐ on the repo helps others find it.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/banner.svg" alt="devin-internals-spec" width="100%"/>
|
|
4
|
+
|
|
5
|
+
<a href="https://github.com/Icaro0310/devin-internals-spec/actions/workflows/tests.yml"><img src="https://github.com/Icaro0310/devin-internals-spec/actions/workflows/tests.yml/badge.svg" alt="tests"/></a>
|
|
6
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/Icaro0310/devin-internals-spec"><img src="https://api.scorecard.dev/projects/github.com/Icaro0310/devin-internals-spec/badge" alt="OpenSSF Scorecard"/></a>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
# devin-internals-spec
|
|
12
|
+
|
|
13
|
+
> **Unofficial community project.** Not affiliated with, endorsed by, or
|
|
14
|
+
> sponsored by Cognition AI. "Devin" is a trademark of Cognition AI.
|
|
15
|
+
|
|
16
|
+
**[Português (BR)](README.pt-BR.md)** · English
|
|
17
|
+
|
|
18
|
+
A documented map of Devin's local session stores — the CLI `sessions.db`, the
|
|
19
|
+
Desktop GUI `acp-messages/*.db` and `state.vscdb` — plus a schema-version
|
|
20
|
+
detector and deterministic synthetic fixtures, so tooling fails loudly instead
|
|
21
|
+
of silently misreading your data.
|
|
22
|
+
|
|
23
|
+
## The problem
|
|
24
|
+
|
|
25
|
+
Everything Devin stores on your disk is kept in undocumented SQLite databases
|
|
26
|
+
whose schema **changes without notice**: `sessions.db` has already gone through
|
|
27
|
+
**17 migrations** (v1–v15 on 2026-05-06, v16 on 2026-07-05, v17 on 2026-09-14).
|
|
28
|
+
Any tool that reads these stores has to reverse-engineer the format — and when
|
|
29
|
+
Cognition ships the next migration, those tools break *silently*: wrong counts,
|
|
30
|
+
missed rows, or corrupted interpretation, with no error raised.
|
|
31
|
+
|
|
32
|
+
The Devin Desktop app is worse off than the CLI: its stores
|
|
33
|
+
(`acp-messages/*.db`, `state.vscdb`, session locks, the
|
|
34
|
+
`refinery_schema_history` migration ledger) are not documented anywhere.
|
|
35
|
+
|
|
36
|
+
## Prior art
|
|
37
|
+
|
|
38
|
+
Session-log tooling exists for other agent CLIs — e.g. **tokmesh** and
|
|
39
|
+
**UniSessions** document and parse Devin's CLI `sessions.db`. This project does
|
|
40
|
+
not reinvent that: it borrows the same idea (SQLite schema → typed parsing) and
|
|
41
|
+
extends it to what those tools don't cover — the Desktop GUI stores — and adds
|
|
42
|
+
the piece they lack: an explicit **schema-version gate** so a parser refuses to
|
|
43
|
+
run against a schema it has never seen.
|
|
44
|
+
|
|
45
|
+
## What makes it Devin-native
|
|
46
|
+
|
|
47
|
+
The differentiator, in one sentence: *it's the map of what Devin keeps on your
|
|
48
|
+
disk — and it warns you when that changes.*
|
|
49
|
+
|
|
50
|
+
1. **Side-by-side:** it covers `acp-messages/*.db`, `state.vscdb`
|
|
51
|
+
(`windsurfSpace.*` keys) and `refinery_schema_history`, which no existing
|
|
52
|
+
tool documents.
|
|
53
|
+
2. **No-Devin:** remove Devin and there is no store to document — the extra
|
|
54
|
+
disappears entirely.
|
|
55
|
+
3. **Loud failure:** `detect_schema_version()` returns a version contract and
|
|
56
|
+
raises on anything unknown, instead of guessing at bytes.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
Python ≥ 3.10 and `pipx` are required. **Windows (PowerShell):** install `pipx` with `py -m pip install --user pipx`, run `py -m pipx ensurepath`, then reopen the terminal. **Linux (Debian/Ubuntu):** run `sudo apt install pipx python3-venv` and `pipx ensurepath`; reopen the terminal. Other Linux distributions should install `pipx` using their package manager.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pipx install "devin-internals-spec @ git+https://github.com/Icaro0310/devin-internals-spec.git"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For development:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install -e ".[dev]"
|
|
70
|
+
pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
devin-inspect schema <sessions.db> # schema-detection contract (JSON)
|
|
77
|
+
devin-inspect sessions <sessions.db> # list sessions (id, title, cwd, …)
|
|
78
|
+
devin-inspect health <devin-data-dir> # locate + check all three stores
|
|
79
|
+
devin-inspect contract <devin-data-dir> # unified drift check: schema +
|
|
80
|
+
# acp meta + usage shape, one report
|
|
81
|
+
devin-inspect make-fixture <out> # deterministic synthetic stores
|
|
82
|
+
# for tests/demos (--kind, --seed,
|
|
83
|
+
# --schema-version, --n-sessions)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`contract` is the single drift boundary for the whole catalog: it reports
|
|
87
|
+
`sessions.db` schema version, `acp-messages` meta `schema_version` (observed:
|
|
88
|
+
6; 1 on legacy DBs) and unexpected meta keys, and the verified usage shape
|
|
89
|
+
(no cost persisted — `num_tokens_preceding` only). On Linux it resolves the
|
|
90
|
+
split layout automatically (`~/.local/share/devin` data root +
|
|
91
|
+
`~/.config/Devin` GUI root). Exit code is non-zero on any drift.
|
|
92
|
+
|
|
93
|
+
`AcpMessagesStore.typed_meta()` decodes the `meta` table into a typed
|
|
94
|
+
view (`schema_version` normalized to int, `message_count`, `truncated`,
|
|
95
|
+
`title` from the `info` JSON blob) with `raw` as fallback.
|
|
96
|
+
`devin_internals.projects` gives the canonical project key/path used to
|
|
97
|
+
join sessions across tools, and `devin_internals.commits.commit_references()`
|
|
98
|
+
extracts git commit SHAs (40-hex + `/commit/<sha>` URLs, with repo context)
|
|
99
|
+
from `tool_call_state` payloads — short SHAs are ignored on purpose
|
|
100
|
+
(precision over recall for graph joins).
|
|
101
|
+
|
|
102
|
+
Every subcommand is read-only and accepts `--json`. The Python library is the
|
|
103
|
+
supported interface — the CLI is a thin wrapper:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import os
|
|
107
|
+
import sys
|
|
108
|
+
from pathlib import Path
|
|
109
|
+
from devin_internals import detect_schema_version
|
|
110
|
+
from devin_internals.parsers import SessionsStore
|
|
111
|
+
|
|
112
|
+
if os.name == "nt":
|
|
113
|
+
root = Path(os.environ["APPDATA"]) / "devin"
|
|
114
|
+
elif sys.platform == "darwin":
|
|
115
|
+
root = Path.home() / "Library" / "Application Support" / "devin"
|
|
116
|
+
else:
|
|
117
|
+
data_home = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local/share"))
|
|
118
|
+
root = data_home / "devin"
|
|
119
|
+
sessions_db = root / "cli" / "sessions.db"
|
|
120
|
+
|
|
121
|
+
detect_schema_version(sessions_db)
|
|
122
|
+
# {"schema_version": 17, "known": True, "min_supported": 15, ...}
|
|
123
|
+
|
|
124
|
+
with SessionsStore(sessions_db) as store:
|
|
125
|
+
store.sessions() # typed dataclasses
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Works with Devin alone (Devin-only mode)
|
|
129
|
+
|
|
130
|
+
The spec is documentation plus a small local validation library: it reads
|
|
131
|
+
Devin's stores to report the schema version and gates tools when the version
|
|
132
|
+
is newer than what is known — it stops loudly instead of misparsing. Purely
|
|
133
|
+
local; nothing external is needed.
|
|
134
|
+
|
|
135
|
+
## Platform support
|
|
136
|
+
|
|
137
|
+
Pure stdlib Python — identical behavior on Windows, Linux and macOS. CI runs
|
|
138
|
+
the suite on `windows-latest` + `ubuntu-latest`; the target file or
|
|
139
|
+
directory is always an explicit argument, so there are no
|
|
140
|
+
platform-specific paths.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### `vscdb-scan` — shape-only audit (IS-1)
|
|
144
|
+
|
|
145
|
+
`devin-internals vscdb-scan <state.vscdb>` audits the GUI key/value store
|
|
146
|
+
and reports, per key: name, value *shape* (json-object/array/string/…),
|
|
147
|
+
length, top-level JSON keys and risk flags (`sensitive-key-name`,
|
|
148
|
+
`looks-like-jwt`, `large-blob`). **Values are never printed** — flags are
|
|
149
|
+
heuristic and recall-biased; a real audit confirmed `state.vscdb` can
|
|
150
|
+
hold auth tokens and PII. `--fail-on-flags` exits 1 for CI.
|
|
151
|
+
|
|
152
|
+
## Limitations
|
|
153
|
+
|
|
154
|
+
- **Private, volatile internals.** These stores are implementation details of
|
|
155
|
+
Devin; the schema can change in any release. Only what is marked "verified"
|
|
156
|
+
in `docs/SPEC.md` should be relied on.
|
|
157
|
+
- **Verified against schema v17** only (the latest at time of writing). The
|
|
158
|
+
detector *refuses* versions it doesn't know — that's a feature, but it means
|
|
159
|
+
new Devin releases will break detection until the spec is updated.
|
|
160
|
+
- **Read-only.** This project never writes to Devin's databases.
|
|
161
|
+
- **Not a session exporter.** It documents and guards the format; it does not
|
|
162
|
+
dump your conversations (that is `devin-history`'s job).
|
|
163
|
+
- Fixtures contain **synthetic data only** — no real session content is ever
|
|
164
|
+
copied, by design.
|
|
165
|
+
|
|
166
|
+
## Development
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
pip install -e ".[dev]"
|
|
170
|
+
pytest
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Ground rules in [CONTRIBUTING.md](CONTRIBUTING.md): fixtures before parsers,
|
|
174
|
+
small commits, bilingual docs.
|
|
175
|
+
|
|
176
|
+
## When to use this
|
|
177
|
+
|
|
178
|
+
- You are building a tool that reads Devin's local stores and need the documented schema, not reverse-engineering.
|
|
179
|
+
- You want a schema-version gate: `detect_schema_version()` refuses loudly on unknown versions instead of misparsing.
|
|
180
|
+
- You need deterministic synthetic fixtures to test parsers — no real session data required.
|
|
181
|
+
- You need typed, read-only access to `sessions.db` via `SessionsStore` in Python.
|
|
182
|
+
|
|
183
|
+
## When NOT to use this
|
|
184
|
+
|
|
185
|
+
- You want to export or dump sessions — this documents and guards the format; `devin-history` does the exporting.
|
|
186
|
+
- Your Devin release ships a schema newer than v17 — the detector refuses by design until the spec catches up.
|
|
187
|
+
- You need writes — every parser and subcommand is strictly read-only.
|
|
188
|
+
|
|
189
|
+
## FAQ
|
|
190
|
+
|
|
191
|
+
**What data does Devin store locally, and where?** Per this spec: a versioned `sessions.db` under `cli/` (sessions, tool-call state, transcripts), one `acp-messages/*.db` per GUI session, a `state.vscdb` KV store with `windsurfSpace.*` keys, `credentials.toml`, and a `refinery_schema_history` migration ledger. The verified details live in `docs/SPEC.md`.
|
|
192
|
+
|
|
193
|
+
**What happens when Devin ships a new schema version?** Tools using this library fail loudly, not silently. `detect_schema_version()` returns a contract (`known`, `min_supported`) and raises on versions it does not recognize — verified against schema v17 at time of writing.
|
|
194
|
+
|
|
195
|
+
**How is this different from other sessions.db parsers?** It also documents the Desktop GUI stores (`acp-messages/*.db`, `state.vscdb`, session locks, the migration ledger) that other tools don't cover, and adds the explicit schema-version gate. The library is the supported interface; `devin-inspect` is a thin CLI wrapper.
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT — see [LICENSE](LICENSE).
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
If this saved you debugging time, a ⭐ on the repo helps others find it.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "devin-internals-spec"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Documented internals of Devin Desktop/CLI session stores, schema-version detection and test fixtures (unofficial)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "Icaro0310" }]
|
|
13
|
+
dependencies = []
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
dev = ["pytest>=8"]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
devin-inspect = "devin_internals.cli:main"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
where = ["src"]
|
|
23
|
+
|
|
24
|
+
[tool.pytest.ini_options]
|
|
25
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__version__ = "0.3.0"
|
|
2
|
+
|
|
3
|
+
from devin_internals.schema import (
|
|
4
|
+
LATEST_KNOWN_SCHEMA,
|
|
5
|
+
MIN_SUPPORTED_SCHEMA,
|
|
6
|
+
SchemaDetectionError,
|
|
7
|
+
SchemaError,
|
|
8
|
+
UnknownSchemaVersionError,
|
|
9
|
+
detect_schema_version,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"LATEST_KNOWN_SCHEMA",
|
|
14
|
+
"MIN_SUPPORTED_SCHEMA",
|
|
15
|
+
"SchemaDetectionError",
|
|
16
|
+
"SchemaError",
|
|
17
|
+
"UnknownSchemaVersionError",
|
|
18
|
+
"detect_schema_version",
|
|
19
|
+
"__version__",
|
|
20
|
+
]
|