@scrylog/opencode-plugin 0.4.2 → 0.5.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
@@ -137,8 +137,8 @@ That confirms local daemon reachability and current OpenCode mode.
137
137
 
138
138
  The plugin uses one environment variable:
139
139
 
140
- | Variable | Default | Purpose |
141
- | --- | --- | --- |
140
+ | Variable | Default | Purpose |
141
+ | ------------- | -------------------------------------------- | ----------------------------------------- |
142
142
  | `SCRYLOG_URL` | `http://127.0.0.1:7788/api/webhook/opencode` | Full webhook URL for the `scrylog` daemon |
143
143
 
144
144
  ### Example: custom daemon port
@@ -169,17 +169,17 @@ export SCRYLOG_URL=http://127.0.0.1:9000/api/webhook/opencode
169
169
 
170
170
  The plugin forwards these OpenCode events:
171
171
 
172
- | Event | Meaning |
173
- | --- | --- |
174
- | `session.created` | New session created |
175
- | `session.updated` | Session metadata changed |
176
- | `session.deleted` | Session deleted |
177
- | `session.status` | State changed, such as `busy`, `idle`, or `retry` |
178
- | `session.idle` | Explicit idle signal |
179
- | `session.error` | Session error |
180
- | `permission.updated` | Permission prompt state updated |
181
- | `permission.asked` | Permission prompt shown |
182
- | `permission.replied` | Permission prompt answered |
172
+ | Event | Meaning |
173
+ | -------------------- | ------------------------------------------------- |
174
+ | `session.created` | New session created |
175
+ | `session.updated` | Session metadata changed |
176
+ | `session.deleted` | Session deleted |
177
+ | `session.status` | State changed, such as `busy`, `idle`, or `retry` |
178
+ | `session.idle` | Explicit idle signal |
179
+ | `session.error` | Session error |
180
+ | `permission.updated` | Permission prompt state updated |
181
+ | `permission.asked` | Permission prompt shown |
182
+ | `permission.replied` | Permission prompt answered |
183
183
 
184
184
  ## Request Format
185
185
 
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default as server } from "./server";
1
+ export { default as server } from './server';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { default as server } from "./server";
1
+ export { default as server } from './server';
package/dist/server.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { Plugin } from "@opencode-ai/plugin";
1
+ import type { Plugin } from '@opencode-ai/plugin';
2
2
  export declare const ScrylogServerPlugin: Plugin;
3
3
  export default ScrylogServerPlugin;
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
- import { getTmuxPane, getWebhookUrl, post, setTmuxSessionOption } from "./shared";
1
+ import { getTmuxPane, getWebhookUrl, post, setTmuxSessionOption, } from './shared';
2
2
  export const ScrylogServerPlugin = async (input) => {
3
- const { client, directory, $ } = input;
3
+ const { $, client, directory } = input;
4
4
  const webhookUrl = getWebhookUrl();
5
5
  if (getTmuxPane()) {
6
6
  client.session
@@ -8,6 +8,7 @@ export const ScrylogServerPlugin = async (input) => {
8
8
  .then(({ data }) => {
9
9
  if (!data?.length)
10
10
  return;
11
+ // eslint-disable-next-line prefer-destructuring
11
12
  const latest = [...data]
12
13
  .filter((s) => !s.parentID)
13
14
  .sort((a, b) => (b.time.updated ?? 0) - (a.time.updated ?? 0))[0];
@@ -19,14 +20,15 @@ export const ScrylogServerPlugin = async (input) => {
19
20
  return {
20
21
  event: async ({ event }) => {
21
22
  post(webhookUrl, {
22
- event: event.type,
23
23
  directory,
24
+ event: event.type,
24
25
  ...event.properties,
25
26
  });
26
- if (event.type === "session.created" || event.type === "session.updated") {
27
+ if (event.type === 'session.created' ||
28
+ event.type === 'session.updated') {
27
29
  const sessionID = event.properties.info?.id;
28
30
  const parentID = event.properties.info?.parentID;
29
- if (typeof sessionID === "string" && !parentID)
31
+ if (typeof sessionID === 'string' && !parentID)
30
32
  setTmuxSessionOption(sessionID, $);
31
33
  }
32
34
  },
package/dist/shared.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
1
+ import type { PluginInput } from '@opencode-ai/plugin';
2
2
  export declare const DEFAULT_WEBHOOK_URL = "http://127.0.0.1:7788/api/webhook/opencode";
3
3
  export declare function getWebhookUrl(): string;
4
4
  export declare function post(webhookUrl: string, body: Record<string, unknown>): void;
5
5
  export declare function getTmuxPane(): string | undefined;
6
- export declare function setTmuxSessionOption(sessionID: string, $?: PluginInput["$"]): void;
6
+ export declare function setTmuxSessionOption(sessionID: string, $?: PluginInput['$']): void;
package/dist/shared.js CHANGED
@@ -1,18 +1,18 @@
1
- export const DEFAULT_WEBHOOK_URL = "http://127.0.0.1:7788/api/webhook/opencode";
1
+ export const DEFAULT_WEBHOOK_URL = 'http://127.0.0.1:7788/api/webhook/opencode';
2
2
  export function getWebhookUrl() {
3
- return process.env["SCRYLOG_URL"] ?? DEFAULT_WEBHOOK_URL;
3
+ return process.env['SCRYLOG_URL'] ?? DEFAULT_WEBHOOK_URL;
4
4
  }
5
5
  export function post(webhookUrl, body) {
6
6
  fetch(webhookUrl, {
7
- method: "POST",
8
- headers: { "Content-Type": "application/json" },
9
7
  body: JSON.stringify(body),
8
+ headers: { 'Content-Type': 'application/json' },
9
+ method: 'POST',
10
10
  }).catch(() => {
11
11
  // Ignore all errors — daemon may not be running
12
12
  });
13
13
  }
14
14
  export function getTmuxPane() {
15
- const pane = process.env["TMUX_PANE"];
15
+ const pane = process.env['TMUX_PANE'];
16
16
  if (!pane)
17
17
  return undefined;
18
18
  if (!/^%\d+$/.test(pane))
package/package.json CHANGED
@@ -1,53 +1,65 @@
1
1
  {
2
2
  "name": "@scrylog/opencode-plugin",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "OpenCode plugin that pushes session events to scrylog daemon",
5
- "author": "Joel D. Martinez",
5
+ "keywords": [
6
+ "hooks",
7
+ "opencode",
8
+ "plugin",
9
+ "scrylog",
10
+ "webhook"
11
+ ],
12
+ "homepage": "https://github.com/scrylog/scrylog/tree/main/packages/opencode-plugin#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/scrylog/scrylog/issues"
15
+ },
6
16
  "license": "MIT",
7
- "type": "module",
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
17
+ "author": "Joel D. Martinez",
11
18
  "repository": {
12
19
  "type": "git",
13
20
  "url": "git+https://github.com/scrylog/scrylog.git",
14
21
  "directory": "packages/opencode-plugin"
15
22
  },
16
- "homepage": "https://github.com/scrylog/scrylog/tree/main/packages/opencode-plugin#readme",
17
- "bugs": {
18
- "url": "https://github.com/scrylog/scrylog/issues"
19
- },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "type": "module",
29
+ "main": "./dist/index.js",
30
+ "module": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
20
32
  "exports": {
21
33
  ".": {
22
34
  "import": "./dist/index.js",
23
35
  "types": "./dist/index.d.ts"
24
36
  }
25
37
  },
26
- "files": [
27
- "dist",
28
- "README.md",
29
- "LICENSE"
30
- ],
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
31
41
  "scripts": {
32
42
  "build": "tsc",
33
43
  "check-types": "tsc --noEmit",
34
44
  "clean": "rm -rf .turbo && rm -rf dist",
35
45
  "clean:node-modules": "rm -rf node_modules",
36
46
  "dev": "tsc --watch",
37
- "prepack": "npm run build",
38
- "pack:dry-run": "bash ../../scripts/npm-pack.sh \"$PWD\" \"\" --dry-run"
39
- },
40
- "keywords": [
41
- "opencode",
42
- "plugin",
43
- "scrylog",
44
- "hooks",
45
- "webhook"
46
- ],
47
- "publishConfig": {
48
- "access": "public"
47
+ "lint": "concurrently --kill-others-on-fail \"bun lint:fmt\" \"bun lint:oxc\" \"bun lint:eslint\" \"bun lint:tsc\"",
48
+ "lint:eslint": "eslint ./src --max-warnings 0",
49
+ "lint:eslint:fix": "bun lint:eslint -- --fix",
50
+ "lint:fmt": "bun --bun oxfmt --check",
51
+ "lint:fmt:fix": "bun --bun oxfmt",
52
+ "lint:oxc": "oxlint --tsconfig ./tsconfig.json --deny-warnings",
53
+ "lint:oxc:fix": "bun lint:oxc -- --fix --fix-suggestions",
54
+ "lint:oxc:type-aware": "bun lint:oxc -- --type-aware",
55
+ "lint:oxc:type-check": "bun lint:oxc:type-aware -- --type-check",
56
+ "lint:tsc": "bun tsc --noEmit",
57
+ "lint:tsc:go": "bun tsgo --project ./tsconfig.base.json --noEmit",
58
+ "pack:dry-run": "bash ../../scripts/npm-pack.sh \"$PWD\" \"\" --dry-run",
59
+ "prepack": "npm run build"
49
60
  },
50
61
  "devDependencies": {
62
+ "@mainqueueio/eslint-config": "0.2.1-next.14",
51
63
  "@opencode-ai/plugin": "1.4.0",
52
64
  "@opencode-ai/sdk": "1.4.10",
53
65
  "@types/node": "^24.3.0",