@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 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 (built by `npm run build`) | always all — the CI bundle |
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
- Interactive (manual sharing, `/share` command, sidebar chip):
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/tui"] }
28
+ { "plugin": ["@mirrowel/opencode-openshare"] }
27
29
  ```
28
30
 
29
- CI (share everything, link to a file):
31
+ **v2 hosts** — the CLI writes the config for you:
30
32
 
31
- ```jsonc
32
- // OPENCODE_CONFIG one-file setup
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
- Then configure (`openshare.config.json` next to the package — see the
42
- [main README](../README.md#configuration) for all keys):
37
+ Restart opencode; `/share` and `/openshare` appear in the TUI.
43
38
 
44
- ```jsonc
45
- { "workerUrl": "https://your-worker.workers.dev", "createToken": "…" }
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 the real production path — local
127
- `wrangler dev` worker + real `opencode serve` with a mock OpenAI-compatible
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: enrollment, code burn, rotate,
140
- freeze (secret dead too), limits, reassign, public mode (48 checks).
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-to-end (single file + package +
148
- silenced outputs), on-demand only (uses the default model).
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 dialog + servers section + admin console
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
@@ -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
  }