onechat-cli 0.1.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.
- onechat_cli-0.1.1/PKG-INFO +201 -0
- onechat_cli-0.1.1/README.md +177 -0
- onechat_cli-0.1.1/pyproject.toml +78 -0
- onechat_cli-0.1.1/pyproject.toml.orig +60 -0
- onechat_cli-0.1.1/src/onechat/__init__.py +46 -0
- onechat_cli-0.1.1/src/onechat/benchmark.py +253 -0
- onechat_cli-0.1.1/src/onechat/cli.py +252 -0
- onechat_cli-0.1.1/src/onechat/cli_doctor.py +272 -0
- onechat_cli-0.1.1/src/onechat/cli_repl.py +116 -0
- onechat_cli-0.1.1/src/onechat/config.py +311 -0
- onechat_cli-0.1.1/src/onechat/contracts.py +142 -0
- onechat_cli-0.1.1/src/onechat/defaults.yaml +47 -0
- onechat_cli-0.1.1/src/onechat/executors/__init__.py +19 -0
- onechat_cli-0.1.1/src/onechat/executors/api.py +254 -0
- onechat_cli-0.1.1/src/onechat/executors/cli.py +211 -0
- onechat_cli-0.1.1/src/onechat/executors/parser_cc.py +129 -0
- onechat_cli-0.1.1/src/onechat/executors/parser_formats.py +81 -0
- onechat_cli-0.1.1/src/onechat/executors/parser_tool_streams.py +218 -0
- onechat_cli-0.1.1/src/onechat/executors/parsers.py +52 -0
- onechat_cli-0.1.1/src/onechat/executors/process.py +228 -0
- onechat_cli-0.1.1/src/onechat/gitstate.py +91 -0
- onechat_cli-0.1.1/src/onechat/handoff.py +176 -0
- onechat_cli-0.1.1/src/onechat/profiles/agy.yaml +11 -0
- onechat_cli-0.1.1/src/onechat/profiles/autoclaw.yaml +12 -0
- onechat_cli-0.1.1/src/onechat/profiles/claude.yaml +11 -0
- onechat_cli-0.1.1/src/onechat/profiles/codex.yaml +14 -0
- onechat_cli-0.1.1/src/onechat/profiles/gemini.yaml +11 -0
- onechat_cli-0.1.1/src/onechat/profiles/opencode.yaml +11 -0
- onechat_cli-0.1.1/src/onechat/profiles/qoder.yaml +12 -0
- onechat_cli-0.1.1/src/onechat/profiles/qwen.yaml +11 -0
- onechat_cli-0.1.1/src/onechat/profiles/workbuddy.yaml +13 -0
- onechat_cli-0.1.1/src/onechat/profiles/zcode.yaml +12 -0
- onechat_cli-0.1.1/src/onechat/quota.py +287 -0
- onechat_cli-0.1.1/src/onechat/redact.py +58 -0
- onechat_cli-0.1.1/src/onechat/router.py +299 -0
- onechat_cli-0.1.1/src/onechat/router_helpers.py +288 -0
- onechat_cli-0.1.1/src/onechat/scoring.py +241 -0
- onechat_cli-0.1.1/src/onechat/sdk.py +210 -0
- onechat_cli-0.1.1/src/onechat/selector.py +294 -0
- onechat_cli-0.1.1/src/onechat/store.py +298 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onechat-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: One chat session surviving AI backend switches (CLI agents + OpenAI-compatible APIs)
|
|
5
|
+
Keywords: ai,cli,llm,router,claude-code,codex,gemini,agents
|
|
6
|
+
Author: Abolfazl Moeini
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Dist: pydantic>=2.8
|
|
16
|
+
Requires-Dist: typer>=0.12
|
|
17
|
+
Requires-Dist: pyyaml>=6
|
|
18
|
+
Requires-Dist: openai==3.42.1
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Project-URL: Homepage, https://github.com/abolfazl-moeini/onechat
|
|
21
|
+
Project-URL: Repository, https://github.com/abolfazl-moeini/onechat
|
|
22
|
+
Project-URL: Issues, https://github.com/abolfazl-moeini/onechat/issues
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# onechat
|
|
26
|
+
|
|
27
|
+
[](https://github.com/abolfazl-moeini/onechat/actions/workflows/ci.yml)
|
|
28
|
+
[](https://pypi.org/project/onechat-cli/)
|
|
29
|
+
[](https://www.python.org/downloads/)
|
|
30
|
+
[](https://github.com/abolfazl-moeini/onechat/blob/main/LICENSE)
|
|
31
|
+
|
|
32
|
+
**The Problem:** You are deep into a coding or debugging session with Claude Code, Codex, or Gemini CLI—then you hit a rate limit, quota wall, or timeout. Switching tools means starting a fresh terminal and re-explaining your entire context from scratch.
|
|
33
|
+
|
|
34
|
+
**The Solution:** `onechat` gives you **one persistent chat session that survives AI backend switches**. It automatically detects quota/auth/timeout failures, places the failing backend on cooldown, generates a compact handoff brief (plus current git state), and continues the exact same conversation on the next available CLI agent or OpenAI-compatible API.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Supported Backends
|
|
39
|
+
|
|
40
|
+
| Backend | Kind | Profile / Parser | Notes |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| **Claude Code** (`claude`) | CLI | `claude` | Native JSONL stream + session resume |
|
|
43
|
+
| **OpenAI Codex** (`codex`) | CLI | `codex` | Native JSONL stream + session resume |
|
|
44
|
+
| **Google Gemini CLI** (`gemini`) | CLI | `gemini` | Stream JSON + session resume |
|
|
45
|
+
| **OpenCode** (`opencode`) | CLI | `opencode` | Multi-provider CLI + model routing |
|
|
46
|
+
| **Qwen Code** (`qwen`) | CLI | `qwen` | Stream JSON + session resume |
|
|
47
|
+
| **OpenAI-compatible APIs** | API | `kind: api` | Groq, OpenRouter, DeepSeek, Cerebras, local vLLM/Ollama |
|
|
48
|
+
| **Additional CLI profiles** | CLI | `agy`, `autoclaw`, `workbuddy`, `qoder`, `zcode` | Built-in YAML profiles + custom `~/.onechat/profiles/*.yaml` |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How It Works
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
flowchart LR
|
|
56
|
+
U["User / SDK / CLI (`onechat chat` or `onechat run`)"] --> R["Router"]
|
|
57
|
+
R --> S["Selector (Tier, Capabilities, Skills, Cost)"]
|
|
58
|
+
S --> Q["Quota & Cooldown Book (SQLite WAL)"]
|
|
59
|
+
Q -->|Available| E1["Primary Executor (CLI / API)"]
|
|
60
|
+
E1 -->|Quota / Timeout / Error| H["Handoff Brief + Git State"]
|
|
61
|
+
H --> E2["Fallback Executor (Next Backend)"]
|
|
62
|
+
E1 -->|Done| DB[("~/.onechat/onechat.db")]
|
|
63
|
+
E2 -->|Done| DB
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **Same backend next turn?** Uses native session resume (`--resume`) for zero extra token overhead.
|
|
67
|
+
- **Switched to a different backend?** Injects a bounded `<asf-handoff>` summary + recent turns + current git status/diff so the new model picks up seamlessly.
|
|
68
|
+
- **Zero secrets stored:** API keys are read strictly from environment variables (`os.environ` or `~/.onechat/env`) and automatically redacted from logs, errors, and SQLite.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Install globally as a CLI tool (recommended)
|
|
76
|
+
uv tool install onechat-cli
|
|
77
|
+
|
|
78
|
+
# Or with pip
|
|
79
|
+
pip install onechat-cli
|
|
80
|
+
|
|
81
|
+
# Or run one-off without installing
|
|
82
|
+
uvx --from onechat-cli onechat doctor
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# 1. Check installed CLI binaries, API key env vars, and SQLite DB
|
|
91
|
+
onechat doctor
|
|
92
|
+
|
|
93
|
+
# 2. Start an interactive multi-backend chat REPL
|
|
94
|
+
onechat chat
|
|
95
|
+
|
|
96
|
+
# 3. Run a single turn in a persistent session
|
|
97
|
+
onechat run "Find why tests/test_auth.py is flaky" --session my-debug
|
|
98
|
+
|
|
99
|
+
# 4. Inspect executor pool, cooldowns, and session history
|
|
100
|
+
onechat executors list
|
|
101
|
+
onechat sessions list
|
|
102
|
+
onechat sessions export my-debug --format md
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Inside `onechat chat`:
|
|
106
|
+
- `/use <executor>` — switch backend mid-conversation without losing context
|
|
107
|
+
- `/tier low|medium|high` — override reasoning/cost tier
|
|
108
|
+
- `/status` — inspect active session, executor, and cooldowns
|
|
109
|
+
- `/exit` — quit
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Configuration (`~/.onechat/config.yaml`)
|
|
114
|
+
|
|
115
|
+
`onechat` works out of the box with defaults, and deep-merges `~/.onechat/config.yaml` (or `$ONECHAT_CONFIG`).
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
db_path: ~/.onechat/onechat.db
|
|
119
|
+
|
|
120
|
+
# Optional: define your prioritized executor pool (free -> subscription -> paid)
|
|
121
|
+
executors:
|
|
122
|
+
- id: codex-main
|
|
123
|
+
kind: cli
|
|
124
|
+
profile: codex
|
|
125
|
+
tier: 3
|
|
126
|
+
cost: subscription
|
|
127
|
+
capabilities: [chat, code]
|
|
128
|
+
|
|
129
|
+
- id: claude-main
|
|
130
|
+
kind: cli
|
|
131
|
+
profile: claude
|
|
132
|
+
tier: 3
|
|
133
|
+
cost: subscription
|
|
134
|
+
capabilities: [chat, code]
|
|
135
|
+
|
|
136
|
+
- id: gemini-cli
|
|
137
|
+
kind: cli
|
|
138
|
+
profile: gemini
|
|
139
|
+
tier: 2
|
|
140
|
+
cost: free
|
|
141
|
+
capabilities: [chat, code]
|
|
142
|
+
|
|
143
|
+
- id: groq-fast
|
|
144
|
+
kind: api
|
|
145
|
+
base_url: https://api.groq.com/openai/v1
|
|
146
|
+
model: llama-3.3-70b-versatile
|
|
147
|
+
api_key_env: GROQ_API_KEY
|
|
148
|
+
tier: 2
|
|
149
|
+
cost: free
|
|
150
|
+
capabilities: [chat]
|
|
151
|
+
|
|
152
|
+
- id: openrouter-fallback
|
|
153
|
+
kind: api
|
|
154
|
+
base_url: https://openrouter.ai/api/v1
|
|
155
|
+
model: qwen/qwen3-coder:free
|
|
156
|
+
api_key_env: OPENROUTER_API_KEY
|
|
157
|
+
tier: 3
|
|
158
|
+
cost: free
|
|
159
|
+
capabilities: [chat, code]
|
|
160
|
+
|
|
161
|
+
tier_policy:
|
|
162
|
+
cost_order: [free, subscription, paid]
|
|
163
|
+
allow_paid: false
|
|
164
|
+
|
|
165
|
+
cooldown:
|
|
166
|
+
quota_cooldown_s: 7200
|
|
167
|
+
timeout_cooldown_s: 7200
|
|
168
|
+
error_cooldown_s: 14400
|
|
169
|
+
auth_cooldown_s: 86400
|
|
170
|
+
share_profile_cooldown: true
|
|
171
|
+
|
|
172
|
+
handoff:
|
|
173
|
+
recent_turns: 6
|
|
174
|
+
turn_max_chars: 4000
|
|
175
|
+
brief_max_chars: 24000
|
|
176
|
+
compact_threshold_chars: 30000
|
|
177
|
+
|
|
178
|
+
roles:
|
|
179
|
+
builder: codex
|
|
180
|
+
reviewer: claude
|
|
181
|
+
auditor: codex
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Python SDK
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from onechat import OneChatClient
|
|
190
|
+
|
|
191
|
+
client = OneChatClient()
|
|
192
|
+
session = client.session(workdir=".")
|
|
193
|
+
|
|
194
|
+
# Turn 1: runs on the best available executor
|
|
195
|
+
reply1 = session.ask_sync("Summarize the architecture of src/")
|
|
196
|
+
print(f"[{reply1.executor_id}] {reply1.text}")
|
|
197
|
+
|
|
198
|
+
# Turn 2: force a switch or let failover handle quota automatically
|
|
199
|
+
reply2 = session.ask_sync("Now write unit tests for the config loader", executor="claude-main")
|
|
200
|
+
print(f"[{reply2.executor_id}] {reply2.text}")
|
|
201
|
+
```
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# onechat
|
|
2
|
+
|
|
3
|
+
[](https://github.com/abolfazl-moeini/onechat/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/onechat-cli/)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](https://github.com/abolfazl-moeini/onechat/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
**The Problem:** You are deep into a coding or debugging session with Claude Code, Codex, or Gemini CLI—then you hit a rate limit, quota wall, or timeout. Switching tools means starting a fresh terminal and re-explaining your entire context from scratch.
|
|
9
|
+
|
|
10
|
+
**The Solution:** `onechat` gives you **one persistent chat session that survives AI backend switches**. It automatically detects quota/auth/timeout failures, places the failing backend on cooldown, generates a compact handoff brief (plus current git state), and continues the exact same conversation on the next available CLI agent or OpenAI-compatible API.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Supported Backends
|
|
15
|
+
|
|
16
|
+
| Backend | Kind | Profile / Parser | Notes |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| **Claude Code** (`claude`) | CLI | `claude` | Native JSONL stream + session resume |
|
|
19
|
+
| **OpenAI Codex** (`codex`) | CLI | `codex` | Native JSONL stream + session resume |
|
|
20
|
+
| **Google Gemini CLI** (`gemini`) | CLI | `gemini` | Stream JSON + session resume |
|
|
21
|
+
| **OpenCode** (`opencode`) | CLI | `opencode` | Multi-provider CLI + model routing |
|
|
22
|
+
| **Qwen Code** (`qwen`) | CLI | `qwen` | Stream JSON + session resume |
|
|
23
|
+
| **OpenAI-compatible APIs** | API | `kind: api` | Groq, OpenRouter, DeepSeek, Cerebras, local vLLM/Ollama |
|
|
24
|
+
| **Additional CLI profiles** | CLI | `agy`, `autoclaw`, `workbuddy`, `qoder`, `zcode` | Built-in YAML profiles + custom `~/.onechat/profiles/*.yaml` |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## How It Works
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
flowchart LR
|
|
32
|
+
U["User / SDK / CLI (`onechat chat` or `onechat run`)"] --> R["Router"]
|
|
33
|
+
R --> S["Selector (Tier, Capabilities, Skills, Cost)"]
|
|
34
|
+
S --> Q["Quota & Cooldown Book (SQLite WAL)"]
|
|
35
|
+
Q -->|Available| E1["Primary Executor (CLI / API)"]
|
|
36
|
+
E1 -->|Quota / Timeout / Error| H["Handoff Brief + Git State"]
|
|
37
|
+
H --> E2["Fallback Executor (Next Backend)"]
|
|
38
|
+
E1 -->|Done| DB[("~/.onechat/onechat.db")]
|
|
39
|
+
E2 -->|Done| DB
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- **Same backend next turn?** Uses native session resume (`--resume`) for zero extra token overhead.
|
|
43
|
+
- **Switched to a different backend?** Injects a bounded `<asf-handoff>` summary + recent turns + current git status/diff so the new model picks up seamlessly.
|
|
44
|
+
- **Zero secrets stored:** API keys are read strictly from environment variables (`os.environ` or `~/.onechat/env`) and automatically redacted from logs, errors, and SQLite.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Install globally as a CLI tool (recommended)
|
|
52
|
+
uv tool install onechat-cli
|
|
53
|
+
|
|
54
|
+
# Or with pip
|
|
55
|
+
pip install onechat-cli
|
|
56
|
+
|
|
57
|
+
# Or run one-off without installing
|
|
58
|
+
uvx --from onechat-cli onechat doctor
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 1. Check installed CLI binaries, API key env vars, and SQLite DB
|
|
67
|
+
onechat doctor
|
|
68
|
+
|
|
69
|
+
# 2. Start an interactive multi-backend chat REPL
|
|
70
|
+
onechat chat
|
|
71
|
+
|
|
72
|
+
# 3. Run a single turn in a persistent session
|
|
73
|
+
onechat run "Find why tests/test_auth.py is flaky" --session my-debug
|
|
74
|
+
|
|
75
|
+
# 4. Inspect executor pool, cooldowns, and session history
|
|
76
|
+
onechat executors list
|
|
77
|
+
onechat sessions list
|
|
78
|
+
onechat sessions export my-debug --format md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Inside `onechat chat`:
|
|
82
|
+
- `/use <executor>` — switch backend mid-conversation without losing context
|
|
83
|
+
- `/tier low|medium|high` — override reasoning/cost tier
|
|
84
|
+
- `/status` — inspect active session, executor, and cooldowns
|
|
85
|
+
- `/exit` — quit
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Configuration (`~/.onechat/config.yaml`)
|
|
90
|
+
|
|
91
|
+
`onechat` works out of the box with defaults, and deep-merges `~/.onechat/config.yaml` (or `$ONECHAT_CONFIG`).
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
db_path: ~/.onechat/onechat.db
|
|
95
|
+
|
|
96
|
+
# Optional: define your prioritized executor pool (free -> subscription -> paid)
|
|
97
|
+
executors:
|
|
98
|
+
- id: codex-main
|
|
99
|
+
kind: cli
|
|
100
|
+
profile: codex
|
|
101
|
+
tier: 3
|
|
102
|
+
cost: subscription
|
|
103
|
+
capabilities: [chat, code]
|
|
104
|
+
|
|
105
|
+
- id: claude-main
|
|
106
|
+
kind: cli
|
|
107
|
+
profile: claude
|
|
108
|
+
tier: 3
|
|
109
|
+
cost: subscription
|
|
110
|
+
capabilities: [chat, code]
|
|
111
|
+
|
|
112
|
+
- id: gemini-cli
|
|
113
|
+
kind: cli
|
|
114
|
+
profile: gemini
|
|
115
|
+
tier: 2
|
|
116
|
+
cost: free
|
|
117
|
+
capabilities: [chat, code]
|
|
118
|
+
|
|
119
|
+
- id: groq-fast
|
|
120
|
+
kind: api
|
|
121
|
+
base_url: https://api.groq.com/openai/v1
|
|
122
|
+
model: llama-3.3-70b-versatile
|
|
123
|
+
api_key_env: GROQ_API_KEY
|
|
124
|
+
tier: 2
|
|
125
|
+
cost: free
|
|
126
|
+
capabilities: [chat]
|
|
127
|
+
|
|
128
|
+
- id: openrouter-fallback
|
|
129
|
+
kind: api
|
|
130
|
+
base_url: https://openrouter.ai/api/v1
|
|
131
|
+
model: qwen/qwen3-coder:free
|
|
132
|
+
api_key_env: OPENROUTER_API_KEY
|
|
133
|
+
tier: 3
|
|
134
|
+
cost: free
|
|
135
|
+
capabilities: [chat, code]
|
|
136
|
+
|
|
137
|
+
tier_policy:
|
|
138
|
+
cost_order: [free, subscription, paid]
|
|
139
|
+
allow_paid: false
|
|
140
|
+
|
|
141
|
+
cooldown:
|
|
142
|
+
quota_cooldown_s: 7200
|
|
143
|
+
timeout_cooldown_s: 7200
|
|
144
|
+
error_cooldown_s: 14400
|
|
145
|
+
auth_cooldown_s: 86400
|
|
146
|
+
share_profile_cooldown: true
|
|
147
|
+
|
|
148
|
+
handoff:
|
|
149
|
+
recent_turns: 6
|
|
150
|
+
turn_max_chars: 4000
|
|
151
|
+
brief_max_chars: 24000
|
|
152
|
+
compact_threshold_chars: 30000
|
|
153
|
+
|
|
154
|
+
roles:
|
|
155
|
+
builder: codex
|
|
156
|
+
reviewer: claude
|
|
157
|
+
auditor: codex
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Python SDK
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from onechat import OneChatClient
|
|
166
|
+
|
|
167
|
+
client = OneChatClient()
|
|
168
|
+
session = client.session(workdir=".")
|
|
169
|
+
|
|
170
|
+
# Turn 1: runs on the best available executor
|
|
171
|
+
reply1 = session.ask_sync("Summarize the architecture of src/")
|
|
172
|
+
print(f"[{reply1.executor_id}] {reply1.text}")
|
|
173
|
+
|
|
174
|
+
# Turn 2: force a switch or let failover handle quota automatically
|
|
175
|
+
reply2 = session.ask_sync("Now write unit tests for the config loader", executor="claude-main")
|
|
176
|
+
print(f"[{reply2.executor_id}] {reply2.text}")
|
|
177
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "onechat-cli"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "One chat session surviving AI backend switches (CLI agents + OpenAI-compatible APIs)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.12"
|
|
8
|
+
keywords = [
|
|
9
|
+
"ai",
|
|
10
|
+
"cli",
|
|
11
|
+
"llm",
|
|
12
|
+
"router",
|
|
13
|
+
"claude-code",
|
|
14
|
+
"codex",
|
|
15
|
+
"gemini",
|
|
16
|
+
"agents",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"pydantic>=2.8",
|
|
29
|
+
"typer>=0.12",
|
|
30
|
+
"pyyaml>=6",
|
|
31
|
+
"openai==3.42.1",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[[project.authors]]
|
|
35
|
+
name = "Abolfazl Moeini"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/abolfazl-moeini/onechat"
|
|
39
|
+
Repository = "https://github.com/abolfazl-moeini/onechat"
|
|
40
|
+
Issues = "https://github.com/abolfazl-moeini/onechat/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
onechat = "onechat.cli:app"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["uv_build>=0.8,<1"]
|
|
47
|
+
build-backend = "uv_build"
|
|
48
|
+
|
|
49
|
+
[tool.uv.build-backend]
|
|
50
|
+
module-name = "onechat"
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
line-length = 100
|
|
54
|
+
target-version = "py312"
|
|
55
|
+
|
|
56
|
+
[tool.ruff.lint]
|
|
57
|
+
select = [
|
|
58
|
+
"E",
|
|
59
|
+
"F",
|
|
60
|
+
"I",
|
|
61
|
+
"B",
|
|
62
|
+
"UP",
|
|
63
|
+
"SIM",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
testpaths = ["tests"]
|
|
68
|
+
markers = ["live: needs network/CLIs"]
|
|
69
|
+
addopts = "-m 'not live'"
|
|
70
|
+
asyncio_mode = "auto"
|
|
71
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
72
|
+
|
|
73
|
+
[dependency-groups]
|
|
74
|
+
dev = [
|
|
75
|
+
"pytest>=8.3",
|
|
76
|
+
"pytest-asyncio>=0.24",
|
|
77
|
+
"ruff>=0.6",
|
|
78
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "onechat-cli"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "One chat session surviving AI backend switches (CLI agents + OpenAI-compatible APIs)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = [{ name = "Abolfazl Moeini" }]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
keywords = ["ai", "cli", "llm", "router", "claude-code", "codex", "gemini", "agents"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"pydantic>=2.8",
|
|
21
|
+
"typer>=0.12",
|
|
22
|
+
"pyyaml>=6",
|
|
23
|
+
"openai==3.42.1",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/abolfazl-moeini/onechat"
|
|
28
|
+
Repository = "https://github.com/abolfazl-moeini/onechat"
|
|
29
|
+
Issues = "https://github.com/abolfazl-moeini/onechat/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
onechat = "onechat.cli:app"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["uv_build>=0.8,<1"]
|
|
36
|
+
build-backend = "uv_build"
|
|
37
|
+
|
|
38
|
+
[tool.uv.build-backend]
|
|
39
|
+
module-name = "onechat"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8.3",
|
|
44
|
+
"pytest-asyncio>=0.24",
|
|
45
|
+
"ruff>=0.6",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.ruff]
|
|
49
|
+
line-length = 100
|
|
50
|
+
target-version = "py312"
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint]
|
|
53
|
+
select = ["E", "F", "I", "B", "UP", "SIM"]
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
markers = ["live: needs network/CLIs"]
|
|
58
|
+
addopts = "-m 'not live'"
|
|
59
|
+
asyncio_mode = "auto"
|
|
60
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""onechat: one chat session surviving AI backend switches."""
|
|
2
|
+
|
|
3
|
+
from .contracts import (
|
|
4
|
+
Capability,
|
|
5
|
+
CostClass,
|
|
6
|
+
Event,
|
|
7
|
+
ExecutorSpec,
|
|
8
|
+
Message,
|
|
9
|
+
Stop,
|
|
10
|
+
Tier,
|
|
11
|
+
TurnRequest,
|
|
12
|
+
TurnResult,
|
|
13
|
+
Usage,
|
|
14
|
+
)
|
|
15
|
+
from .executors.process import AsyncProcessRunner, ProcessRunner, ProcResult
|
|
16
|
+
from .redact import redact
|
|
17
|
+
from .router import NoExecutorAvailable, Reply, Router, SessionBusy
|
|
18
|
+
from .sdk import AsfClient, OneChatClient, Session
|
|
19
|
+
from .selector import Need
|
|
20
|
+
from .store import Store
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"AsfClient",
|
|
24
|
+
"AsyncProcessRunner",
|
|
25
|
+
"Capability",
|
|
26
|
+
"CostClass",
|
|
27
|
+
"Event",
|
|
28
|
+
"ExecutorSpec",
|
|
29
|
+
"Message",
|
|
30
|
+
"Need",
|
|
31
|
+
"NoExecutorAvailable",
|
|
32
|
+
"OneChatClient",
|
|
33
|
+
"ProcessRunner",
|
|
34
|
+
"ProcResult",
|
|
35
|
+
"Reply",
|
|
36
|
+
"Router",
|
|
37
|
+
"Session",
|
|
38
|
+
"SessionBusy",
|
|
39
|
+
"Stop",
|
|
40
|
+
"Store",
|
|
41
|
+
"Tier",
|
|
42
|
+
"TurnRequest",
|
|
43
|
+
"TurnResult",
|
|
44
|
+
"Usage",
|
|
45
|
+
"redact",
|
|
46
|
+
]
|