@okxweb3/a2a-node 0.1.2 → 0.1.3-beta-5afe085f69-260701185206
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 +97 -27
- package/dist/index.js +50 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2285,6 +2285,7 @@ var init_command_store = __esm({
|
|
|
2285
2285
|
toAgentId: params.toAgentId,
|
|
2286
2286
|
toXmtpAddress: params.toXmtpAddress,
|
|
2287
2287
|
gatewaySessionKeys: params.gatewaySessionKeys,
|
|
2288
|
+
payload: params.payload,
|
|
2288
2289
|
createdAt: Date.now()
|
|
2289
2290
|
};
|
|
2290
2291
|
}
|
|
@@ -7893,7 +7894,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7893
7894
|
client: {
|
|
7894
7895
|
id: "gateway-client",
|
|
7895
7896
|
displayName: "okx-a2a-node",
|
|
7896
|
-
version: "0.1.
|
|
7897
|
+
version: "0.1.3-beta-5afe085f69-260701185206",
|
|
7897
7898
|
platform: "node",
|
|
7898
7899
|
mode: "backend",
|
|
7899
7900
|
instanceId
|
|
@@ -7904,7 +7905,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7904
7905
|
commands: [],
|
|
7905
7906
|
permissions: {},
|
|
7906
7907
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
7907
|
-
userAgent: `okx-a2a-node/${"0.1.
|
|
7908
|
+
userAgent: `okx-a2a-node/${"0.1.3-beta-5afe085f69-260701185206"}`,
|
|
7908
7909
|
auth: {
|
|
7909
7910
|
...config.token ? { token: config.token } : {},
|
|
7910
7911
|
...config.password ? { password: config.password } : {}
|
|
@@ -23945,6 +23946,7 @@ var init_events = __esm({
|
|
|
23945
23946
|
ONCHAINOS_SESSION_EXPIRED: "Onchainos session expired",
|
|
23946
23947
|
ONCHAINOS_CLI_ERROR: "Onchainos CLI error",
|
|
23947
23948
|
HEARTBEAT_FAILED: "Heartbeat failed",
|
|
23949
|
+
HEARTBEAT_SKIPPED: "Heartbeat skipped",
|
|
23948
23950
|
MESSAGE_PARSE_FAILED: "Message parse failed",
|
|
23949
23951
|
MESSAGE_HANDLER_ERROR: "Message handler error",
|
|
23950
23952
|
OFFLINE_REPLAY_FAILED: "Offline replay failed",
|
|
@@ -25123,7 +25125,7 @@ var init_sentry_config = __esm({
|
|
|
25123
25125
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
25124
25126
|
SENTRY_CONFIG = {
|
|
25125
25127
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
25126
|
-
release: "0.1.
|
|
25128
|
+
release: "0.1.3-beta-5afe085f69-260701185206",
|
|
25127
25129
|
environment
|
|
25128
25130
|
};
|
|
25129
25131
|
}
|
|
@@ -25271,6 +25273,12 @@ async function runLaunchctl(args, options = {}) {
|
|
|
25271
25273
|
throw new Error(`launchctl ${args.join(" ")} failed: ${(stderr || stdout).trim()}`);
|
|
25272
25274
|
}
|
|
25273
25275
|
}
|
|
25276
|
+
function isSystemdMissingServiceMessage(message) {
|
|
25277
|
+
return /not loaded|not found|does not exist|not exist/i.test(message);
|
|
25278
|
+
}
|
|
25279
|
+
function isLaunchdMissingServiceMessage(message) {
|
|
25280
|
+
return /no such process|could not find|not found|does not exist|not exist/i.test(message);
|
|
25281
|
+
}
|
|
25274
25282
|
function launchdDomain() {
|
|
25275
25283
|
const uid2 = typeof process.getuid === "function" ? process.getuid() : null;
|
|
25276
25284
|
if (uid2 === null) {
|
|
@@ -25304,7 +25312,7 @@ async function stopSystemdAutostart() {
|
|
|
25304
25312
|
const paths = resolveSystemdAutostartPaths();
|
|
25305
25313
|
const result = await runSystemctl(["stop", SERVICE_NAME], { tolerateFailure: true });
|
|
25306
25314
|
const message = (result.stderr || result.stdout).trim();
|
|
25307
|
-
const missing =
|
|
25315
|
+
const missing = isSystemdMissingServiceMessage(message);
|
|
25308
25316
|
return {
|
|
25309
25317
|
platform: "linux-systemd",
|
|
25310
25318
|
path: paths.servicePath,
|
|
@@ -25324,7 +25332,15 @@ async function restartSystemdAutostart() {
|
|
|
25324
25332
|
}
|
|
25325
25333
|
const result = await runSystemctl(["restart", SERVICE_NAME], { tolerateFailure: true });
|
|
25326
25334
|
const message = (result.stderr || result.stdout).trim();
|
|
25327
|
-
const missing =
|
|
25335
|
+
const missing = isSystemdMissingServiceMessage(message);
|
|
25336
|
+
if (missing) {
|
|
25337
|
+
const installed = await installSystemdAutostart();
|
|
25338
|
+
return {
|
|
25339
|
+
...installed,
|
|
25340
|
+
restarted: true,
|
|
25341
|
+
...message ? { message: `systemd service was not loaded; reinstalled autostart. ${message}` } : {}
|
|
25342
|
+
};
|
|
25343
|
+
}
|
|
25328
25344
|
return {
|
|
25329
25345
|
platform: "linux-systemd",
|
|
25330
25346
|
path: paths.servicePath,
|
|
@@ -25358,7 +25374,7 @@ async function stopLaunchdAutostart() {
|
|
|
25358
25374
|
const paths = resolveLaunchdAutostartPaths();
|
|
25359
25375
|
const result = await runLaunchctl(["bootout", launchdDomain(), paths.plistPath], { tolerateFailure: true });
|
|
25360
25376
|
const message = (result.stderr || result.stdout).trim();
|
|
25361
|
-
const missing =
|
|
25377
|
+
const missing = isLaunchdMissingServiceMessage(message);
|
|
25362
25378
|
return {
|
|
25363
25379
|
platform: "macos-launchd",
|
|
25364
25380
|
path: paths.plistPath,
|
|
@@ -25379,7 +25395,15 @@ async function restartLaunchdAutostart() {
|
|
|
25379
25395
|
const service = `${launchdDomain()}/${LAUNCHD_LABEL}`;
|
|
25380
25396
|
const result = await runLaunchctl(["kickstart", "-k", service], { tolerateFailure: true });
|
|
25381
25397
|
const message = (result.stderr || result.stdout).trim();
|
|
25382
|
-
const missing =
|
|
25398
|
+
const missing = isLaunchdMissingServiceMessage(message);
|
|
25399
|
+
if (missing) {
|
|
25400
|
+
const installed = await installLaunchdAutostart();
|
|
25401
|
+
return {
|
|
25402
|
+
...installed,
|
|
25403
|
+
restarted: true,
|
|
25404
|
+
...message ? { message: `launchd service was not loaded; reinstalled autostart. ${message}` } : {}
|
|
25405
|
+
};
|
|
25406
|
+
}
|
|
25383
25407
|
return {
|
|
25384
25408
|
platform: "macos-launchd",
|
|
25385
25409
|
path: paths.plistPath,
|
|
@@ -87267,6 +87291,12 @@ function buildTaskPayload(replyToMessageId) {
|
|
|
87267
87291
|
replyToMessageId: replyToMessageId ?? null
|
|
87268
87292
|
};
|
|
87269
87293
|
}
|
|
87294
|
+
function resolveEnvelopePayload(command, replyToMessageId) {
|
|
87295
|
+
if (command.payload !== void 0) {
|
|
87296
|
+
return command.payload;
|
|
87297
|
+
}
|
|
87298
|
+
return buildTaskPayload(replyToMessageId);
|
|
87299
|
+
}
|
|
87270
87300
|
function parseJson(raw) {
|
|
87271
87301
|
try {
|
|
87272
87302
|
return JSON.parse(raw);
|
|
@@ -87374,7 +87404,7 @@ function buildGroupReplyRaw(command, target, myXmtpAddress, localAgent) {
|
|
|
87374
87404
|
jobId: command.jobId,
|
|
87375
87405
|
senderAgent: localAgent,
|
|
87376
87406
|
receiverAgentId: readString(sender?.agentId),
|
|
87377
|
-
payload:
|
|
87407
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId ?? target.id)
|
|
87378
87408
|
});
|
|
87379
87409
|
}
|
|
87380
87410
|
async function assertOutboundEligible(params) {
|
|
@@ -87706,7 +87736,7 @@ async function handleSqliteGroupSendCommand(params) {
|
|
|
87706
87736
|
jobId: command.jobId,
|
|
87707
87737
|
senderAgent,
|
|
87708
87738
|
receiverAgentId: remote.remoteAgent?.agentId ?? remote.toAgentId ?? null,
|
|
87709
|
-
payload:
|
|
87739
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId)
|
|
87710
87740
|
});
|
|
87711
87741
|
logWithTimestamp(`[okx-agent-task] xmtp envelope ${rawText}`);
|
|
87712
87742
|
await conversation.send(rawText);
|
|
@@ -87843,7 +87873,7 @@ async function handleGroupSendCommand(params) {
|
|
|
87843
87873
|
jobId: command.jobId,
|
|
87844
87874
|
senderAgent,
|
|
87845
87875
|
receiverAgentId: remoteAgent?.agentId ?? session.toAgentId ?? null,
|
|
87846
|
-
payload:
|
|
87876
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId)
|
|
87847
87877
|
});
|
|
87848
87878
|
logWithTimestamp(`[okx-agent-task] xmtp envelope ${rawText}`);
|
|
87849
87879
|
await conversation.send(rawText);
|
|
@@ -93116,12 +93146,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
93116
93146
|
}));
|
|
93117
93147
|
}
|
|
93118
93148
|
});
|
|
93119
|
-
service.setPluginVersion("0.1.
|
|
93149
|
+
service.setPluginVersion("0.1.3-beta-5afe085f69-260701185206");
|
|
93120
93150
|
await service.init();
|
|
93121
93151
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
93122
93152
|
if (pluginVersionStatus.unavailable) {
|
|
93123
93153
|
throw new Error(
|
|
93124
|
-
`@okxweb3/a2a-node v${"0.1.
|
|
93154
|
+
`@okxweb3/a2a-node v${"0.1.3-beta-5afe085f69-260701185206"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
93125
93155
|
);
|
|
93126
93156
|
}
|
|
93127
93157
|
const systemConfig = service.getSystemConfig();
|
|
@@ -93139,7 +93169,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
93139
93169
|
onchainosAgentId: "*",
|
|
93140
93170
|
reason: "system-config missing sentryDsn",
|
|
93141
93171
|
pluginId: "@okxweb3/a2a-node",
|
|
93142
|
-
pluginVersion: "0.1.
|
|
93172
|
+
pluginVersion: "0.1.3-beta-5afe085f69-260701185206"
|
|
93143
93173
|
});
|
|
93144
93174
|
}
|
|
93145
93175
|
logWithTimestamp(
|
|
@@ -93188,10 +93218,33 @@ async function runListenerWithLock(options, paths) {
|
|
|
93188
93218
|
logWithTimestamp(
|
|
93189
93219
|
`[okx-agent-task] provider=${heartbeatProvider ?? "(not set)"} gateway unavailable, skipping heartbeat`
|
|
93190
93220
|
);
|
|
93221
|
+
logger.error(
|
|
93222
|
+
LogEvent.HEARTBEAT_SKIPPED,
|
|
93223
|
+
new Error(`heartbeat skipped: provider=${heartbeatProvider ?? "(not set)"} gateway unavailable`),
|
|
93224
|
+
{
|
|
93225
|
+
component: "node_listener",
|
|
93226
|
+
stage: "sync_tick",
|
|
93227
|
+
reason: "gateway_unavailable",
|
|
93228
|
+
provider: heartbeatProvider ?? "(not set)",
|
|
93229
|
+
chainIndex: ONCHAINOS_CHAIN_INDEX,
|
|
93230
|
+
communicationClass: "gateway_or_plugin"
|
|
93231
|
+
}
|
|
93232
|
+
);
|
|
93191
93233
|
}
|
|
93192
93234
|
}
|
|
93193
93235
|
if (!hasActiveAgents) {
|
|
93194
93236
|
logWithTimestamp("[okx-agent-task] no active agents, skipping heartbeat");
|
|
93237
|
+
logger.error(
|
|
93238
|
+
LogEvent.HEARTBEAT_SKIPPED,
|
|
93239
|
+
new Error("heartbeat skipped: no active agents"),
|
|
93240
|
+
{
|
|
93241
|
+
component: "node_listener",
|
|
93242
|
+
stage: "sync_tick",
|
|
93243
|
+
reason: "no_active_agents",
|
|
93244
|
+
provider: heartbeatProvider ?? "(not set)",
|
|
93245
|
+
chainIndex: ONCHAINOS_CHAIN_INDEX
|
|
93246
|
+
}
|
|
93247
|
+
);
|
|
93195
93248
|
}
|
|
93196
93249
|
const skippedTiming = { durationMs: 0 };
|
|
93197
93250
|
const heartbeatResult = shouldHeartbeat ? await timeSettled(() => sendHeartbeat(ONCHAINOS_CHAIN_INDEX)) : skippedTiming;
|
|
@@ -96708,7 +96761,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
96708
96761
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
96709
96762
|
}
|
|
96710
96763
|
function getBundledNodeCliVersion() {
|
|
96711
|
-
return true ? "0.1.
|
|
96764
|
+
return true ? "0.1.3-beta-5afe085f69-260701185206" : null;
|
|
96712
96765
|
}
|
|
96713
96766
|
function readConfiguredAiProvider() {
|
|
96714
96767
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -96793,13 +96846,15 @@ async function ensureOpenClawOkxA2aPluginConfig() {
|
|
|
96793
96846
|
const conversationHookAccess = await getOpenClawConfigValue(
|
|
96794
96847
|
OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH
|
|
96795
96848
|
);
|
|
96796
|
-
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.found ? allow.value : void 0);
|
|
96797
96849
|
const operations = [];
|
|
96798
96850
|
if (dmScope.value !== OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE) {
|
|
96799
96851
|
operations.push({ path: OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, value: OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE });
|
|
96800
96852
|
}
|
|
96801
|
-
if (
|
|
96802
|
-
|
|
96853
|
+
if (allow.found) {
|
|
96854
|
+
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.value);
|
|
96855
|
+
if (normalizedAllow.changed) {
|
|
96856
|
+
operations.push({ path: OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, value: normalizedAllow.value });
|
|
96857
|
+
}
|
|
96803
96858
|
}
|
|
96804
96859
|
if (conversationHookAccess.value !== true) {
|
|
96805
96860
|
operations.push({ path: OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH, value: true });
|
|
@@ -96808,11 +96863,11 @@ async function ensureOpenClawOkxA2aPluginConfig() {
|
|
|
96808
96863
|
return false;
|
|
96809
96864
|
}
|
|
96810
96865
|
await runCommand("openclaw", ["config", "set", "--batch-json", JSON.stringify(operations)]);
|
|
96811
|
-
console.log("[update] normalized OpenClaw
|
|
96866
|
+
console.log("[update] normalized OpenClaw okx-a2a gateway config through openclaw config set");
|
|
96812
96867
|
return true;
|
|
96813
96868
|
} catch (error) {
|
|
96814
96869
|
const detail = error instanceof Error ? error.message : String(error);
|
|
96815
|
-
console.warn(`[update] skipped OpenClaw
|
|
96870
|
+
console.warn(`[update] skipped OpenClaw okx-a2a gateway config normalization through openclaw CLI: ${detail}`);
|
|
96816
96871
|
return false;
|
|
96817
96872
|
}
|
|
96818
96873
|
}
|
|
@@ -96830,7 +96885,7 @@ async function getOpenClawConfigValue(path) {
|
|
|
96830
96885
|
}
|
|
96831
96886
|
function normalizeOpenClawPluginAllowValue(allow) {
|
|
96832
96887
|
if (!Array.isArray(allow)) {
|
|
96833
|
-
return { value:
|
|
96888
|
+
return { value: allow, changed: false };
|
|
96834
96889
|
}
|
|
96835
96890
|
const nextAllow = [];
|
|
96836
96891
|
let allowChanged = false;
|
|
@@ -97614,7 +97669,7 @@ init_sentry_logger();
|
|
|
97614
97669
|
init_sentry_config();
|
|
97615
97670
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV3 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
97616
97671
|
function printUsage2() {
|
|
97617
|
-
console.log(`okx-a2a ${"0.1.
|
|
97672
|
+
console.log(`okx-a2a ${"0.1.3-beta-5afe085f69-260701185206"}
|
|
97618
97673
|
|
|
97619
97674
|
Usage:
|
|
97620
97675
|
okx-a2a <command> [options]
|
|
@@ -97651,7 +97706,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
97651
97706
|
`);
|
|
97652
97707
|
}
|
|
97653
97708
|
function printVersion() {
|
|
97654
|
-
console.log("0.1.
|
|
97709
|
+
console.log("0.1.3-beta-5afe085f69-260701185206");
|
|
97655
97710
|
}
|
|
97656
97711
|
function printDaemonUsage() {
|
|
97657
97712
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -97716,8 +97771,8 @@ function printAgentUsage() {
|
|
|
97716
97771
|
console.log(`Usage: okx-a2a agent <refresh|bypass> [options]
|
|
97717
97772
|
|
|
97718
97773
|
Commands:
|
|
97719
|
-
refresh [--json]
|
|
97720
|
-
Refresh the listener agent list.
|
|
97774
|
+
refresh [--json] [--timeout-ms <ms>]
|
|
97775
|
+
Refresh the listener agent list and wait for the daemon result.
|
|
97721
97776
|
bypass <on|off> [--json]
|
|
97722
97777
|
Configure AI subsession bypass permissions.
|
|
97723
97778
|
`);
|
|
@@ -97730,6 +97785,7 @@ Options:
|
|
|
97730
97785
|
--to-address <xmtpAddress> Recipient XMTP address fallback
|
|
97731
97786
|
--reply-to <messageId> Reply-to message id
|
|
97732
97787
|
--session-agent-id <id> Session agent id for task file routing
|
|
97788
|
+
--payload <json> JSON string; when valid, fully replaces the envelope payload
|
|
97733
97789
|
--json Print machine-readable output with ok boolean
|
|
97734
97790
|
`);
|
|
97735
97791
|
}
|
|
@@ -97980,7 +98036,8 @@ async function queueXmtpSend(args) {
|
|
|
97980
98036
|
"--session-key",
|
|
97981
98037
|
"--to-agent-id",
|
|
97982
98038
|
"--to-address",
|
|
97983
|
-
"--to-xmtp-address"
|
|
98039
|
+
"--to-xmtp-address",
|
|
98040
|
+
"--payload"
|
|
97984
98041
|
]),
|
|
97985
98042
|
flags: /* @__PURE__ */ new Set(["--json"])
|
|
97986
98043
|
});
|
|
@@ -97992,6 +98049,7 @@ async function queueXmtpSend(args) {
|
|
|
97992
98049
|
const explicitToAgentId = readOption3(args, "--to-agent-id");
|
|
97993
98050
|
const sessionKey = readOption3(args, "--session-key");
|
|
97994
98051
|
const toXmtpAddress = readOption3(args, "--to-address") ?? readOption3(args, "--to-xmtp-address");
|
|
98052
|
+
const payloadOverride = parseXmtpSendPayloadOption(readOption3(args, "--payload"));
|
|
97995
98053
|
const target = resolveXmtpSendTarget({
|
|
97996
98054
|
sessionKey,
|
|
97997
98055
|
jobId: explicitJobId,
|
|
@@ -98013,7 +98071,8 @@ async function queueXmtpSend(args) {
|
|
|
98013
98071
|
myAgentId: target.myAgentId,
|
|
98014
98072
|
toAgentId: target.toAgentId,
|
|
98015
98073
|
toXmtpAddress: toXmtpAddress ?? target.toXmtpAddress,
|
|
98016
|
-
gatewaySessionKeys: readGatewaySessionKeysFromEnv2()
|
|
98074
|
+
gatewaySessionKeys: readGatewaySessionKeysFromEnv2(),
|
|
98075
|
+
payload: payloadOverride
|
|
98017
98076
|
});
|
|
98018
98077
|
await commands.submit(command);
|
|
98019
98078
|
const result = await commands.waitForResult(command.id, Number.POSITIVE_INFINITY);
|
|
@@ -98037,6 +98096,17 @@ async function queueXmtpSend(args) {
|
|
|
98037
98096
|
commands.close();
|
|
98038
98097
|
}
|
|
98039
98098
|
}
|
|
98099
|
+
function parseXmtpSendPayloadOption(raw) {
|
|
98100
|
+
const trimmed = raw?.trim();
|
|
98101
|
+
if (!trimmed) {
|
|
98102
|
+
return void 0;
|
|
98103
|
+
}
|
|
98104
|
+
try {
|
|
98105
|
+
return JSON.parse(trimmed);
|
|
98106
|
+
} catch {
|
|
98107
|
+
return void 0;
|
|
98108
|
+
}
|
|
98109
|
+
}
|
|
98040
98110
|
function readGatewaySessionKeysFromEnv2(env = process.env) {
|
|
98041
98111
|
const keys = /* @__PURE__ */ new Set();
|
|
98042
98112
|
const list = env[CURRENT_GATEWAY_SESSION_KEYS_ENV3]?.trim();
|
|
@@ -98161,7 +98231,7 @@ function assertOnlyKnownOptions(args, input) {
|
|
|
98161
98231
|
async function queueXmtpDaemonCommand(args, type) {
|
|
98162
98232
|
const json = hasFlag2(args, "--json");
|
|
98163
98233
|
const timeoutMsRaw = readOption3(args, "--timeout-ms");
|
|
98164
|
-
const wait3 = type === "xmtp-get-pending-list" || type === "xmtp-deny-pending-conversation";
|
|
98234
|
+
const wait3 = type === "xmtp-get-pending-list" || type === "xmtp-deny-pending-conversation" || type === "xmtp-refresh-agents";
|
|
98165
98235
|
await assertDaemonRunningForQueuedCommand2(type);
|
|
98166
98236
|
const commands = new CommandStore();
|
|
98167
98237
|
const command = type === "xmtp-get-pending-list" ? commands.createXmtpGetPendingListCommand() : type === "xmtp-deny-pending-conversation" ? commands.createXmtpDenyPendingConversationCommand(readDenyPendingConversationOptions(args)) : commands.createXmtpRefreshAgentsCommand();
|
package/dist/index.js
CHANGED
|
@@ -68009,6 +68009,7 @@ __export(index_exports, {
|
|
|
68009
68009
|
resolveConfiguredAiProvider: () => resolveConfiguredAiProvider,
|
|
68010
68010
|
resolveConfiguredAiProviderForJob: () => resolveConfiguredAiProviderForJob,
|
|
68011
68011
|
resolveDirectCommunicationSessionTarget: () => resolveDirectCommunicationSessionTarget,
|
|
68012
|
+
resolveEnvelopePayload: () => resolveEnvelopePayload,
|
|
68012
68013
|
resolveOfflineReplayIntervalSec: () => resolveOfflineReplayIntervalSec,
|
|
68013
68014
|
resolveOpenClawGatewayConfig: () => resolveOpenClawGatewayConfig,
|
|
68014
68015
|
resolveOpenClawGatewayRoute: () => resolveOpenClawGatewayRoute,
|
|
@@ -71555,6 +71556,7 @@ var LogEvent = {
|
|
|
71555
71556
|
ONCHAINOS_SESSION_EXPIRED: "Onchainos session expired",
|
|
71556
71557
|
ONCHAINOS_CLI_ERROR: "Onchainos CLI error",
|
|
71557
71558
|
HEARTBEAT_FAILED: "Heartbeat failed",
|
|
71559
|
+
HEARTBEAT_SKIPPED: "Heartbeat skipped",
|
|
71558
71560
|
MESSAGE_PARSE_FAILED: "Message parse failed",
|
|
71559
71561
|
MESSAGE_HANDLER_ERROR: "Message handler error",
|
|
71560
71562
|
OFFLINE_REPLAY_FAILED: "Offline replay failed",
|
|
@@ -74744,6 +74746,7 @@ var CommandStore = class {
|
|
|
74744
74746
|
toAgentId: params.toAgentId,
|
|
74745
74747
|
toXmtpAddress: params.toXmtpAddress,
|
|
74746
74748
|
gatewaySessionKeys: params.gatewaySessionKeys,
|
|
74749
|
+
payload: params.payload,
|
|
74747
74750
|
createdAt: Date.now()
|
|
74748
74751
|
};
|
|
74749
74752
|
}
|
|
@@ -86775,7 +86778,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86775
86778
|
client: {
|
|
86776
86779
|
id: "gateway-client",
|
|
86777
86780
|
displayName: "okx-a2a-node",
|
|
86778
|
-
version: "0.1.
|
|
86781
|
+
version: "0.1.3-beta-5afe085f69-260701185206",
|
|
86779
86782
|
platform: "node",
|
|
86780
86783
|
mode: "backend",
|
|
86781
86784
|
instanceId
|
|
@@ -86786,7 +86789,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86786
86789
|
commands: [],
|
|
86787
86790
|
permissions: {},
|
|
86788
86791
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
86789
|
-
userAgent: `okx-a2a-node/${"0.1.
|
|
86792
|
+
userAgent: `okx-a2a-node/${"0.1.3-beta-5afe085f69-260701185206"}`,
|
|
86790
86793
|
auth: {
|
|
86791
86794
|
...config.token ? { token: config.token } : {},
|
|
86792
86795
|
...config.password ? { password: config.password } : {}
|
|
@@ -88130,6 +88133,12 @@ function buildTaskPayload(replyToMessageId) {
|
|
|
88130
88133
|
replyToMessageId: replyToMessageId ?? null
|
|
88131
88134
|
};
|
|
88132
88135
|
}
|
|
88136
|
+
function resolveEnvelopePayload(command, replyToMessageId) {
|
|
88137
|
+
if (command.payload !== void 0) {
|
|
88138
|
+
return command.payload;
|
|
88139
|
+
}
|
|
88140
|
+
return buildTaskPayload(replyToMessageId);
|
|
88141
|
+
}
|
|
88133
88142
|
function parseJson(raw) {
|
|
88134
88143
|
try {
|
|
88135
88144
|
return JSON.parse(raw);
|
|
@@ -88237,7 +88246,7 @@ function buildGroupReplyRaw(command, target, myXmtpAddress, localAgent) {
|
|
|
88237
88246
|
jobId: command.jobId,
|
|
88238
88247
|
senderAgent: localAgent,
|
|
88239
88248
|
receiverAgentId: readString(sender?.agentId),
|
|
88240
|
-
payload:
|
|
88249
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId ?? target.id)
|
|
88241
88250
|
});
|
|
88242
88251
|
}
|
|
88243
88252
|
async function assertOutboundEligible(params) {
|
|
@@ -88571,7 +88580,7 @@ async function handleSqliteGroupSendCommand(params) {
|
|
|
88571
88580
|
jobId: command.jobId,
|
|
88572
88581
|
senderAgent,
|
|
88573
88582
|
receiverAgentId: remote.remoteAgent?.agentId ?? remote.toAgentId ?? null,
|
|
88574
|
-
payload:
|
|
88583
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId)
|
|
88575
88584
|
});
|
|
88576
88585
|
logWithTimestamp(`[okx-agent-task] xmtp envelope ${rawText}`);
|
|
88577
88586
|
await conversation.send(rawText);
|
|
@@ -88708,7 +88717,7 @@ async function handleGroupSendCommand(params) {
|
|
|
88708
88717
|
jobId: command.jobId,
|
|
88709
88718
|
senderAgent,
|
|
88710
88719
|
receiverAgentId: remoteAgent?.agentId ?? session.toAgentId ?? null,
|
|
88711
|
-
payload:
|
|
88720
|
+
payload: resolveEnvelopePayload(command, command.replyToMessageId)
|
|
88712
88721
|
});
|
|
88713
88722
|
logWithTimestamp(`[okx-agent-task] xmtp envelope ${rawText}`);
|
|
88714
88723
|
await conversation.send(rawText);
|
|
@@ -91205,7 +91214,7 @@ function userWatchEventDeliveredSentryExtra(event) {
|
|
|
91205
91214
|
var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
91206
91215
|
var SENTRY_CONFIG = {
|
|
91207
91216
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
91208
|
-
release: "0.1.
|
|
91217
|
+
release: "0.1.3-beta-5afe085f69-260701185206",
|
|
91209
91218
|
environment
|
|
91210
91219
|
};
|
|
91211
91220
|
|
|
@@ -91432,12 +91441,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
91432
91441
|
}));
|
|
91433
91442
|
}
|
|
91434
91443
|
});
|
|
91435
|
-
service.setPluginVersion("0.1.
|
|
91444
|
+
service.setPluginVersion("0.1.3-beta-5afe085f69-260701185206");
|
|
91436
91445
|
await service.init();
|
|
91437
91446
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
91438
91447
|
if (pluginVersionStatus.unavailable) {
|
|
91439
91448
|
throw new Error(
|
|
91440
|
-
`@okxweb3/a2a-node v${"0.1.
|
|
91449
|
+
`@okxweb3/a2a-node v${"0.1.3-beta-5afe085f69-260701185206"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
91441
91450
|
);
|
|
91442
91451
|
}
|
|
91443
91452
|
const systemConfig = service.getSystemConfig();
|
|
@@ -91455,7 +91464,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
91455
91464
|
onchainosAgentId: "*",
|
|
91456
91465
|
reason: "system-config missing sentryDsn",
|
|
91457
91466
|
pluginId: "@okxweb3/a2a-node",
|
|
91458
|
-
pluginVersion: "0.1.
|
|
91467
|
+
pluginVersion: "0.1.3-beta-5afe085f69-260701185206"
|
|
91459
91468
|
});
|
|
91460
91469
|
}
|
|
91461
91470
|
logWithTimestamp(
|
|
@@ -91504,10 +91513,33 @@ async function runListenerWithLock(options, paths) {
|
|
|
91504
91513
|
logWithTimestamp(
|
|
91505
91514
|
`[okx-agent-task] provider=${heartbeatProvider ?? "(not set)"} gateway unavailable, skipping heartbeat`
|
|
91506
91515
|
);
|
|
91516
|
+
logger.error(
|
|
91517
|
+
LogEvent.HEARTBEAT_SKIPPED,
|
|
91518
|
+
new Error(`heartbeat skipped: provider=${heartbeatProvider ?? "(not set)"} gateway unavailable`),
|
|
91519
|
+
{
|
|
91520
|
+
component: "node_listener",
|
|
91521
|
+
stage: "sync_tick",
|
|
91522
|
+
reason: "gateway_unavailable",
|
|
91523
|
+
provider: heartbeatProvider ?? "(not set)",
|
|
91524
|
+
chainIndex: ONCHAINOS_CHAIN_INDEX,
|
|
91525
|
+
communicationClass: "gateway_or_plugin"
|
|
91526
|
+
}
|
|
91527
|
+
);
|
|
91507
91528
|
}
|
|
91508
91529
|
}
|
|
91509
91530
|
if (!hasActiveAgents) {
|
|
91510
91531
|
logWithTimestamp("[okx-agent-task] no active agents, skipping heartbeat");
|
|
91532
|
+
logger.error(
|
|
91533
|
+
LogEvent.HEARTBEAT_SKIPPED,
|
|
91534
|
+
new Error("heartbeat skipped: no active agents"),
|
|
91535
|
+
{
|
|
91536
|
+
component: "node_listener",
|
|
91537
|
+
stage: "sync_tick",
|
|
91538
|
+
reason: "no_active_agents",
|
|
91539
|
+
provider: heartbeatProvider ?? "(not set)",
|
|
91540
|
+
chainIndex: ONCHAINOS_CHAIN_INDEX
|
|
91541
|
+
}
|
|
91542
|
+
);
|
|
91511
91543
|
}
|
|
91512
91544
|
const skippedTiming = { durationMs: 0 };
|
|
91513
91545
|
const heartbeatResult = shouldHeartbeat ? await timeSettled(() => sendHeartbeat(ONCHAINOS_CHAIN_INDEX)) : skippedTiming;
|
|
@@ -91807,13 +91839,15 @@ async function ensureOpenClawOkxA2aPluginConfig() {
|
|
|
91807
91839
|
const conversationHookAccess = await getOpenClawConfigValue(
|
|
91808
91840
|
OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH
|
|
91809
91841
|
);
|
|
91810
|
-
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.found ? allow.value : void 0);
|
|
91811
91842
|
const operations = [];
|
|
91812
91843
|
if (dmScope.value !== OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE) {
|
|
91813
91844
|
operations.push({ path: OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, value: OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE });
|
|
91814
91845
|
}
|
|
91815
|
-
if (
|
|
91816
|
-
|
|
91846
|
+
if (allow.found) {
|
|
91847
|
+
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.value);
|
|
91848
|
+
if (normalizedAllow.changed) {
|
|
91849
|
+
operations.push({ path: OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, value: normalizedAllow.value });
|
|
91850
|
+
}
|
|
91817
91851
|
}
|
|
91818
91852
|
if (conversationHookAccess.value !== true) {
|
|
91819
91853
|
operations.push({ path: OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH, value: true });
|
|
@@ -91822,11 +91856,11 @@ async function ensureOpenClawOkxA2aPluginConfig() {
|
|
|
91822
91856
|
return false;
|
|
91823
91857
|
}
|
|
91824
91858
|
await runCommand("openclaw", ["config", "set", "--batch-json", JSON.stringify(operations)]);
|
|
91825
|
-
console.log("[update] normalized OpenClaw
|
|
91859
|
+
console.log("[update] normalized OpenClaw okx-a2a gateway config through openclaw config set");
|
|
91826
91860
|
return true;
|
|
91827
91861
|
} catch (error) {
|
|
91828
91862
|
const detail = error instanceof Error ? error.message : String(error);
|
|
91829
|
-
console.warn(`[update] skipped OpenClaw
|
|
91863
|
+
console.warn(`[update] skipped OpenClaw okx-a2a gateway config normalization through openclaw CLI: ${detail}`);
|
|
91830
91864
|
return false;
|
|
91831
91865
|
}
|
|
91832
91866
|
}
|
|
@@ -91844,7 +91878,7 @@ async function getOpenClawConfigValue(path) {
|
|
|
91844
91878
|
}
|
|
91845
91879
|
function normalizeOpenClawPluginAllowValue(allow) {
|
|
91846
91880
|
if (!Array.isArray(allow)) {
|
|
91847
|
-
return { value:
|
|
91881
|
+
return { value: allow, changed: false };
|
|
91848
91882
|
}
|
|
91849
91883
|
const nextAllow = [];
|
|
91850
91884
|
let allowChanged = false;
|
|
@@ -92257,6 +92291,7 @@ async function runCommandCaptureOptional(command, args) {
|
|
|
92257
92291
|
resolveConfiguredAiProvider,
|
|
92258
92292
|
resolveConfiguredAiProviderForJob,
|
|
92259
92293
|
resolveDirectCommunicationSessionTarget,
|
|
92294
|
+
resolveEnvelopePayload,
|
|
92260
92295
|
resolveOfflineReplayIntervalSec,
|
|
92261
92296
|
resolveOpenClawGatewayConfig,
|
|
92262
92297
|
resolveOpenClawGatewayRoute,
|
package/package.json
CHANGED