ccx-native 0.0.0-stage → 0.1.0

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.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -2
  3. package/bin/ccx +56 -0
  4. package/ccx/__init__.py +163 -0
  5. package/ccx/__main__.py +28 -0
  6. package/ccx/claude/__init__.py +0 -0
  7. package/ccx/claude/analytics.py +466 -0
  8. package/ccx/claude/attach.py +762 -0
  9. package/ccx/claude/context.py +465 -0
  10. package/ccx/claude/delivery.py +806 -0
  11. package/ccx/claude/external.py +253 -0
  12. package/ccx/claude/host/__init__.py +0 -0
  13. package/ccx/claude/host/events.py +297 -0
  14. package/ccx/claude/host/hooks.py +438 -0
  15. package/ccx/claude/host/pty.py +250 -0
  16. package/ccx/claude/host/session.py +5184 -0
  17. package/ccx/claude/host/subagents.py +169 -0
  18. package/ccx/claude/host/successor.py +267 -0
  19. package/ccx/claude/managed_turns.py +240 -0
  20. package/ccx/claude/oauth.py +176 -0
  21. package/ccx/claude/settings.py +339 -0
  22. package/ccx/claude/spawn.py +557 -0
  23. package/ccx/claude/tasks.py +72 -0
  24. package/ccx/claude/telemetry.py +282 -0
  25. package/ccx/claude/transcript.py +2281 -0
  26. package/ccx/claude/usage.py +837 -0
  27. package/ccx/claude/usage_control.py +152 -0
  28. package/ccx/cli/__init__.py +0 -0
  29. package/ccx/cli/codex.py +1009 -0
  30. package/ccx/cli/commands/__init__.py +0 -0
  31. package/ccx/cli/commands/_common.py +407 -0
  32. package/ccx/cli/commands/control.py +161 -0
  33. package/ccx/cli/commands/create.py +669 -0
  34. package/ccx/cli/commands/read.py +1020 -0
  35. package/ccx/cli/commands/turns.py +1081 -0
  36. package/ccx/cli/controller.py +757 -0
  37. package/ccx/cli/main.py +301 -0
  38. package/ccx/cli/parser.py +1324 -0
  39. package/ccx/cli/skills.py +215 -0
  40. package/ccx/cli/statusline.py +160 -0
  41. package/ccx/client.py +1900 -0
  42. package/ccx/codex/__init__.py +0 -0
  43. package/ccx/codex/attach_tty.py +267 -0
  44. package/ccx/codex/client.py +732 -0
  45. package/ccx/codex/completion.py +121 -0
  46. package/ccx/codex/control.py +288 -0
  47. package/ccx/codex/daemon/__init__.py +0 -0
  48. package/ccx/codex/daemon/__main__.py +4 -0
  49. package/ccx/codex/daemon/daemon.py +1556 -0
  50. package/ccx/codex/daemon/models.py +140 -0
  51. package/ccx/codex/daemon/native.py +1590 -0
  52. package/ccx/codex/daemon/release.py +367 -0
  53. package/ccx/codex/daemon/worker.py +2396 -0
  54. package/ccx/codex/delivery.py +758 -0
  55. package/ccx/codex/delivery_recovery.py +232 -0
  56. package/ccx/codex/evidence.py +827 -0
  57. package/ccx/codex/history.py +158 -0
  58. package/ccx/codex/notify_history.py +140 -0
  59. package/ccx/codex/ops.py +666 -0
  60. package/ccx/codex/paths.py +70 -0
  61. package/ccx/codex/protocol.py +805 -0
  62. package/ccx/codex/provenance.py +105 -0
  63. package/ccx/codex/read.py +29 -0
  64. package/ccx/codex/records.py +51 -0
  65. package/ccx/codex/reports.py +177 -0
  66. package/ccx/codex/runtime.py +1412 -0
  67. package/ccx/codex/settle.py +363 -0
  68. package/ccx/codex/telemetry.py +792 -0
  69. package/ccx/codex/types.py +659 -0
  70. package/ccx/codex/worker_environment.py +25 -0
  71. package/ccx/constants.py +288 -0
  72. package/ccx/controllers/__init__.py +0 -0
  73. package/ccx/controllers/controller.py +1449 -0
  74. package/ccx/controllers/live_vars.py +1706 -0
  75. package/ccx/controllers/live_vars_runner.py +216 -0
  76. package/ccx/controllers/notify.py +213 -0
  77. package/ccx/controllers/orchestrator.py +193 -0
  78. package/ccx/controllers/policy.py +57 -0
  79. package/ccx/controllers/store.py +681 -0
  80. package/ccx/errors.py +634 -0
  81. package/ccx/notify/__init__.py +0 -0
  82. package/ccx/notify/__main__.py +5 -0
  83. package/ccx/notify/client.py +116 -0
  84. package/ccx/notify/daemon.py +480 -0
  85. package/ccx/notify/deliver.py +304 -0
  86. package/ccx/notify/paths.py +51 -0
  87. package/ccx/notify/registry.py +649 -0
  88. package/ccx/notify/select.py +750 -0
  89. package/ccx/notify/settle.py +684 -0
  90. package/ccx/ops/__init__.py +0 -0
  91. package/ccx/ops/background.py +115 -0
  92. package/ccx/ops/cancel.py +289 -0
  93. package/ccx/ops/codex_import.py +96 -0
  94. package/ccx/ops/common.py +397 -0
  95. package/ccx/ops/compact.py +337 -0
  96. package/ccx/ops/compact_ops.py +550 -0
  97. package/ccx/ops/context_events.py +48 -0
  98. package/ccx/ops/conversation.py +1540 -0
  99. package/ccx/ops/conversation_paging.py +1338 -0
  100. package/ccx/ops/create.py +56 -0
  101. package/ccx/ops/creation.py +952 -0
  102. package/ccx/ops/creation_steps.py +579 -0
  103. package/ccx/ops/event_feed.py +710 -0
  104. package/ccx/ops/forking.py +711 -0
  105. package/ccx/ops/input.py +556 -0
  106. package/ccx/ops/maintenance.py +295 -0
  107. package/ccx/ops/report.py +770 -0
  108. package/ccx/ops/semantics.py +490 -0
  109. package/ccx/ops/send.py +961 -0
  110. package/ccx/ops/steer_ops.py +867 -0
  111. package/ccx/ops/terminate.py +383 -0
  112. package/ccx/ops/turn_reports.py +306 -0
  113. package/ccx/ops/wait.py +762 -0
  114. package/ccx/ops/worker_events.py +636 -0
  115. package/ccx/rpc/__init__.py +0 -0
  116. package/ccx/rpc/local_rpc.py +1602 -0
  117. package/ccx/rpc/rpc.py +559 -0
  118. package/ccx/rpc/serve.py +374 -0
  119. package/ccx/rpc/transport.py +409 -0
  120. package/ccx/rpc/view.py +125 -0
  121. package/ccx/store/__init__.py +0 -0
  122. package/ccx/store/discovery.py +170 -0
  123. package/ccx/store/identity.py +105 -0
  124. package/ccx/store/journal_io.py +79 -0
  125. package/ccx/store/liveness.py +194 -0
  126. package/ccx/store/paths.py +254 -0
  127. package/ccx/store/record_cache.py +40 -0
  128. package/ccx/store/records.py +309 -0
  129. package/ccx/store/root.py +804 -0
  130. package/ccx/store/runtime_presence.py +137 -0
  131. package/ccx/store/store.py +2332 -0
  132. package/ccx/store/worker_state.py +86 -0
  133. package/ccx/system/__init__.py +0 -0
  134. package/ccx/system/bounded.py +296 -0
  135. package/ccx/system/cwd_paths.py +25 -0
  136. package/ccx/system/engine_binary.py +59 -0
  137. package/ccx/system/executable.py +50 -0
  138. package/ccx/system/oslayer.py +667 -0
  139. package/ccx/system/pipes.py +46 -0
  140. package/ccx/system/sanitize.py +43 -0
  141. package/ccx/types.py +705 -0
  142. package/ccx/version.py +29 -0
  143. package/ccx/workers.py +2081 -0
  144. package/ccx.py +9 -0
  145. package/package.json +40 -4
  146. package/pyproject.toml +87 -0
  147. package/skills/ccx/SKILL.md +155 -0
  148. package/skills/ccx/references/controllers.md +244 -0
  149. package/skills/ccx/references/troubleshooting.md +94 -0
  150. package/skills/ccx/references/variables.md +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fernando
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.
package/README.md CHANGED
@@ -1,3 +1,242 @@
1
- # Temporary Holding Version
1
+ # ccx
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Control and monitor native Claude Code and Codex sessions from the CLI, Python
4
+ or RPC.**
5
+
6
+ You, your agents and your scripts share the same persistent sessions. They run
7
+ on your own Claude and ChatGPT subscriptions with your existing setup, and you
8
+ can open any of them live with `ccx attach`.
9
+
10
+ ```bash
11
+ npm install -g ccx-native
12
+ ccx skills install
13
+ ```
14
+
15
+ [▶ Examples](#examples) · [Docs](docs/getting-started.md) · Unofficial: read
16
+ [Risks and system changes](#risks-and-system-changes).
17
+
18
+ ## Usage
19
+
20
+ Most work needs five commands, the same for Claude Code and Codex:
21
+
22
+ ```bash
23
+ ccx new --engine claude "Implement the plan in PLAN.md" # prints claude:1a2b3c4d-...
24
+ ccx wait 1a2b3c4d
25
+ ccx report 1a2b3c4d
26
+ ccx send 1a2b3c4d "Also update the changelog"
27
+ ccx attach 1a2b3c4d
28
+ ```
29
+
30
+ Use `--engine codex` for a Codex worker. Replace `1a2b3c4d` with a unique prefix
31
+ of at least 8 characters from the id `ccx new` prints. `ccx help` lists the other
32
+ commands.
33
+
34
+ ## Features
35
+
36
+ - **Let Codex run Claude Code.** Codex starts Claude Code workers, is woken when
37
+ they finish, reviews their work and sends fixes back. Claude Code can drive
38
+ Codex workers the same way.
39
+ - **Runs the official Claude Code and Codex.** ccx drives the unmodified
40
+ `claude` program through a terminal (PTY), as you would, and `codex` through
41
+ its app-server. Workers are signed in as you and run on your Claude or ChatGPT
42
+ subscription, with no API keys.
43
+ - **Keep your setup.** Your config, `CLAUDE.md`/`AGENTS.md`, hooks, skills and
44
+ MCP servers all apply. Start a worker in any folder, which a subagent can't do.
45
+ - **Join any session live.** `ccx attach` opens a worker in the engine's own
46
+ interface while agents keep driving it. `ccx import` brings in a session you
47
+ started yourself.
48
+ - **Find and resume workers.** Workers keep their history across turns and
49
+ restarts, stop when idle and resume on the next message. `ccx list` finds
50
+ them; `ccx peek` shows what one is doing.
51
+ - **Keep long work going.** Steer a running turn, compact a worker's context
52
+ between steps, and stop work at a usage cap.
53
+ - **Build on it.** A [Python API](docs/python/README.md),
54
+ [controllers](docs/controllers.md) and a local [JSON protocol](docs/rpc/README.md)
55
+ put workers inside your own tools, dashboards and services.
56
+
57
+ ## Examples
58
+
59
+ ### Codex drives Claude Code and Codex workers
60
+
61
+ https://github.com/user-attachments/assets/661f5247-7614-40e8-866b-b8e9742b158b
62
+
63
+ I asked Codex for a Claude worker to implement a design, then for a Codex worker
64
+ to check the proxy setup in parallel. Left: the Codex app. Right: its terminal,
65
+ where I attach to the workers and open the dashboard.
66
+
67
+ Watch for: 0:33 Claude finishes and Codex wakes up · 1:29 Codex tells Claude about
68
+ the Codex worker · 1:45 Codex compacts Claude before the next step.
69
+
70
+ ### Native Claude Code and Codex, one Python API
71
+
72
+ https://github.com/user-attachments/assets/849efe10-4f8c-457d-a08e-eea7bf17af17
73
+
74
+ Right: a web chat built on the ccx Python API. Left: the same Claude Code session,
75
+ open with `ccx attach`. Only the chat is used: Claude runs the slow tests in the
76
+ background and has a Codex worker review its changes.
77
+
78
+ ## Controllers
79
+
80
+ A controller is a Python script that runs a multi-step flow across workers. It
81
+ can stop at a checkpoint for the owner's decision, then resume without redoing
82
+ finished steps.
83
+
84
+ ```mermaid
85
+ %%{init: {"sequence": {"mirrorActors": false}}}%%
86
+ sequenceDiagram
87
+ participant O as Owner<br/>(you or your agent)
88
+ participant C as Controller
89
+ participant CL as Claude worker
90
+ participant CX as Codex worker
91
+ O->>C: ccx controller run deploy.py --notify-parent
92
+ rect rgba(201, 100, 66, 0.12)
93
+ C->>CL: design template.yaml
94
+ C->>CX: security review
95
+ CX-->>C: findings
96
+ C->>CL: fix the findings
97
+ C->>CL: write the runbook, create the change set
98
+ end
99
+ C-->>O: report: change set ready (wakes the owner)
100
+ Note over C: The controller stops here
101
+ O->>C: ccx controller resume deploy --note "Go"
102
+ Note over C: Finished steps are skipped
103
+ rect rgba(59, 111, 182, 0.12)
104
+ C->>CL: deploy the change set, with the owner's note
105
+ C->>CX: verify the live stack
106
+ C->>CL: write the ops notes
107
+ end
108
+ C-->>O: final report (wakes the owner)
109
+ ```
110
+
111
+ ```python
112
+ from ccx import WorkerClient, controller, current, task
113
+
114
+ workers = WorkerClient()
115
+
116
+ @task
117
+ def security_review(): # a fresh Codex worker returns its findings
118
+ found = {"issues": None}
119
+ workers.create(engine="codex", model="gpt-6.1-sol", cwd=str(current.workspace),
120
+ prompt=REVIEW_PROMPT, variables=found, wait=True)
121
+ return found["issues"]
122
+
123
+ # design, fix, prepare, deploy, verify and handover are tasks like this one.
124
+
125
+ @controller(name="deploy")
126
+ def main():
127
+ design() # Claude writes template.yaml
128
+ issues = security_review()
129
+ if issues:
130
+ fix(issues) # the same Claude worker fixes them
131
+ change_set = prepare() # Claude: runbook + change set
132
+ if not current.inputs: # checkpoint: stop until the owner resumes
133
+ return current.report(status="awaiting-approval", checkpoint="deploy",
134
+ summary="Change set ready. Resume with a note to deploy.",
135
+ data={"change_set": change_set})
136
+ deploy(change_set, current.inputs[0].comment) # Claude follows the runbook
137
+ verify() # Codex smoke-tests the live stack
138
+ handover() # Claude writes the ops notes
139
+ current.report(status="completed", summary="Deployed, verified and documented.")
140
+ ```
141
+
142
+ [Controllers](docs/controllers.md) explains resume and has runnable examples.
143
+
144
+ ## ccx and the Agent SDK
145
+
146
+ The Claude Agent SDK runs the Claude Code binary from Python or TypeScript.
147
+ The program that starts an SDK session drives it while it is live; other
148
+ processes have no built-in way to inspect or drive that live session. You can
149
+ resume it later with `claude --resume <session-id>`.
150
+
151
+ ccx provides a shared worker lifecycle for Claude Code and Codex:
152
+
153
+ - **Shared, live workers.** A worker has a durable id independent of whoever
154
+ started it. Any agent, shell, Python process or dashboard can inspect,
155
+ message or steer it, or open it live with `ccx attach`.
156
+ - **Every operation is a command.** Any agent that can run a shell command
157
+ can drive workers. Python and RPC interfaces are available too.
158
+ - **Built-in lifecycle.** Send a new message or steer a running turn. Questions
159
+ and approvals go to whoever is driving. Idle workers stop and revive on the
160
+ next message. A Codex parent is notified when its Claude worker finishes.
161
+ The same lifecycle covers Claude Code and Codex.
162
+
163
+ The SDK and ccx serve different layers and can complement each other in the
164
+ same workflow.
165
+
166
+ ## Install
167
+
168
+ You need:
169
+
170
+ - Linux, macOS or WSL2, with Python 3.11 or newer
171
+ - [Claude Code](https://docs.claude.com/en/docs/claude-code),
172
+ [Codex](https://github.com/openai/codex) or both, installed and signed in
173
+
174
+ Install ccx with whichever tool you like:
175
+
176
+ ```bash
177
+ npm install -g ccx-native # needs Python 3.11+ on your PATH
178
+ uv tool install ccx-native
179
+ pipx install ccx-native
180
+ ```
181
+
182
+ The package is `ccx-native`; the command is `ccx`.
183
+
184
+ Optionally, teach your agents to use it:
185
+
186
+ ```bash
187
+ ccx skills install
188
+ ```
189
+
190
+ This adds the ccx skill to Claude Code and Codex (`~/.claude/skills`,
191
+ `~/.agents/skills`) and keeps it current when you upgrade. Or use
192
+ [skills.sh](https://skills.sh):
193
+
194
+ ```bash
195
+ npx skills add ccx-native/ccx -g
196
+ ```
197
+
198
+ Tested with Claude Code 2.1.316 and Codex 0.166 on WSL2, macOS 12 (Intel) and
199
+ macOS 27 (Apple silicon). If `ccx` isn't found after installing, see
200
+ [Installing](docs/troubleshooting.md#installing).
201
+
202
+ ## Risks and system changes
203
+
204
+ > [!IMPORTANT]
205
+ > - **Unofficial.** ccx is an independent project, not affiliated with or
206
+ > endorsed by Anthropic or OpenAI. Using Claude Code and Codex through it is
207
+ > still subject to their terms.
208
+ > - **It can break on updates.** ccx drives Claude Code's interactive interface
209
+ > and hooks, and Codex's app-server protocol. Neither is a stable public API,
210
+ > so a new release of either can break ccx until it adapts.
211
+ > - **It spends your quota.** Workers run unattended on your Claude and Codex
212
+ > plans. Usage caps (`--cap-5h`, `--cap-7d`) help, but they're not exact.
213
+ > - **Workers have your full user privileges by default**: they can read, write
214
+ > and run anything you can, not only inside their folder. Use
215
+ > `--permissions restricted` for permission prompts and Codex sandboxing.
216
+ > - **It changes a few things on your machine:** it marks worker folders as
217
+ > trusted in `~/.claude.json` (`ccx untrust` undoes it), leaves background
218
+ > processes running (`ccx shutdown` stops them), and adds `python`/`python3`
219
+ > shell functions inside worker shells for [variables](docs/variables/README.md).
220
+ > [What ccx changes on your machine](docs/machine-changes.md) has the full list.
221
+
222
+ ## Docs
223
+
224
+ Start with [Getting started](docs/getting-started.md) and
225
+ [Concepts](docs/concepts.md). The rest:
226
+ [Permissions](docs/permissions.md) ·
227
+ [Usage and caps](docs/usage.md) ·
228
+ [Codex workers](docs/codex.md) ·
229
+ [Controllers](docs/controllers.md) ·
230
+ [Variables](docs/variables/README.md) ·
231
+ [Troubleshooting](docs/troubleshooting.md) ·
232
+ [What ccx changes on your machine](docs/machine-changes.md) ·
233
+ [Python API](docs/python/README.md) ·
234
+ [RPC](docs/rpc/README.md) ·
235
+ [Architecture](docs/architecture.md).
236
+ `ccx help COMMAND` has the details for each command.
237
+
238
+ ## Contributing, security, license
239
+
240
+ Small fixes are welcome as pull requests; for new features, open an issue
241
+ instead. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
242
+ Released under the [MIT License](LICENSE).
package/bin/ccx ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ // Plain old syntax on purpose: an outdated distro Node should still reach the
3
+ // Python check below instead of failing to parse this file.
4
+ const { spawnSync } = require("child_process");
5
+ const path = require("path");
6
+
7
+ const script = path.resolve(__dirname, "..", "ccx.py");
8
+ // Homebrew's versioned formulas and uv-installed Pythons often only provide
9
+ // a versioned name, so try those after python3.
10
+ const candidates = process.env.PYTHON ? [process.env.PYTHON] : [
11
+ "python3", "python3.15", "python3.14", "python3.13", "python3.12", "python3.11", "python"
12
+ ];
13
+
14
+ // ccx needs 3.11+; an older interpreter would fail with a SyntaxError or a
15
+ // missing tomllib instead of saying so.
16
+ const versionProbe = "import sys; print('%d.%d' % sys.version_info[:2]); sys.exit(sys.version_info < (3, 11))";
17
+
18
+ let lastError = null;
19
+ const tooOld = [];
20
+ for (const python of candidates) {
21
+ const probe = spawnSync(python, ["-c", versionProbe], { encoding: "utf8" });
22
+ if (probe.error && probe.error.code === "ENOENT") {
23
+ lastError = probe.error;
24
+ continue;
25
+ }
26
+ if (!probe.error && probe.status !== 0) {
27
+ tooOld.push(`${python} is Python ${(probe.stdout || "").trim() || "unknown"}`);
28
+ continue;
29
+ }
30
+ const result = spawnSync(python, [script, ...process.argv.slice(2)], {
31
+ stdio: "inherit"
32
+ });
33
+
34
+ if (result.error) {
35
+ if (result.error.code === "ENOENT") {
36
+ lastError = result.error;
37
+ continue;
38
+ }
39
+ console.error(`ccx: failed to run ${python}: ${result.error.message}`);
40
+ process.exit(1);
41
+ }
42
+
43
+ if (result.signal) {
44
+ process.kill(process.pid, result.signal);
45
+ }
46
+ process.exit(result.status === null ? 0 : result.status);
47
+ }
48
+
49
+ console.error(
50
+ "ccx: Python 3.11+ is required" + (tooOld.length ? ` (${tooOld.join("; ")})` : "") +
51
+ ". Set PYTHON=/path/to/python if needed."
52
+ );
53
+ if (lastError && process.env.CCX_DEBUG) {
54
+ console.error(lastError.message);
55
+ }
56
+ process.exit(127);
@@ -0,0 +1,163 @@
1
+ "ccx package.\n\nPublic Python API:\n\n from ccx import CcxClient\n cx = CcxClient()\n\n from ccx import CodexClient\n codex = CodexClient()\n\n from ccx import WorkerClient\n workers = WorkerClient() # one lifecycle for either engine\n\n from ccx import controller, current, task\n # durable task-specific Python orchestration, launched by `ccx controller`\n\nSee :mod:`ccx.client` and :mod:`ccx.codex.client` for the clients,\n:mod:`ccx.types` and :mod:`ccx.codex.types` for returned dataclasses, and\n:mod:`ccx.errors` for the shared typed exception hierarchy. Each client drives\nits engine's same on-disk sessions; durable controllers reference those real\nworkers without creating another worker type.\n"
2
+
3
+ from __future__ import annotations
4
+
5
+ from .client import CcxClient
6
+ from ccx.codex.client import CodexClient
7
+ from ccx.codex.types import (
8
+ CodexApprovalResult,
9
+ CodexCompactResult,
10
+ CodexContext,
11
+ CodexControlResult,
12
+ CodexReport,
13
+ CodexReconcileResult,
14
+ CodexResumeResult,
15
+ CodexSessionInfo,
16
+ CodexTelemetryPage,
17
+ CodexTurnResult,
18
+ CodexUsage,
19
+ CodexWaitResult,
20
+ )
21
+ from .errors import (
22
+ BudgetStopped,
23
+ CapabilityUnsupported,
24
+ CompactFailed,
25
+ CreatePartialFailure,
26
+ CompactIndeterminate,
27
+ CcxError,
28
+ CursorInvalidated,
29
+ DeliveryRejected,
30
+ InvalidRequest,
31
+ AmbiguousWorker,
32
+ OperationConflict,
33
+ OperationTimeout,
34
+ ProviderProtocolError,
35
+ PayloadTooLarge,
36
+ SessionNotFound,
37
+ SessionUnavailable,
38
+ SessionWaiting,
39
+ SpawnFailed,
40
+ SteerIndeterminate,
41
+ SendIndeterminate,
42
+ TurnIncomplete,
43
+ WorkerApiError,
44
+ WorkerApiPermanent,
45
+ WorkerApiTransient,
46
+ WorkerRateLimited,
47
+ ControllerError,
48
+ ControllerLaunchRequired,
49
+ ControllerOperationIndeterminate,
50
+ ControllerReplayMismatch,
51
+ ControllerLiveStateLost,
52
+ )
53
+ from .types import (
54
+ ClaudeContext,
55
+ ClaudeTask,
56
+ CompactOperationResult,
57
+ CompactResult,
58
+ Event,
59
+ PendingInput,
60
+ Question,
61
+ Report,
62
+ SemanticDeliveryResult,
63
+ SendResult,
64
+ SessionInfo,
65
+ SessionStatus,
66
+ SteerResult,
67
+ Usage,
68
+ WaitResult,
69
+ )
70
+ from ccx.ops.steer_ops import SteerJournalBusy
71
+ from .workers import WorkerClient, evaluate_quota
72
+ from ccx.ops.creation import new_worker_id
73
+ from ccx.store.discovery import resolve_worker
74
+ from ccx.notify.client import ParentNotificationClient
75
+ from ccx.controllers.controller import (
76
+ ControllerInput,
77
+ Task,
78
+ TaskFuture,
79
+ TaskOutput,
80
+ controller,
81
+ current,
82
+ task,
83
+ task_output,
84
+ )
85
+
86
+ __all__ = [
87
+ "CcxClient",
88
+ "CodexClient",
89
+ "WorkerClient",
90
+ "new_worker_id",
91
+ "resolve_worker",
92
+ "CreatePartialFailure",
93
+ "ParentNotificationClient",
94
+ "evaluate_quota",
95
+ "controller",
96
+ "task",
97
+ "current",
98
+ "task_output",
99
+ "Task",
100
+ "TaskFuture",
101
+ "TaskOutput",
102
+ "ControllerInput",
103
+ # errors
104
+ "CcxError",
105
+ "CursorInvalidated",
106
+ "InvalidRequest",
107
+ "AmbiguousWorker",
108
+ "OperationConflict",
109
+ "OperationTimeout",
110
+ "ProviderProtocolError",
111
+ "CapabilityUnsupported",
112
+ "CompactIndeterminate",
113
+ "SessionNotFound",
114
+ "PayloadTooLarge",
115
+ "SessionUnavailable",
116
+ "SpawnFailed",
117
+ "SessionWaiting",
118
+ "DeliveryRejected",
119
+ "SteerIndeterminate",
120
+ "SteerJournalBusy",
121
+ "SendIndeterminate",
122
+ "TurnIncomplete",
123
+ "CompactFailed",
124
+ "BudgetStopped",
125
+ "WorkerApiError",
126
+ "WorkerApiPermanent",
127
+ "WorkerApiTransient",
128
+ "WorkerRateLimited",
129
+ "ControllerError",
130
+ "ControllerLaunchRequired",
131
+ "ControllerOperationIndeterminate",
132
+ "ControllerReplayMismatch",
133
+ "ControllerLiveStateLost",
134
+ # types
135
+ "SessionInfo",
136
+ "ClaudeContext",
137
+ "ClaudeTask",
138
+ "SessionStatus",
139
+ "PendingInput",
140
+ "Question",
141
+ "Report",
142
+ "SemanticDeliveryResult",
143
+ "SendResult",
144
+ "SteerResult",
145
+ "CompactResult",
146
+ "CompactOperationResult",
147
+ "WaitResult",
148
+ "Event",
149
+ "Usage",
150
+ # Codex types
151
+ "CodexSessionInfo",
152
+ "CodexResumeResult",
153
+ "CodexTelemetryPage",
154
+ "CodexTurnResult",
155
+ "CodexReconcileResult",
156
+ "CodexControlResult",
157
+ "CodexWaitResult",
158
+ "CodexReport",
159
+ "CodexApprovalResult",
160
+ "CodexCompactResult",
161
+ "CodexContext",
162
+ "CodexUsage",
163
+ ]
@@ -0,0 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ if __package__:
4
+ from ccx.cli.main import main
5
+ else:
6
+ # Hosts and hooks may re-exec this file directly after the parent command
7
+ # was invoked as `python -m ccx`. In direct-script mode Python does not know
8
+ # the package parent, so add it before importing ccx.cli absolutely.
9
+ #
10
+ # Do not import pathlib here before fixing sys.path: when this file is
11
+ # executed directly, sys.path[0] is the package directory, so stdlib imports
12
+ # of `types` can accidentally resolve to ccx/types.py.
13
+ import sys
14
+
15
+ normalized = __file__.replace("\\", "/")
16
+ package_dir = normalized.rsplit("/", 1)[0]
17
+ root = normalized.rsplit("/", 2)[0]
18
+ # Direct script execution sets sys.path[0] to the package directory. That
19
+ # makes top-level stdlib imports like `types` resolve to ccx/types.py. Drop
20
+ # that entry and import ccx as a package from its parent instead.
21
+ sys.path = [p for p in sys.path if p.replace("\\", "/") != package_dir]
22
+ if root not in sys.path:
23
+ sys.path.insert(0, root)
24
+ from ccx.cli.main import main
25
+
26
+
27
+ if __name__ == "__main__":
28
+ main()
File without changes