Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/NOTIFICATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ OpenCode.
}
```

The package is pinned to `@opencode-ai/plugin@0.0.0-beta-18387`. It subscribes to
The package is pinned to `@opencode/plugin@2.0.27`, matching OpenCode `2.0.27`.
The old beta SDK is incompatible with this server's bundled Effect runtime and
fails during import, before plugin setup. It subscribes to
`permission.asked`, `permission.replied`, `form.created`, `form.replied`,
`form.cancelled`, and `session.execution.succeeded`. It converts permission
actions to a finite category before storing a sanitized retry queue in plugin
Expand Down Expand Up @@ -128,6 +130,12 @@ plugin entry. Configure the compiled `dist` directory, which contains both
`index.js` and `tui.js`. Rebuild after changes, restart the OpenCode service for
server-plugin changes, and reopen the TUI for TUI-plugin changes.

After rebuilding and reloading the server plugin, run `pnpm notifications:smoke`
from this checkout to verify that the configured plugin is active in the live
OpenCode server. This opt-in check requires the plugin configuration and broker
token file above. A plain Node import does not exercise the server's shared
runtime dependency resolution and cannot detect SDK mismatches.

## Start and pair

Start the broker in one terminal:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"mobile:runtime": "node scripts/mobile-runtime.mjs",
"notifications:build": "pnpm --filter @opencode2-mobile/notification-protocol build && pnpm --filter @opencode2-mobile/notification-broker build && pnpm --filter @opencode2-mobile/opencode-notification-plugin build",
"notifications:broker": "node apps/notification-broker/dist/cli.js",
"notifications:smoke": "node scripts/notification-plugin-smoke.mjs",
"test": "node --test scripts/*.test.mjs && pnpm -r --if-present test",
"typecheck": "pnpm -r typecheck",
"build:packages": "pnpm --filter './packages/*' build"
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode-notification-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typecheck": "tsc -p tsconfig.json"
},
"dependencies": {
"@opencode-ai/plugin": "0.0.0-beta-18387",
"@opencode/plugin": "2.0.27",
"@opencode2-mobile/notification-protocol": "workspace:*"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/opencode-notification-plugin/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { describe, expect, it } from "vitest";
import notificationPlugin, { normalizeOpenCodeNotificationEvent } from "./index.js";

describe("notification plugin projection", () => {
it("loads the matching TUI controls", () => {
expect(notificationPlugin.tui).toBe(true);
it("defines the server notification plugin", () => {
expect(notificationPlugin.id).toBe("opencode-mobile-notifications");
expect(notificationPlugin.setup).toBeTypeOf("function");
});

it("projects permission events without request content", () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/opencode-notification-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from "@opencode-ai/plugin";
import { Plugin } from "@opencode/plugin";
import {
type NotificationCategory,
type NotificationPluginEvent,
Expand All @@ -13,7 +13,6 @@ const maximumQueueSize = 1_000;

export default Plugin.define({
id: "opencode-mobile-notifications",
tui: true,
async setup(ctx) {
const access = await readBrokerAccess(ctx.options);
let queue = parseStoredQueue(await ctx.storage.get(queueStorageKey));
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode-notification-plugin/src/tui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeEach, expect, it, vi } from "vitest";

const { readBrokerAccess } = vi.hoisted(() => ({ readBrokerAccess: vi.fn() }));

vi.mock("@opencode-ai/plugin/tui", () => ({
vi.mock("@opencode/plugin/tui", () => ({
Plugin: { define: <T>(plugin: T) => plugin },
}));
vi.mock("./broker.js", () => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode-notification-plugin/src/tui.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from "@opencode-ai/plugin/tui";
import { Plugin } from "@opencode/plugin/tui";

import { readBrokerAccess, requestNotificationDeliveryState } from "./broker.js";

Expand Down
Loading
Loading