@okxweb3/a2a-node 0.2.1-beta-8ae7a0d300-260807181806 → 0.2.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.
- package/dist/cli.js +77 -29
- package/dist/index.js +74 -26
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9433,7 +9433,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
9433
9433
|
client: {
|
|
9434
9434
|
id: "gateway-client",
|
|
9435
9435
|
displayName: "okx-a2a-node",
|
|
9436
|
-
version: "0.2.1
|
|
9436
|
+
version: "0.2.1",
|
|
9437
9437
|
platform: "node",
|
|
9438
9438
|
mode: "backend",
|
|
9439
9439
|
instanceId
|
|
@@ -9444,7 +9444,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
9444
9444
|
commands: [],
|
|
9445
9445
|
permissions: {},
|
|
9446
9446
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
9447
|
-
userAgent: `okx-a2a-node/${"0.2.1
|
|
9447
|
+
userAgent: `okx-a2a-node/${"0.2.1"}`,
|
|
9448
9448
|
auth: {
|
|
9449
9449
|
...config.token ? { token: config.token } : {},
|
|
9450
9450
|
...config.password ? { password: config.password } : {}
|
|
@@ -27633,7 +27633,7 @@ var init_sentry_config = __esm({
|
|
|
27633
27633
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
27634
27634
|
SENTRY_CONFIG = {
|
|
27635
27635
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
27636
|
-
release: "0.2.1
|
|
27636
|
+
release: "0.2.1",
|
|
27637
27637
|
environment,
|
|
27638
27638
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
27639
27639
|
};
|
|
@@ -38803,7 +38803,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
38803
38803
|
node: process.version,
|
|
38804
38804
|
platform: process.platform,
|
|
38805
38805
|
arch: process.arch,
|
|
38806
|
-
packageVersion: true ? "0.2.1
|
|
38806
|
+
packageVersion: true ? "0.2.1" : "unknown",
|
|
38807
38807
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
38808
38808
|
listenerAndLlmContentIncluded: true,
|
|
38809
38809
|
credentialsAlwaysRedacted: true,
|
|
@@ -55644,6 +55644,12 @@ function parseGroupPayload(content2) {
|
|
|
55644
55644
|
function isOfflineReplayForTrigger(trigger) {
|
|
55645
55645
|
return trigger === "startup";
|
|
55646
55646
|
}
|
|
55647
|
+
function replaySingleFlightDiscriminator(trigger, clientGeneration, recoveryIdentity) {
|
|
55648
|
+
if (trigger === "stream_recovery") {
|
|
55649
|
+
return `stream_recovery:${clientGeneration}:${recoveryIdentity ?? "unknown"}`;
|
|
55650
|
+
}
|
|
55651
|
+
return isOfflineReplayForTrigger(trigger) ? `startup_offline:${clientGeneration}` : `online_repair:${clientGeneration}`;
|
|
55652
|
+
}
|
|
55647
55653
|
function createOfflineReplayAddressSummary(address) {
|
|
55648
55654
|
return {
|
|
55649
55655
|
address,
|
|
@@ -55746,7 +55752,7 @@ var init_xmtp_sdk = __esm({
|
|
|
55746
55752
|
await this.inbound(item.ctx, item.next);
|
|
55747
55753
|
} catch (err2) {
|
|
55748
55754
|
this.queue.unshift(item);
|
|
55749
|
-
this.holds
|
|
55755
|
+
this.holds++;
|
|
55750
55756
|
throw err2;
|
|
55751
55757
|
}
|
|
55752
55758
|
drained++;
|
|
@@ -55818,6 +55824,10 @@ var init_xmtp_sdk = __esm({
|
|
|
55818
55824
|
streamRecoveryCleanupByAddress = /* @__PURE__ */ new Map();
|
|
55819
55825
|
nextClientGeneration = 1;
|
|
55820
55826
|
clientGenerationByClient = /* @__PURE__ */ new WeakMap();
|
|
55827
|
+
resolveStartupReplayCompletion;
|
|
55828
|
+
startupReplayCompletion = new Promise((resolve14) => {
|
|
55829
|
+
this.resolveStartupReplayCompletion = resolve14;
|
|
55830
|
+
});
|
|
55821
55831
|
agentListFingerprint;
|
|
55822
55832
|
// Only one refreshAgents can be in flight at a time; concurrent calls
|
|
55823
55833
|
// coalesce onto the same promise. This avoids duplicate Agent.create()
|
|
@@ -56446,9 +56456,15 @@ var init_xmtp_sdk = __esm({
|
|
|
56446
56456
|
logWithTimestamp(
|
|
56447
56457
|
`[xmtp-sdk] refresh: ${address} has a prior sync timestamp, triggering offline replay`
|
|
56448
56458
|
);
|
|
56459
|
+
const expectedClient = this.clients.get(address) ?? null;
|
|
56460
|
+
const expectedGate = this.inboundReplayGates.get(
|
|
56461
|
+
address.toLowerCase()
|
|
56462
|
+
);
|
|
56449
56463
|
void this.replayOfflineMessagesForAddressSingleFlight(
|
|
56450
56464
|
address,
|
|
56451
|
-
"agent_refresh"
|
|
56465
|
+
"agent_refresh",
|
|
56466
|
+
void 0,
|
|
56467
|
+
expectedClient
|
|
56452
56468
|
).catch((err2) => {
|
|
56453
56469
|
logWithTimestamp(`[xmtp-sdk] refresh: ${address} offline replay failed:`, err2);
|
|
56454
56470
|
logger.error(
|
|
@@ -56459,7 +56475,7 @@ var init_xmtp_sdk = __esm({
|
|
|
56459
56475
|
stage: "refreshAgents/replay"
|
|
56460
56476
|
}
|
|
56461
56477
|
);
|
|
56462
|
-
}).then(() => this.drainInboundReplayGate(address)).catch((err2) => {
|
|
56478
|
+
}).then(() => this.drainInboundReplayGate(address, expectedGate)).catch((err2) => {
|
|
56463
56479
|
logWithTimestamp(`[xmtp-sdk] refresh: ${address} replay gate drain failed:`, err2);
|
|
56464
56480
|
});
|
|
56465
56481
|
}
|
|
@@ -56548,14 +56564,17 @@ var init_xmtp_sdk = __esm({
|
|
|
56548
56564
|
phase: "recycle"
|
|
56549
56565
|
});
|
|
56550
56566
|
await this.startListeningForAddresses([address]);
|
|
56567
|
+
const replayGate = this.inboundReplayGates.get(addressKey);
|
|
56551
56568
|
let replaySummary;
|
|
56552
56569
|
try {
|
|
56553
56570
|
replaySummary = await this.replayOfflineMessagesForAddressSingleFlight(
|
|
56554
56571
|
address,
|
|
56555
|
-
"client_recycle"
|
|
56572
|
+
"client_recycle",
|
|
56573
|
+
void 0,
|
|
56574
|
+
agent
|
|
56556
56575
|
);
|
|
56557
56576
|
} finally {
|
|
56558
|
-
await this.drainInboundReplayGate(address);
|
|
56577
|
+
await this.drainInboundReplayGate(address, replayGate);
|
|
56559
56578
|
}
|
|
56560
56579
|
addresses.push(replaySummary);
|
|
56561
56580
|
replayed += replaySummary.replayed;
|
|
@@ -56965,8 +56984,11 @@ var init_xmtp_sdk = __esm({
|
|
|
56965
56984
|
await this.startListeningForAddresses([...this.clients.keys()]);
|
|
56966
56985
|
}
|
|
56967
56986
|
async drainInboundReplayGate(address, expectedGate) {
|
|
56987
|
+
if (!expectedGate) {
|
|
56988
|
+
return 0;
|
|
56989
|
+
}
|
|
56968
56990
|
const gate = this.inboundReplayGates.get(address.toLowerCase());
|
|
56969
|
-
if (!gate ||
|
|
56991
|
+
if (!gate || gate !== expectedGate) {
|
|
56970
56992
|
return 0;
|
|
56971
56993
|
}
|
|
56972
56994
|
let attempt = 0;
|
|
@@ -57071,10 +57093,18 @@ var init_xmtp_sdk = __esm({
|
|
|
57071
57093
|
* cannot overtake the stored backlog.
|
|
57072
57094
|
*/
|
|
57073
57095
|
async completeStartupReplay() {
|
|
57096
|
+
const startupGates = new Map(
|
|
57097
|
+
[...this.clients.keys()].map((address) => [
|
|
57098
|
+
address,
|
|
57099
|
+
this.inboundReplayGates.get(address.toLowerCase())
|
|
57100
|
+
])
|
|
57101
|
+
);
|
|
57074
57102
|
const summary = await this.replayOfflineMessages("startup");
|
|
57075
|
-
for (const address of
|
|
57076
|
-
await this.drainInboundReplayGate(address);
|
|
57103
|
+
for (const [address, expectedGate] of startupGates) {
|
|
57104
|
+
await this.drainInboundReplayGate(address, expectedGate);
|
|
57077
57105
|
}
|
|
57106
|
+
this.resolveStartupReplayCompletion?.();
|
|
57107
|
+
this.resolveStartupReplayCompletion = void 0;
|
|
57078
57108
|
this.notifyAgentsWakeupAfterReplay();
|
|
57079
57109
|
return summary;
|
|
57080
57110
|
}
|
|
@@ -57264,10 +57294,10 @@ var init_xmtp_sdk = __esm({
|
|
|
57264
57294
|
});
|
|
57265
57295
|
void (async () => {
|
|
57266
57296
|
try {
|
|
57267
|
-
const summary = await this.
|
|
57297
|
+
const summary = await this.replayOfflineMessagesForStreamRecovery(
|
|
57268
57298
|
address,
|
|
57269
|
-
|
|
57270
|
-
|
|
57299
|
+
String(recovery.recoverySequence),
|
|
57300
|
+
agent
|
|
57271
57301
|
);
|
|
57272
57302
|
if (!recoveryDisposed && this.clients.get(address) === agent) {
|
|
57273
57303
|
logger.info(LogEvent.AGENT_STREAM_RECOVERY_REPLAY_COMPLETED, {
|
|
@@ -57328,12 +57358,12 @@ var init_xmtp_sdk = __esm({
|
|
|
57328
57358
|
logWithTimestamp(`${tag} message listener started`);
|
|
57329
57359
|
});
|
|
57330
57360
|
}
|
|
57331
|
-
async replayOfflineMessagesForAddress(address, trigger = "periodic_repair") {
|
|
57361
|
+
async replayOfflineMessagesForAddress(address, expectedClient, trigger = "periodic_repair") {
|
|
57332
57362
|
const addressReplayStartedAt = Date.now();
|
|
57333
57363
|
const summary = createOfflineReplayAddressSummary(address);
|
|
57334
57364
|
const isOfflineReplay = isOfflineReplayForTrigger(trigger);
|
|
57335
57365
|
const agent = this.clients.get(address);
|
|
57336
|
-
if (!agent) {
|
|
57366
|
+
if (!agent || agent !== expectedClient) {
|
|
57337
57367
|
summary.durationMs = Date.now() - addressReplayStartedAt;
|
|
57338
57368
|
return summary;
|
|
57339
57369
|
}
|
|
@@ -57538,17 +57568,35 @@ var init_xmtp_sdk = __esm({
|
|
|
57538
57568
|
);
|
|
57539
57569
|
return summary;
|
|
57540
57570
|
}
|
|
57541
|
-
replayOfflineMessagesForAddressSingleFlight(address, trigger = "periodic_repair", recoveryIdentity) {
|
|
57542
|
-
const
|
|
57571
|
+
replayOfflineMessagesForAddressSingleFlight(address, trigger = "periodic_repair", recoveryIdentity, expectedClient = this.clients.get(address) ?? null) {
|
|
57572
|
+
const clientGeneration = expectedClient ? this.getClientGeneration(expectedClient) : "missing";
|
|
57573
|
+
const eligibilityClass = replaySingleFlightDiscriminator(
|
|
57574
|
+
trigger,
|
|
57575
|
+
clientGeneration,
|
|
57576
|
+
recoveryIdentity
|
|
57577
|
+
);
|
|
57543
57578
|
return this.offlineReplaySingleFlight.run(
|
|
57544
57579
|
address,
|
|
57545
57580
|
eligibilityClass,
|
|
57546
57581
|
async () => {
|
|
57547
57582
|
await this._backupReady;
|
|
57548
|
-
return this.replayOfflineMessagesForAddress(
|
|
57583
|
+
return this.replayOfflineMessagesForAddress(
|
|
57584
|
+
address,
|
|
57585
|
+
expectedClient,
|
|
57586
|
+
trigger
|
|
57587
|
+
);
|
|
57549
57588
|
}
|
|
57550
57589
|
);
|
|
57551
57590
|
}
|
|
57591
|
+
async replayOfflineMessagesForStreamRecovery(address, recoveryIdentity, expectedClient) {
|
|
57592
|
+
await this.startupReplayCompletion;
|
|
57593
|
+
return this.replayOfflineMessagesForAddressSingleFlight(
|
|
57594
|
+
address,
|
|
57595
|
+
"stream_recovery",
|
|
57596
|
+
recoveryIdentity,
|
|
57597
|
+
expectedClient
|
|
57598
|
+
);
|
|
57599
|
+
}
|
|
57552
57600
|
async replayOfflineMessages(trigger = "periodic_repair") {
|
|
57553
57601
|
await this._backupReady;
|
|
57554
57602
|
const replayStartedAt = Date.now();
|
|
@@ -66080,12 +66128,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
66080
66128
|
});
|
|
66081
66129
|
}
|
|
66082
66130
|
});
|
|
66083
|
-
service.setPluginVersion("0.2.1
|
|
66131
|
+
service.setPluginVersion("0.2.1");
|
|
66084
66132
|
await service.init();
|
|
66085
66133
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
66086
66134
|
if (pluginVersionStatus.unavailable) {
|
|
66087
66135
|
throw new Error(
|
|
66088
|
-
`@okxweb3/a2a-node v${"0.2.1
|
|
66136
|
+
`@okxweb3/a2a-node v${"0.2.1"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
66089
66137
|
);
|
|
66090
66138
|
}
|
|
66091
66139
|
const systemConfig = service.getSystemConfig();
|
|
@@ -66103,7 +66151,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
66103
66151
|
onchainosAgentId: "*",
|
|
66104
66152
|
reason: "system-config missing sentryDsn",
|
|
66105
66153
|
pluginId: "@okxweb3/a2a-node",
|
|
66106
|
-
pluginVersion: "0.2.1
|
|
66154
|
+
pluginVersion: "0.2.1"
|
|
66107
66155
|
});
|
|
66108
66156
|
}
|
|
66109
66157
|
logWithTimestamp(
|
|
@@ -114202,7 +114250,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
114202
114250
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
114203
114251
|
}
|
|
114204
114252
|
function getBundledNodeCliVersion() {
|
|
114205
|
-
return true ? "0.2.1
|
|
114253
|
+
return true ? "0.2.1" : null;
|
|
114206
114254
|
}
|
|
114207
114255
|
function readConfiguredAiProvider() {
|
|
114208
114256
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -114412,7 +114460,7 @@ async function updateHermes(release, options) {
|
|
|
114412
114460
|
}
|
|
114413
114461
|
}
|
|
114414
114462
|
async function installGatewayPluginForDoctor(target) {
|
|
114415
|
-
const release = isPrereleaseVersion("0.2.1
|
|
114463
|
+
const release = isPrereleaseVersion("0.2.1") ? "beta" : "latest";
|
|
114416
114464
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
114417
114465
|
const options = {
|
|
114418
114466
|
restart: !insideTargetGateway,
|
|
@@ -115400,7 +115448,7 @@ async function runDoctor(options = {}) {
|
|
|
115400
115448
|
platform: options.platform ?? process.platform,
|
|
115401
115449
|
env: options.env ?? process.env,
|
|
115402
115450
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
115403
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.1
|
|
115451
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.1" : "0.0.0"),
|
|
115404
115452
|
fixMode: options.fix === true,
|
|
115405
115453
|
nonInteractive: options.nonInteractive === true,
|
|
115406
115454
|
packageChanged: false,
|
|
@@ -116368,7 +116416,7 @@ init_sentry_logger();
|
|
|
116368
116416
|
init_sentry_config();
|
|
116369
116417
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
116370
116418
|
function printUsage3() {
|
|
116371
|
-
console.log(`okx-a2a ${"0.2.1
|
|
116419
|
+
console.log(`okx-a2a ${"0.2.1"}
|
|
116372
116420
|
|
|
116373
116421
|
Usage:
|
|
116374
116422
|
okx-a2a <command> [options]
|
|
@@ -116408,7 +116456,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
116408
116456
|
`);
|
|
116409
116457
|
}
|
|
116410
116458
|
function printVersion() {
|
|
116411
|
-
console.log("0.2.1
|
|
116459
|
+
console.log("0.2.1");
|
|
116412
116460
|
}
|
|
116413
116461
|
function printDaemonUsage() {
|
|
116414
116462
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -117819,7 +117867,7 @@ async function main() {
|
|
|
117819
117867
|
if (command === "xmtp-test") {
|
|
117820
117868
|
const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
|
|
117821
117869
|
await handleXmtpTestCommand2(process.argv.slice(3), {
|
|
117822
|
-
packageVersion: "0.2.1
|
|
117870
|
+
packageVersion: "0.2.1",
|
|
117823
117871
|
agentSdkVersion: "2.3.0",
|
|
117824
117872
|
nodeSdkVersion: "6.1.0",
|
|
117825
117873
|
nodeBindingsVersion: "1.11.0"
|
package/dist/index.js
CHANGED
|
@@ -31149,7 +31149,7 @@ var init_sentry_config = __esm({
|
|
|
31149
31149
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
31150
31150
|
SENTRY_CONFIG = {
|
|
31151
31151
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
31152
|
-
release: "0.2.1
|
|
31152
|
+
release: "0.2.1",
|
|
31153
31153
|
environment,
|
|
31154
31154
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
31155
31155
|
};
|
|
@@ -32079,7 +32079,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
32079
32079
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
32080
32080
|
}
|
|
32081
32081
|
function getBundledNodeCliVersion() {
|
|
32082
|
-
return true ? "0.2.1
|
|
32082
|
+
return true ? "0.2.1" : null;
|
|
32083
32083
|
}
|
|
32084
32084
|
function readConfiguredAiProvider() {
|
|
32085
32085
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -32289,7 +32289,7 @@ async function updateHermes(release, options) {
|
|
|
32289
32289
|
}
|
|
32290
32290
|
}
|
|
32291
32291
|
async function installGatewayPluginForDoctor(target) {
|
|
32292
|
-
const release = isPrereleaseVersion("0.2.1
|
|
32292
|
+
const release = isPrereleaseVersion("0.2.1") ? "beta" : "latest";
|
|
32293
32293
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
32294
32294
|
const options = {
|
|
32295
32295
|
restart: !insideTargetGateway,
|
|
@@ -55035,7 +55035,7 @@ var InboundReplayGate = class {
|
|
|
55035
55035
|
await this.inbound(item.ctx, item.next);
|
|
55036
55036
|
} catch (err) {
|
|
55037
55037
|
this.queue.unshift(item);
|
|
55038
|
-
this.holds
|
|
55038
|
+
this.holds++;
|
|
55039
55039
|
throw err;
|
|
55040
55040
|
}
|
|
55041
55041
|
drained++;
|
|
@@ -55241,6 +55241,12 @@ function parseGroupPayload(content) {
|
|
|
55241
55241
|
function isOfflineReplayForTrigger(trigger) {
|
|
55242
55242
|
return trigger === "startup";
|
|
55243
55243
|
}
|
|
55244
|
+
function replaySingleFlightDiscriminator(trigger, clientGeneration, recoveryIdentity) {
|
|
55245
|
+
if (trigger === "stream_recovery") {
|
|
55246
|
+
return `stream_recovery:${clientGeneration}:${recoveryIdentity ?? "unknown"}`;
|
|
55247
|
+
}
|
|
55248
|
+
return isOfflineReplayForTrigger(trigger) ? `startup_offline:${clientGeneration}` : `online_repair:${clientGeneration}`;
|
|
55249
|
+
}
|
|
55244
55250
|
var XmtpService = class _XmtpService {
|
|
55245
55251
|
static instance = null;
|
|
55246
55252
|
env = process.env.XMTP_ENV ?? "production";
|
|
@@ -55271,6 +55277,10 @@ var XmtpService = class _XmtpService {
|
|
|
55271
55277
|
streamRecoveryCleanupByAddress = /* @__PURE__ */ new Map();
|
|
55272
55278
|
nextClientGeneration = 1;
|
|
55273
55279
|
clientGenerationByClient = /* @__PURE__ */ new WeakMap();
|
|
55280
|
+
resolveStartupReplayCompletion;
|
|
55281
|
+
startupReplayCompletion = new Promise((resolve11) => {
|
|
55282
|
+
this.resolveStartupReplayCompletion = resolve11;
|
|
55283
|
+
});
|
|
55274
55284
|
agentListFingerprint;
|
|
55275
55285
|
// Only one refreshAgents can be in flight at a time; concurrent calls
|
|
55276
55286
|
// coalesce onto the same promise. This avoids duplicate Agent.create()
|
|
@@ -55899,9 +55909,15 @@ var XmtpService = class _XmtpService {
|
|
|
55899
55909
|
logWithTimestamp(
|
|
55900
55910
|
`[xmtp-sdk] refresh: ${address} has a prior sync timestamp, triggering offline replay`
|
|
55901
55911
|
);
|
|
55912
|
+
const expectedClient = this.clients.get(address) ?? null;
|
|
55913
|
+
const expectedGate = this.inboundReplayGates.get(
|
|
55914
|
+
address.toLowerCase()
|
|
55915
|
+
);
|
|
55902
55916
|
void this.replayOfflineMessagesForAddressSingleFlight(
|
|
55903
55917
|
address,
|
|
55904
|
-
"agent_refresh"
|
|
55918
|
+
"agent_refresh",
|
|
55919
|
+
void 0,
|
|
55920
|
+
expectedClient
|
|
55905
55921
|
).catch((err) => {
|
|
55906
55922
|
logWithTimestamp(`[xmtp-sdk] refresh: ${address} offline replay failed:`, err);
|
|
55907
55923
|
logger.error(
|
|
@@ -55912,7 +55928,7 @@ var XmtpService = class _XmtpService {
|
|
|
55912
55928
|
stage: "refreshAgents/replay"
|
|
55913
55929
|
}
|
|
55914
55930
|
);
|
|
55915
|
-
}).then(() => this.drainInboundReplayGate(address)).catch((err) => {
|
|
55931
|
+
}).then(() => this.drainInboundReplayGate(address, expectedGate)).catch((err) => {
|
|
55916
55932
|
logWithTimestamp(`[xmtp-sdk] refresh: ${address} replay gate drain failed:`, err);
|
|
55917
55933
|
});
|
|
55918
55934
|
}
|
|
@@ -56001,14 +56017,17 @@ var XmtpService = class _XmtpService {
|
|
|
56001
56017
|
phase: "recycle"
|
|
56002
56018
|
});
|
|
56003
56019
|
await this.startListeningForAddresses([address]);
|
|
56020
|
+
const replayGate = this.inboundReplayGates.get(addressKey);
|
|
56004
56021
|
let replaySummary;
|
|
56005
56022
|
try {
|
|
56006
56023
|
replaySummary = await this.replayOfflineMessagesForAddressSingleFlight(
|
|
56007
56024
|
address,
|
|
56008
|
-
"client_recycle"
|
|
56025
|
+
"client_recycle",
|
|
56026
|
+
void 0,
|
|
56027
|
+
agent
|
|
56009
56028
|
);
|
|
56010
56029
|
} finally {
|
|
56011
|
-
await this.drainInboundReplayGate(address);
|
|
56030
|
+
await this.drainInboundReplayGate(address, replayGate);
|
|
56012
56031
|
}
|
|
56013
56032
|
addresses.push(replaySummary);
|
|
56014
56033
|
replayed += replaySummary.replayed;
|
|
@@ -56418,8 +56437,11 @@ var XmtpService = class _XmtpService {
|
|
|
56418
56437
|
await this.startListeningForAddresses([...this.clients.keys()]);
|
|
56419
56438
|
}
|
|
56420
56439
|
async drainInboundReplayGate(address, expectedGate) {
|
|
56440
|
+
if (!expectedGate) {
|
|
56441
|
+
return 0;
|
|
56442
|
+
}
|
|
56421
56443
|
const gate = this.inboundReplayGates.get(address.toLowerCase());
|
|
56422
|
-
if (!gate ||
|
|
56444
|
+
if (!gate || gate !== expectedGate) {
|
|
56423
56445
|
return 0;
|
|
56424
56446
|
}
|
|
56425
56447
|
let attempt = 0;
|
|
@@ -56524,10 +56546,18 @@ var XmtpService = class _XmtpService {
|
|
|
56524
56546
|
* cannot overtake the stored backlog.
|
|
56525
56547
|
*/
|
|
56526
56548
|
async completeStartupReplay() {
|
|
56549
|
+
const startupGates = new Map(
|
|
56550
|
+
[...this.clients.keys()].map((address) => [
|
|
56551
|
+
address,
|
|
56552
|
+
this.inboundReplayGates.get(address.toLowerCase())
|
|
56553
|
+
])
|
|
56554
|
+
);
|
|
56527
56555
|
const summary = await this.replayOfflineMessages("startup");
|
|
56528
|
-
for (const address of
|
|
56529
|
-
await this.drainInboundReplayGate(address);
|
|
56556
|
+
for (const [address, expectedGate] of startupGates) {
|
|
56557
|
+
await this.drainInboundReplayGate(address, expectedGate);
|
|
56530
56558
|
}
|
|
56559
|
+
this.resolveStartupReplayCompletion?.();
|
|
56560
|
+
this.resolveStartupReplayCompletion = void 0;
|
|
56531
56561
|
this.notifyAgentsWakeupAfterReplay();
|
|
56532
56562
|
return summary;
|
|
56533
56563
|
}
|
|
@@ -56717,10 +56747,10 @@ var XmtpService = class _XmtpService {
|
|
|
56717
56747
|
});
|
|
56718
56748
|
void (async () => {
|
|
56719
56749
|
try {
|
|
56720
|
-
const summary = await this.
|
|
56750
|
+
const summary = await this.replayOfflineMessagesForStreamRecovery(
|
|
56721
56751
|
address,
|
|
56722
|
-
|
|
56723
|
-
|
|
56752
|
+
String(recovery.recoverySequence),
|
|
56753
|
+
agent
|
|
56724
56754
|
);
|
|
56725
56755
|
if (!recoveryDisposed && this.clients.get(address) === agent) {
|
|
56726
56756
|
logger.info(LogEvent.AGENT_STREAM_RECOVERY_REPLAY_COMPLETED, {
|
|
@@ -56781,12 +56811,12 @@ var XmtpService = class _XmtpService {
|
|
|
56781
56811
|
logWithTimestamp(`${tag} message listener started`);
|
|
56782
56812
|
});
|
|
56783
56813
|
}
|
|
56784
|
-
async replayOfflineMessagesForAddress(address, trigger = "periodic_repair") {
|
|
56814
|
+
async replayOfflineMessagesForAddress(address, expectedClient, trigger = "periodic_repair") {
|
|
56785
56815
|
const addressReplayStartedAt = Date.now();
|
|
56786
56816
|
const summary = createOfflineReplayAddressSummary(address);
|
|
56787
56817
|
const isOfflineReplay = isOfflineReplayForTrigger(trigger);
|
|
56788
56818
|
const agent = this.clients.get(address);
|
|
56789
|
-
if (!agent) {
|
|
56819
|
+
if (!agent || agent !== expectedClient) {
|
|
56790
56820
|
summary.durationMs = Date.now() - addressReplayStartedAt;
|
|
56791
56821
|
return summary;
|
|
56792
56822
|
}
|
|
@@ -56991,17 +57021,35 @@ var XmtpService = class _XmtpService {
|
|
|
56991
57021
|
);
|
|
56992
57022
|
return summary;
|
|
56993
57023
|
}
|
|
56994
|
-
replayOfflineMessagesForAddressSingleFlight(address, trigger = "periodic_repair", recoveryIdentity) {
|
|
56995
|
-
const
|
|
57024
|
+
replayOfflineMessagesForAddressSingleFlight(address, trigger = "periodic_repair", recoveryIdentity, expectedClient = this.clients.get(address) ?? null) {
|
|
57025
|
+
const clientGeneration = expectedClient ? this.getClientGeneration(expectedClient) : "missing";
|
|
57026
|
+
const eligibilityClass = replaySingleFlightDiscriminator(
|
|
57027
|
+
trigger,
|
|
57028
|
+
clientGeneration,
|
|
57029
|
+
recoveryIdentity
|
|
57030
|
+
);
|
|
56996
57031
|
return this.offlineReplaySingleFlight.run(
|
|
56997
57032
|
address,
|
|
56998
57033
|
eligibilityClass,
|
|
56999
57034
|
async () => {
|
|
57000
57035
|
await this._backupReady;
|
|
57001
|
-
return this.replayOfflineMessagesForAddress(
|
|
57036
|
+
return this.replayOfflineMessagesForAddress(
|
|
57037
|
+
address,
|
|
57038
|
+
expectedClient,
|
|
57039
|
+
trigger
|
|
57040
|
+
);
|
|
57002
57041
|
}
|
|
57003
57042
|
);
|
|
57004
57043
|
}
|
|
57044
|
+
async replayOfflineMessagesForStreamRecovery(address, recoveryIdentity, expectedClient) {
|
|
57045
|
+
await this.startupReplayCompletion;
|
|
57046
|
+
return this.replayOfflineMessagesForAddressSingleFlight(
|
|
57047
|
+
address,
|
|
57048
|
+
"stream_recovery",
|
|
57049
|
+
recoveryIdentity,
|
|
57050
|
+
expectedClient
|
|
57051
|
+
);
|
|
57052
|
+
}
|
|
57005
57053
|
async replayOfflineMessages(trigger = "periodic_repair") {
|
|
57006
57054
|
await this._backupReady;
|
|
57007
57055
|
const replayStartedAt = Date.now();
|
|
@@ -58863,7 +58911,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
58863
58911
|
client: {
|
|
58864
58912
|
id: "gateway-client",
|
|
58865
58913
|
displayName: "okx-a2a-node",
|
|
58866
|
-
version: "0.2.1
|
|
58914
|
+
version: "0.2.1",
|
|
58867
58915
|
platform: "node",
|
|
58868
58916
|
mode: "backend",
|
|
58869
58917
|
instanceId
|
|
@@ -58874,7 +58922,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
58874
58922
|
commands: [],
|
|
58875
58923
|
permissions: {},
|
|
58876
58924
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
58877
|
-
userAgent: `okx-a2a-node/${"0.2.1
|
|
58925
|
+
userAgent: `okx-a2a-node/${"0.2.1"}`,
|
|
58878
58926
|
auth: {
|
|
58879
58927
|
...config.token ? { token: config.token } : {},
|
|
58880
58928
|
...config.password ? { password: config.password } : {}
|
|
@@ -64872,12 +64920,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
64872
64920
|
});
|
|
64873
64921
|
}
|
|
64874
64922
|
});
|
|
64875
|
-
service.setPluginVersion("0.2.1
|
|
64923
|
+
service.setPluginVersion("0.2.1");
|
|
64876
64924
|
await service.init();
|
|
64877
64925
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
64878
64926
|
if (pluginVersionStatus.unavailable) {
|
|
64879
64927
|
throw new Error(
|
|
64880
|
-
`@okxweb3/a2a-node v${"0.2.1
|
|
64928
|
+
`@okxweb3/a2a-node v${"0.2.1"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
64881
64929
|
);
|
|
64882
64930
|
}
|
|
64883
64931
|
const systemConfig = service.getSystemConfig();
|
|
@@ -64895,7 +64943,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
64895
64943
|
onchainosAgentId: "*",
|
|
64896
64944
|
reason: "system-config missing sentryDsn",
|
|
64897
64945
|
pluginId: "@okxweb3/a2a-node",
|
|
64898
|
-
pluginVersion: "0.2.1
|
|
64946
|
+
pluginVersion: "0.2.1"
|
|
64899
64947
|
});
|
|
64900
64948
|
}
|
|
64901
64949
|
logWithTimestamp(
|
|
@@ -67515,7 +67563,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
67515
67563
|
node: process.version,
|
|
67516
67564
|
platform: process.platform,
|
|
67517
67565
|
arch: process.arch,
|
|
67518
|
-
packageVersion: true ? "0.2.1
|
|
67566
|
+
packageVersion: true ? "0.2.1" : "unknown",
|
|
67519
67567
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
67520
67568
|
listenerAndLlmContentIncluded: true,
|
|
67521
67569
|
credentialsAlwaysRedacted: true,
|
|
@@ -69240,7 +69288,7 @@ async function runDoctor(options = {}) {
|
|
|
69240
69288
|
platform: options.platform ?? process.platform,
|
|
69241
69289
|
env: options.env ?? process.env,
|
|
69242
69290
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
69243
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.1
|
|
69291
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.1" : "0.0.0"),
|
|
69244
69292
|
fixMode: options.fix === true,
|
|
69245
69293
|
nonInteractive: options.nonInteractive === true,
|
|
69246
69294
|
packageChanged: false,
|
package/package.json
CHANGED