@datanovallc/openclaw-slack-router 0.1.25 → 0.1.26
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
|
@@ -22,7 +22,7 @@ In the [Slack app console](https://api.slack.com/apps), create a new app and con
|
|
|
22
22
|
### 2. Install the plugin
|
|
23
23
|
|
|
24
24
|
```
|
|
25
|
-
openclaw plugins install @datanovallc/openclaw-slack-router@0.1.
|
|
25
|
+
openclaw plugins install @datanovallc/openclaw-slack-router@0.1.26
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### 3. Configure your tokens
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { gatewayChatSend } from "../gateway/chat-client.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
|
+
function formatGatewayMessage(ctx) {
|
|
4
|
+
const history = (ctx.threadHistory ?? [])
|
|
5
|
+
.slice(-12)
|
|
6
|
+
.map((m) => `${m.role === "assistant" ? "Assistant" : "User"}: ${m.content}`)
|
|
7
|
+
.join("\n");
|
|
8
|
+
if (!history)
|
|
9
|
+
return ctx.currentMessage;
|
|
10
|
+
return [
|
|
11
|
+
"Recent conversation context:",
|
|
12
|
+
history,
|
|
13
|
+
"",
|
|
14
|
+
"Latest user message:",
|
|
15
|
+
ctx.currentMessage,
|
|
16
|
+
].join("\n");
|
|
17
|
+
}
|
|
3
18
|
export function createOpenclawGatewaySubagent(options) {
|
|
4
19
|
const { gatewayUrl, gatewayToken, timeoutMs } = options;
|
|
5
20
|
return {
|
|
@@ -14,8 +29,8 @@ export function createOpenclawGatewaySubagent(options) {
|
|
|
14
29
|
const idempotencyKey = randomUUID();
|
|
15
30
|
try {
|
|
16
31
|
const result = await gatewayChatSend(chatOptions, {
|
|
17
|
-
sessionKey: ctx.channelId
|
|
18
|
-
message: ctx
|
|
32
|
+
sessionKey: `slack:${ctx.channelId}`,
|
|
33
|
+
message: formatGatewayMessage(ctx),
|
|
19
34
|
idempotencyKey,
|
|
20
35
|
});
|
|
21
36
|
return result.text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-gateway.js","sourceRoot":"","sources":["../../src/subagents/openclaw-gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"openclaw-gateway.js","sourceRoot":"","sources":["../../src/subagents/openclaw-gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,SAAS,oBAAoB,CAAC,GAAoB;IAChD,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;SACtC,KAAK,CAAC,CAAC,EAAE,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;SAC5E,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC,cAAc,CAAC;IAExC,OAAO;QACL,8BAA8B;QAC9B,OAAO;QACP,EAAE;QACF,sBAAsB;QACtB,GAAG,CAAC,cAAc;KACnB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAQD,MAAM,UAAU,6BAA6B,CAC3C,OAAuC;IAEvC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAExD,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,oDAAoD;QACjE,KAAK,CAAC,MAAM,CAAC,GAAoB;YAC/B,MAAM,WAAW,GAAu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