@agentchatme/openclaw 0.6.16 → 0.6.17
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/CHANGELOG.md +5 -0
- package/dist/index.cjs +65 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +65 -24
- package/dist/index.js.map +1 -1
- package/dist/setup-entry.cjs +65 -24
- package/dist/setup-entry.cjs.map +1 -1
- package/dist/setup-entry.js +65 -24
- package/dist/setup-entry.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { waitUntilAbort } from 'openclaw/plugin-sdk/channel-lifecycle';
|
|
|
7
7
|
import pino from 'pino';
|
|
8
8
|
import { WebSocket } from 'ws';
|
|
9
9
|
import { dispatchInboundDirectDmWithRuntime } from 'openclaw/plugin-sdk/direct-dm';
|
|
10
|
+
import { resolveInboundRouteEnvelopeBuilderWithRuntime } from 'openclaw/plugin-sdk/inbound-envelope';
|
|
11
|
+
import { recordInboundSessionAndDispatchReply } from 'openclaw/plugin-sdk/inbound-reply-dispatch';
|
|
10
12
|
import { AgentChatClient } from '@agentchatme/agentchat';
|
|
11
13
|
import { Type } from '@sinclair/typebox';
|
|
12
14
|
|
|
@@ -1855,7 +1857,7 @@ var CircuitBreaker = class {
|
|
|
1855
1857
|
};
|
|
1856
1858
|
|
|
1857
1859
|
// src/version.ts
|
|
1858
|
-
var PACKAGE_VERSION = "0.6.
|
|
1860
|
+
var PACKAGE_VERSION = "0.6.17";
|
|
1859
1861
|
|
|
1860
1862
|
// src/outbound.ts
|
|
1861
1863
|
var DEFAULT_RETRY_POLICY = {
|
|
@@ -2487,31 +2489,70 @@ async function handleMessage(deps, event) {
|
|
|
2487
2489
|
}
|
|
2488
2490
|
});
|
|
2489
2491
|
} else {
|
|
2490
|
-
const
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2492
|
+
const ts = typeof event.createdAt === "number" ? event.createdAt : Date.parse(event.createdAt);
|
|
2493
|
+
const runtime = channelRuntime;
|
|
2494
|
+
const { route, buildEnvelope } = resolveInboundRouteEnvelopeBuilderWithRuntime({
|
|
2493
2495
|
cfg: deps.gatewayCfg,
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2496
|
+
channel: "agentchat",
|
|
2497
|
+
accountId: deps.accountId,
|
|
2498
|
+
peer: { kind: "group", id: event.conversationId },
|
|
2499
|
+
runtime
|
|
2500
|
+
});
|
|
2501
|
+
const { storePath, body: envelopeBody } = buildEnvelope({
|
|
2502
|
+
channel: "AgentChat",
|
|
2503
|
+
from: conversationLabel,
|
|
2504
|
+
body,
|
|
2505
|
+
timestamp: ts
|
|
2506
|
+
});
|
|
2507
|
+
const finalize = channelRuntime.reply.finalizeInboundContext;
|
|
2508
|
+
const ctxPayload = finalize({
|
|
2509
|
+
Body: envelopeBody,
|
|
2510
|
+
BodyForAgent: body,
|
|
2511
|
+
RawBody: body,
|
|
2512
|
+
CommandBody: body,
|
|
2513
|
+
From: `@${senderHandle}`,
|
|
2514
|
+
To: `@${recipientHandle}`,
|
|
2515
|
+
SessionKey: route.sessionKey,
|
|
2516
|
+
AccountId: deps.accountId,
|
|
2517
|
+
ChatType: "group",
|
|
2518
|
+
ConversationLabel: conversationLabel,
|
|
2519
|
+
SenderId: senderHandle,
|
|
2520
|
+
Provider: "agentchat",
|
|
2521
|
+
Surface: "agentchat",
|
|
2522
|
+
MessageSid: event.messageId,
|
|
2523
|
+
MessageSidFull: event.messageId,
|
|
2524
|
+
Timestamp: ts,
|
|
2525
|
+
OriginatingChannel: "agentchat",
|
|
2526
|
+
OriginatingTo: `@${recipientHandle}`
|
|
2527
|
+
});
|
|
2528
|
+
const session = channelRuntime.session;
|
|
2529
|
+
await recordInboundSessionAndDispatchReply({
|
|
2530
|
+
cfg: deps.gatewayCfg,
|
|
2531
|
+
channel: "agentchat",
|
|
2532
|
+
accountId: deps.accountId,
|
|
2533
|
+
agentId: route.agentId,
|
|
2534
|
+
routeSessionKey: route.sessionKey,
|
|
2535
|
+
storePath,
|
|
2536
|
+
ctxPayload,
|
|
2537
|
+
recordInboundSession: session.recordInboundSession,
|
|
2538
|
+
dispatchReplyWithBufferedBlockDispatcher: channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
2539
|
+
deliver: deliver2,
|
|
2540
|
+
onRecordError: (err3) => {
|
|
2541
|
+
deps.logger.error(
|
|
2542
|
+
{ err: err3 instanceof Error ? err3.message : String(err3), messageId: event.messageId },
|
|
2543
|
+
"recordInboundSession failed (group)"
|
|
2544
|
+
);
|
|
2513
2545
|
},
|
|
2514
|
-
|
|
2546
|
+
onDispatchError: (err3, info) => {
|
|
2547
|
+
deps.logger.error(
|
|
2548
|
+
{
|
|
2549
|
+
err: err3 instanceof Error ? err3.message : String(err3),
|
|
2550
|
+
messageId: event.messageId,
|
|
2551
|
+
kind: info.kind
|
|
2552
|
+
},
|
|
2553
|
+
"inbound dispatch failed (group)"
|
|
2554
|
+
);
|
|
2555
|
+
}
|
|
2515
2556
|
});
|
|
2516
2557
|
}
|
|
2517
2558
|
} catch (err3) {
|