@okxweb3/a2a-node 0.0.4 → 0.0.5
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 +90 -30
- package/dist/index.js +83 -30
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -230,7 +230,7 @@ function assertAiProvider(provider) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
function isAiProvider(provider) {
|
|
233
|
-
return provider === "codex" || provider === "claude"
|
|
233
|
+
return provider === "codex" || provider === "claude";
|
|
234
234
|
}
|
|
235
235
|
function normalizeLimit(limit, fallback) {
|
|
236
236
|
if (limit === void 0) {
|
|
@@ -2170,8 +2170,6 @@ function detectAiProviders(commandExists2 = commandExists, env = process.env) {
|
|
|
2170
2170
|
return {
|
|
2171
2171
|
codex,
|
|
2172
2172
|
claude,
|
|
2173
|
-
openclaw: false,
|
|
2174
|
-
hermes: false,
|
|
2175
2173
|
available: [
|
|
2176
2174
|
...codex ? ["codex"] : [],
|
|
2177
2175
|
...claude ? ["claude"] : []
|
|
@@ -18251,7 +18249,6 @@ var init_sentry_logger = __esm({
|
|
|
18251
18249
|
Sentry.captureEvent({
|
|
18252
18250
|
level: "info",
|
|
18253
18251
|
message,
|
|
18254
|
-
contexts: { report: { info: JSON.stringify(extraWithFlow) } },
|
|
18255
18252
|
extra: {
|
|
18256
18253
|
...extraWithFlow,
|
|
18257
18254
|
eventName: message
|
|
@@ -18275,7 +18272,6 @@ var init_sentry_logger = __esm({
|
|
|
18275
18272
|
try {
|
|
18276
18273
|
Sentry.withScope((scope) => {
|
|
18277
18274
|
scope.setLevel("error");
|
|
18278
|
-
scope.setContext("report", { info: JSON.stringify(extraWithFlow) });
|
|
18279
18275
|
_SentryLogger.applyDiagnostics(scope, message, extraWithFlow);
|
|
18280
18276
|
Sentry.captureException(_SentryLogger.createSentryEvent(message), {
|
|
18281
18277
|
extra: error ? {
|
|
@@ -18421,7 +18417,7 @@ var init_sentry_config = __esm({
|
|
|
18421
18417
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
18422
18418
|
SENTRY_CONFIG = {
|
|
18423
18419
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
18424
|
-
release: "0.0.
|
|
18420
|
+
release: "0.0.5",
|
|
18425
18421
|
environment
|
|
18426
18422
|
};
|
|
18427
18423
|
}
|
|
@@ -63242,6 +63238,44 @@ var init_dist4 = __esm({
|
|
|
63242
63238
|
}
|
|
63243
63239
|
});
|
|
63244
63240
|
|
|
63241
|
+
// ../core/src/xmtp-sdk/extract-job-id.ts
|
|
63242
|
+
function extractJobIdFromContent(content3) {
|
|
63243
|
+
const raw = typeof content3 === "string" ? content3 : JSON.stringify(content3) ?? "";
|
|
63244
|
+
if (!raw) {
|
|
63245
|
+
return "";
|
|
63246
|
+
}
|
|
63247
|
+
let parsed;
|
|
63248
|
+
try {
|
|
63249
|
+
parsed = JSON.parse(raw);
|
|
63250
|
+
} catch {
|
|
63251
|
+
return "";
|
|
63252
|
+
}
|
|
63253
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
63254
|
+
return "";
|
|
63255
|
+
}
|
|
63256
|
+
const payload = parsed;
|
|
63257
|
+
if (typeof payload.jobId === "string" && payload.jobId) {
|
|
63258
|
+
return payload.jobId;
|
|
63259
|
+
}
|
|
63260
|
+
const message = payload.message;
|
|
63261
|
+
if (message && typeof message === "object" && !Array.isArray(message)) {
|
|
63262
|
+
const jobId = message.jobId;
|
|
63263
|
+
if (typeof jobId === "string" && jobId) {
|
|
63264
|
+
return jobId;
|
|
63265
|
+
}
|
|
63266
|
+
}
|
|
63267
|
+
return "";
|
|
63268
|
+
}
|
|
63269
|
+
function jobIdExtras(content3) {
|
|
63270
|
+
const jobId = extractJobIdFromContent(content3);
|
|
63271
|
+
return jobId ? { taskId: jobId } : {};
|
|
63272
|
+
}
|
|
63273
|
+
var init_extract_job_id = __esm({
|
|
63274
|
+
"../core/src/xmtp-sdk/extract-job-id.ts"() {
|
|
63275
|
+
"use strict";
|
|
63276
|
+
}
|
|
63277
|
+
});
|
|
63278
|
+
|
|
63245
63279
|
// ../core/src/xmtp-sdk/middleware/self-filter.ts
|
|
63246
63280
|
function selfFilterMiddleware() {
|
|
63247
63281
|
return async (ctx, next) => {
|
|
@@ -63270,9 +63304,11 @@ function loggingMiddleware(identity3) {
|
|
|
63270
63304
|
const contentSummary = summarizeMessageContent(msg.content);
|
|
63271
63305
|
const baseExtras = {
|
|
63272
63306
|
...agentExtras(identity3),
|
|
63307
|
+
...jobIdExtras(msg.content),
|
|
63273
63308
|
peerInboxId: msg.senderInboxId,
|
|
63274
63309
|
conversationId,
|
|
63275
|
-
messageId: msg.id
|
|
63310
|
+
messageId: msg.id,
|
|
63311
|
+
stage: "inbound/transport_received"
|
|
63276
63312
|
};
|
|
63277
63313
|
if (conv instanceof Group) {
|
|
63278
63314
|
const groupName = conv.name ?? "unnamed";
|
|
@@ -63354,6 +63390,7 @@ var init_logging = __esm({
|
|
|
63354
63390
|
"use strict";
|
|
63355
63391
|
init_dist4();
|
|
63356
63392
|
init_sentry_logger();
|
|
63393
|
+
init_extract_job_id();
|
|
63357
63394
|
}
|
|
63358
63395
|
});
|
|
63359
63396
|
|
|
@@ -77541,6 +77578,7 @@ var init_xmtp_sdk = __esm({
|
|
|
77541
77578
|
import_node_path11 = require("node:path");
|
|
77542
77579
|
init_dist4();
|
|
77543
77580
|
init_sentry_logger();
|
|
77581
|
+
init_extract_job_id();
|
|
77544
77582
|
init_self_filter();
|
|
77545
77583
|
init_logging();
|
|
77546
77584
|
init_sensitive_word();
|
|
@@ -78741,8 +78779,10 @@ var init_xmtp_sdk = __esm({
|
|
|
78741
78779
|
inboxId: agent.client?.inboxId,
|
|
78742
78780
|
onchainosAgentId: this.getAgentByAddress(address)?.agentId
|
|
78743
78781
|
}),
|
|
78782
|
+
...jobIdExtras(msg.content),
|
|
78744
78783
|
messageId: msg.id,
|
|
78745
|
-
conversationId: conv.id
|
|
78784
|
+
conversationId: conv.id,
|
|
78785
|
+
stage: "offlineReplay/handleMessage"
|
|
78746
78786
|
});
|
|
78747
78787
|
} else {
|
|
78748
78788
|
summary.skipped++;
|
|
@@ -78754,8 +78794,11 @@ var init_xmtp_sdk = __esm({
|
|
|
78754
78794
|
err2 instanceof Error ? err2 : void 0,
|
|
78755
78795
|
{
|
|
78756
78796
|
walletAddress: address,
|
|
78797
|
+
...jobIdExtras(msg.content),
|
|
78757
78798
|
messageId: msg.id,
|
|
78758
|
-
conversationId: conv.id
|
|
78799
|
+
conversationId: conv.id,
|
|
78800
|
+
stage: "offlineReplay/handleMessage",
|
|
78801
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error"
|
|
78759
78802
|
}
|
|
78760
78803
|
);
|
|
78761
78804
|
} finally {
|
|
@@ -78774,6 +78817,8 @@ var init_xmtp_sdk = __esm({
|
|
|
78774
78817
|
err2 instanceof Error ? err2 : void 0,
|
|
78775
78818
|
{
|
|
78776
78819
|
walletAddress: address,
|
|
78820
|
+
stage: "offlineReplay/readConversation",
|
|
78821
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error",
|
|
78777
78822
|
conversationId: conv.id
|
|
78778
78823
|
}
|
|
78779
78824
|
);
|
|
@@ -79185,7 +79230,7 @@ async function checkMessageEligible(params) {
|
|
|
79185
79230
|
]));
|
|
79186
79231
|
} catch (err2) {
|
|
79187
79232
|
guardCatchSessionExpired(err2, "message-eligible");
|
|
79188
|
-
|
|
79233
|
+
throw new Error("message-eligible-cli-error", { cause: err2 });
|
|
79189
79234
|
}
|
|
79190
79235
|
if (stderr) {
|
|
79191
79236
|
console.log(`[onchainos] stderr (message-eligible): ${stderr}`);
|
|
@@ -79203,13 +79248,13 @@ async function checkMessageEligible(params) {
|
|
|
79203
79248
|
direction: params.direction,
|
|
79204
79249
|
providerSecurityRate: String(params.providerSecurityRate)
|
|
79205
79250
|
});
|
|
79206
|
-
} catch {
|
|
79207
|
-
|
|
79251
|
+
} catch (err2) {
|
|
79252
|
+
throw new Error("message-eligible-json-parse-failed", { cause: err2 });
|
|
79208
79253
|
}
|
|
79209
79254
|
if (!res.ok) {
|
|
79210
79255
|
guardSessionExpired(stdout, "message-eligible");
|
|
79211
79256
|
console.warn(
|
|
79212
|
-
`[onchainos] message-eligible ok=false
|
|
79257
|
+
`[onchainos] message-eligible ok=false: ${stdout.slice(0, 200)}`
|
|
79213
79258
|
);
|
|
79214
79259
|
logger.error(
|
|
79215
79260
|
LogEvent.ONCHAINOS_CLI_ERROR,
|
|
@@ -79228,7 +79273,7 @@ async function checkMessageEligible(params) {
|
|
|
79228
79273
|
reason: "ok=false"
|
|
79229
79274
|
})
|
|
79230
79275
|
);
|
|
79231
|
-
|
|
79276
|
+
throw new Error("message-eligible-ok-false");
|
|
79232
79277
|
}
|
|
79233
79278
|
console.log(
|
|
79234
79279
|
`[onchainos] message-eligible result: eligible=${res.data.eligible}`
|
|
@@ -80028,10 +80073,10 @@ async function assertOutboundEligible(params) {
|
|
|
80028
80073
|
});
|
|
80029
80074
|
} catch (err2) {
|
|
80030
80075
|
console.log(
|
|
80031
|
-
`[okx-agent-task] outbound message-eligible call failed,
|
|
80076
|
+
`[okx-agent-task] outbound message-eligible call failed, letting send continue: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
|
|
80032
80077
|
err2
|
|
80033
80078
|
);
|
|
80034
|
-
|
|
80079
|
+
return;
|
|
80035
80080
|
}
|
|
80036
80081
|
console.log(
|
|
80037
80082
|
`[okx-agent-task] outbound message-eligible: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId} result=${JSON.stringify(result)}`
|
|
@@ -80732,7 +80777,8 @@ function buildAiAdapterCommand(options) {
|
|
|
80732
80777
|
args: options.sessionId ? [...prefix, "resume", "--json", "--skip-git-repo-check", options.sessionId, options.prompt] : [...prefix, "--json", "--skip-git-repo-check", options.prompt]
|
|
80733
80778
|
};
|
|
80734
80779
|
}
|
|
80735
|
-
|
|
80780
|
+
const dormantProvider = options.provider;
|
|
80781
|
+
if (dormantProvider === "openclaw") {
|
|
80736
80782
|
const agentId = env.OKX_A2A_AI_OPENCLAW_AGENT_ID || "okx-a2a";
|
|
80737
80783
|
const sessionArgs = options.sessionId ? ["--session-id", options.sessionId] : options.sessionKey ? ["--session-key", formatOpenClawSessionKey(options.sessionKey, agentId)] : [];
|
|
80738
80784
|
return {
|
|
@@ -80741,7 +80787,7 @@ function buildAiAdapterCommand(options) {
|
|
|
80741
80787
|
args: ["agent", ...sessionArgs, "--message", options.prompt, "--json"]
|
|
80742
80788
|
};
|
|
80743
80789
|
}
|
|
80744
|
-
if (
|
|
80790
|
+
if (dormantProvider === "hermes") {
|
|
80745
80791
|
return {
|
|
80746
80792
|
provider: options.provider,
|
|
80747
80793
|
command,
|
|
@@ -83910,7 +83956,8 @@ async function isTrustedDmSender(params) {
|
|
|
83910
83956
|
peerInboxId: senderInboxId,
|
|
83911
83957
|
messageId,
|
|
83912
83958
|
conversationId,
|
|
83913
|
-
chatType: "dm"
|
|
83959
|
+
chatType: "dm",
|
|
83960
|
+
stage: "inbound/dm_trust_check"
|
|
83914
83961
|
});
|
|
83915
83962
|
const matches = (ids) => {
|
|
83916
83963
|
if (ids.length === 0) {
|
|
@@ -83925,11 +83972,11 @@ async function isTrustedDmSender(params) {
|
|
|
83925
83972
|
trustedInboxIds = svc.getTrustedDmInboxIds();
|
|
83926
83973
|
}
|
|
83927
83974
|
if (trustedInboxIds.length === 0) {
|
|
83928
|
-
logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, dmExtras());
|
|
83975
|
+
logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, { ...dmExtras(), reason: "trusted_inbox_list_empty" });
|
|
83929
83976
|
return true;
|
|
83930
83977
|
}
|
|
83931
83978
|
if (!matches(trustedInboxIds)) {
|
|
83932
|
-
logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, dmExtras());
|
|
83979
|
+
logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, { ...dmExtras(), reason: "sender_not_in_system_whitelist" });
|
|
83933
83980
|
console.log(
|
|
83934
83981
|
`[okx-agent-task:${myXmtpAddress}] DM sender not in system whitelist, dropping: senderInboxId=${senderInboxId || "(empty)"}`
|
|
83935
83982
|
);
|
|
@@ -83976,7 +84023,9 @@ async function claimedAddressMatchesSender(params) {
|
|
|
83976
84023
|
peerInboxId: senderInboxId,
|
|
83977
84024
|
taskId: "",
|
|
83978
84025
|
conversationId,
|
|
83979
|
-
messageId
|
|
84026
|
+
messageId,
|
|
84027
|
+
stage: "inbound/address_check",
|
|
84028
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error"
|
|
83980
84029
|
}
|
|
83981
84030
|
);
|
|
83982
84031
|
return false;
|
|
@@ -84025,6 +84074,7 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
84025
84074
|
conversationId: groupId,
|
|
84026
84075
|
messageId,
|
|
84027
84076
|
action: "auto-deny",
|
|
84077
|
+
stage: "inbound/address_check",
|
|
84028
84078
|
reason: "claimed-address-mismatch"
|
|
84029
84079
|
});
|
|
84030
84080
|
}
|
|
@@ -84040,6 +84090,8 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
84040
84090
|
conversationId: groupId,
|
|
84041
84091
|
messageId,
|
|
84042
84092
|
consentState: String(consentState ?? ""),
|
|
84093
|
+
stage: "inbound/address_check",
|
|
84094
|
+
reason: "claimed_address_mismatch",
|
|
84043
84095
|
action: autoDenyAttempted ? "auto-deny" : "drop",
|
|
84044
84096
|
autoDenyAttempted: String(autoDenyAttempted),
|
|
84045
84097
|
autoDenySucceeded: String(autoDenySucceeded),
|
|
@@ -84084,16 +84136,17 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
84084
84136
|
messageId,
|
|
84085
84137
|
direction: isSenderClient ? "client_to_provider" : "provider_to_client",
|
|
84086
84138
|
providerSecurityRate: String(providerSecurityRate),
|
|
84139
|
+
stage: "inbound/eligibility_check",
|
|
84087
84140
|
reason: result.reason ?? ""
|
|
84088
84141
|
});
|
|
84089
84142
|
return false;
|
|
84090
84143
|
}
|
|
84091
84144
|
} catch (err2) {
|
|
84092
84145
|
console.log(
|
|
84093
|
-
`[okx-agent-task:${myXmtpAddress}] message-eligible call failed,
|
|
84146
|
+
`[okx-agent-task:${myXmtpAddress}] message-eligible call failed, letting message through:`,
|
|
84094
84147
|
err2
|
|
84095
84148
|
);
|
|
84096
|
-
logger.
|
|
84149
|
+
logger.error(LogEvent.INBOUND_ELIGIBILITY_BYPASSED, err2 instanceof Error ? err2 : new Error(String(err2)), {
|
|
84097
84150
|
...agentExtras({ walletAddress: myXmtpAddress, onchainosAgentId: myAgent.agentId }),
|
|
84098
84151
|
peerWalletAddress: senderAddress,
|
|
84099
84152
|
peerInboxId: senderInboxId,
|
|
@@ -84103,9 +84156,10 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
84103
84156
|
messageId,
|
|
84104
84157
|
direction: isSenderClient ? "client_to_provider" : "provider_to_client",
|
|
84105
84158
|
providerSecurityRate: String(providerSecurityRate),
|
|
84159
|
+
stage: "inbound/eligibility_check",
|
|
84106
84160
|
reason: "exception"
|
|
84107
84161
|
});
|
|
84108
|
-
return
|
|
84162
|
+
return true;
|
|
84109
84163
|
}
|
|
84110
84164
|
return true;
|
|
84111
84165
|
}
|
|
@@ -84139,7 +84193,9 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
84139
84193
|
{
|
|
84140
84194
|
...agentExtras({ walletAddress: deps.myXmtpAddress }),
|
|
84141
84195
|
taskId: systemNotification.jobId ?? "",
|
|
84142
|
-
messageId: systemMessageId
|
|
84196
|
+
messageId: systemMessageId,
|
|
84197
|
+
stage: "inbound/payload_parse",
|
|
84198
|
+
reason: "system_dm_missing_agent_id"
|
|
84143
84199
|
}
|
|
84144
84200
|
);
|
|
84145
84201
|
}
|
|
@@ -84202,7 +84258,9 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
84202
84258
|
messageId,
|
|
84203
84259
|
chatType: "group",
|
|
84204
84260
|
msgType: readString2(payloadObject?.msgType) ?? "",
|
|
84205
|
-
msgTypeType: typeof payloadObject?.msgType
|
|
84261
|
+
msgTypeType: typeof payloadObject?.msgType,
|
|
84262
|
+
stage: "inbound/payload_parse",
|
|
84263
|
+
reason: "unsupported_msg_type"
|
|
84206
84264
|
});
|
|
84207
84265
|
return true;
|
|
84208
84266
|
}
|
|
@@ -84634,12 +84692,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
84634
84692
|
}));
|
|
84635
84693
|
}
|
|
84636
84694
|
});
|
|
84637
|
-
service.setPluginVersion("0.0.
|
|
84695
|
+
service.setPluginVersion("0.0.5");
|
|
84638
84696
|
await service.init();
|
|
84639
84697
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
84640
84698
|
if (pluginVersionStatus.unavailable) {
|
|
84641
84699
|
throw new Error(
|
|
84642
|
-
`@okxweb3/a2a-node v${"0.0.
|
|
84700
|
+
`@okxweb3/a2a-node v${"0.0.5"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
84643
84701
|
);
|
|
84644
84702
|
}
|
|
84645
84703
|
const systemConfig = service.getSystemConfig();
|
|
@@ -84657,7 +84715,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
84657
84715
|
onchainosAgentId: "*",
|
|
84658
84716
|
reason: "system-config missing sentryDsn",
|
|
84659
84717
|
pluginId: "@okxweb3/a2a-node",
|
|
84660
|
-
pluginVersion: "0.0.
|
|
84718
|
+
pluginVersion: "0.0.5"
|
|
84661
84719
|
});
|
|
84662
84720
|
}
|
|
84663
84721
|
console.log(
|
|
@@ -84690,6 +84748,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
84690
84748
|
logger.error(LogEvent.HEARTBEAT_FAILED, heartbeatResult.error instanceof Error ? heartbeatResult.error : new Error(String(heartbeatResult.error)), {
|
|
84691
84749
|
component: "node_listener",
|
|
84692
84750
|
stage: "sync_tick",
|
|
84751
|
+
reason: heartbeatResult.error instanceof Error ? heartbeatResult.error.name : "unknown_error",
|
|
84693
84752
|
durationMs: String(heartbeatMs),
|
|
84694
84753
|
chainIndex: ONCHAINOS_CHAIN_INDEX,
|
|
84695
84754
|
communicationClass: "onchainos_or_network"
|
|
@@ -84700,6 +84759,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
84700
84759
|
logger.error(LogEvent.OFFLINE_REPLAY_FAILED, replayResult.error instanceof Error ? replayResult.error : new Error(String(replayResult.error)), {
|
|
84701
84760
|
component: "node_listener",
|
|
84702
84761
|
stage: "sync_tick",
|
|
84762
|
+
reason: replayResult.error instanceof Error ? replayResult.error.name : "unknown_error",
|
|
84703
84763
|
durationMs: String(replayMs),
|
|
84704
84764
|
communicationClass: "xmtp_replay_or_storage"
|
|
84705
84765
|
});
|
package/dist/index.js
CHANGED
|
@@ -65259,7 +65259,7 @@ function assertAiProvider(provider) {
|
|
|
65259
65259
|
}
|
|
65260
65260
|
}
|
|
65261
65261
|
function isAiProvider(provider) {
|
|
65262
|
-
return provider === "codex" || provider === "claude"
|
|
65262
|
+
return provider === "codex" || provider === "claude";
|
|
65263
65263
|
}
|
|
65264
65264
|
function normalizeLimit(limit, fallback) {
|
|
65265
65265
|
if (limit === void 0) {
|
|
@@ -66120,8 +66120,6 @@ function detectAiProviders(commandExists2 = commandExists, env = process.env) {
|
|
|
66120
66120
|
return {
|
|
66121
66121
|
codex,
|
|
66122
66122
|
claude,
|
|
66123
|
-
openclaw: false,
|
|
66124
|
-
hermes: false,
|
|
66125
66123
|
available: [
|
|
66126
66124
|
...codex ? ["codex"] : [],
|
|
66127
66125
|
...claude ? ["claude"] : []
|
|
@@ -66937,7 +66935,6 @@ var SentryLogger = class _SentryLogger {
|
|
|
66937
66935
|
Sentry.captureEvent({
|
|
66938
66936
|
level: "info",
|
|
66939
66937
|
message,
|
|
66940
|
-
contexts: { report: { info: JSON.stringify(extraWithFlow) } },
|
|
66941
66938
|
extra: {
|
|
66942
66939
|
...extraWithFlow,
|
|
66943
66940
|
eventName: message
|
|
@@ -66961,7 +66958,6 @@ var SentryLogger = class _SentryLogger {
|
|
|
66961
66958
|
try {
|
|
66962
66959
|
Sentry.withScope((scope) => {
|
|
66963
66960
|
scope.setLevel("error");
|
|
66964
|
-
scope.setContext("report", { info: JSON.stringify(extraWithFlow) });
|
|
66965
66961
|
_SentryLogger.applyDiagnostics(scope, message, extraWithFlow);
|
|
66966
66962
|
Sentry.captureException(_SentryLogger.createSentryEvent(message), {
|
|
66967
66963
|
extra: error ? {
|
|
@@ -67177,7 +67173,8 @@ function buildAiAdapterCommand(options) {
|
|
|
67177
67173
|
args: options.sessionId ? [...prefix, "resume", "--json", "--skip-git-repo-check", options.sessionId, options.prompt] : [...prefix, "--json", "--skip-git-repo-check", options.prompt]
|
|
67178
67174
|
};
|
|
67179
67175
|
}
|
|
67180
|
-
|
|
67176
|
+
const dormantProvider = options.provider;
|
|
67177
|
+
if (dormantProvider === "openclaw") {
|
|
67181
67178
|
const agentId = env.OKX_A2A_AI_OPENCLAW_AGENT_ID || "okx-a2a";
|
|
67182
67179
|
const sessionArgs = options.sessionId ? ["--session-id", options.sessionId] : options.sessionKey ? ["--session-key", formatOpenClawSessionKey(options.sessionKey, agentId)] : [];
|
|
67183
67180
|
return {
|
|
@@ -67186,7 +67183,7 @@ function buildAiAdapterCommand(options) {
|
|
|
67186
67183
|
args: ["agent", ...sessionArgs, "--message", options.prompt, "--json"]
|
|
67187
67184
|
};
|
|
67188
67185
|
}
|
|
67189
|
-
if (
|
|
67186
|
+
if (dormantProvider === "hermes") {
|
|
67190
67187
|
return {
|
|
67191
67188
|
provider: options.provider,
|
|
67192
67189
|
command,
|
|
@@ -72140,6 +72137,39 @@ var Client = class _Client {
|
|
|
72140
72137
|
var import_node_fs9 = require("node:fs");
|
|
72141
72138
|
var import_node_path14 = require("node:path");
|
|
72142
72139
|
|
|
72140
|
+
// ../core/src/xmtp-sdk/extract-job-id.ts
|
|
72141
|
+
function extractJobIdFromContent(content3) {
|
|
72142
|
+
const raw = typeof content3 === "string" ? content3 : JSON.stringify(content3) ?? "";
|
|
72143
|
+
if (!raw) {
|
|
72144
|
+
return "";
|
|
72145
|
+
}
|
|
72146
|
+
let parsed;
|
|
72147
|
+
try {
|
|
72148
|
+
parsed = JSON.parse(raw);
|
|
72149
|
+
} catch {
|
|
72150
|
+
return "";
|
|
72151
|
+
}
|
|
72152
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
72153
|
+
return "";
|
|
72154
|
+
}
|
|
72155
|
+
const payload = parsed;
|
|
72156
|
+
if (typeof payload.jobId === "string" && payload.jobId) {
|
|
72157
|
+
return payload.jobId;
|
|
72158
|
+
}
|
|
72159
|
+
const message = payload.message;
|
|
72160
|
+
if (message && typeof message === "object" && !Array.isArray(message)) {
|
|
72161
|
+
const jobId = message.jobId;
|
|
72162
|
+
if (typeof jobId === "string" && jobId) {
|
|
72163
|
+
return jobId;
|
|
72164
|
+
}
|
|
72165
|
+
}
|
|
72166
|
+
return "";
|
|
72167
|
+
}
|
|
72168
|
+
function jobIdExtras(content3) {
|
|
72169
|
+
const jobId = extractJobIdFromContent(content3);
|
|
72170
|
+
return jobId ? { taskId: jobId } : {};
|
|
72171
|
+
}
|
|
72172
|
+
|
|
72143
72173
|
// ../core/src/xmtp-sdk/middleware/self-filter.ts
|
|
72144
72174
|
function selfFilterMiddleware() {
|
|
72145
72175
|
return async (ctx, next) => {
|
|
@@ -72163,9 +72193,11 @@ function loggingMiddleware(identity3) {
|
|
|
72163
72193
|
const contentSummary = summarizeMessageContent(msg.content);
|
|
72164
72194
|
const baseExtras = {
|
|
72165
72195
|
...agentExtras(identity3),
|
|
72196
|
+
...jobIdExtras(msg.content),
|
|
72166
72197
|
peerInboxId: msg.senderInboxId,
|
|
72167
72198
|
conversationId,
|
|
72168
|
-
messageId: msg.id
|
|
72199
|
+
messageId: msg.id,
|
|
72200
|
+
stage: "inbound/transport_received"
|
|
72169
72201
|
};
|
|
72170
72202
|
if (conv instanceof Group) {
|
|
72171
72203
|
const groupName = conv.name ?? "unnamed";
|
|
@@ -80051,8 +80083,10 @@ var XmtpService = class _XmtpService {
|
|
|
80051
80083
|
inboxId: agent.client?.inboxId,
|
|
80052
80084
|
onchainosAgentId: this.getAgentByAddress(address)?.agentId
|
|
80053
80085
|
}),
|
|
80086
|
+
...jobIdExtras(msg.content),
|
|
80054
80087
|
messageId: msg.id,
|
|
80055
|
-
conversationId: conv.id
|
|
80088
|
+
conversationId: conv.id,
|
|
80089
|
+
stage: "offlineReplay/handleMessage"
|
|
80056
80090
|
});
|
|
80057
80091
|
} else {
|
|
80058
80092
|
summary.skipped++;
|
|
@@ -80064,8 +80098,11 @@ var XmtpService = class _XmtpService {
|
|
|
80064
80098
|
err2 instanceof Error ? err2 : void 0,
|
|
80065
80099
|
{
|
|
80066
80100
|
walletAddress: address,
|
|
80101
|
+
...jobIdExtras(msg.content),
|
|
80067
80102
|
messageId: msg.id,
|
|
80068
|
-
conversationId: conv.id
|
|
80103
|
+
conversationId: conv.id,
|
|
80104
|
+
stage: "offlineReplay/handleMessage",
|
|
80105
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error"
|
|
80069
80106
|
}
|
|
80070
80107
|
);
|
|
80071
80108
|
} finally {
|
|
@@ -80084,6 +80121,8 @@ var XmtpService = class _XmtpService {
|
|
|
80084
80121
|
err2 instanceof Error ? err2 : void 0,
|
|
80085
80122
|
{
|
|
80086
80123
|
walletAddress: address,
|
|
80124
|
+
stage: "offlineReplay/readConversation",
|
|
80125
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error",
|
|
80087
80126
|
conversationId: conv.id
|
|
80088
80127
|
}
|
|
80089
80128
|
);
|
|
@@ -80704,7 +80743,7 @@ async function checkMessageEligible(params) {
|
|
|
80704
80743
|
]));
|
|
80705
80744
|
} catch (err2) {
|
|
80706
80745
|
guardCatchSessionExpired(err2, "message-eligible");
|
|
80707
|
-
|
|
80746
|
+
throw new Error("message-eligible-cli-error", { cause: err2 });
|
|
80708
80747
|
}
|
|
80709
80748
|
if (stderr) {
|
|
80710
80749
|
console.log(`[onchainos] stderr (message-eligible): ${stderr}`);
|
|
@@ -80722,13 +80761,13 @@ async function checkMessageEligible(params) {
|
|
|
80722
80761
|
direction: params.direction,
|
|
80723
80762
|
providerSecurityRate: String(params.providerSecurityRate)
|
|
80724
80763
|
});
|
|
80725
|
-
} catch {
|
|
80726
|
-
|
|
80764
|
+
} catch (err2) {
|
|
80765
|
+
throw new Error("message-eligible-json-parse-failed", { cause: err2 });
|
|
80727
80766
|
}
|
|
80728
80767
|
if (!res.ok) {
|
|
80729
80768
|
guardSessionExpired(stdout, "message-eligible");
|
|
80730
80769
|
console.warn(
|
|
80731
|
-
`[onchainos] message-eligible ok=false
|
|
80770
|
+
`[onchainos] message-eligible ok=false: ${stdout.slice(0, 200)}`
|
|
80732
80771
|
);
|
|
80733
80772
|
logger.error(
|
|
80734
80773
|
LogEvent.ONCHAINOS_CLI_ERROR,
|
|
@@ -80747,7 +80786,7 @@ async function checkMessageEligible(params) {
|
|
|
80747
80786
|
reason: "ok=false"
|
|
80748
80787
|
})
|
|
80749
80788
|
);
|
|
80750
|
-
|
|
80789
|
+
throw new Error("message-eligible-ok-false");
|
|
80751
80790
|
}
|
|
80752
80791
|
console.log(
|
|
80753
80792
|
`[onchainos] message-eligible result: eligible=${res.data.eligible}`
|
|
@@ -81147,10 +81186,10 @@ async function assertOutboundEligible(params) {
|
|
|
81147
81186
|
});
|
|
81148
81187
|
} catch (err2) {
|
|
81149
81188
|
console.log(
|
|
81150
|
-
`[okx-agent-task] outbound message-eligible call failed,
|
|
81189
|
+
`[okx-agent-task] outbound message-eligible call failed, letting send continue: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
|
|
81151
81190
|
err2
|
|
81152
81191
|
);
|
|
81153
|
-
|
|
81192
|
+
return;
|
|
81154
81193
|
}
|
|
81155
81194
|
console.log(
|
|
81156
81195
|
`[okx-agent-task] outbound message-eligible: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId} result=${JSON.stringify(result)}`
|
|
@@ -82553,7 +82592,8 @@ async function isTrustedDmSender(params) {
|
|
|
82553
82592
|
peerInboxId: senderInboxId,
|
|
82554
82593
|
messageId,
|
|
82555
82594
|
conversationId,
|
|
82556
|
-
chatType: "dm"
|
|
82595
|
+
chatType: "dm",
|
|
82596
|
+
stage: "inbound/dm_trust_check"
|
|
82557
82597
|
});
|
|
82558
82598
|
const matches = (ids) => {
|
|
82559
82599
|
if (ids.length === 0) {
|
|
@@ -82568,11 +82608,11 @@ async function isTrustedDmSender(params) {
|
|
|
82568
82608
|
trustedInboxIds = svc.getTrustedDmInboxIds();
|
|
82569
82609
|
}
|
|
82570
82610
|
if (trustedInboxIds.length === 0) {
|
|
82571
|
-
logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, dmExtras());
|
|
82611
|
+
logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, { ...dmExtras(), reason: "trusted_inbox_list_empty" });
|
|
82572
82612
|
return true;
|
|
82573
82613
|
}
|
|
82574
82614
|
if (!matches(trustedInboxIds)) {
|
|
82575
|
-
logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, dmExtras());
|
|
82615
|
+
logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, { ...dmExtras(), reason: "sender_not_in_system_whitelist" });
|
|
82576
82616
|
console.log(
|
|
82577
82617
|
`[okx-agent-task:${myXmtpAddress}] DM sender not in system whitelist, dropping: senderInboxId=${senderInboxId || "(empty)"}`
|
|
82578
82618
|
);
|
|
@@ -82619,7 +82659,9 @@ async function claimedAddressMatchesSender(params) {
|
|
|
82619
82659
|
peerInboxId: senderInboxId,
|
|
82620
82660
|
taskId: "",
|
|
82621
82661
|
conversationId,
|
|
82622
|
-
messageId
|
|
82662
|
+
messageId,
|
|
82663
|
+
stage: "inbound/address_check",
|
|
82664
|
+
reason: err2 instanceof Error ? err2.name : "unknown_error"
|
|
82623
82665
|
}
|
|
82624
82666
|
);
|
|
82625
82667
|
return false;
|
|
@@ -82668,6 +82710,7 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
82668
82710
|
conversationId: groupId,
|
|
82669
82711
|
messageId,
|
|
82670
82712
|
action: "auto-deny",
|
|
82713
|
+
stage: "inbound/address_check",
|
|
82671
82714
|
reason: "claimed-address-mismatch"
|
|
82672
82715
|
});
|
|
82673
82716
|
}
|
|
@@ -82683,6 +82726,8 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
82683
82726
|
conversationId: groupId,
|
|
82684
82727
|
messageId,
|
|
82685
82728
|
consentState: String(consentState ?? ""),
|
|
82729
|
+
stage: "inbound/address_check",
|
|
82730
|
+
reason: "claimed_address_mismatch",
|
|
82686
82731
|
action: autoDenyAttempted ? "auto-deny" : "drop",
|
|
82687
82732
|
autoDenyAttempted: String(autoDenyAttempted),
|
|
82688
82733
|
autoDenySucceeded: String(autoDenySucceeded),
|
|
@@ -82727,16 +82772,17 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
82727
82772
|
messageId,
|
|
82728
82773
|
direction: isSenderClient ? "client_to_provider" : "provider_to_client",
|
|
82729
82774
|
providerSecurityRate: String(providerSecurityRate),
|
|
82775
|
+
stage: "inbound/eligibility_check",
|
|
82730
82776
|
reason: result.reason ?? ""
|
|
82731
82777
|
});
|
|
82732
82778
|
return false;
|
|
82733
82779
|
}
|
|
82734
82780
|
} catch (err2) {
|
|
82735
82781
|
console.log(
|
|
82736
|
-
`[okx-agent-task:${myXmtpAddress}] message-eligible call failed,
|
|
82782
|
+
`[okx-agent-task:${myXmtpAddress}] message-eligible call failed, letting message through:`,
|
|
82737
82783
|
err2
|
|
82738
82784
|
);
|
|
82739
|
-
logger.
|
|
82785
|
+
logger.error(LogEvent.INBOUND_ELIGIBILITY_BYPASSED, err2 instanceof Error ? err2 : new Error(String(err2)), {
|
|
82740
82786
|
...agentExtras({ walletAddress: myXmtpAddress, onchainosAgentId: myAgent.agentId }),
|
|
82741
82787
|
peerWalletAddress: senderAddress,
|
|
82742
82788
|
peerInboxId: senderInboxId,
|
|
@@ -82746,9 +82792,10 @@ async function verifyInboundA2AGroupMessage(params) {
|
|
|
82746
82792
|
messageId,
|
|
82747
82793
|
direction: isSenderClient ? "client_to_provider" : "provider_to_client",
|
|
82748
82794
|
providerSecurityRate: String(providerSecurityRate),
|
|
82795
|
+
stage: "inbound/eligibility_check",
|
|
82749
82796
|
reason: "exception"
|
|
82750
82797
|
});
|
|
82751
|
-
return
|
|
82798
|
+
return true;
|
|
82752
82799
|
}
|
|
82753
82800
|
return true;
|
|
82754
82801
|
}
|
|
@@ -82782,7 +82829,9 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
82782
82829
|
{
|
|
82783
82830
|
...agentExtras({ walletAddress: deps.myXmtpAddress }),
|
|
82784
82831
|
taskId: systemNotification.jobId ?? "",
|
|
82785
|
-
messageId: systemMessageId
|
|
82832
|
+
messageId: systemMessageId,
|
|
82833
|
+
stage: "inbound/payload_parse",
|
|
82834
|
+
reason: "system_dm_missing_agent_id"
|
|
82786
82835
|
}
|
|
82787
82836
|
);
|
|
82788
82837
|
}
|
|
@@ -82845,7 +82894,9 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
82845
82894
|
messageId,
|
|
82846
82895
|
chatType: "group",
|
|
82847
82896
|
msgType: readString2(payloadObject?.msgType) ?? "",
|
|
82848
|
-
msgTypeType: typeof payloadObject?.msgType
|
|
82897
|
+
msgTypeType: typeof payloadObject?.msgType,
|
|
82898
|
+
stage: "inbound/payload_parse",
|
|
82899
|
+
reason: "unsupported_msg_type"
|
|
82849
82900
|
});
|
|
82850
82901
|
return true;
|
|
82851
82902
|
}
|
|
@@ -83237,7 +83288,7 @@ function startUserAttentionWatcherCoordinator(options) {
|
|
|
83237
83288
|
var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
83238
83289
|
var SENTRY_CONFIG = {
|
|
83239
83290
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
83240
|
-
release: "0.0.
|
|
83291
|
+
release: "0.0.5",
|
|
83241
83292
|
environment
|
|
83242
83293
|
};
|
|
83243
83294
|
|
|
@@ -83356,12 +83407,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
83356
83407
|
}));
|
|
83357
83408
|
}
|
|
83358
83409
|
});
|
|
83359
|
-
service.setPluginVersion("0.0.
|
|
83410
|
+
service.setPluginVersion("0.0.5");
|
|
83360
83411
|
await service.init();
|
|
83361
83412
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
83362
83413
|
if (pluginVersionStatus.unavailable) {
|
|
83363
83414
|
throw new Error(
|
|
83364
|
-
`@okxweb3/a2a-node v${"0.0.
|
|
83415
|
+
`@okxweb3/a2a-node v${"0.0.5"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
83365
83416
|
);
|
|
83366
83417
|
}
|
|
83367
83418
|
const systemConfig = service.getSystemConfig();
|
|
@@ -83379,7 +83430,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
83379
83430
|
onchainosAgentId: "*",
|
|
83380
83431
|
reason: "system-config missing sentryDsn",
|
|
83381
83432
|
pluginId: "@okxweb3/a2a-node",
|
|
83382
|
-
pluginVersion: "0.0.
|
|
83433
|
+
pluginVersion: "0.0.5"
|
|
83383
83434
|
});
|
|
83384
83435
|
}
|
|
83385
83436
|
console.log(
|
|
@@ -83412,6 +83463,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
83412
83463
|
logger.error(LogEvent.HEARTBEAT_FAILED, heartbeatResult.error instanceof Error ? heartbeatResult.error : new Error(String(heartbeatResult.error)), {
|
|
83413
83464
|
component: "node_listener",
|
|
83414
83465
|
stage: "sync_tick",
|
|
83466
|
+
reason: heartbeatResult.error instanceof Error ? heartbeatResult.error.name : "unknown_error",
|
|
83415
83467
|
durationMs: String(heartbeatMs),
|
|
83416
83468
|
chainIndex: ONCHAINOS_CHAIN_INDEX,
|
|
83417
83469
|
communicationClass: "onchainos_or_network"
|
|
@@ -83422,6 +83474,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
83422
83474
|
logger.error(LogEvent.OFFLINE_REPLAY_FAILED, replayResult.error instanceof Error ? replayResult.error : new Error(String(replayResult.error)), {
|
|
83423
83475
|
component: "node_listener",
|
|
83424
83476
|
stage: "sync_tick",
|
|
83477
|
+
reason: replayResult.error instanceof Error ? replayResult.error.name : "unknown_error",
|
|
83425
83478
|
durationMs: String(replayMs),
|
|
83426
83479
|
communicationClass: "xmtp_replay_or_storage"
|
|
83427
83480
|
});
|