omoclaw 2.2.0 → 2.2.2

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/dist/config.d.ts CHANGED
@@ -6,10 +6,16 @@ export interface MonitorConfig {
6
6
  gatewayToken: string;
7
7
  /** Use /hooks/agent instead of /hooks/wake for targeted delivery */
8
8
  useAgent: boolean;
9
- /** Discord channel ID to deliver notifications to */
9
+ /** Channel/chat ID to deliver notifications to */
10
10
  channel: string;
11
- /** Delivery channel type (discord, telegram, etc.) */
11
+ /** Delivery channel type (discord, telegram, slack, etc.) */
12
12
  channelType: string;
13
+ /** Chat type within channel (channel, dm, groupdm, private, etc.) */
14
+ chatType: string;
15
+ /** Agent ID for session key generation */
16
+ agentId: string;
17
+ /** Full session key override — if set, channelType/channel/chatType/agentId are ignored */
18
+ sessionKey: string;
13
19
  };
14
20
  staleTimeoutMs: number;
15
21
  permissionReminderMs: number;
package/dist/index.js CHANGED
@@ -13,7 +13,10 @@ var DEFAULT_CONFIG = {
13
13
  gatewayToken: "",
14
14
  useAgent: true,
15
15
  channel: "",
16
- channelType: "discord"
16
+ channelType: "discord",
17
+ chatType: "channel",
18
+ agentId: "main",
19
+ sessionKey: ""
17
20
  },
18
21
  staleTimeoutMs: 900000,
19
22
  permissionReminderMs: 120000,
@@ -49,7 +52,10 @@ function loadConfig() {
49
52
  gatewayToken: typeof webhook?.gatewayToken === "string" ? webhook.gatewayToken : DEFAULT_CONFIG.webhook.gatewayToken,
50
53
  useAgent: typeof webhook?.useAgent === "boolean" ? webhook.useAgent : DEFAULT_CONFIG.webhook.useAgent,
51
54
  channel: typeof webhook?.channel === "string" ? webhook.channel : DEFAULT_CONFIG.webhook.channel,
52
- channelType: typeof webhook?.channelType === "string" ? webhook.channelType : DEFAULT_CONFIG.webhook.channelType
55
+ channelType: typeof webhook?.channelType === "string" ? webhook.channelType : DEFAULT_CONFIG.webhook.channelType,
56
+ chatType: typeof webhook?.chatType === "string" ? webhook.chatType : DEFAULT_CONFIG.webhook.chatType,
57
+ agentId: typeof webhook?.agentId === "string" ? webhook.agentId : DEFAULT_CONFIG.webhook.agentId,
58
+ sessionKey: typeof webhook?.sessionKey === "string" ? webhook.sessionKey : DEFAULT_CONFIG.webhook.sessionKey
53
59
  },
54
60
  staleTimeoutMs: typeof root.staleTimeoutMs === "number" ? root.staleTimeoutMs : DEFAULT_CONFIG.staleTimeoutMs,
55
61
  permissionReminderMs: typeof root.permissionReminderMs === "number" ? root.permissionReminderMs : DEFAULT_CONFIG.permissionReminderMs,
@@ -402,8 +408,13 @@ function wlog(msg) {
402
408
  function sendWebhook(config, text) {
403
409
  const { webhook } = config;
404
410
  const body = { text, mode: "now" };
405
- if (webhook.channel) {
406
- body.sessionKey = `agent:main:discord:channel:${webhook.channel}`;
411
+ const envSessionKey = process.env.OPENCLAW_SESSION_KEY;
412
+ if (envSessionKey) {
413
+ body.sessionKey = envSessionKey;
414
+ } else if (webhook.sessionKey) {
415
+ body.sessionKey = webhook.sessionKey;
416
+ } else if (webhook.channel) {
417
+ body.sessionKey = `agent:${webhook.agentId}:${webhook.channelType}:${webhook.chatType}:${webhook.channel}`;
407
418
  }
408
419
  wlog(`Sending /hooks/wake to ${webhook.url} (session: ${body.sessionKey ?? "main"}): ${text}`);
409
420
  fetch(webhook.url, {
package/dist/webhook.d.ts CHANGED
@@ -1,8 +1,2 @@
1
1
  import type { MonitorConfig } from "./config";
2
- /**
3
- * Send wake notification to OpenClaw via /hooks/wake with session targeting.
4
- * Uses patched /hooks/wake that accepts optional sessionKey parameter.
5
- * If channel is configured, targets the specific Discord channel session.
6
- * Fire-and-forget, no token cost, instant 200 response.
7
- */
8
2
  export declare function sendWebhook(config: MonitorConfig, text: string): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omoclaw",
3
- "version": "2.2.0",
4
- "description": "OpenCode session monitor plugin \u2014 native event-driven webhook notifications for session state changes",
3
+ "version": "2.2.2",
4
+ "description": "OpenCode session monitor plugin native event-driven webhook notifications for session state changes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
@@ -33,4 +33,4 @@
33
33
  "bun-types": "^1.3.6",
34
34
  "typescript": "^5.7.3"
35
35
  }
36
- }
36
+ }