opencode-courier 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +66 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -143,7 +143,25 @@ conflict.
143
143
 
144
144
  ## Install
145
145
 
146
- Requires OpenCode V2 (`npm install -g @opencode-ai/cli@beta`, command `opencode2`).
146
+ Requires OpenCode V2, command `opencode2`. Its plugin API is still beta, and each release is built
147
+ and tested against one version of it: the `@opencode-ai/plugin` peer dependency in `package.json`.
148
+ The CLI of that version is the one known to work:
149
+
150
+ ```bash
151
+ npm install -g @opencode-ai/cli@0.0.0-beta-19271
152
+ ```
153
+
154
+ Then install the plugin:
155
+
156
+ ```bash
157
+ opencode2 plugin add opencode-courier
158
+ ```
159
+
160
+ This installs the package from npm and adds `"opencode-courier"` to `plugins` in the global
161
+ configuration (`~/.config/opencode/opencode.json`). To receive webhooks, replace that entry with the
162
+ object form shown below, which carries a `webhook` option.
163
+
164
+ ### From a local clone
147
165
 
148
166
  ```bash
149
167
  git clone <this repo> && cd opencode-courier
@@ -159,11 +177,6 @@ Then list it in `opencode.json` (V2 uses `plugins`, plural). A local plugin path
159
177
  }
160
178
  ```
161
179
 
162
- To receive webhooks, give the plugin a `webhook` option instead (see below).
163
-
164
- Once published to npm, `opencode2 plugin add opencode-courier` installs it and adds it to the
165
- global configuration.
166
-
167
180
  ## Receiving webhooks
168
181
 
169
182
  The receiver is off unless the plugin has a `webhook` option. Put it in the **global** config
@@ -173,16 +186,16 @@ The receiver is off unless the plugin has a `webhook` option. Put it in the **gl
173
186
  {
174
187
  "plugins": [
175
188
  {
176
- "package": "/absolute/path/to/opencode-courier/dist",
189
+ "package": "opencode-courier",
177
190
  "options": { "webhook": { "port": 4097, "secretFile": "~/.config/opencode/courier-webhook-secret" } }
178
191
  }
179
192
  ]
180
193
  }
181
194
  ```
182
195
 
183
- `"webhook": true` takes every default. If the option is given more than once, for example in a
184
- project's config as well, the first location to load wins, and the others log that their settings
185
- are ignored.
196
+ From a local clone, `package` is the path to its `dist` directory instead. `"webhook": true`
197
+ takes every default. If the option is given more than once, for example in a project's config as
198
+ well, the first location to load wins, and the others log that their settings are ignored.
186
199
 
187
200
  | Option | Default | |
188
201
  |---|---|---|
@@ -230,7 +243,6 @@ lists them under Recent Deliveries with a Redeliver button.
230
243
  Tracked as [issues](https://github.com/ivopogace/opencode-courier/issues):
231
244
 
232
245
  - [#5](https://github.com/ivopogace/opencode-courier/issues/5) **Smoke test with a real model.**
233
- - [#6](https://github.com/ivopogace/opencode-courier/issues/6) **Publish to npm.**
234
246
 
235
247
  ## Development
236
248
 
@@ -252,27 +264,61 @@ that a cancelled one never arrives, that a pending one is delivered after a serv
252
264
  a recorded GitHub review delivery (`e2e/fixtures/pull_request_review.json`), signed, wakes an idle
253
265
  session subscribed with `courier_subscribe`, once, while unsigned and wrongly signed ones are
254
266
  refused, and that `courier_cleanup` removes an isolated child's clean worktree but keeps one with an
255
- uncommitted file until asked with `force`. It takes about two minutes and needs node, bun, git,
256
- curl, jq and openssl.
267
+ uncommitted file until asked with `force`. Last, it packs the package with `npm pack`, serves the
268
+ tarball from a stand-in registry (`e2e/registry.mjs`), installs it with `opencode2 plugin add
269
+ opencode-courier` and checks that its tools load from the installed copy. It takes about two
270
+ minutes and needs node, npm, bun, git, curl, jq and openssl.
257
271
 
258
272
  CI (`.github/workflows/ci.yml`) runs both on every push to `main` and every pull request, with the
259
273
  OpenCode CLI at the same version as the pinned plugin API.
260
274
 
261
275
  ### Releasing
262
276
 
263
- `.github/workflows/release.yml` publishes to npm on a `v*` tag. It runs the CI workflow first,
264
- checks that the tag matches the `version` in `package.json`, builds, publishes from the `npm`
265
- environment with provenance, and then creates a GitHub release with generated notes. A
266
- prerelease version (`1.2.0-beta.1`) goes to the `next` dist-tag and is marked as a prerelease.
277
+ `.github/workflows/release.yml` stages a release on npm when a `v*` tag is pushed; a maintainer
278
+ then approves it. No token is involved anywhere.
267
279
 
268
280
  ```bash
269
281
  npm version patch # bumps package.json, commits, tags vX.Y.Z
270
282
  git push --follow-tags
271
283
  ```
272
284
 
273
- It authenticates with npm trusted publishing (OIDC), which needs no stored token: on npmjs.com,
274
- the package's trusted publisher is this repository, workflow `release.yml`, environment `npm`.
275
- Until that is set up, npm falls back to an access token in the repository secret `NPM_TOKEN`.
285
+ 1. The workflow runs the CI workflow, checks that the tag matches the `version` in `package.json`,
286
+ builds, and runs `npm stage publish` from the `npm` environment. It authenticates with npm
287
+ trusted publishing (OIDC), which also adds a provenance attestation. On npmjs.com, the
288
+ package's trusted publisher is this repository, workflow `release.yml`, environment `npm`, and
289
+ it may only stage. Before staging, the job logs the claims of its OIDC token (repository,
290
+ workflow, environment, ref) so a mismatch with the trusted publisher shows in the log, and it
291
+ stages with `--loglevel verbose` because npm reports a failed OIDC exchange only there.
292
+ 2. It then creates a **draft** GitHub release with generated notes, so nothing is announced yet.
293
+ 3. A maintainer reviews the staged version and approves it with 2FA: on npmjs.com under Staged
294
+ Packages, or with `npm stage list` and `npm stage approve <id>`. The version is live from then.
295
+ 4. Publish the draft release: `gh release edit vX.Y.Z --draft=false`, or Publish release on
296
+ GitHub.
297
+
298
+ If staging fails, nothing reached npm and the version is still free. Re-running the job reuses the
299
+ workflow file at the tag, so after fixing `release.yml` move the tag to the fixed commit instead:
300
+ `git push origin :refs/tags/vX.Y.Z`, then tag and push again.
301
+
302
+ **npm cannot use trusted publishing for this repository yet.** The registry rejects the immutable
303
+ OIDC subject claims GitHub issues for repositories created after 2026-07-15
304
+ ([npm/cli#9969](https://github.com/npm/cli/issues/9969)), so `release.yml` fails at Stage with
305
+ `OIDC token exchange error - package not found` in its verbose log, although the claims it prints
306
+ match the trusted publisher. Until npm fixes this, stage by hand from the tag, still without a
307
+ stored token (npm 11.15.0 or later, Node 22.14 or later):
308
+
309
+ ```bash
310
+ git checkout vX.Y.Z
311
+ npm install && npm run build
312
+ npm login
313
+ npm stage publish --access public # add --tag next for a prerelease
314
+ ```
315
+
316
+ Approve the staged version with 2FA as above, then create the release:
317
+ `gh release create vX.Y.Z --verify-tag --generate-notes` (add `--prerelease` for a prerelease). A
318
+ version staged by hand has no provenance attestation.
319
+
320
+ A prerelease version (`1.2.0-beta.1`) is staged for the `next` dist-tag and its release is marked
321
+ as a prerelease.
276
322
 
277
323
  CI also checks the package as published: `publint` for `package.json` and `exports`, and
278
324
  `@arethetypeswrong/cli` for the type declarations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-courier",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenCode V2 plugin: spawn sessions, message them, and wake idle sessions without polling.",
5
5
  "license": "MIT",
6
6
  "repository": {