@mirrowel/opencode-openshare 0.1.0 → 0.2.0-dev.1
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.
- package/README.md +36 -30
- package/ci/openshare.config.json +7 -2
- package/ci/openshare.js +625 -197
- package/dist/config.d.ts +5 -1
- package/dist/config.js +9 -2
- package/dist/contract.d.ts +156 -0
- package/dist/contract.js +263 -0
- package/dist/core.js +411 -55
- package/dist/dialogs.js +38 -0
- package/dist/share-flow.js +2 -2
- package/dist/sidebar.d.ts +3 -1
- package/dist/sidebar.js +3 -17
- package/dist/tui.js +73 -121
- package/dist/v2-server.d.ts +0 -27
- package/dist/v2-server.js +6 -121
- package/openshare.config.json +1 -1
- package/package.json +4 -2
- package/src/banner.txt +7 -4
- package/src/config.ts +8 -2
- package/src/contract.ts +320 -0
- package/src/core.ts +403 -56
- package/src/dialogs.tsx +34 -0
- package/src/share-flow.ts +2 -2
- package/src/sidebar.tsx +4 -21
- package/src/tui.tsx +1 -1
- package/src/v2-server.ts +7 -110
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ OpenCode v1 and v2, self-hosted on your own worker.
|
|
|
9
9
|
|---|---|---|
|
|
10
10
|
| `dist/server.js` | package server entry (opencode.json `plugin` array) | all, unless the TUI is registered |
|
|
11
11
|
| `dist/tui.js` | package TUI entry (tui.json `plugin` array) | its presence flips the server to manual |
|
|
12
|
-
| `openshare.js` | single-file, zero-dependency bundle of the same engine (
|
|
12
|
+
| `ci/openshare.js` | single-file, zero-dependency bundle of the same engine (committed; rebuilt by `npm run build`) | always all — the CI bundle |
|
|
13
13
|
|
|
14
14
|
All three are behavior-identical where they overlap — `npm run
|
|
15
15
|
test:regression` proves the single file and the package match the frozen
|
|
@@ -17,36 +17,29 @@ original (`reference/openshare.legacy.js`) on the full share lifecycle.
|
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
From the registry (published). **v1 hosts** — the bare package name in
|
|
21
|
+
BOTH config files (no `/tui` suffix; opencode resolves the entrypoints
|
|
22
|
+
itself):
|
|
21
23
|
|
|
22
24
|
```jsonc
|
|
23
25
|
// opencode.json
|
|
24
26
|
{ "plugin": ["@mirrowel/opencode-openshare"] }
|
|
25
27
|
// tui.json (global ~/.config/opencode/tui.json or project)
|
|
26
|
-
{ "plugin": ["@mirrowel/opencode-openshare
|
|
28
|
+
{ "plugin": ["@mirrowel/opencode-openshare"] }
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
**v2 hosts** — the CLI writes the config for you:
|
|
30
32
|
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
"plugin": ["/path/to/openshare.js"]
|
|
35
|
-
// + openshare.config.json next to the bundle (servers group or the
|
|
36
|
-
// legacy env pair), OPENSHARE_URL_FILE collects each share URL
|
|
37
|
-
// (also printed to stderr)
|
|
38
|
-
}
|
|
33
|
+
```sh
|
|
34
|
+
opencode plugin add @mirrowel/opencode-openshare
|
|
39
35
|
```
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
[main README](../README.md#configuration) for all keys):
|
|
37
|
+
Restart opencode; `/share` and `/openshare` appear in the TUI.
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Or the multi-server form (canonical; `workerUrl`/`createToken` above is
|
|
49
|
-
the single-server shorthand):
|
|
39
|
+
Then configure. For an npm install the durable config file is the
|
|
40
|
+
**settings home** (`~/.config/opencode/openshare.config.json` — also
|
|
41
|
+
what `/openshare` writes); "next to the package" only applies to file
|
|
42
|
+
installs (the CI bundle):
|
|
50
43
|
|
|
51
44
|
```jsonc
|
|
52
45
|
{
|
|
@@ -57,6 +50,15 @@ the single-server shorthand):
|
|
|
57
50
|
}
|
|
58
51
|
```
|
|
59
52
|
|
|
53
|
+
`workerUrl`/`createToken` is the legacy single-server shorthand for the
|
|
54
|
+
same thing — the `servers` form above is canonical.
|
|
55
|
+
|
|
56
|
+
From a local checkout (developing / tracking main): use the directory
|
|
57
|
+
spec `"file:///…/openshare/share-plugin"` in both config files (run
|
|
58
|
+
`npm run build` first — `dist/` is not committed). The CI bundle needs
|
|
59
|
+
no build at all: [`ci/openshare.js`](ci/README.md), committed ready to
|
|
60
|
+
use.
|
|
61
|
+
|
|
60
62
|
**With no token the plugin enrolls itself** on first contact: public
|
|
61
63
|
servers (hoster set `AUTH_MODE=public`) take anyone; private ones need
|
|
62
64
|
a `code` from the hoster (activation-budgeted invite). The enrolled
|
|
@@ -116,16 +118,15 @@ stays all-mode.
|
|
|
116
118
|
|
|
117
119
|
```bash
|
|
118
120
|
npm install
|
|
119
|
-
npm run build # tsc -> dist/ + bun bundle -> openshare.js
|
|
121
|
+
npm run build # tsc -> dist/ + bun bundle -> ci/openshare.js (Bun on PATH)
|
|
120
122
|
npm run typecheck
|
|
121
123
|
npm run test # full matrix via the parallel driver (~4.5 min)
|
|
122
124
|
npm run test:quick # everyday gate (~90s): parity + manual core + TUI + v2 + auth
|
|
123
125
|
```
|
|
124
126
|
|
|
125
127
|
Suites (shared machinery in `scripts/suite-lib.mjs`; every run is
|
|
126
|
-
watchdogged, port-swept, and drives
|
|
127
|
-
|
|
128
|
-
provider):
|
|
128
|
+
watchdogged, port-swept, and drives real `opencode serve` instances with
|
|
129
|
+
a mock OpenAI-compatible provider — except where noted):
|
|
129
130
|
|
|
130
131
|
- `test:regression` — parity of legacy / single-file / package across the
|
|
131
132
|
full lifecycle (create → prompt → completed → delete → 404).
|
|
@@ -134,18 +135,21 @@ provider):
|
|
|
134
135
|
gates, undo tombstones, completed debounce, turn-mode drops.
|
|
135
136
|
- `test:tui-flow` — share/unshare flows, config round-trip, connect
|
|
136
137
|
flow (enroll + persist + rotate), admin console round-trip.
|
|
137
|
-
- `test:v2` — the v2 adapter against a scripted mock v2 host (event
|
|
138
|
+
- `test:v2` — the v2 adapter against a **scripted mock v2 host** (event
|
|
138
139
|
classification, message conversion, live re-sync, delete).
|
|
139
|
-
- `test:auth` — server identity contract
|
|
140
|
-
|
|
140
|
+
- `test:auth` — the **server identity contract** exercised over HTTP/WS
|
|
141
|
+
(no opencode instance): enrollment, code burn, rotate, freeze (secret
|
|
142
|
+
dead too), limits, reassign, public mode (48 checks).
|
|
141
143
|
- `test:enroll` — the plugin's enrollment lifecycle end to end (code
|
|
142
144
|
enroll, token persistence across processes, revoke → re-enroll,
|
|
143
145
|
blocked path, public zero-config).
|
|
144
146
|
- `test:fanout` — multi-server: v2 bindings, content parity across
|
|
145
147
|
servers, mid-session join with full-history backfill, per-session
|
|
146
148
|
opt-outs.
|
|
147
|
-
- `test:cli` — real `opencode run` end
|
|
148
|
-
silenced outputs
|
|
149
|
+
- `test:cli` — real `opencode run` end to end (single file + package +
|
|
150
|
+
silenced outputs; mock provider, sandboxed XDG homes) — on demand.
|
|
151
|
+
- `node scripts/npm-e2e.mjs` — the **published** npm package installed
|
|
152
|
+
by registry spec, end to end — on demand.
|
|
149
153
|
- `test:server-auth` / `test:server-enroll` — the SAME auth/enroll
|
|
150
154
|
suites against the portable Bun backend (`../share-server`): the
|
|
151
155
|
two-backends-one-protocol parity guarantee.
|
|
@@ -162,7 +166,9 @@ src/
|
|
|
162
166
|
commands.ts /share (toggle + fan-out manager + collision dialog) /openshare
|
|
163
167
|
share-flow.ts host-agnostic flows: flag, bindings v1/v2, enrollment,
|
|
164
168
|
rotate/disconnect, admin client, unshare multi-delete
|
|
165
|
-
settings.ts settings
|
|
169
|
+
settings.ts grouped settings tree + servers section + admin console
|
|
170
|
+
dialogs.tsx MenuDialog/InfoDialog/PromptDialog + the sizing core (75% budget)
|
|
171
|
+
ui-prefs.ts menu size prefs (host kv store)
|
|
166
172
|
sidebar.tsx sidebar_title slot chip (v1, box-rooted)
|
|
167
173
|
tui-host.ts host facade interface
|
|
168
174
|
v2-server.ts v2 setup: event mapping + client adapter + v2->v1 conversion
|
package/ci/openshare.config.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "Open(code)Share CI bundle config. This file sits NEXT TO openshare.js and is read at load; OPENSHARE_* env vars always win (the CI way). The single-file bundle ALWAYS shares all sessions.",
|
|
2
|
+
"$comment": "Open(code)Share CI bundle config. This file sits NEXT TO openshare.js and is read at load; OPENSHARE_* env vars always win (the CI way). The single-file bundle ALWAYS shares all sessions. Prefer the servers form below (workerUrl/createToken is the legacy single-server shorthand). Empty string means unset. urlFile/announceStderr control the two URL outputs; 'none' disables the file.",
|
|
3
|
+
"servers": {
|
|
4
|
+
"https://your-worker.workers.dev": { "token": "" }
|
|
5
|
+
},
|
|
3
6
|
"workerUrl": "",
|
|
4
|
-
"createToken": ""
|
|
7
|
+
"createToken": "",
|
|
8
|
+
"urlFile": "",
|
|
9
|
+
"announceStderr": true
|
|
5
10
|
}
|