harness-exchange 0.1.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.
- harness_exchange-0.1.0/LICENSE +21 -0
- harness_exchange-0.1.0/PKG-INFO +141 -0
- harness_exchange-0.1.0/README.md +112 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/PKG-INFO +141 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/SOURCES.txt +23 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/dependency_links.txt +1 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/entry_points.txt +2 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/requires.txt +6 -0
- harness_exchange-0.1.0/harness_exchange.egg-info/top_level.txt +1 -0
- harness_exchange-0.1.0/harnessexchange/__init__.py +0 -0
- harness_exchange-0.1.0/harnessexchange/__main__.py +85 -0
- harness_exchange-0.1.0/harnessexchange/harness/__init__.py +17 -0
- harness_exchange-0.1.0/harnessexchange/harness/base.py +29 -0
- harness_exchange-0.1.0/harnessexchange/harness/claude.py +558 -0
- harness_exchange-0.1.0/harnessexchange/harness/codex.py +361 -0
- harness_exchange-0.1.0/harnessexchange/harness/opencode.py +489 -0
- harness_exchange-0.1.0/harnessexchange/models.py +25 -0
- harness_exchange-0.1.0/harnessexchange/ui.py +65 -0
- harness_exchange-0.1.0/pyproject.toml +50 -0
- harness_exchange-0.1.0/setup.cfg +4 -0
- harness_exchange-0.1.0/tests/test_cli.py +182 -0
- harness_exchange-0.1.0/tests/test_harness_claude.py +286 -0
- harness_exchange-0.1.0/tests/test_harness_codex.py +237 -0
- harness_exchange-0.1.0/tests/test_harness_opencode.py +308 -0
- harness_exchange-0.1.0/tests/test_integration.py +297 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SessionExchange
|
|
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,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: harness-exchange
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Exchange agent/chat sessions between codex, opencode, and claude-code
|
|
5
|
+
Author: harness-exchange contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/cnmoro/harness-exchange
|
|
8
|
+
Project-URL: Tracker, https://github.com/cnmoro/harness-exchange/issues
|
|
9
|
+
Keywords: codex,opencode,claude,harness,session,exchange,cli
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: questionary>=2.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# harness-exchange
|
|
31
|
+
|
|
32
|
+
Exchange sessions between **codex**, **opencode**, and **claude-code**.
|
|
33
|
+
|
|
34
|
+
Rate-limited on one tool but still have context you need? Port your session to another harness and keep going.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
harness-exchange --from codex --to opencode
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install harness-exchange
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Requires Python 3.11+.
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Interactive (arrow-key selection)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
harness-exchange --from codex --to opencode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Lists the 15 most recent sessions from the source harness, each with a preview of the first and last message. Use arrow keys to select, Enter to transfer.
|
|
57
|
+
|
|
58
|
+
### Non-interactive (session ID)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
harness-exchange --from claude --to codex --session-id <session-uuid>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Combine with `--non-interactive` for scripting:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
harness-exchange --from codex --to opencode --session-id <id> --non-interactive
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### All combinations
|
|
71
|
+
|
|
72
|
+
| From | To |
|
|
73
|
+
|------|----|
|
|
74
|
+
| `codex` | `opencode` |
|
|
75
|
+
| `codex` | `claude` |
|
|
76
|
+
| `opencode` | `codex` |
|
|
77
|
+
| `opencode` | `claude` |
|
|
78
|
+
| `claude` | `codex` |
|
|
79
|
+
| `claude` | `opencode` |
|
|
80
|
+
|
|
81
|
+
### Options
|
|
82
|
+
|
|
83
|
+
| Flag | Description |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| `--from` | Source harness (`codex`, `opencode`, `claude`) |
|
|
86
|
+
| `--to` | Target harness (`codex`, `opencode`, `claude`) |
|
|
87
|
+
| `--session-id` | Transfer a specific session by ID (skips selection) |
|
|
88
|
+
| `--limit` | Number of recent sessions to show (default: 15) |
|
|
89
|
+
| `--non-interactive` | Skip interactive prompts (requires `--session-id`) |
|
|
90
|
+
|
|
91
|
+
## Storage locations
|
|
92
|
+
|
|
93
|
+
Each tool stores sessions in a different format:
|
|
94
|
+
|
|
95
|
+
| Tool | Format | Location |
|
|
96
|
+
|------|--------|----------|
|
|
97
|
+
| **codex** | JSONL rollouts | `~/.codex/sessions/YYYY/MM/DD/*.jsonl` |
|
|
98
|
+
| **opencode** | SQLite | `~/.local/share/opencode/opencode.db` |
|
|
99
|
+
| **claude-code** | JSONL transcript | `~/.claude/projects/<cwd>/<sessionId>.jsonl` (+ `sessions/<pid>.json` and `history.jsonl`) |
|
|
100
|
+
|
|
101
|
+
The tool detects these paths automatically (uses `$HOME`). Writing to opencode
|
|
102
|
+
uses opencode's own `import` command so the schema stays valid; writing to
|
|
103
|
+
claude-code produces a real `projects/` transcript so the session is resumable
|
|
104
|
+
with `claude --resume`.
|
|
105
|
+
|
|
106
|
+
## What gets transferred
|
|
107
|
+
|
|
108
|
+
- All conversation messages, with **user and assistant roles preserved**
|
|
109
|
+
- Tool calls and their outputs (where the target format supports them)
|
|
110
|
+
- Session title, working directory (`cwd`), and timestamps
|
|
111
|
+
- Agent and model information (where available)
|
|
112
|
+
|
|
113
|
+
Codex injects system prompts and context (`AGENTS.md`, `<environment_context>`,
|
|
114
|
+
permissions/personality specs) as hidden turns; these are filtered out so only
|
|
115
|
+
the real conversation is carried over.
|
|
116
|
+
|
|
117
|
+
## How it works
|
|
118
|
+
|
|
119
|
+
1. **Lists** the most recent sessions from the source harness (default: 15)
|
|
120
|
+
2. **Shows** a preview of the first and last real user message for each session
|
|
121
|
+
3. **Reads** the full session (metadata + all messages) from source storage
|
|
122
|
+
4. **Writes** the session into the target harness's storage format
|
|
123
|
+
|
|
124
|
+
The interactive selector uses `questionary` with a plain-text fallback if the library isn't available.
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/cnmoro/harness-exchange.git
|
|
130
|
+
cd harness-exchange
|
|
131
|
+
|
|
132
|
+
# Install dev dependencies
|
|
133
|
+
pip install -e ".[dev]"
|
|
134
|
+
|
|
135
|
+
# Run tests
|
|
136
|
+
pytest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# harness-exchange
|
|
2
|
+
|
|
3
|
+
Exchange sessions between **codex**, **opencode**, and **claude-code**.
|
|
4
|
+
|
|
5
|
+
Rate-limited on one tool but still have context you need? Port your session to another harness and keep going.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
harness-exchange --from codex --to opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install harness-exchange
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Python 3.11+.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Interactive (arrow-key selection)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
harness-exchange --from codex --to opencode
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Lists the 15 most recent sessions from the source harness, each with a preview of the first and last message. Use arrow keys to select, Enter to transfer.
|
|
28
|
+
|
|
29
|
+
### Non-interactive (session ID)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
harness-exchange --from claude --to codex --session-id <session-uuid>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Combine with `--non-interactive` for scripting:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
harness-exchange --from codex --to opencode --session-id <id> --non-interactive
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### All combinations
|
|
42
|
+
|
|
43
|
+
| From | To |
|
|
44
|
+
|------|----|
|
|
45
|
+
| `codex` | `opencode` |
|
|
46
|
+
| `codex` | `claude` |
|
|
47
|
+
| `opencode` | `codex` |
|
|
48
|
+
| `opencode` | `claude` |
|
|
49
|
+
| `claude` | `codex` |
|
|
50
|
+
| `claude` | `opencode` |
|
|
51
|
+
|
|
52
|
+
### Options
|
|
53
|
+
|
|
54
|
+
| Flag | Description |
|
|
55
|
+
|------|-------------|
|
|
56
|
+
| `--from` | Source harness (`codex`, `opencode`, `claude`) |
|
|
57
|
+
| `--to` | Target harness (`codex`, `opencode`, `claude`) |
|
|
58
|
+
| `--session-id` | Transfer a specific session by ID (skips selection) |
|
|
59
|
+
| `--limit` | Number of recent sessions to show (default: 15) |
|
|
60
|
+
| `--non-interactive` | Skip interactive prompts (requires `--session-id`) |
|
|
61
|
+
|
|
62
|
+
## Storage locations
|
|
63
|
+
|
|
64
|
+
Each tool stores sessions in a different format:
|
|
65
|
+
|
|
66
|
+
| Tool | Format | Location |
|
|
67
|
+
|------|--------|----------|
|
|
68
|
+
| **codex** | JSONL rollouts | `~/.codex/sessions/YYYY/MM/DD/*.jsonl` |
|
|
69
|
+
| **opencode** | SQLite | `~/.local/share/opencode/opencode.db` |
|
|
70
|
+
| **claude-code** | JSONL transcript | `~/.claude/projects/<cwd>/<sessionId>.jsonl` (+ `sessions/<pid>.json` and `history.jsonl`) |
|
|
71
|
+
|
|
72
|
+
The tool detects these paths automatically (uses `$HOME`). Writing to opencode
|
|
73
|
+
uses opencode's own `import` command so the schema stays valid; writing to
|
|
74
|
+
claude-code produces a real `projects/` transcript so the session is resumable
|
|
75
|
+
with `claude --resume`.
|
|
76
|
+
|
|
77
|
+
## What gets transferred
|
|
78
|
+
|
|
79
|
+
- All conversation messages, with **user and assistant roles preserved**
|
|
80
|
+
- Tool calls and their outputs (where the target format supports them)
|
|
81
|
+
- Session title, working directory (`cwd`), and timestamps
|
|
82
|
+
- Agent and model information (where available)
|
|
83
|
+
|
|
84
|
+
Codex injects system prompts and context (`AGENTS.md`, `<environment_context>`,
|
|
85
|
+
permissions/personality specs) as hidden turns; these are filtered out so only
|
|
86
|
+
the real conversation is carried over.
|
|
87
|
+
|
|
88
|
+
## How it works
|
|
89
|
+
|
|
90
|
+
1. **Lists** the most recent sessions from the source harness (default: 15)
|
|
91
|
+
2. **Shows** a preview of the first and last real user message for each session
|
|
92
|
+
3. **Reads** the full session (metadata + all messages) from source storage
|
|
93
|
+
4. **Writes** the session into the target harness's storage format
|
|
94
|
+
|
|
95
|
+
The interactive selector uses `questionary` with a plain-text fallback if the library isn't available.
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/cnmoro/harness-exchange.git
|
|
101
|
+
cd harness-exchange
|
|
102
|
+
|
|
103
|
+
# Install dev dependencies
|
|
104
|
+
pip install -e ".[dev]"
|
|
105
|
+
|
|
106
|
+
# Run tests
|
|
107
|
+
pytest
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: harness-exchange
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Exchange agent/chat sessions between codex, opencode, and claude-code
|
|
5
|
+
Author: harness-exchange contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/cnmoro/harness-exchange
|
|
8
|
+
Project-URL: Tracker, https://github.com/cnmoro/harness-exchange/issues
|
|
9
|
+
Keywords: codex,opencode,claude,harness,session,exchange,cli
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: questionary>=2.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# harness-exchange
|
|
31
|
+
|
|
32
|
+
Exchange sessions between **codex**, **opencode**, and **claude-code**.
|
|
33
|
+
|
|
34
|
+
Rate-limited on one tool but still have context you need? Port your session to another harness and keep going.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
harness-exchange --from codex --to opencode
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install harness-exchange
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Requires Python 3.11+.
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Interactive (arrow-key selection)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
harness-exchange --from codex --to opencode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Lists the 15 most recent sessions from the source harness, each with a preview of the first and last message. Use arrow keys to select, Enter to transfer.
|
|
57
|
+
|
|
58
|
+
### Non-interactive (session ID)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
harness-exchange --from claude --to codex --session-id <session-uuid>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Combine with `--non-interactive` for scripting:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
harness-exchange --from codex --to opencode --session-id <id> --non-interactive
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### All combinations
|
|
71
|
+
|
|
72
|
+
| From | To |
|
|
73
|
+
|------|----|
|
|
74
|
+
| `codex` | `opencode` |
|
|
75
|
+
| `codex` | `claude` |
|
|
76
|
+
| `opencode` | `codex` |
|
|
77
|
+
| `opencode` | `claude` |
|
|
78
|
+
| `claude` | `codex` |
|
|
79
|
+
| `claude` | `opencode` |
|
|
80
|
+
|
|
81
|
+
### Options
|
|
82
|
+
|
|
83
|
+
| Flag | Description |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| `--from` | Source harness (`codex`, `opencode`, `claude`) |
|
|
86
|
+
| `--to` | Target harness (`codex`, `opencode`, `claude`) |
|
|
87
|
+
| `--session-id` | Transfer a specific session by ID (skips selection) |
|
|
88
|
+
| `--limit` | Number of recent sessions to show (default: 15) |
|
|
89
|
+
| `--non-interactive` | Skip interactive prompts (requires `--session-id`) |
|
|
90
|
+
|
|
91
|
+
## Storage locations
|
|
92
|
+
|
|
93
|
+
Each tool stores sessions in a different format:
|
|
94
|
+
|
|
95
|
+
| Tool | Format | Location |
|
|
96
|
+
|------|--------|----------|
|
|
97
|
+
| **codex** | JSONL rollouts | `~/.codex/sessions/YYYY/MM/DD/*.jsonl` |
|
|
98
|
+
| **opencode** | SQLite | `~/.local/share/opencode/opencode.db` |
|
|
99
|
+
| **claude-code** | JSONL transcript | `~/.claude/projects/<cwd>/<sessionId>.jsonl` (+ `sessions/<pid>.json` and `history.jsonl`) |
|
|
100
|
+
|
|
101
|
+
The tool detects these paths automatically (uses `$HOME`). Writing to opencode
|
|
102
|
+
uses opencode's own `import` command so the schema stays valid; writing to
|
|
103
|
+
claude-code produces a real `projects/` transcript so the session is resumable
|
|
104
|
+
with `claude --resume`.
|
|
105
|
+
|
|
106
|
+
## What gets transferred
|
|
107
|
+
|
|
108
|
+
- All conversation messages, with **user and assistant roles preserved**
|
|
109
|
+
- Tool calls and their outputs (where the target format supports them)
|
|
110
|
+
- Session title, working directory (`cwd`), and timestamps
|
|
111
|
+
- Agent and model information (where available)
|
|
112
|
+
|
|
113
|
+
Codex injects system prompts and context (`AGENTS.md`, `<environment_context>`,
|
|
114
|
+
permissions/personality specs) as hidden turns; these are filtered out so only
|
|
115
|
+
the real conversation is carried over.
|
|
116
|
+
|
|
117
|
+
## How it works
|
|
118
|
+
|
|
119
|
+
1. **Lists** the most recent sessions from the source harness (default: 15)
|
|
120
|
+
2. **Shows** a preview of the first and last real user message for each session
|
|
121
|
+
3. **Reads** the full session (metadata + all messages) from source storage
|
|
122
|
+
4. **Writes** the session into the target harness's storage format
|
|
123
|
+
|
|
124
|
+
The interactive selector uses `questionary` with a plain-text fallback if the library isn't available.
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/cnmoro/harness-exchange.git
|
|
130
|
+
cd harness-exchange
|
|
131
|
+
|
|
132
|
+
# Install dev dependencies
|
|
133
|
+
pip install -e ".[dev]"
|
|
134
|
+
|
|
135
|
+
# Run tests
|
|
136
|
+
pytest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
harness_exchange.egg-info/PKG-INFO
|
|
5
|
+
harness_exchange.egg-info/SOURCES.txt
|
|
6
|
+
harness_exchange.egg-info/dependency_links.txt
|
|
7
|
+
harness_exchange.egg-info/entry_points.txt
|
|
8
|
+
harness_exchange.egg-info/requires.txt
|
|
9
|
+
harness_exchange.egg-info/top_level.txt
|
|
10
|
+
harnessexchange/__init__.py
|
|
11
|
+
harnessexchange/__main__.py
|
|
12
|
+
harnessexchange/models.py
|
|
13
|
+
harnessexchange/ui.py
|
|
14
|
+
harnessexchange/harness/__init__.py
|
|
15
|
+
harnessexchange/harness/base.py
|
|
16
|
+
harnessexchange/harness/claude.py
|
|
17
|
+
harnessexchange/harness/codex.py
|
|
18
|
+
harnessexchange/harness/opencode.py
|
|
19
|
+
tests/test_cli.py
|
|
20
|
+
tests/test_harness_claude.py
|
|
21
|
+
tests/test_harness_codex.py
|
|
22
|
+
tests/test_harness_opencode.py
|
|
23
|
+
tests/test_integration.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
harnessexchange
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from harnessexchange import ui
|
|
5
|
+
from harnessexchange.harness import get_harness, HARNESS_MAP
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main() -> None:
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
description="Exchange sessions between codex, opencode, and claude-code"
|
|
11
|
+
)
|
|
12
|
+
parser.add_argument(
|
|
13
|
+
"--from",
|
|
14
|
+
dest="from_",
|
|
15
|
+
required=True,
|
|
16
|
+
choices=list(HARNESS_MAP.keys()),
|
|
17
|
+
help="Source harness",
|
|
18
|
+
)
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"--to",
|
|
21
|
+
required=True,
|
|
22
|
+
choices=list(HARNESS_MAP.keys()),
|
|
23
|
+
help="Target harness",
|
|
24
|
+
)
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--session-id",
|
|
27
|
+
help="Session ID to exchange (skip interactive selection)",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--limit",
|
|
31
|
+
type=int,
|
|
32
|
+
default=15,
|
|
33
|
+
help="Number of recent sessions to show (default: 15)",
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"--non-interactive",
|
|
37
|
+
action="store_true",
|
|
38
|
+
help="Skip interactive selection (requires --session-id)",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
args = parser.parse_args()
|
|
42
|
+
|
|
43
|
+
if args.non_interactive and not args.session_id:
|
|
44
|
+
parser.error("--non-interactive requires --session-id")
|
|
45
|
+
|
|
46
|
+
if args.from_ == args.to:
|
|
47
|
+
print(f"Source and target are the same: {args.from_}. Nothing to do.")
|
|
48
|
+
sys.exit(0)
|
|
49
|
+
|
|
50
|
+
source = get_harness(args.from_)
|
|
51
|
+
target = get_harness(args.to)
|
|
52
|
+
|
|
53
|
+
if args.session_id:
|
|
54
|
+
result = source.read_session(args.session_id)
|
|
55
|
+
if result is None:
|
|
56
|
+
print(f"Session '{args.session_id}' not found in {args.from_}.", file=sys.stderr)
|
|
57
|
+
sys.exit(1)
|
|
58
|
+
session, messages = result
|
|
59
|
+
elif args.non_interactive:
|
|
60
|
+
print("Session not found.", file=sys.stderr)
|
|
61
|
+
sys.exit(1)
|
|
62
|
+
else:
|
|
63
|
+
sessions = source.list_sessions(limit=args.limit)
|
|
64
|
+
if not sessions:
|
|
65
|
+
print(f"No sessions found in {args.from_}.", file=sys.stderr)
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
|
|
68
|
+
selected = ui.interactive_select(sessions, source.name)
|
|
69
|
+
if selected is None:
|
|
70
|
+
print("No session selected.", file=sys.stderr)
|
|
71
|
+
sys.exit(1)
|
|
72
|
+
|
|
73
|
+
result = source.read_session(selected.id)
|
|
74
|
+
if result is None:
|
|
75
|
+
print(f"Failed to read session '{selected.id}'.", file=sys.stderr)
|
|
76
|
+
sys.exit(1)
|
|
77
|
+
session, messages = result
|
|
78
|
+
|
|
79
|
+
target.write_session(session, messages)
|
|
80
|
+
print(f"Session '{session.title}' transferred from {args.from_} to {args.to}.")
|
|
81
|
+
sys.exit(0)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
main()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from harnessexchange.harness.base import Harness
|
|
2
|
+
from harnessexchange.harness.codex import CodexHarness
|
|
3
|
+
from harnessexchange.harness.claude import ClaudeHarness
|
|
4
|
+
from harnessexchange.harness.opencode import OpenCodeHarness
|
|
5
|
+
|
|
6
|
+
HARNESS_MAP: dict[str, type[Harness]] = {
|
|
7
|
+
"codex": CodexHarness,
|
|
8
|
+
"claude": ClaudeHarness,
|
|
9
|
+
"opencode": OpenCodeHarness,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def get_harness(name: str) -> Harness:
|
|
13
|
+
cls = HARNESS_MAP.get(name.lower())
|
|
14
|
+
if cls is None:
|
|
15
|
+
valid = ", ".join(HARNESS_MAP)
|
|
16
|
+
raise ValueError(f"Unknown harness '{name}'. Valid: {valid}")
|
|
17
|
+
return cls()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from harnessexchange.models import Message, Session
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Harness(ABC):
|
|
9
|
+
@property
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def name(self) -> str:
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def session_dir(self) -> Path:
|
|
17
|
+
...
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def list_sessions(self, limit: int = 15) -> list[Session]:
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
@abstractmethod
|
|
24
|
+
def read_session(self, session_id: str) -> Optional[tuple[Session, list[Message]]]:
|
|
25
|
+
...
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def write_session(self, session: Session, messages: list[Message]) -> str:
|
|
29
|
+
...
|