orca-agent 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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenClaw webhook integration.
|
|
3
3
|
*
|
|
4
|
-
* Sends messages to the OpenClaw local daemon
|
|
4
|
+
* Sends messages to the OpenClaw local daemon.
|
|
5
|
+
* Works with or without Telegram - messages appear in OpenClaw UI/TUI.
|
|
5
6
|
* Handles ECONNREFUSED gracefully (OpenClaw not installed).
|
|
6
7
|
*/
|
|
7
8
|
export interface WebhookPayload {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/openclaw/webhook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/openclaw/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,GACpC,OAAO,CAAC,IAAI,CAAC,CAuCf;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAItD"}
|
package/dist/openclaw/webhook.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenClaw webhook integration.
|
|
3
3
|
*
|
|
4
|
-
* Sends messages to the OpenClaw local daemon
|
|
4
|
+
* Sends messages to the OpenClaw local daemon.
|
|
5
|
+
* Works with or without Telegram - messages appear in OpenClaw UI/TUI.
|
|
5
6
|
* Handles ECONNREFUSED gracefully (OpenClaw not installed).
|
|
6
7
|
*/
|
|
7
8
|
const OPENCLAW_URL = "http://127.0.0.1:18789";
|
|
@@ -10,9 +11,13 @@ export async function sendWebhook(message, options = {}) {
|
|
|
10
11
|
message,
|
|
11
12
|
name: options.name || "Orca Network",
|
|
12
13
|
sessionKey: options.sessionKey || "hook:orca",
|
|
13
|
-
deliver:
|
|
14
|
-
|
|
14
|
+
// deliver: false means show in OpenClaw UI only, no Telegram required
|
|
15
|
+
deliver: options.deliver ?? false,
|
|
15
16
|
};
|
|
17
|
+
// Only add channel if explicitly specified (for users with Telegram)
|
|
18
|
+
if (options.channel) {
|
|
19
|
+
payload.channel = options.channel;
|
|
20
|
+
}
|
|
16
21
|
try {
|
|
17
22
|
const response = await fetch(`${OPENCLAW_URL}/hooks/agent`, {
|
|
18
23
|
method: "POST",
|
|
@@ -31,7 +36,7 @@ export async function sendWebhook(message, options = {}) {
|
|
|
31
36
|
if (error instanceof Error &&
|
|
32
37
|
(error.message.includes("ECONNREFUSED") ||
|
|
33
38
|
error.message.includes("fetch failed"))) {
|
|
34
|
-
console.log("OpenClaw not available, skipping
|
|
39
|
+
console.log("OpenClaw not available, skipping message delivery");
|
|
35
40
|
throw new Error("OpenClaw not available");
|
|
36
41
|
}
|
|
37
42
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/openclaw/webhook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/openclaw/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAU9C,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,UAAmC,EAAE;IAErC,MAAM,OAAO,GAAmB;QAC9B,OAAO;QACP,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,cAAc;QACpC,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