You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ graph LR
42
42
E2E --> Core
43
43
```
44
44
45
-
`packages/opencode/package.json:32-45` declares two `oc-plugin` entry points: `server` (the fetch interceptor / OAuth / quota controller) and `tui` (the OpenTUI sidebar) — the host loads them as separate plugin registrations. The Pi package's `pi.extensions` field (`packages/pi/package.json:34-38`) is the analogue. The core package has no peer dependencies on any host runtime; it only depends on Node built-ins and `@openauthjs/openauth`.
45
+
`packages/opencode/package.json` exposes two `exports` subpaths that the host installer reads: `exports["."]` (the fetch interceptor / OAuth / quota controller) and `exports["./tui"]` (the OpenTUI sidebar). The host's `opencode plugin` installer writes a server entry to `opencode.json` and a TUI entry to `tui.json`; the host loads the two registrations independently. The Pi package's `pi.extensions` field (`packages/pi/package.json:34-38`) is the analogue. The core package has no peer dependencies on any host runtime; it only depends on Node built-ins and `@openauthjs/openauth`.
46
46
47
47
### Process topology at runtime
48
48
@@ -206,7 +206,7 @@ The `RetryState` at `packages/opencode/src/plugin/fetch/retry-state.ts` and `War
206
206
207
207
### Two halves of the contract
208
208
209
-
The OpenTUI plugin is declared in `packages/opencode/package.json:32-45` as `"oc-plugin": ["server", "tui"]`. The host loads the TUI entry point separately; the entry dispatches to either the precompiled Solid bundle or the raw `tui.tsx` based on the host runtime module's availability (`packages/opencode/src/tui/entry.mjs:30-66`).
209
+
The OpenTUI plugin is wired through the package's `exports["./tui"]` subpath (`packages/opencode/package.json`). The host's `opencode plugin` installer reads that subpath and writes the registration into `tui.json`; the host loads the TUI entry point separately from the server entry, and the entry dispatches to either the precompiled Solid bundle or the raw `tui.tsx` based on the host runtime module's availability (`packages/opencode/src/tui/entry.mjs:30-66`).
210
210
211
211
The two halves share a small amount of code through `packages/opencode/src/tui-compiled/` (the precompiled mirror) and the slim contract modules:
| OpenCode (server + TUI) |`2.0.0`|`@opencode-ai/plugin >=1.17.13 <2` · `@opentui/core`, `@opentui/keymap`, `@opentui/solid` all `^0.4.5`|`opencode plugin @cortexkit/opencode-antigravity-auth@latest` (writes the server entry to `opencode.json` and the TUI entry to `tui.json`) |
26
26
| Pi coding agent |`2.0.0`|`@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui` (peer) |`pi install npm:@cortexkit/pi-antigravity-auth` then `/login google-antigravity`|
27
27
| Standalone CLI | shipped inside the OpenCode package as the `antigravity-auth` bin | Node 20+ |`npx @cortexkit/opencode-antigravity-auth`|
The OpenCode package's `oc-plugin` field publishes two subpaths:
30
+
The OpenCode package exposes two `exports` subpaths the host installer reads:
31
31
32
-
-`oc-plugin: "server"` — the default `@opencode-ai/plugin` entry; OpenCode loads it via the`plugin` array.
33
-
-`oc-plugin: "tui"` — exports the TUI sidebar through the `"./tui"` subpath. OpenCode 1.17.13+ resolves this automatically; legacy hosts declare it explicitly through the package's `oc-plugin` declaration in `package.json` (`["server","tui"]`). The precompiled JSX tree ships under `dist/src/tui-compiled/` and is regenerated by `bun run build:tui`; the host's loader also accepts the raw `src/tui.tsx` source path for development installs.
32
+
-`exports["."]` — the bundled `dist/index.js` server root; `opencode plugin` writes this entry into `opencode.json`'s`plugin` array.
33
+
-`exports["./tui"]` — `src/tui/entry.mjs`, the OpenTUI sidebar loader; `opencode plugin` writes this entry into `tui.json` so the TUI process picks it up on the next host start. The precompiled JSX tree ships under `dist/src/tui-compiled/` and is regenerated by `bun run build:tui`; the host's loader also accepts the raw `src/tui.tsx` source path for development installs.
34
34
35
-
Both core and opencode packages are dual-target: the OpenCode package bundles a CommonJS-free ESM artifact via `esbuild`, while the core package ships `tsc`-emitted ESM. Runtime requirements match the `engines.node` field (`>=20`).
35
+
The host enforces the minimum OpenCode version through the package's `engines.opencode` field (`>=1.17.13 <2`); `opencode plugin` refuses to install a plugin that asks for an unsupported range. Both core and opencode packages are dual-target: the OpenCode package bundles a CommonJS-free ESM artifact via `esbuild`, while the core package ships `tsc`-emitted ESM. Runtime requirements match the `engines.node` field (`>=20`).
36
36
37
37
## Installation matrix
38
38
39
39
### OpenCode (npm — the only end-user install path)
40
40
41
-
Edit `~/.config/opencode/opencode.json` (or the path `OPENCODE_CONFIG_DIR` points at):
41
+
The supported installer writes both registrations in one step:
- Reads the package's `exports["."]` (the server root) and writes it into `~/.config/opencode/opencode.json` under the `plugin` array — that is the `auth.loader` and `fetch` interceptor the host calls on every model dispatch.
50
+
- Reads the package's `exports["./tui"]` (the OpenTUI sidebar loader) and writes it into `~/.config/opencode/tui.json` so the TUI process picks the sidebar up on the next host start.
51
+
- Refuses to install when the host's OpenCode version falls outside the package's `engines.opencode` range (`>=1.17.13 <2`).
52
+
53
+
#### Manual config (hand-edited configs)
54
+
55
+
If you cannot use `opencode plugin`, write both files by hand. The server entry lives in `opencode.json`:
The plugin field is the **server** subpath. The TUI sidebar is loaded automatically through the `oc-plugin` declaration in the npm package; no extra config is required on a 1.17.13+ host. On older hosts, explicitly add the `./tui` exports subpath through the host plugin loader.
64
+
The TUI entry lives in a separate `tui.json` file under the same config dir:
The two files are independent — the host reads the server registration from `opencode.json` and the TUI registration from `tui.json`. Dropping one side disables that half of the plugin without touching the other.
Copy file name to clipboardExpand all lines: STRUCTURE.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ Every production file has a corresponding `*.test.ts` sibling. The dense transfo
99
99
100
100
## `packages/opencode` inventory
101
101
102
-
`@cortexkit/opencode-antigravity-auth`. Has two `oc-plugin` entry points (`server`, `tui`) declared in `package.json:32-45`. Production layout:
102
+
`@cortexkit/opencode-antigravity-auth`. Exposes two `exports` subpaths (`"."` and `"./tui"`) and pins the supported host range through `engines.opencode` (`>=1.17.13 <2`); the host installer (`opencode plugin`) reads the subpaths and writes a server entry to `opencode.json` and a TUI entry to `tui.json`. Production layout:
103
103
104
104
```
105
105
packages/opencode/
@@ -343,7 +343,7 @@ Project-wide tsconfig used by `bun run typecheck` (root script `typecheck`) for
343
343
|`@cortexkit/opencode-antigravity-auth` (`server` — fallback) |`packages/opencode/src/plugin-entry.test.ts`| test entry | Verifies the public barrel exports the two stable plugin names. |
344
344
|`@cortexkit/pi-antigravity-auth`|`packages/pi/src/index.ts`|`default function`| Pi extension. Resolves as `pi.extensions: ['./dist/index.js']` per `packages/pi/package.json:34-38`. |
345
345
346
-
The `oc-plugin` manifest at `packages/opencode/package.json:32-45` declares the `server`and `tui`entry points and the `exports` map declares both `.` (the bundled server root) and `./tui` (the loader). The host resolves them as separate plugin registrations.
346
+
The `exports` map at `packages/opencode/package.json` declares both `.` (the bundled server root) and `./tui`(the OpenTUI loader). The host's `opencode plugin` installer reads the subpaths and writes a server entry to `opencode.json` plus a TUI entry to `tui.json`; the host then resolves them as two independent plugin registrations.
Copy file name to clipboardExpand all lines: packages/opencode/README.md
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,28 +32,49 @@ This package is part of the `@cortexkit/antigravity-auth@2.0.0` monorepo. See th
32
32
|`@opentui/core`, `@opentui/keymap`, `@opentui/solid` (peer) |`^0.4.5` each |
33
33
| Node |`>=20`|
34
34
35
-
The package declares both `oc-plugin` subpaths in its `package.json`:
35
+
The package pins the supported host range through `engines.opencode` (`>=1.17.13 <2`); `opencode plugin` refuses to install a plugin that asks for an unsupported range.
36
36
37
-
```jsonc
38
-
{
39
-
"oc-plugin": ["server", "tui"]
40
-
}
41
-
```
37
+
The package exposes two `exports` subpaths the host installer reads:
42
38
43
-
OpenCode 1.17.13+ resolves the **server** subpath through the `plugin` array and the **tui** subpath through `oc-plugin` automatically. Legacy hosts can declare the `./tui` exports subpath explicitly through their own plugin loader.
39
+
-`exports["."]` — the bundled `dist/index.js` server root. `opencode plugin` writes this entry into `opencode.json`'s `plugin` array.
40
+
-`exports["./tui"]` — `src/tui/entry.mjs`, the OpenTUI sidebar loader. `opencode plugin` writes this entry into `tui.json` so the TUI process picks it up on the next host start.
44
41
45
42
## Installation
46
43
47
44
### End-user (npm) — the supported path
48
45
49
-
Add to `~/.config/opencode/opencode.json`:
46
+
The supported installer writes both registrations in one step:
- Reads the package's `exports["."]` and writes it into `~/.config/opencode/opencode.json` under the `plugin` array — the `auth.loader` and `fetch` interceptor the host calls on every model dispatch.
55
+
- Reads the package's `exports["./tui"]` and writes it into `~/.config/opencode/tui.json` so the TUI process picks the sidebar up on the next host start.
56
+
- Refuses to install when the host's OpenCode version falls outside the package's `engines.opencode` range.
57
+
58
+
#### Manual config (hand-edited configs)
59
+
60
+
If you cannot use `opencode plugin`, write both files by hand:
The two files are independent — the server registration is read from `opencode.json` and the TUI registration from `tui.json`.
77
+
57
78
Then start OpenCode and run `opencode auth login`, pick **Antigravity (Google OAuth)** in the menu (or `/antigravity-account add`). Verify with `npx -y @cortexkit/opencode-antigravity-auth quota`.
58
79
59
80
### Contributor (Bun)
@@ -80,7 +101,7 @@ A precompiled JSX tree ships under `dist/src/tui-compiled/` and is regenerated b
-**`@opencode-ai/plugin` peer dependency** moved from `^0.15.30` to `^1.17.13`. Hosts on 1.17.13+ get the automatic `oc-plugin: tui` discovery for free.
104
+
-**`@opencode-ai/plugin` peer dependency** moved from `^0.15.30` to `^1.17.13`. Hosts on 1.17.13+ get the TUI registration through `opencode plugin` (the host reads `exports["./tui"]` and writes it into `tui.json`).
84
105
-**New peer dependencies** (`@opentui/core`, `@opentui/keymap`, `@opentui/solid` at `^0.4.5`) — required by the sidebar.
85
106
- No account-storage changes: the on-disk format is unchanged from the v1.4+ storage schema (`AccountStorageV4`).
86
107
- Missing accounts now return **HTTP 401 `UNAUTHENTICATED`** from the fetch interceptor instead of a synthetic 200 with assistant text.
0 commit comments