atomicdjt-agent-session-bridge 0.2.1__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.
- atomicdjt_agent_session_bridge-0.2.1/LICENSE +21 -0
- atomicdjt_agent_session_bridge-0.2.1/PKG-INFO +209 -0
- atomicdjt_agent_session_bridge-0.2.1/README.md +177 -0
- atomicdjt_agent_session_bridge-0.2.1/pyproject.toml +53 -0
- atomicdjt_agent_session_bridge-0.2.1/setup.cfg +4 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/__init__.py +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/antigravity/__init__.py +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/antigravity/exporter.py +83 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/antigravity/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/claude/__init__.py +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/claude/parser.py +224 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/claude/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/adapters/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/PKG-INFO +209 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/SOURCES.txt +34 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/dependency_links.txt +1 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/entry_points.txt +2 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/requires.txt +13 -0
- atomicdjt_agent_session_bridge-0.2.1/src/atomicdjt_agent_session_bridge.egg-info/top_level.txt +5 -0
- atomicdjt_agent_session_bridge-0.2.1/src/bridge/__init__.py +1 -0
- atomicdjt_agent_session_bridge-0.2.1/src/bridge/models.py +39 -0
- atomicdjt_agent_session_bridge-0.2.1/src/bridge/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/cli/__init__.py +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/cli/main.py +172 -0
- atomicdjt_agent_session_bridge-0.2.1/src/cli/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/observability/__init__.py +1 -0
- atomicdjt_agent_session_bridge-0.2.1/src/observability/exporter.py +54 -0
- atomicdjt_agent_session_bridge-0.2.1/src/observability/mapping.py +84 -0
- atomicdjt_agent_session_bridge-0.2.1/src/observability/spans.py +166 -0
- atomicdjt_agent_session_bridge-0.2.1/src/security/__init__.py +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/security/py.typed +0 -0
- atomicdjt_agent_session_bridge-0.2.1/src/security/redact.py +80 -0
- atomicdjt_agent_session_bridge-0.2.1/tests/test_atif_conversion.py +493 -0
- atomicdjt_agent_session_bridge-0.2.1/tests/test_claude_parser.py +29 -0
- atomicdjt_agent_session_bridge-0.2.1/tests/test_claude_tool_result_roles.py +111 -0
- atomicdjt_agent_session_bridge-0.2.1/tests/test_observability.py +379 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agent Session Bridge Contributors
|
|
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,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: atomicdjt-agent-session-bridge
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: ATIF-based reference implementation for portable coding-agent trajectories with explicit fidelity and loss reporting.
|
|
5
|
+
Author: David Turner
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/atomicdjt/agent-session-bridge
|
|
8
|
+
Project-URL: Repository, https://github.com/atomicdjt/agent-session-bridge
|
|
9
|
+
Project-URL: Issues, https://github.com/atomicdjt/agent-session-bridge/issues
|
|
10
|
+
Keywords: ai-agents,coding-agents,claude-code,session-portability,interoperability
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: atif<1.8,>=1.7
|
|
21
|
+
Requires-Dist: pydantic>=2.0.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
24
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: ruff>=0.0.280; extra == "dev"
|
|
26
|
+
Provides-Extra: observability
|
|
27
|
+
Requires-Dist: opentelemetry-api>=1.20.0; extra == "observability"
|
|
28
|
+
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "observability"
|
|
29
|
+
Requires-Dist: opentelemetry-exporter-otlp>=1.20.0; extra == "observability"
|
|
30
|
+
Requires-Dist: openinference-semantic-conventions>=0.1.0; extra == "observability"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# Agent Session Bridge
|
|
34
|
+
|
|
35
|
+
**Move structured coding-agent history between tools without collapsing it into a prose summary.**
|
|
36
|
+
|
|
37
|
+
**[Canonical project page](https://ai-project-portfolio-portfolio-hub.vercel.app/projects/agent-session-bridge) · [Repository](https://github.com/atomicdjt/agent-session-bridge) · [Full portfolio](https://ai-project-portfolio-portfolio-hub.vercel.app/)**
|
|
38
|
+
|
|
39
|
+
Agent Session Bridge is an MIT-licensed reference implementation for converting supported coding-agent transcripts into the [Agent Trajectory Interchange Format (ATIF)](https://github.com/harbor-framework/harbor/blob/main/rfcs/0001-trajectory-format.md). It is not a competing interchange standard.
|
|
40
|
+
|
|
41
|
+
> **Current status:** Claude Code JSONL normalization to ATIF v1.7, heuristic secret redaction, ASB fidelity reporting, and an Antigravity derived-log mapping are implemented. Native Antigravity session rehydration is not supported because Antigravity has no supported historical-session import boundary.
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
*Animated architecture tour based on documented behavior; it is not a fabricated live screen recording.*
|
|
46
|
+
|
|
47
|
+
## What ATIF provides and what ASB adds
|
|
48
|
+
|
|
49
|
+
ATIF is the portable trajectory layer: ordered system/user/agent steps, structured tool calls, call-correlated observations, agent metadata, metrics, and a namespaced `extra` extension mechanism. ASB converts provider-specific transcript shapes into that public format.
|
|
50
|
+
|
|
51
|
+
ASB's distinct responsibilities are deliberately narrower:
|
|
52
|
+
|
|
53
|
+
- provider-specific parsing and normalization;
|
|
54
|
+
- best-effort secret redaction before export;
|
|
55
|
+
- transformation/fidelity accounting in `extra.agent_session_bridge`;
|
|
56
|
+
- target-specific mappings, such as the observed Antigravity derived-log shape; and
|
|
57
|
+
- explicit refusal to fabricate native resumable session state.
|
|
58
|
+
|
|
59
|
+
The current Antigravity reference mapper reports any ATIF system messages it cannot map to the observed derived-log shape; it does not silently invent a target record type.
|
|
60
|
+
|
|
61
|
+
See [the ATIF mapping](docs/FORMAT.md) and [layered architecture](docs/ARCHITECTURE.md) for exact preserved, transformed, and unsupported semantics.
|
|
62
|
+
|
|
63
|
+
## What works today
|
|
64
|
+
|
|
65
|
+
| Capability | Status | Notes |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| Claude Code JSONL import | ✅ | Parses supported message and tool structures into ATIF v1.7 |
|
|
68
|
+
| Portable interchange document | ✅ | Validated by the official `atif` Python models |
|
|
69
|
+
| ASB fidelity reporting | ✅ | Namespaced provenance and unsupported/degraded source counts in ATIF `extra` |
|
|
70
|
+
| Heuristic secret redaction | ✅ | Best effort only; output still requires human review |
|
|
71
|
+
| Antigravity derived-log mapping | ✅ | Reference payload based on observed `transcript.jsonl` structures |
|
|
72
|
+
| Native Antigravity session import | ❌ blocked upstream | No supported API creates or resumes external historical state |
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
This project is not published as `agent-session-bridge` on PyPI; that name belongs to an unrelated project. It is packaged as `atomicdjt-agent-session-bridge` (build and install verified locally — sdist/wheel pass `twine check`, install cleanly into a fresh virtualenv, and the CLI runs end-to-end against the fixtures in this repo). It is not yet live on PyPI; see [Releasing](#releasing) for the exact remaining step. Until then, install from this repository with Python 3.11 or newer:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git clone https://github.com/atomicdjt/agent-session-bridge.git
|
|
80
|
+
cd agent-session-bridge
|
|
81
|
+
python -m venv .venv
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Activate the environment, then install the package:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Linux/macOS
|
|
88
|
+
source .venv/bin/activate
|
|
89
|
+
|
|
90
|
+
# Windows PowerShell
|
|
91
|
+
.\.venv\Scripts\Activate.ps1
|
|
92
|
+
|
|
93
|
+
python -m pip install -e .
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Normalize a Claude Code transcript to an ATIF document, inspect ASB's source-fidelity report, or generate the Antigravity reference mapping:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
agent-session import --from claude-code --source your_claude_log.jsonl --output trajectory.atif.json --report
|
|
100
|
+
agent-session convert --from claude-code --to antigravity your_claude_log.jsonl
|
|
101
|
+
agent-session handoff --from claude-code --to antigravity your_claude_log.jsonl
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`handoff` returns `UnsupportedNativeImport` after producing the reference payload. It does not imply that Antigravity can resume the converted history.
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
provider transcript
|
|
110
|
+
│
|
|
111
|
+
▼
|
|
112
|
+
source parser and normalizer
|
|
113
|
+
│
|
|
114
|
+
▼
|
|
115
|
+
ATIF trajectory ─────► ASB provenance/fidelity extension
|
|
116
|
+
│
|
|
117
|
+
├──────────────► redacted portable trajectory
|
|
118
|
+
│
|
|
119
|
+
▼
|
|
120
|
+
target-specific mapper
|
|
121
|
+
│
|
|
122
|
+
▼
|
|
123
|
+
target payload / supported importer, if one exists
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
ATIF makes a trajectory portable; it does not require target runtimes to ingest it as native state. Native resumption remains a target-owned capability, with target-owned validation, persistence, and security constraints.
|
|
127
|
+
|
|
128
|
+
## Fidelity and security boundaries
|
|
129
|
+
|
|
130
|
+
For the current Claude Code adapter, ASB preserves supported roles, ISO-8601 timestamps, text, tool names, tool arguments, and tool results. It normalizes later Claude `tool_result` blocks into ATIF observations attached to their originating calls. Unsupported source records or blocks are counted in `extra.agent_session_bridge.fidelity`; they are never represented as successfully preserved.
|
|
131
|
+
|
|
132
|
+
- Imported history is processed as data. Historical commands are never executed.
|
|
133
|
+
- Redaction is heuristic and is not a guarantee.
|
|
134
|
+
- Do not publish a converted transcript without reviewing it for credentials, personal data, private source, or proprietary context.
|
|
135
|
+
- ASB does not reverse-engineer or write Antigravity's opaque internal session database.
|
|
136
|
+
|
|
137
|
+
## Optional observability projection
|
|
138
|
+
|
|
139
|
+
The observability implementation is an optional downstream projection of ATIF, not a replacement for ATIF, and not original runtime instrumentation. It is a historical structural projection.
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
provider transcript
|
|
143
|
+
↓
|
|
144
|
+
Agent Session Bridge
|
|
145
|
+
↓
|
|
146
|
+
ATIF v1.7
|
|
147
|
+
↓
|
|
148
|
+
historical observability projection
|
|
149
|
+
↓
|
|
150
|
+
OpenTelemetry / OpenInference
|
|
151
|
+
↓
|
|
152
|
+
OTLP
|
|
153
|
+
↓
|
|
154
|
+
Phoenix or another compatible backend
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
To install the optional observability dependencies:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python -m pip install -e ".[observability]"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
For the local Phoenix example, Phoenix may be installed separately. It is not required for core Agent Session Bridge operation:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
python -m pip install arize-phoenix
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
A Claude Code source may also be observed using the existing supported `--from claude-code` path where appropriate.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
agent-session observe trajectory.atif.json \
|
|
173
|
+
--from atif \
|
|
174
|
+
--backend phoenix \
|
|
175
|
+
--endpoint http://127.0.0.1:6006/v1/traces
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Privacy
|
|
179
|
+
|
|
180
|
+
- `metadata-only` is the default.
|
|
181
|
+
- `redacted-content` exports redacted textual content.
|
|
182
|
+
- `full-content` must be explicitly selected and may expose sensitive transcript data. Treat `full-content` carefully.
|
|
183
|
+
|
|
184
|
+
### Historical timing
|
|
185
|
+
|
|
186
|
+
As this is a historical structural projection:
|
|
187
|
+
- ATIF Step timestamps may be represented as observed timing.
|
|
188
|
+
- Root boundaries may be derived from observed Step timestamps.
|
|
189
|
+
- Where independent tool completion timing is unavailable from ATIF, the projection does not pretend to have measured runtime duration.
|
|
190
|
+
|
|
191
|
+
For implementation details, see [docs/OBSERVABILITY.md](docs/OBSERVABILITY.md). For the evidence model, ecosystem comparison, limitations, and external-review questions, see [Reconstructing Agent Traces After the Fact Without Inventing Runtime Truth](docs/HISTORICAL_OBSERVABILITY_WRITEUP.md).
|
|
192
|
+
|
|
193
|
+
## Migration from v0.1 ASEF output
|
|
194
|
+
|
|
195
|
+
v0.2 removes the proprietary ASEF schema. Existing `*.asef.json` files are not ATIF documents and must not be relabeled as such. Re-run the original source transcript through `agent-session import` to produce a validated `*.atif.json` file, then review the ASB fidelity report. Python 3.11 is now the minimum supported version because the official ATIF models require it.
|
|
196
|
+
|
|
197
|
+
## Releasing
|
|
198
|
+
|
|
199
|
+
`.github/workflows/publish.yml` builds the sdist/wheel, runs `twine check`, and publishes to PyPI via [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (OIDC) on a `v*.*.*` tag push or manual dispatch. No PyPI token is stored in this repository.
|
|
200
|
+
|
|
201
|
+
Before the first publish, add a pending trusted publisher on pypi.org for a project named `atomicdjt-agent-session-bridge`, with owner `atomicdjt`, repository `agent-session-bridge`, workflow `publish.yml`, and environment `pypi`. That is the only step this workflow cannot perform on its own.
|
|
202
|
+
|
|
203
|
+
## Contributing
|
|
204
|
+
|
|
205
|
+
Useful contributions include provider transcript fixtures, source adapters, target mappings for documented ingestion boundaries, fidelity-report improvements, and reproducible evidence about real cross-provider transformations. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
MIT License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Agent Session Bridge
|
|
2
|
+
|
|
3
|
+
**Move structured coding-agent history between tools without collapsing it into a prose summary.**
|
|
4
|
+
|
|
5
|
+
**[Canonical project page](https://ai-project-portfolio-portfolio-hub.vercel.app/projects/agent-session-bridge) · [Repository](https://github.com/atomicdjt/agent-session-bridge) · [Full portfolio](https://ai-project-portfolio-portfolio-hub.vercel.app/)**
|
|
6
|
+
|
|
7
|
+
Agent Session Bridge is an MIT-licensed reference implementation for converting supported coding-agent transcripts into the [Agent Trajectory Interchange Format (ATIF)](https://github.com/harbor-framework/harbor/blob/main/rfcs/0001-trajectory-format.md). It is not a competing interchange standard.
|
|
8
|
+
|
|
9
|
+
> **Current status:** Claude Code JSONL normalization to ATIF v1.7, heuristic secret redaction, ASB fidelity reporting, and an Antigravity derived-log mapping are implemented. Native Antigravity session rehydration is not supported because Antigravity has no supported historical-session import boundary.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
*Animated architecture tour based on documented behavior; it is not a fabricated live screen recording.*
|
|
14
|
+
|
|
15
|
+
## What ATIF provides and what ASB adds
|
|
16
|
+
|
|
17
|
+
ATIF is the portable trajectory layer: ordered system/user/agent steps, structured tool calls, call-correlated observations, agent metadata, metrics, and a namespaced `extra` extension mechanism. ASB converts provider-specific transcript shapes into that public format.
|
|
18
|
+
|
|
19
|
+
ASB's distinct responsibilities are deliberately narrower:
|
|
20
|
+
|
|
21
|
+
- provider-specific parsing and normalization;
|
|
22
|
+
- best-effort secret redaction before export;
|
|
23
|
+
- transformation/fidelity accounting in `extra.agent_session_bridge`;
|
|
24
|
+
- target-specific mappings, such as the observed Antigravity derived-log shape; and
|
|
25
|
+
- explicit refusal to fabricate native resumable session state.
|
|
26
|
+
|
|
27
|
+
The current Antigravity reference mapper reports any ATIF system messages it cannot map to the observed derived-log shape; it does not silently invent a target record type.
|
|
28
|
+
|
|
29
|
+
See [the ATIF mapping](docs/FORMAT.md) and [layered architecture](docs/ARCHITECTURE.md) for exact preserved, transformed, and unsupported semantics.
|
|
30
|
+
|
|
31
|
+
## What works today
|
|
32
|
+
|
|
33
|
+
| Capability | Status | Notes |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| Claude Code JSONL import | ✅ | Parses supported message and tool structures into ATIF v1.7 |
|
|
36
|
+
| Portable interchange document | ✅ | Validated by the official `atif` Python models |
|
|
37
|
+
| ASB fidelity reporting | ✅ | Namespaced provenance and unsupported/degraded source counts in ATIF `extra` |
|
|
38
|
+
| Heuristic secret redaction | ✅ | Best effort only; output still requires human review |
|
|
39
|
+
| Antigravity derived-log mapping | ✅ | Reference payload based on observed `transcript.jsonl` structures |
|
|
40
|
+
| Native Antigravity session import | ❌ blocked upstream | No supported API creates or resumes external historical state |
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
This project is not published as `agent-session-bridge` on PyPI; that name belongs to an unrelated project. It is packaged as `atomicdjt-agent-session-bridge` (build and install verified locally — sdist/wheel pass `twine check`, install cleanly into a fresh virtualenv, and the CLI runs end-to-end against the fixtures in this repo). It is not yet live on PyPI; see [Releasing](#releasing) for the exact remaining step. Until then, install from this repository with Python 3.11 or newer:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git clone https://github.com/atomicdjt/agent-session-bridge.git
|
|
48
|
+
cd agent-session-bridge
|
|
49
|
+
python -m venv .venv
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Activate the environment, then install the package:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Linux/macOS
|
|
56
|
+
source .venv/bin/activate
|
|
57
|
+
|
|
58
|
+
# Windows PowerShell
|
|
59
|
+
.\.venv\Scripts\Activate.ps1
|
|
60
|
+
|
|
61
|
+
python -m pip install -e .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Normalize a Claude Code transcript to an ATIF document, inspect ASB's source-fidelity report, or generate the Antigravity reference mapping:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
agent-session import --from claude-code --source your_claude_log.jsonl --output trajectory.atif.json --report
|
|
68
|
+
agent-session convert --from claude-code --to antigravity your_claude_log.jsonl
|
|
69
|
+
agent-session handoff --from claude-code --to antigravity your_claude_log.jsonl
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`handoff` returns `UnsupportedNativeImport` after producing the reference payload. It does not imply that Antigravity can resume the converted history.
|
|
73
|
+
|
|
74
|
+
## Architecture
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
provider transcript
|
|
78
|
+
│
|
|
79
|
+
▼
|
|
80
|
+
source parser and normalizer
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
ATIF trajectory ─────► ASB provenance/fidelity extension
|
|
84
|
+
│
|
|
85
|
+
├──────────────► redacted portable trajectory
|
|
86
|
+
│
|
|
87
|
+
▼
|
|
88
|
+
target-specific mapper
|
|
89
|
+
│
|
|
90
|
+
▼
|
|
91
|
+
target payload / supported importer, if one exists
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
ATIF makes a trajectory portable; it does not require target runtimes to ingest it as native state. Native resumption remains a target-owned capability, with target-owned validation, persistence, and security constraints.
|
|
95
|
+
|
|
96
|
+
## Fidelity and security boundaries
|
|
97
|
+
|
|
98
|
+
For the current Claude Code adapter, ASB preserves supported roles, ISO-8601 timestamps, text, tool names, tool arguments, and tool results. It normalizes later Claude `tool_result` blocks into ATIF observations attached to their originating calls. Unsupported source records or blocks are counted in `extra.agent_session_bridge.fidelity`; they are never represented as successfully preserved.
|
|
99
|
+
|
|
100
|
+
- Imported history is processed as data. Historical commands are never executed.
|
|
101
|
+
- Redaction is heuristic and is not a guarantee.
|
|
102
|
+
- Do not publish a converted transcript without reviewing it for credentials, personal data, private source, or proprietary context.
|
|
103
|
+
- ASB does not reverse-engineer or write Antigravity's opaque internal session database.
|
|
104
|
+
|
|
105
|
+
## Optional observability projection
|
|
106
|
+
|
|
107
|
+
The observability implementation is an optional downstream projection of ATIF, not a replacement for ATIF, and not original runtime instrumentation. It is a historical structural projection.
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
provider transcript
|
|
111
|
+
↓
|
|
112
|
+
Agent Session Bridge
|
|
113
|
+
↓
|
|
114
|
+
ATIF v1.7
|
|
115
|
+
↓
|
|
116
|
+
historical observability projection
|
|
117
|
+
↓
|
|
118
|
+
OpenTelemetry / OpenInference
|
|
119
|
+
↓
|
|
120
|
+
OTLP
|
|
121
|
+
↓
|
|
122
|
+
Phoenix or another compatible backend
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
To install the optional observability dependencies:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python -m pip install -e ".[observability]"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For the local Phoenix example, Phoenix may be installed separately. It is not required for core Agent Session Bridge operation:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
python -m pip install arize-phoenix
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
A Claude Code source may also be observed using the existing supported `--from claude-code` path where appropriate.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
agent-session observe trajectory.atif.json \
|
|
141
|
+
--from atif \
|
|
142
|
+
--backend phoenix \
|
|
143
|
+
--endpoint http://127.0.0.1:6006/v1/traces
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Privacy
|
|
147
|
+
|
|
148
|
+
- `metadata-only` is the default.
|
|
149
|
+
- `redacted-content` exports redacted textual content.
|
|
150
|
+
- `full-content` must be explicitly selected and may expose sensitive transcript data. Treat `full-content` carefully.
|
|
151
|
+
|
|
152
|
+
### Historical timing
|
|
153
|
+
|
|
154
|
+
As this is a historical structural projection:
|
|
155
|
+
- ATIF Step timestamps may be represented as observed timing.
|
|
156
|
+
- Root boundaries may be derived from observed Step timestamps.
|
|
157
|
+
- Where independent tool completion timing is unavailable from ATIF, the projection does not pretend to have measured runtime duration.
|
|
158
|
+
|
|
159
|
+
For implementation details, see [docs/OBSERVABILITY.md](docs/OBSERVABILITY.md). For the evidence model, ecosystem comparison, limitations, and external-review questions, see [Reconstructing Agent Traces After the Fact Without Inventing Runtime Truth](docs/HISTORICAL_OBSERVABILITY_WRITEUP.md).
|
|
160
|
+
|
|
161
|
+
## Migration from v0.1 ASEF output
|
|
162
|
+
|
|
163
|
+
v0.2 removes the proprietary ASEF schema. Existing `*.asef.json` files are not ATIF documents and must not be relabeled as such. Re-run the original source transcript through `agent-session import` to produce a validated `*.atif.json` file, then review the ASB fidelity report. Python 3.11 is now the minimum supported version because the official ATIF models require it.
|
|
164
|
+
|
|
165
|
+
## Releasing
|
|
166
|
+
|
|
167
|
+
`.github/workflows/publish.yml` builds the sdist/wheel, runs `twine check`, and publishes to PyPI via [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (OIDC) on a `v*.*.*` tag push or manual dispatch. No PyPI token is stored in this repository.
|
|
168
|
+
|
|
169
|
+
Before the first publish, add a pending trusted publisher on pypi.org for a project named `atomicdjt-agent-session-bridge`, with owner `atomicdjt`, repository `agent-session-bridge`, workflow `publish.yml`, and environment `pypi`. That is the only step this workflow cannot perform on its own.
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
Useful contributions include provider transcript fixtures, source adapters, target mappings for documented ingestion boundaries, fidelity-report improvements, and reproducible evidence about real cross-provider transformations. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "atomicdjt-agent-session-bridge"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "ATIF-based reference implementation for portable coding-agent trajectories with explicit fidelity and loss reporting."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "David Turner"}]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"atif>=1.7,<1.8",
|
|
15
|
+
"pydantic>=2.0.0",
|
|
16
|
+
]
|
|
17
|
+
keywords = [
|
|
18
|
+
"ai-agents",
|
|
19
|
+
"coding-agents",
|
|
20
|
+
"claude-code",
|
|
21
|
+
"session-portability",
|
|
22
|
+
"interoperability",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/atomicdjt/agent-session-bridge"
|
|
35
|
+
Repository = "https://github.com/atomicdjt/agent-session-bridge"
|
|
36
|
+
Issues = "https://github.com/atomicdjt/agent-session-bridge/issues"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = [
|
|
40
|
+
"pytest>=7.0.0",
|
|
41
|
+
"mypy>=1.0.0",
|
|
42
|
+
"ruff>=0.0.280"
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
observability = [
|
|
46
|
+
"opentelemetry-api>=1.20.0",
|
|
47
|
+
"opentelemetry-sdk>=1.20.0",
|
|
48
|
+
"opentelemetry-exporter-otlp>=1.20.0",
|
|
49
|
+
"openinference-semantic-conventions>=0.1.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
agent-session = "cli.main:main"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
from atif import Step, Trajectory
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class AntigravityExport:
|
|
9
|
+
payload: str
|
|
10
|
+
omitted_system_messages: int
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def export_to_antigravity(trajectory: Trajectory) -> str:
|
|
14
|
+
"""Return the reference payload for callers that need only JSONL."""
|
|
15
|
+
return export_with_report(trajectory).payload
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def export_with_report(trajectory: Trajectory) -> AntigravityExport:
|
|
19
|
+
"""Map an ATIF trajectory to the observed Antigravity derived-log shape.
|
|
20
|
+
|
|
21
|
+
This is a reference export only. The generated log is not represented as a
|
|
22
|
+
supported native Antigravity session-import format.
|
|
23
|
+
"""
|
|
24
|
+
transcript_lines: list[str] = []
|
|
25
|
+
omitted_system_messages = 0
|
|
26
|
+
|
|
27
|
+
for step in trajectory.steps:
|
|
28
|
+
if step.source == "user":
|
|
29
|
+
transcript_lines.append(
|
|
30
|
+
json.dumps(
|
|
31
|
+
{
|
|
32
|
+
"step_index": len(transcript_lines) + 1,
|
|
33
|
+
"source": "USER_EXPLICIT",
|
|
34
|
+
"type": "USER_INPUT",
|
|
35
|
+
"status": "DONE",
|
|
36
|
+
"created_at": step.timestamp,
|
|
37
|
+
"content": step.message,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
elif step.source == "agent":
|
|
42
|
+
transcript_lines.append(
|
|
43
|
+
json.dumps(
|
|
44
|
+
{
|
|
45
|
+
"step_index": len(transcript_lines) + 1,
|
|
46
|
+
"source": "MODEL",
|
|
47
|
+
"type": "PLANNER_RESPONSE",
|
|
48
|
+
"status": "DONE",
|
|
49
|
+
"created_at": step.timestamp,
|
|
50
|
+
"content": step.message,
|
|
51
|
+
"tool_calls": _tool_calls(step),
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
elif step.source == "system" and step.message:
|
|
56
|
+
omitted_system_messages += 1
|
|
57
|
+
|
|
58
|
+
if step.observation:
|
|
59
|
+
for result in step.observation.results:
|
|
60
|
+
transcript_lines.append(
|
|
61
|
+
json.dumps(
|
|
62
|
+
{
|
|
63
|
+
"step_index": len(transcript_lines) + 1,
|
|
64
|
+
"source": "SYSTEM",
|
|
65
|
+
"type": "TOOL_RESPONSE",
|
|
66
|
+
"status": "DONE",
|
|
67
|
+
"created_at": step.timestamp,
|
|
68
|
+
"content": result.content or "",
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return AntigravityExport(
|
|
74
|
+
payload="\n".join(transcript_lines) + "\n",
|
|
75
|
+
omitted_system_messages=omitted_system_messages,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _tool_calls(step: Step) -> list[dict[str, object]]:
|
|
80
|
+
return [
|
|
81
|
+
{"name": call.function_name, "args": call.arguments}
|
|
82
|
+
for call in step.tool_calls or []
|
|
83
|
+
]
|
|
File without changes
|
|
File without changes
|