@corbet-labs/ccht 0.2.0 → 0.2.3

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 (40) hide show
  1. package/LICENSE.md +11 -6
  2. package/LICENSES/LGPL-3.0-linking-exception.txt +16 -0
  3. package/LICENSES/LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt +16 -0
  4. package/LICENSES/dependencies/bytes-1.12.1/LICENSE +25 -0
  5. package/README.md +194 -212
  6. package/THIRD-PARTY.md +17 -0
  7. package/index.d.ts +6 -1
  8. package/index.js +8 -1
  9. package/package.json +17 -3
  10. package/source/.ci/wasm-bundle/Cargo.toml +1 -1
  11. package/source/CHANGELOG.md +59 -2
  12. package/source/Cargo.lock +9 -1
  13. package/source/Cargo.toml +4 -4
  14. package/source/LICENSE.md +11 -6
  15. package/source/LICENSES/LGPL-3.0-linking-exception.txt +16 -0
  16. package/source/LICENSES/LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt +16 -0
  17. package/source/README.md +67 -12
  18. package/source/THIRD-PARTY.md +17 -0
  19. package/source/dependencies.tar.gz +0 -0
  20. package/source/src/auth.rs +435 -0
  21. package/source/src/configuration.rs +51 -0
  22. package/source/src/conversation.rs +25 -0
  23. package/source/src/dock.rs +564 -0
  24. package/source/src/lib.rs +9 -0
  25. package/source/src/native/client.rs +6 -0
  26. package/source/src/native/drivers/codex.rs +506 -0
  27. package/source/src/native/drivers/mod.rs +305 -0
  28. package/source/src/native/drivers/opencode.rs +531 -0
  29. package/source/src/native/env.rs +264 -0
  30. package/source/src/native/fixture.py +78 -1
  31. package/source/src/native/mod.rs +5 -0
  32. package/source/src/native/pool.rs +440 -0
  33. package/source/src/native/session.rs +6 -0
  34. package/source/src/native/tests.rs +204 -0
  35. package/source/src/transport.rs +330 -0
  36. package/src/auth.ts +149 -0
  37. package/src/components/AccountConnection.svelte +201 -0
  38. package/src/components/Dock.svelte +172 -0
  39. package/src/dock.ts +244 -0
  40. package/wasm/ccht_bg.wasm +0 -0
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 - 2026-09-19
4
+
5
+ - No code changes from 0.2.2. Repack the npm distribution from the verified
6
+ stage (license notices, corresponding source kit, built Wasm). npm 0.2.2
7
+ was published from the bare working tree, is deprecated, and must not
8
+ be used.
9
+
10
+ ## 0.2.2 - 2026-09-19
11
+
12
+ - No runtime behavior changes to existing APIs; all existing APIs unchanged.
13
+ - ADDED: `src/dock.rs` — headless dock state (`DockKind`, `Placement`,
14
+ `DockId`, `DockManager` with open/placement/focus-token/serialize/restore).
15
+ Portable Rust with no I/O; mirrored by `web/src/dock.ts`.
16
+ - ADDED: `src/transport.rs` — `TransportKind` (`Stdio` / `Socket`), `Transport`
17
+ trait, `TransportError`, `StdioTransport`, `SocketTransport` (validation
18
+ only, no I/O).
19
+ - ADDED: `src/native/env.rs` — `EnvProfile::{strict, permissive}`, `apply()`,
20
+ `apply_to_command()`.
21
+ - ADDED: `src/native/drivers/` — `Challenge` + `validate()`, `AccountInfo`,
22
+ `DriverError` + `code()`, `LoginState`, `LoginDriver` trait
23
+ (`async start` / `poll` / `account` / `cancel`). Native-only, no credential
24
+ extraction or persistence; the app owns storage via `CredentialsProvider`.
25
+ Includes `codex.rs` (`CodexDeviceDriver`: spawns the caller's Codex
26
+ app-server, ChatGPT device-code, host-allowlisted challenge, poll deadline,
27
+ projection-only account read) and `opencode.rs` (`OpenCodeKeyDriver`:
28
+ loopback `opencode serve`, ephemeral port, env-only server password, user
29
+ key PUT, connected check; hand-rolled HTTP, no new dependencies).
30
+ - ADDED: `web/src/dock.ts` + `web/src/components/Dock.svelte`
31
+ (with `web/README.md` and `web/package.json` / `web/jsr.json` exports) —
32
+ framework-free dock state (`DockKind`, `Placement`, `validateDockId`,
33
+ `createDockManager` with open/placement/focus-token/serialize/restore) and
34
+ a generic Svelte 5 edge rail (unstyled `ccht-dock-` classes, effects via
35
+ app callbacks, never fetches, spawns, or stores).
36
+ - ADDED: `web/src/auth.ts` + `web/src/components/AccountConnection.svelte`
37
+ (with `web/README.md` and `web/package.json` exports) — Svelte 5, unstyled
38
+ `ccht-` classes, effects via app callbacks, never spawns agents.
39
+ - ADDED: `src/native/pool.rs` — `SessionPool`: keyed native sessions over one
40
+ shared client (lazy per-key sessions, per-key turn serialization, tagged
41
+ `PoolEvent` stream, per-key conversation snapshots for replay).
42
+
43
+ ### Migration notes
44
+
45
+ - Private drivers become `LoginDriver` impls (`CodexDeviceDriver`,
46
+ `OpenCodeKeyDriver`); adapt call sites to `start` / `poll` / `account` /
47
+ `cancel` and projection-only `AccountInfo`.
48
+ - `AccountConnection.svelte` becomes the shared component; keep product copy,
49
+ flows, and operation state in the app and drive effects through
50
+ `onStart` / `onCancel` / `onKeySubmit` / `onDisconnect`.
51
+ - `publish_challenge` URL pinning stays server-side; the browser only renders
52
+ a validated challenge.
53
+ - careervector-tui gains: its local `AuthState` mirror can become
54
+ `pub use ccht::auth::AuthState`; `BrowserCredentialsProvider` wraps the
55
+ shared `CredentialsProvider` shape.
56
+
57
+ ## 0.2.1 — 2026-09-13
58
+
59
+ - No runtime behavior changes.
60
+
3
61
  ## 0.2.0 — 2026-09-12
4
62
 
5
63
  - Expose live session configuration and validated model, select and boolean controls.
@@ -19,10 +77,9 @@
19
77
 
20
78
  ## 0.1.0 — 2026-09-11
21
79
 
22
- - Rename the unpublished cllm package to ccht and license current work LGPL-3.0-only.
80
+ - Rename the unpublished cllm package to ccht.
23
81
  - Share the Rust conversation model with browsers through @corbet-labs/ccht Wasm.
24
82
  - Integrate installed upstream agents through the official ACP SDK: typed sessions,
25
83
  streaming, permissions, cancellation, capability checks and bounded delivery.
26
84
  - Remove direct provider HTTP and credential-handling adapters. Applications own
27
85
  any explicit local inference backend and emit the shared conversation contract.
28
- - Keep historical source grants unchanged; no old release is retroactively relicensed.
package/source/Cargo.lock CHANGED
@@ -214,6 +214,12 @@ version = "3.20.3"
214
214
  source = "registry+https://github.com/rust-lang/crates.io-index"
215
215
  checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
216
216
 
217
+ [[package]]
218
+ name = "bytes"
219
+ version = "1.12.1"
220
+ source = "registry+https://github.com/rust-lang/crates.io-index"
221
+ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
222
+
217
223
  [[package]]
218
224
  name = "cc"
219
225
  version = "1.4.5"
@@ -226,7 +232,7 @@ dependencies = [
226
232
 
227
233
  [[package]]
228
234
  name = "ccht"
229
- version = "0.2.0"
235
+ version = "0.2.3"
230
236
  dependencies = [
231
237
  "agent-client-protocol",
232
238
  "agent-client-protocol-schema",
@@ -1347,9 +1353,11 @@ version = "1.53.1"
1347
1353
  source = "registry+https://github.com/rust-lang/crates.io-index"
1348
1354
  checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
1349
1355
  dependencies = [
1356
+ "bytes",
1350
1357
  "libc",
1351
1358
  "mio",
1352
1359
  "pin-project-lite",
1360
+ "signal-hook-registry",
1353
1361
  "socket2",
1354
1362
  "tokio-macros",
1355
1363
  "windows-sys",
package/source/Cargo.toml CHANGED
@@ -1,13 +1,13 @@
1
1
  [package]
2
2
  name = "ccht"
3
- version = "0.2.0"
3
+ version = "0.2.3"
4
4
  edition = "2024"
5
5
  rust-version = "1.88"
6
- license = "LGPL-3.0-only"
6
+ license = "LGPL-3.0-only WITH LGPL-3.0-linking-exception"
7
7
  description = "Reusable conversations for native applications and the web, with upstream ACP agent integration"
8
8
  repository = "https://github.com/corbet-labs/ccht"
9
9
  readme = "README.md"
10
- include = ["Cargo.toml", "Cargo.lock", "src/**", "examples/**", "README.md", "CHANGELOG.md", "LICENSE", "LICENSE.md", "LICENSES/LGPL-3.0-only.txt", "LICENSES/GPL-3.0-only.txt", "THIRD-PARTY.md"]
10
+ include = ["Cargo.toml", "Cargo.lock", "src/**", "examples/**", "README.md", "CHANGELOG.md", "LICENSE", "LICENSE.md", "LICENSES/LGPL-3.0-only.txt", "LICENSES/LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt", "LICENSES/LGPL-3.0-linking-exception.txt", "LICENSES/GPL-3.0-only.txt", "THIRD-PARTY.md"]
11
11
  keywords = ["chat", "acp", "agents", "wasm", "streaming"]
12
12
  categories = ["development-tools", "web-programming"]
13
13
 
@@ -34,7 +34,7 @@ wasm-bindgen = { version = "=0.2.128", optional = true }
34
34
  [target.'cfg(not(target_family = "wasm"))'.dependencies]
35
35
  # Keep the SDK and schema paired: both expose the same public ACP types.
36
36
  agent-client-protocol = { version = "=2.1.0", optional = true }
37
- tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "sync", "time"], optional = true }
37
+ tokio = { version = "1", features = ["io-std", "io-util", "macros", "net", "process", "rt", "rt-multi-thread", "sync", "time"], optional = true }
38
38
  futures = { version = "0.3", optional = true }
39
39
 
40
40
  [target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
package/source/LICENSE.md CHANGED
@@ -2,15 +2,20 @@
2
2
 
3
3
  Copyright 2026 Julian Y. Richard Corbet.
4
4
 
5
- The current ccht library is licensed under **LGPL-3.0-only**. The complete
5
+ The current ccht library is licensed under **LGPL-3.0-only WITH
6
+ LGPL-3.0-linking-exception**. The complete
6
7
  [LGPL version 3](LICENSES/LGPL-3.0-only.txt) incorporates
7
- [GPL version 3](LICENSES/GPL-3.0-only.txt).
8
+ [GPL version 3](LICENSES/GPL-3.0-only.txt); the
9
+ [linking exception](<LICENSES/LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt>) waives the
10
+ Minimal Corresponding Source, Minimal Application Code and
11
+ installation-information duties (LGPLv3 §§4d/4e) for combined works that
12
+ link statically or dynamically.
8
13
 
9
14
  Applications may use the library under different licenses subject to the LGPL's
10
- conditions. Distribution must preserve the library's notices and rights to modify
11
- and replace or relink it, including reverse engineering to debug such changes.
12
- The application license must not restrict those library rights. See section 4
13
- of the LGPL for the complete conditions for combined works.
15
+ conditions. Distribution must preserve the library's notices and the openness
16
+ of library modifications, including reverse engineering to debug such changes.
17
+ The application license must not restrict those library rights. No relinking
18
+ route or object files are required for combined works under the exception.
14
19
 
15
20
  Dependencies and external agent executables retain their own licenses and service
16
21
  terms. The library's license does not grant rights to an external runtime or
@@ -0,0 +1,16 @@
1
+ As a special exception to the GNU Lesser General Public License version 3
2
+ ("LGPL3"), the copyright holders of this Library give you permission to
3
+ convey to a third party a Combined Work that links statically or dynamically
4
+ to this Library without providing any Minimal Corresponding Source or
5
+ Minimal Application Code as set out in 4d or providing the installation
6
+ information set out in section 4e, provided that you comply with the other
7
+ provisions of LGPL3 and provided that you meet, for the Application the
8
+ terms and conditions of the license(s) which apply to the Application.
9
+
10
+ Except as stated in this special exception, the provisions of LGPL3 will
11
+ continue to comply in full to this Library. If you modify this Library, you
12
+ may apply this exception to your version of this Library, but you are not
13
+ obliged to do so. If you do not wish to do so, delete this exception
14
+ statement from your version. This exception does not (and cannot) modify any
15
+ license terms which apply to the Application, with which you must still
16
+ comply.
@@ -0,0 +1,16 @@
1
+ As a special exception to the GNU Lesser General Public License version 3
2
+ ("LGPL3"), the copyright holders of this Library give you permission to
3
+ convey to a third party a Combined Work that links statically or dynamically
4
+ to this Library without providing any Minimal Corresponding Source or
5
+ Minimal Application Code as set out in 4d or providing the installation
6
+ information set out in section 4e, provided that you comply with the other
7
+ provisions of LGPL3 and provided that you meet, for the Application the
8
+ terms and conditions of the license(s) which apply to the Application.
9
+
10
+ Except as stated in this special exception, the provisions of LGPL3 will
11
+ continue to comply in full to this Library. If you modify this Library, you
12
+ may apply this exception to your version of this Library, but you are not
13
+ obliged to do so. If you do not wish to do so, delete this exception
14
+ statement from your version. This exception does not (and cannot) modify any
15
+ license terms which apply to the Application, with which you must still
16
+ comply.
package/source/README.md CHANGED
@@ -12,13 +12,68 @@ TUI / native UI ── ccht::Conversation ── ccht::native ── upstream AC
12
12
  ```
13
13
 
14
14
  The library owns structured conversation events, ordered replay, native sessions,
15
- streaming, cancellation and permission requests. Your application owns its UI,
16
- instructions, context, tools, user authorization, storage and HTTP/WebSocket/SSE
17
- transport. No Corbet-specific prompts or database are required.
18
-
19
- Agent reasoning, tools, authentication and protocol translation remain upstream.
20
- ccht does not implement an agent loop, read provider credentials, install agents,
21
- call paid model HTTP APIs or select an API-key fallback.
15
+ streaming, cancellation, permission requests, native login MECHANISMS
16
+ (`native::env`, `native::drivers`), and generic web auth contracts/components
17
+ (`auth.ts`, `AccountConnection.svelte`). Your application owns product flows,
18
+ product UI, instructions, context, tools, user authorization, storage and
19
+ HTTP/WebSocket/SSE transport. No Corbet-specific prompts or database are required.
20
+
21
+ Agent reasoning, tools, and protocol translation remain upstream.
22
+ ccht does not implement an agent loop, persist or read back provider credentials,
23
+ install agents, call paid model HTTP APIs or select an API-key fallback. Login
24
+ drivers project vendor state only; storage, prompts, and authority stay in the app.
25
+
26
+ ## Layers
27
+
28
+ Core (everywhere, including Wasm): conversation model, `WireEvent` contract,
29
+ auth state/store shapes (`src/auth.rs`), and transport validation
30
+ (`src/transport.rs`). No I/O, spawning, or storage.
31
+
32
+ Native effects (optional `native` feature, never Wasm): ACP sessions
33
+ (`src/native/`), environment allowlist (`src/native/env.rs` with
34
+ `EnvProfile::strict` / `permissive`), and vendor login drivers
35
+ (`src/native/drivers/` with `LoginDriver`, `Challenge` + `validate()`,
36
+ `AccountInfo`, `DriverError` + `code()`, `LoginState`, `CodexDeviceDriver`,
37
+ `OpenCodeKeyDriver`). Drivers run handshakes only and report projection-only
38
+ state; the app owns storage via `CredentialsProvider`.
39
+
40
+ Web bindings + components (`web/`, see `web/README.md`): Wasm conversation
41
+ model plus `web/src/auth.ts` mirrors and
42
+ `web/src/components/AccountConnection.svelte` (Svelte 5, unstyled `ccht-`
43
+ classes, effects via app callbacks, never spawns agents).
44
+
45
+ Feature flags: `native` is the default feature (ACP sessions, env, drivers;
46
+ requires Tokio; native-only). `web` enables Wasm bindings. Use
47
+ `default-features = false` for the portable model alone.
48
+
49
+ Transport: one ACP-style JSON-RPC protocol over two validated endpoints
50
+ (`src/transport.rs`): `StdioTransport` (explicit native program + args, no
51
+ shell) today, and `SocketTransport` (`ws` / `wss` / `http` / `https` with a
52
+ host, shape-only check) for a later Wasm socket bridge. `TransportKind`
53
+ (`Stdio` / `Socket`), the `Transport` trait, and `TransportError` describe
54
+ and validate endpoints only; they never connect, spawn, or perform I/O, and
55
+ errors use fixed text so secrets cannot leak. The app owns actual delivery
56
+ and storage.
57
+
58
+ ## Acceptable use — single-operator local use only
59
+
60
+ ccht is for single-operator local use only. No pooling, sharing, resale, or
61
+ multi-tenant hosting of subscriptions. ccht grants no rights to external
62
+ runtimes or subscriptions; their own terms apply (see [THIRD-PARTY.md](THIRD-PARTY.md)).
63
+
64
+ - No credential persistence or read-back in the library. Drivers report
65
+ projection-only state (`AccountInfo`, `AuthState`); the app owns storage
66
+ via `CredentialsProvider`.
67
+ - The caller supplies binary paths, homes, and clientInfo; ccht never
68
+ hard-codes product strings.
69
+ - Respect upstream gates: device-code settings, forced methods, and usage limits.
70
+ - OpenCode use is one operator key to one loopback `opencode serve`; the
71
+ server password is ephemeral and env-only. Use the API-key path for
72
+ CI/programmatic use.
73
+
74
+ Module details: `src/native/drivers/mod.rs`, `src/native/drivers/codex.rs`,
75
+ `src/native/drivers/opencode.rs`, `src/native/env.rs`, `src/transport.rs`,
76
+ `web/src/auth.ts`, `web/README.md`.
22
77
 
23
78
  ## Rust
24
79
 
@@ -219,12 +274,12 @@ its advertised capabilities, login state and execution policy.
219
274
 
220
275
  ## License
221
276
 
222
- ccht is **LGPL-3.0-only**. See [LICENSE.md](LICENSE.md) and
277
+ ccht is **LGPL-3.0-only WITH LGPL-3.0-linking-exception**. See [LICENSE.md](LICENSE.md) and
223
278
  [THIRD-PARTY.md](THIRD-PARTY.md). Applications may use different licenses while
224
- preserving the LGPL library rights. Distributing a combined Rust binary requires
225
- a compliant relinking route; making source available somewhere is not by itself
226
- sufficient. Keep the browser's Wasm replaceable and provide its corresponding
227
- source and notices. Review the complete license for your distribution method.
279
+ preserving the LGPL library rights. Combined works may link statically or
280
+ dynamically without a relinking route; library modifications stay LGPL.
281
+ Provide the library's corresponding source and notices. Review the complete
282
+ license for your distribution method.
228
283
 
229
284
  ACP and an account's subscription do not guarantee a billing mode. The operator
230
285
  must configure the native agent/account and disable unwanted paid usage. Known
@@ -21,8 +21,25 @@ comply with their runtime and service conditions when packaging them yourself.
21
21
  Do not infer permission to offer a customer-facing subscription login or pooled
22
22
  account service from the wrapper's permissive license.
23
23
 
24
+ Permissive references informing the native login drivers (no vendored code;
25
+ hand-rolled protocol shapes with attribution in the module docs):
26
+
27
+ - Codex app-server protocol (`account/login/start` device-code challenge,
28
+ `account/login/completed`, `account/read`) from openai/codex under
29
+ Apache-2.0 informs `src/native/drivers/codex.rs` (`CodexDeviceDriver`).
30
+ The driver spawns the caller's Codex `app-server`, relays the
31
+ host-allowlisted challenge, and projects presence only.
32
+ - OpenCode `serve` control plane (`GET /global/health`,
33
+ `PUT /auth/opencode-go`, `GET /provider`) under MIT informs
34
+ `src/native/drivers/opencode.rs` (`OpenCodeKeyDriver`). The driver uses
35
+ loopback `opencode serve` with an ephemeral port, an env-only server
36
+ password, and hand-rolled HTTP with no new dependencies.
37
+
38
+ Preserve their original grants and notices when reusing these shapes.
39
+
24
40
  Upstream sources: [ACP SDK](https://github.com/agentclientprotocol/rust-sdk),
25
41
  [Codex ACP](https://github.com/agentclientprotocol/codex-acp),
42
+ [openai/codex](https://github.com/openai/codex),
26
43
  [Claude ACP](https://github.com/agentclientprotocol/claude-agent-acp),
27
44
  [OpenCode](https://github.com/anomalyco/opencode),
28
45
  [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen).
Binary file