@mirrowel/opencode-openshare 0.2.0-dev.1 → 0.2.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.
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
- | `ci/openshare.js` | single-file, zero-dependency bundle of the same engine (committed; rebuilt 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`) | all-mode **by default** — it declares no TUI entry, but an explicit `shareMode` in config/env still wins |
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
@@ -89,11 +89,14 @@ stays all-mode.
89
89
 
90
90
  ## TUI
91
91
 
92
- - `/share` — share the session (one-time consent; copies the URL). On a
93
- child session, shares the whole family. Already shared → the share
94
- manager: copy links (per server), per-server stop / leave-as-snapshot,
95
- share to another server, stop all. A credential conflict opens the
96
- collision dialog (copy debug info / share on a new share / don't share).
92
+ - `/share` — share the session (explicit consent on EVERY creation —
93
+ nothing is published silently; then the URL is copied). On a child
94
+ session, shares the whole family. Already shared → the session menu,
95
+ identical to `/openshare → This session`: copy links (per server, or
96
+ all), stop sharing — delete or leave a snapshot, per-server stop on
97
+ multi-server shares —, share to another server, session TTL and read
98
+ auth. A credential conflict opens the collision dialog (copy debug
99
+ info / share on a new share / don't share).
97
100
  - `/openshare` — grouped settings (compact root with live summaries →
98
101
  focused submenus): This session (share/stop — delete or leave a
99
102
  snapshot —, TTL override, session read auth), **Servers** (connection
@@ -105,11 +108,12 @@ stays all-mode.
105
108
  preview), Advanced, Config files. Danger rows red, dirty rows green,
106
109
  `[i]` panes paged (`## sections`, 1-9 jump), messages wrap in real
107
110
  bodies (no clipped one-liners).
108
- - Sidebar chip — share status next to the session title (`·N` when the
109
- session streams to several servers); click copies the link. A share
110
- whose page died server-side renders `⊘ gone` — clicking opens the share
111
- manager, which verifies every bound server, auto-clears dead entries
112
- and offers Share again (see Gone detection in the root README).
111
+ - Sidebar chip (v1 hosts — the v2 TUI context has no slot registry yet) —
112
+ share status next to the session title (`·N` when the session streams
113
+ to several servers); click copies the link. A share whose page died
114
+ server-side renders `⊘ gone` — clicking opens the share manager, which
115
+ verifies every bound server, auto-clears dead entries and offers
116
+ Share again (see Gone detection in the root README).
113
117
  - Every menu row carries an `[i]` detail pane (what it does, current
114
118
  value + source, full URLs/ids); Interface rows set menu width/height
115
119
  (host preference store).
@@ -126,44 +130,39 @@ npm run test:quick # everyday gate (~90s): parity + manual core + TUI + v2 +
126
130
 
127
131
  Suites (shared machinery in `scripts/suite-lib.mjs`; every run is
128
132
  watchdogged, port-swept, and drives real `opencode serve` instances with
129
- a mock OpenAI-compatible provider — except where noted):
133
+ a mock OpenAI-compatible provider — except where noted). The canonical
134
+ suite table — what each covers, including the big/backends scale suites —
135
+ lives in [`../DEVELOPMENT.md`](../DEVELOPMENT.md#test-suites); the
136
+ commands:
130
137
 
131
138
  - `test:regression` — parity of legacy / single-file / package across the
132
- full lifecycle (create → prompt → completed → delete → 404).
133
- - `test:manual` — dormancy, flag activation + backfill, restart attach,
134
- unshare, re-share, per-session auth opts, all-override, pre-existing
135
- gates, undo tombstones, completed debounce, turn-mode drops.
136
- - `test:tui-flow` — share/unshare flows, config round-trip, connect
137
- flow (enroll + persist + rotate), admin console round-trip.
138
- - `test:v2` — the v2 adapter against a **scripted mock v2 host** (event
139
- classification, message conversion, live re-sync, delete).
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).
143
- - `test:enroll` — the plugin's enrollment lifecycle end to end (code
144
- enroll, token persistence across processes, revoke → re-enroll,
145
- blocked path, public zero-config).
146
- - `test:fanout` — multi-server: v2 bindings, content parity across
147
- servers, mid-session join with full-history backfill, per-session
148
- opt-outs.
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.
153
- - `test:server-auth` / `test:server-enroll` — the SAME auth/enroll
154
- suites against the portable Bun backend (`../share-server`): the
155
- two-backends-one-protocol parity guarantee.
139
+ full lifecycle.
140
+ - `test:manual` — the engine scenarios (dormancy, backfill, tombstones,
141
+ timers, turn sockets, all-mode gating).
142
+ - `test:tui-flow` — share/manager flows, config write targets, enrollment,
143
+ admin console, gone detection.
144
+ - `test:v2` — the v2 adapter against a scripted mock v2 host.
145
+ - `test:auth` / `test:server-auth` — the identity contract (52 checks)
146
+ against the Cloudflare worker and the Bun backend.
147
+ - `test:enroll` / `test:server-enroll`, `test:fanout`, `test:big` /
148
+ `test:server-big` — enrollment lifecycle, multi-server fan-out,
149
+ big-session scale (both backends).
150
+ - `test:cli`, `node scripts/npm-e2e.mjs` — real `opencode run` / the
151
+ published npm package — on demand only.
156
152
 
157
153
  Layout:
158
154
 
159
155
  ```
160
156
  src/
161
157
  config.ts config load/save (servers group, field-level merge), shareMode, tui.json scan
158
+ contract.ts the OpenShare item contract (v: 2 envelope, message/diff
159
+ normalization, tombstone shape) — shared truth for plugin,
160
+ worker, Bun server, and viewer
162
161
  core.ts the engine: fan-out remotes (socket/spool/rev per server),
163
162
  ws handshake, chunked syncs, backfill, collisions, opt-outs
164
163
  server.ts v1 entry {id, server, setup}
165
164
  tui.tsx v1 TUI entry + host facade
166
- commands.ts /share (toggle + fan-out manager + collision dialog) /openshare
165
+ commands.ts /share (consent gate → session menu — the SAME menu as /openshare → This session — plus collision + gone dialogs) /openshare
167
166
  share-flow.ts host-agnostic flows: flag, bindings v1/v2, enrollment,
168
167
  rotate/disconnect, admin client, unshare multi-delete
169
168
  settings.ts grouped settings tree + servers section + admin console
package/ci/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Open(code)Share — CI bundle (`openshare.js`)
2
2
 
3
- The single-file, zero-dependency build of the plugin. **Always shares all
4
- sessions** — this is the headless/CI artifact, behavior-identical to the
5
- package server (`../dist/server.js`), proven by `npm run test:regression`.
3
+ The single-file, zero-dependency build of the plugin. **All-mode by
4
+ default** — it declares no TUI entry, so presence detection always
5
+ resolves "all" on a CI runner (an explicit `shareMode` in config/env
6
+ still wins). Behavior-identical to the package server
7
+ (`../dist/server.js`), proven by `npm run test:regression`.
8
+
9
+ If your runner executes the bundle under plain Node (outside
10
+ opencode's runtime), use Node 22+ — the engine relies on the
11
+ `WebSocket`/`fetch` globals.
6
12
 
7
13
  This folder is deliberately separate from the package root so that loading
8
14
  the plugin by directory (`plugin: ["file:///…/share-plugin"]`) can only