@agentchatme/openclaw 0.6.15 → 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 +14 -0
- package/dist/index.cjs +67 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -26
- package/dist/index.js.map +1 -1
- package/dist/setup-entry.cjs +67 -26
- package/dist/setup-entry.cjs.map +1 -1
- package/dist/setup-entry.js +67 -26
- package/dist/setup-entry.js.map +1 -1
- package/openclaw.plugin.json +7 -7
- package/package.json +14 -17
package/dist/setup-entry.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
|
|
|
@@ -852,8 +854,8 @@ var reconnectConfigSchema = z.object({
|
|
|
852
854
|
jitterRatio: z.number().min(0).max(1).default(0.2)
|
|
853
855
|
}).strict();
|
|
854
856
|
var pingConfigSchema = z.object({
|
|
855
|
-
intervalMs: z.number().int().min(5e3).max(12e4).default(
|
|
856
|
-
timeoutMs: z.number().int().min(1e3).max(
|
|
857
|
+
intervalMs: z.number().int().min(5e3).max(12e4).default(45e3),
|
|
858
|
+
timeoutMs: z.number().int().min(1e3).max(6e4).default(3e4)
|
|
857
859
|
}).strict();
|
|
858
860
|
var outboundConfigSchema = z.object({
|
|
859
861
|
maxInFlight: z.number().int().min(1).max(1e4).default(256),
|
|
@@ -1847,7 +1849,7 @@ var CircuitBreaker = class {
|
|
|
1847
1849
|
};
|
|
1848
1850
|
|
|
1849
1851
|
// src/version.ts
|
|
1850
|
-
var PACKAGE_VERSION = "0.6.
|
|
1852
|
+
var PACKAGE_VERSION = "0.6.17";
|
|
1851
1853
|
|
|
1852
1854
|
// src/outbound.ts
|
|
1853
1855
|
var DEFAULT_RETRY_POLICY = {
|
|
@@ -2479,31 +2481,70 @@ async function handleMessage(deps, event) {
|
|
|
2479
2481
|
}
|
|
2480
2482
|
});
|
|
2481
2483
|
} else {
|
|
2482
|
-
const
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2484
|
+
const ts = typeof event.createdAt === "number" ? event.createdAt : Date.parse(event.createdAt);
|
|
2485
|
+
const runtime = channelRuntime;
|
|
2486
|
+
const { route, buildEnvelope } = resolveInboundRouteEnvelopeBuilderWithRuntime({
|
|
2485
2487
|
cfg: deps.gatewayCfg,
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2488
|
+
channel: "agentchat",
|
|
2489
|
+
accountId: deps.accountId,
|
|
2490
|
+
peer: { kind: "group", id: event.conversationId },
|
|
2491
|
+
runtime
|
|
2492
|
+
});
|
|
2493
|
+
const { storePath, body: envelopeBody } = buildEnvelope({
|
|
2494
|
+
channel: "AgentChat",
|
|
2495
|
+
from: conversationLabel,
|
|
2496
|
+
body,
|
|
2497
|
+
timestamp: ts
|
|
2498
|
+
});
|
|
2499
|
+
const finalize = channelRuntime.reply.finalizeInboundContext;
|
|
2500
|
+
const ctxPayload = finalize({
|
|
2501
|
+
Body: envelopeBody,
|
|
2502
|
+
BodyForAgent: body,
|
|
2503
|
+
RawBody: body,
|
|
2504
|
+
CommandBody: body,
|
|
2505
|
+
From: `@${senderHandle}`,
|
|
2506
|
+
To: `@${recipientHandle}`,
|
|
2507
|
+
SessionKey: route.sessionKey,
|
|
2508
|
+
AccountId: deps.accountId,
|
|
2509
|
+
ChatType: "group",
|
|
2510
|
+
ConversationLabel: conversationLabel,
|
|
2511
|
+
SenderId: senderHandle,
|
|
2512
|
+
Provider: "agentchat",
|
|
2513
|
+
Surface: "agentchat",
|
|
2514
|
+
MessageSid: event.messageId,
|
|
2515
|
+
MessageSidFull: event.messageId,
|
|
2516
|
+
Timestamp: ts,
|
|
2517
|
+
OriginatingChannel: "agentchat",
|
|
2518
|
+
OriginatingTo: `@${recipientHandle}`
|
|
2519
|
+
});
|
|
2520
|
+
const session = channelRuntime.session;
|
|
2521
|
+
await recordInboundSessionAndDispatchReply({
|
|
2522
|
+
cfg: deps.gatewayCfg,
|
|
2523
|
+
channel: "agentchat",
|
|
2524
|
+
accountId: deps.accountId,
|
|
2525
|
+
agentId: route.agentId,
|
|
2526
|
+
routeSessionKey: route.sessionKey,
|
|
2527
|
+
storePath,
|
|
2528
|
+
ctxPayload,
|
|
2529
|
+
recordInboundSession: session.recordInboundSession,
|
|
2530
|
+
dispatchReplyWithBufferedBlockDispatcher: channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
2531
|
+
deliver: deliver2,
|
|
2532
|
+
onRecordError: (err3) => {
|
|
2533
|
+
deps.logger.error(
|
|
2534
|
+
{ err: err3 instanceof Error ? err3.message : String(err3), messageId: event.messageId },
|
|
2535
|
+
"recordInboundSession failed (group)"
|
|
2536
|
+
);
|
|
2505
2537
|
},
|
|
2506
|
-
|
|
2538
|
+
onDispatchError: (err3, info) => {
|
|
2539
|
+
deps.logger.error(
|
|
2540
|
+
{
|
|
2541
|
+
err: err3 instanceof Error ? err3.message : String(err3),
|
|
2542
|
+
messageId: event.messageId,
|
|
2543
|
+
kind: info.kind
|
|
2544
|
+
},
|
|
2545
|
+
"inbound dispatch failed (group)"
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2507
2548
|
});
|
|
2508
2549
|
}
|
|
2509
2550
|
} catch (err3) {
|