@okxweb3/a2a-node 0.0.20-beta-17d080241c-260626172852 → 0.0.20
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 +159 -29
- package/dist/index.js +67 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2189,7 +2189,8 @@ function isDaemonCommand(value) {
|
|
|
2189
2189
|
return true;
|
|
2190
2190
|
}
|
|
2191
2191
|
if (parsed.type === "xmtp-deny-pending-conversation") {
|
|
2192
|
-
|
|
2192
|
+
const command = parsed;
|
|
2193
|
+
return typeof command.groupId === "string" || typeof command.jobId === "string";
|
|
2193
2194
|
}
|
|
2194
2195
|
if (parsed.type === "xmtp-refresh-agents") {
|
|
2195
2196
|
return true;
|
|
@@ -2260,6 +2261,7 @@ var init_command_store = __esm({
|
|
|
2260
2261
|
id: (0, import_node_crypto2.randomUUID)(),
|
|
2261
2262
|
type: "xmtp-deny-pending-conversation",
|
|
2262
2263
|
groupId: params.groupId,
|
|
2264
|
+
jobId: params.jobId,
|
|
2263
2265
|
agentId: params.agentId,
|
|
2264
2266
|
createdAt: Date.now()
|
|
2265
2267
|
};
|
|
@@ -7817,7 +7819,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7817
7819
|
client: {
|
|
7818
7820
|
id: "gateway-client",
|
|
7819
7821
|
displayName: "okx-a2a-node",
|
|
7820
|
-
version: "0.0.20
|
|
7822
|
+
version: "0.0.20",
|
|
7821
7823
|
platform: "node",
|
|
7822
7824
|
mode: "backend",
|
|
7823
7825
|
instanceId
|
|
@@ -7828,7 +7830,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7828
7830
|
commands: [],
|
|
7829
7831
|
permissions: {},
|
|
7830
7832
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
7831
|
-
userAgent: `okx-a2a-node/${"0.0.20
|
|
7833
|
+
userAgent: `okx-a2a-node/${"0.0.20"}`,
|
|
7832
7834
|
auth: {
|
|
7833
7835
|
...config.token ? { token: config.token } : {},
|
|
7834
7836
|
...config.password ? { password: config.password } : {}
|
|
@@ -25047,7 +25049,7 @@ var init_sentry_config = __esm({
|
|
|
25047
25049
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
25048
25050
|
SENTRY_CONFIG = {
|
|
25049
25051
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
25050
|
-
release: "0.0.20
|
|
25052
|
+
release: "0.0.20",
|
|
25051
25053
|
environment
|
|
25052
25054
|
};
|
|
25053
25055
|
}
|
|
@@ -90614,6 +90616,7 @@ function commandSentryExtra(command, extra = {}) {
|
|
|
90614
90616
|
base3.toXmtpAddress = command.toXmtpAddress ?? "";
|
|
90615
90617
|
} else if (command.type === "xmtp-deny-pending-conversation") {
|
|
90616
90618
|
base3.groupId = command.groupId;
|
|
90619
|
+
base3.jobId = command.jobId ?? "";
|
|
90617
90620
|
base3.agentId = command.agentId ?? "";
|
|
90618
90621
|
} else if (command.type === "xmtp-get-conversation-history") {
|
|
90619
90622
|
base3.jobId = command.jobId;
|
|
@@ -90845,13 +90848,18 @@ async function handleDaemonCommand(command, params) {
|
|
|
90845
90848
|
return { ok: true, messageId: result.messageId };
|
|
90846
90849
|
}
|
|
90847
90850
|
if (command.type === "xmtp-get-pending-list") {
|
|
90848
|
-
|
|
90849
|
-
for (const [address] of params.service.getClients()) {
|
|
90850
|
-
result.push(...await params.service.listUnknownGroups(address));
|
|
90851
|
-
}
|
|
90852
|
-
return { ok: true, payload: filterKnownPendingGroups(result, params.sessionStore) };
|
|
90851
|
+
return { ok: true, payload: await listPendingTaskRequests(params) };
|
|
90853
90852
|
}
|
|
90854
90853
|
if (command.type === "xmtp-deny-pending-conversation") {
|
|
90854
|
+
if (command.jobId) {
|
|
90855
|
+
return {
|
|
90856
|
+
ok: true,
|
|
90857
|
+
payload: await denyPendingConversationsByJobId(command.jobId, params)
|
|
90858
|
+
};
|
|
90859
|
+
}
|
|
90860
|
+
if (!command.groupId) {
|
|
90861
|
+
throw new Error("xmtp-deny-pending-conversation requires groupId or jobId");
|
|
90862
|
+
}
|
|
90855
90863
|
if (command.agentId) {
|
|
90856
90864
|
const address = params.service.getAddressByAgentId(command.agentId);
|
|
90857
90865
|
if (!address) {
|
|
@@ -90884,6 +90892,51 @@ async function handleDaemonCommand(command, params) {
|
|
|
90884
90892
|
}
|
|
90885
90893
|
};
|
|
90886
90894
|
}
|
|
90895
|
+
async function listPendingTaskRequests(params) {
|
|
90896
|
+
const result = [];
|
|
90897
|
+
for (const [address] of params.service.getClients()) {
|
|
90898
|
+
result.push(...await params.service.listUnknownGroups(address));
|
|
90899
|
+
}
|
|
90900
|
+
return filterKnownPendingGroups(result, params.sessionStore);
|
|
90901
|
+
}
|
|
90902
|
+
async function denyPendingConversationsByJobId(jobId, params) {
|
|
90903
|
+
const pending = await listPendingTaskRequests(params);
|
|
90904
|
+
const matched = pending.filter((item) => isPlainObject2(item) && readString2(item.jobId) === jobId);
|
|
90905
|
+
const clientAddresses = [...params.service.getClients().keys()];
|
|
90906
|
+
const targetsByKey = /* @__PURE__ */ new Map();
|
|
90907
|
+
const groupIds = /* @__PURE__ */ new Set();
|
|
90908
|
+
for (const item of matched) {
|
|
90909
|
+
if (!isPlainObject2(item)) {
|
|
90910
|
+
continue;
|
|
90911
|
+
}
|
|
90912
|
+
const groupId = readString2(item.groupId);
|
|
90913
|
+
if (!groupId) {
|
|
90914
|
+
continue;
|
|
90915
|
+
}
|
|
90916
|
+
groupIds.add(groupId);
|
|
90917
|
+
const address = readString2(item.myXmtpAddress);
|
|
90918
|
+
const addresses = address ? [address] : clientAddresses;
|
|
90919
|
+
for (const candidate of addresses) {
|
|
90920
|
+
targetsByKey.set(`${candidate}
|
|
90921
|
+
${groupId}`, { address: candidate, groupId });
|
|
90922
|
+
}
|
|
90923
|
+
}
|
|
90924
|
+
const results = await Promise.all(
|
|
90925
|
+
[...targetsByKey.values()].map(async (target) => ({
|
|
90926
|
+
...target,
|
|
90927
|
+
denied: await params.service.denyGroup(target.address, target.groupId)
|
|
90928
|
+
}))
|
|
90929
|
+
);
|
|
90930
|
+
const deniedOn = results.filter((result) => result.denied).map(({ address, groupId }) => ({ address, groupId }));
|
|
90931
|
+
return {
|
|
90932
|
+
denied: deniedOn.length > 0,
|
|
90933
|
+
jobId,
|
|
90934
|
+
matched: matched.length,
|
|
90935
|
+
groupIds: [...groupIds],
|
|
90936
|
+
deniedClientCount: deniedOn.length,
|
|
90937
|
+
deniedOn
|
|
90938
|
+
};
|
|
90939
|
+
}
|
|
90887
90940
|
function filterKnownPendingGroups(items, sessionStore) {
|
|
90888
90941
|
if (!sessionStore) {
|
|
90889
90942
|
return items;
|
|
@@ -91038,7 +91091,8 @@ function formatCommandCompleted(command, result) {
|
|
|
91038
91091
|
return `[okx-agent-task] xmtp-get-pending-list command completed id=${command.id}`;
|
|
91039
91092
|
}
|
|
91040
91093
|
if (command.type === "xmtp-deny-pending-conversation") {
|
|
91041
|
-
|
|
91094
|
+
const target = command.jobId ? `job=${command.jobId}` : `group=${command.groupId}`;
|
|
91095
|
+
return `[okx-agent-task] xmtp-deny-pending-conversation command completed id=${command.id} ${target}`;
|
|
91042
91096
|
}
|
|
91043
91097
|
if (command.type === "xmtp-get-conversation-history") {
|
|
91044
91098
|
const rows = Array.isArray(result.payload) ? result.payload.length : 0;
|
|
@@ -92821,12 +92875,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
92821
92875
|
}));
|
|
92822
92876
|
}
|
|
92823
92877
|
});
|
|
92824
|
-
service.setPluginVersion("0.0.20
|
|
92878
|
+
service.setPluginVersion("0.0.20");
|
|
92825
92879
|
await service.init();
|
|
92826
92880
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
92827
92881
|
if (pluginVersionStatus.unavailable) {
|
|
92828
92882
|
throw new Error(
|
|
92829
|
-
`@okxweb3/a2a-node v${"0.0.20
|
|
92883
|
+
`@okxweb3/a2a-node v${"0.0.20"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
92830
92884
|
);
|
|
92831
92885
|
}
|
|
92832
92886
|
const systemConfig = service.getSystemConfig();
|
|
@@ -92844,7 +92898,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
92844
92898
|
onchainosAgentId: "*",
|
|
92845
92899
|
reason: "system-config missing sentryDsn",
|
|
92846
92900
|
pluginId: "@okxweb3/a2a-node",
|
|
92847
|
-
pluginVersion: "0.0.20
|
|
92901
|
+
pluginVersion: "0.0.20"
|
|
92848
92902
|
});
|
|
92849
92903
|
}
|
|
92850
92904
|
logWithTimestamp(
|
|
@@ -96009,7 +96063,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
96009
96063
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
96010
96064
|
}
|
|
96011
96065
|
function getBundledNodeCliVersion() {
|
|
96012
|
-
return true ? "0.0.20
|
|
96066
|
+
return true ? "0.0.20" : null;
|
|
96013
96067
|
}
|
|
96014
96068
|
function readConfiguredAiProvider() {
|
|
96015
96069
|
const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
|
|
@@ -96842,7 +96896,7 @@ init_sentry_logger();
|
|
|
96842
96896
|
init_sentry_config();
|
|
96843
96897
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV2 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
96844
96898
|
function printUsage2() {
|
|
96845
|
-
console.log(`okx-a2a ${"0.0.20
|
|
96899
|
+
console.log(`okx-a2a ${"0.0.20"}
|
|
96846
96900
|
|
|
96847
96901
|
Usage:
|
|
96848
96902
|
okx-a2a <command> [options]
|
|
@@ -96879,7 +96933,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
96879
96933
|
`);
|
|
96880
96934
|
}
|
|
96881
96935
|
function printVersion() {
|
|
96882
|
-
console.log("0.0.20
|
|
96936
|
+
console.log("0.0.20");
|
|
96883
96937
|
}
|
|
96884
96938
|
function printDaemonUsage() {
|
|
96885
96939
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -96911,10 +96965,34 @@ function printTaskUsage() {
|
|
|
96911
96965
|
Commands:
|
|
96912
96966
|
requests [--json] [--timeout-ms <ms>]
|
|
96913
96967
|
List pending XMTP task requests.
|
|
96914
|
-
reject --group-id <id> [--agent-id <id>] [--json]
|
|
96968
|
+
reject (--job-id <id> | --group-id <id> [--agent-id <id>]) [--json] [--timeout-ms <ms>]
|
|
96915
96969
|
Deny a pending XMTP conversation.
|
|
96916
96970
|
`);
|
|
96917
96971
|
}
|
|
96972
|
+
function printTaskSubcommandUsage(subcommand) {
|
|
96973
|
+
if (subcommand === "requests") {
|
|
96974
|
+
console.log(`Usage: okx-a2a task requests [options]
|
|
96975
|
+
|
|
96976
|
+
Options:
|
|
96977
|
+
--json Print machine-readable JSON output.
|
|
96978
|
+
--timeout-ms <ms> Timeout while waiting for daemon result. Default: 60000.
|
|
96979
|
+
`);
|
|
96980
|
+
return true;
|
|
96981
|
+
}
|
|
96982
|
+
if (subcommand === "reject") {
|
|
96983
|
+
console.log(`Usage: okx-a2a task reject (--job-id <id> | --group-id <id> [--agent-id <id>]) [options]
|
|
96984
|
+
|
|
96985
|
+
Options:
|
|
96986
|
+
--job-id <id> Deny every pending conversation matching this job id.
|
|
96987
|
+
--group-id <id> XMTP group id for the pending conversation.
|
|
96988
|
+
--agent-id <id> Agent id whose pending conversation should be denied.
|
|
96989
|
+
--json Print machine-readable JSON output.
|
|
96990
|
+
--timeout-ms <ms> Timeout while waiting for daemon result. Default: 60000.
|
|
96991
|
+
`);
|
|
96992
|
+
return true;
|
|
96993
|
+
}
|
|
96994
|
+
return false;
|
|
96995
|
+
}
|
|
96918
96996
|
function printAgentUsage() {
|
|
96919
96997
|
console.log(`Usage: okx-a2a agent <refresh|bypass> [options]
|
|
96920
96998
|
|
|
@@ -97361,13 +97439,10 @@ function assertOnlyKnownOptions(args, input) {
|
|
|
97361
97439
|
async function queueXmtpDaemonCommand(args, type) {
|
|
97362
97440
|
const json = hasFlag2(args, "--json");
|
|
97363
97441
|
const timeoutMsRaw = readOption3(args, "--timeout-ms");
|
|
97364
|
-
const wait3 = type === "xmtp-get-pending-list";
|
|
97442
|
+
const wait3 = type === "xmtp-get-pending-list" || type === "xmtp-deny-pending-conversation";
|
|
97365
97443
|
await assertDaemonRunningForQueuedCommand2(type);
|
|
97366
97444
|
const commands = new CommandStore();
|
|
97367
|
-
const command = type === "xmtp-get-pending-list" ? commands.createXmtpGetPendingListCommand() : type === "xmtp-deny-pending-conversation" ? commands.createXmtpDenyPendingConversationCommand(
|
|
97368
|
-
groupId: readRequiredOption4(args, "--group-id"),
|
|
97369
|
-
agentId: readOption3(args, "--agent-id")
|
|
97370
|
-
}) : commands.createXmtpRefreshAgentsCommand();
|
|
97445
|
+
const command = type === "xmtp-get-pending-list" ? commands.createXmtpGetPendingListCommand() : type === "xmtp-deny-pending-conversation" ? commands.createXmtpDenyPendingConversationCommand(readDenyPendingConversationOptions(args)) : commands.createXmtpRefreshAgentsCommand();
|
|
97371
97446
|
await commands.submit(command);
|
|
97372
97447
|
if (!wait3) {
|
|
97373
97448
|
outputCommandResult(json, { id: command.id, ok: true, completedAt: Date.now(), payload: { queued: true } }, `${type} queued command=${command.id}`);
|
|
@@ -97376,19 +97451,45 @@ async function queueXmtpDaemonCommand(args, type) {
|
|
|
97376
97451
|
const timeoutMs = timeoutMsRaw ? Number(timeoutMsRaw) : 6e4;
|
|
97377
97452
|
const result = await commands.waitForResult(command.id, timeoutMs);
|
|
97378
97453
|
if (!result) {
|
|
97379
|
-
|
|
97454
|
+
outputCommandResult(json, {
|
|
97455
|
+
id: command.id,
|
|
97456
|
+
ok: false,
|
|
97457
|
+
completedAt: Date.now(),
|
|
97458
|
+
error: `${type} timed out waiting for command=${command.id}`
|
|
97459
|
+
}, `ok=false ${type} command=${command.id} error=timed out waiting for daemon result`);
|
|
97460
|
+
process.exitCode = 1;
|
|
97461
|
+
return;
|
|
97380
97462
|
}
|
|
97381
97463
|
if (!result.ok) {
|
|
97382
|
-
|
|
97464
|
+
outputCommandResult(json, result, formatDaemonCommandResult(type, result));
|
|
97465
|
+
process.exitCode = 1;
|
|
97466
|
+
return;
|
|
97383
97467
|
}
|
|
97384
97468
|
outputCommandResult(json, result, formatDaemonCommandResult(type, result));
|
|
97385
97469
|
}
|
|
97386
97470
|
async function handleTaskCommand(args) {
|
|
97387
|
-
|
|
97471
|
+
const subcommand = args[0];
|
|
97472
|
+
if (!subcommand || args.every(isHelpArg4)) {
|
|
97388
97473
|
printTaskUsage();
|
|
97389
97474
|
return;
|
|
97390
97475
|
}
|
|
97391
|
-
|
|
97476
|
+
if (subcommand === "help") {
|
|
97477
|
+
const helpTarget = args.slice(1).find((arg) => !isHelpArg4(arg));
|
|
97478
|
+
if (!helpTarget) {
|
|
97479
|
+
printTaskUsage();
|
|
97480
|
+
return;
|
|
97481
|
+
}
|
|
97482
|
+
if (!printTaskSubcommandUsage(helpTarget)) {
|
|
97483
|
+
throw new Error(`Unknown task command: ${helpTarget}`);
|
|
97484
|
+
}
|
|
97485
|
+
return;
|
|
97486
|
+
}
|
|
97487
|
+
if (hasHelpFlag5(args.slice(1))) {
|
|
97488
|
+
if (!printTaskSubcommandUsage(subcommand)) {
|
|
97489
|
+
throw new Error(`Unknown task command: ${subcommand}`);
|
|
97490
|
+
}
|
|
97491
|
+
return;
|
|
97492
|
+
}
|
|
97392
97493
|
const rest = args.slice(1);
|
|
97393
97494
|
if (subcommand === "requests") {
|
|
97394
97495
|
await queueXmtpDaemonCommand(rest, "xmtp-get-pending-list");
|
|
@@ -97456,9 +97557,32 @@ function readRequiredOption4(args, name2) {
|
|
|
97456
97557
|
}
|
|
97457
97558
|
return value;
|
|
97458
97559
|
}
|
|
97560
|
+
function readDenyPendingConversationOptions(args) {
|
|
97561
|
+
const jobId = readOption3(args, "--job-id");
|
|
97562
|
+
const groupId = readOption3(args, "--group-id");
|
|
97563
|
+
const agentId = readOption3(args, "--agent-id");
|
|
97564
|
+
if (jobId) {
|
|
97565
|
+
if (groupId || agentId) {
|
|
97566
|
+
throw new Error("task reject --job-id cannot be used with --group-id or --agent-id");
|
|
97567
|
+
}
|
|
97568
|
+
return { jobId };
|
|
97569
|
+
}
|
|
97570
|
+
if (!groupId) {
|
|
97571
|
+
throw new Error("task reject requires --job-id <id> or --group-id <id>");
|
|
97572
|
+
}
|
|
97573
|
+
return {
|
|
97574
|
+
groupId,
|
|
97575
|
+
...agentId ? { agentId } : {}
|
|
97576
|
+
};
|
|
97577
|
+
}
|
|
97459
97578
|
function outputCommandResult(json, result, human) {
|
|
97460
97579
|
if (json) {
|
|
97461
|
-
console.log(JSON.stringify({
|
|
97580
|
+
console.log(JSON.stringify({
|
|
97581
|
+
ok: result.ok,
|
|
97582
|
+
commandId: result.id,
|
|
97583
|
+
payload: result.payload ?? null,
|
|
97584
|
+
error: result.error ?? null
|
|
97585
|
+
}));
|
|
97462
97586
|
return;
|
|
97463
97587
|
}
|
|
97464
97588
|
console.log(human);
|
|
@@ -97480,12 +97604,18 @@ function printXmtpSendCommandResult(json, result) {
|
|
|
97480
97604
|
console.log(`ok=false xmtp-send failed command=${result.id} error=${result.error ?? "unknown error"}`);
|
|
97481
97605
|
}
|
|
97482
97606
|
function formatDaemonCommandResult(type, result) {
|
|
97607
|
+
if (!result.ok) {
|
|
97608
|
+
return `ok=false ${type} command=${result.id} error=${result.error ?? "unknown error"}`;
|
|
97609
|
+
}
|
|
97483
97610
|
if (type === "xmtp-get-pending-list") {
|
|
97484
97611
|
return JSON.stringify(result.payload ?? [], null, 2);
|
|
97485
97612
|
}
|
|
97486
97613
|
if (type === "xmtp-deny-pending-conversation") {
|
|
97487
97614
|
const payload2 = result.payload;
|
|
97488
|
-
|
|
97615
|
+
const target = payload2?.jobId ? `jobId=${payload2.jobId}` : `groupId=${payload2?.groupId ?? ""}`;
|
|
97616
|
+
const matched = typeof payload2?.matched === "number" ? ` matched=${payload2.matched}` : "";
|
|
97617
|
+
const groupIds = payload2?.groupIds?.length ? ` groupIds=${payload2.groupIds.join(",")}` : "";
|
|
97618
|
+
return `ok=true denied=${payload2?.denied ? "true" : "false"} ${target}${matched}${groupIds} clients=${payload2?.deniedClientCount ?? 0}`;
|
|
97489
97619
|
}
|
|
97490
97620
|
const payload = result.payload;
|
|
97491
97621
|
return `agents=${payload?.agentCount ?? 0} activeClients=${payload?.activeClients ?? 0} changed=${payload?.changed ? "yes" : "no"} added=${payload?.added?.length ?? 0} removed=${payload?.removed?.length ?? 0}`;
|
|
@@ -98143,7 +98273,7 @@ async function main() {
|
|
|
98143
98273
|
process.exitCode = 1;
|
|
98144
98274
|
}
|
|
98145
98275
|
function shouldDeferHelpToNestedHandler(command, args) {
|
|
98146
|
-
if (command !== "session" && command !== "user") {
|
|
98276
|
+
if (command !== "session" && command !== "user" && command !== "task") {
|
|
98147
98277
|
return false;
|
|
98148
98278
|
}
|
|
98149
98279
|
return args.some((arg) => !isHelpArg4(arg));
|
package/dist/index.js
CHANGED
|
@@ -74676,6 +74676,7 @@ var CommandStore = class {
|
|
|
74676
74676
|
id: (0, import_node_crypto4.randomUUID)(),
|
|
74677
74677
|
type: "xmtp-deny-pending-conversation",
|
|
74678
74678
|
groupId: params.groupId,
|
|
74679
|
+
jobId: params.jobId,
|
|
74679
74680
|
agentId: params.agentId,
|
|
74680
74681
|
createdAt: Date.now()
|
|
74681
74682
|
};
|
|
@@ -74957,7 +74958,8 @@ function isDaemonCommand(value) {
|
|
|
74957
74958
|
return true;
|
|
74958
74959
|
}
|
|
74959
74960
|
if (parsed.type === "xmtp-deny-pending-conversation") {
|
|
74960
|
-
|
|
74961
|
+
const command = parsed;
|
|
74962
|
+
return typeof command.groupId === "string" || typeof command.jobId === "string";
|
|
74961
74963
|
}
|
|
74962
74964
|
if (parsed.type === "xmtp-refresh-agents") {
|
|
74963
74965
|
return true;
|
|
@@ -86689,7 +86691,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86689
86691
|
client: {
|
|
86690
86692
|
id: "gateway-client",
|
|
86691
86693
|
displayName: "okx-a2a-node",
|
|
86692
|
-
version: "0.0.20
|
|
86694
|
+
version: "0.0.20",
|
|
86693
86695
|
platform: "node",
|
|
86694
86696
|
mode: "backend",
|
|
86695
86697
|
instanceId
|
|
@@ -86700,7 +86702,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86700
86702
|
commands: [],
|
|
86701
86703
|
permissions: {},
|
|
86702
86704
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
86703
|
-
userAgent: `okx-a2a-node/${"0.0.20
|
|
86705
|
+
userAgent: `okx-a2a-node/${"0.0.20"}`,
|
|
86704
86706
|
auth: {
|
|
86705
86707
|
...config.token ? { token: config.token } : {},
|
|
86706
86708
|
...config.password ? { password: config.password } : {}
|
|
@@ -88913,6 +88915,7 @@ function commandSentryExtra(command, extra = {}) {
|
|
|
88913
88915
|
base3.toXmtpAddress = command.toXmtpAddress ?? "";
|
|
88914
88916
|
} else if (command.type === "xmtp-deny-pending-conversation") {
|
|
88915
88917
|
base3.groupId = command.groupId;
|
|
88918
|
+
base3.jobId = command.jobId ?? "";
|
|
88916
88919
|
base3.agentId = command.agentId ?? "";
|
|
88917
88920
|
} else if (command.type === "xmtp-get-conversation-history") {
|
|
88918
88921
|
base3.jobId = command.jobId;
|
|
@@ -89144,13 +89147,18 @@ async function handleDaemonCommand(command, params) {
|
|
|
89144
89147
|
return { ok: true, messageId: result.messageId };
|
|
89145
89148
|
}
|
|
89146
89149
|
if (command.type === "xmtp-get-pending-list") {
|
|
89147
|
-
|
|
89148
|
-
for (const [address] of params.service.getClients()) {
|
|
89149
|
-
result.push(...await params.service.listUnknownGroups(address));
|
|
89150
|
-
}
|
|
89151
|
-
return { ok: true, payload: filterKnownPendingGroups(result, params.sessionStore) };
|
|
89150
|
+
return { ok: true, payload: await listPendingTaskRequests(params) };
|
|
89152
89151
|
}
|
|
89153
89152
|
if (command.type === "xmtp-deny-pending-conversation") {
|
|
89153
|
+
if (command.jobId) {
|
|
89154
|
+
return {
|
|
89155
|
+
ok: true,
|
|
89156
|
+
payload: await denyPendingConversationsByJobId(command.jobId, params)
|
|
89157
|
+
};
|
|
89158
|
+
}
|
|
89159
|
+
if (!command.groupId) {
|
|
89160
|
+
throw new Error("xmtp-deny-pending-conversation requires groupId or jobId");
|
|
89161
|
+
}
|
|
89154
89162
|
if (command.agentId) {
|
|
89155
89163
|
const address = params.service.getAddressByAgentId(command.agentId);
|
|
89156
89164
|
if (!address) {
|
|
@@ -89183,6 +89191,51 @@ async function handleDaemonCommand(command, params) {
|
|
|
89183
89191
|
}
|
|
89184
89192
|
};
|
|
89185
89193
|
}
|
|
89194
|
+
async function listPendingTaskRequests(params) {
|
|
89195
|
+
const result = [];
|
|
89196
|
+
for (const [address] of params.service.getClients()) {
|
|
89197
|
+
result.push(...await params.service.listUnknownGroups(address));
|
|
89198
|
+
}
|
|
89199
|
+
return filterKnownPendingGroups(result, params.sessionStore);
|
|
89200
|
+
}
|
|
89201
|
+
async function denyPendingConversationsByJobId(jobId, params) {
|
|
89202
|
+
const pending = await listPendingTaskRequests(params);
|
|
89203
|
+
const matched = pending.filter((item) => isPlainObject2(item) && readString2(item.jobId) === jobId);
|
|
89204
|
+
const clientAddresses = [...params.service.getClients().keys()];
|
|
89205
|
+
const targetsByKey = /* @__PURE__ */ new Map();
|
|
89206
|
+
const groupIds = /* @__PURE__ */ new Set();
|
|
89207
|
+
for (const item of matched) {
|
|
89208
|
+
if (!isPlainObject2(item)) {
|
|
89209
|
+
continue;
|
|
89210
|
+
}
|
|
89211
|
+
const groupId = readString2(item.groupId);
|
|
89212
|
+
if (!groupId) {
|
|
89213
|
+
continue;
|
|
89214
|
+
}
|
|
89215
|
+
groupIds.add(groupId);
|
|
89216
|
+
const address = readString2(item.myXmtpAddress);
|
|
89217
|
+
const addresses = address ? [address] : clientAddresses;
|
|
89218
|
+
for (const candidate of addresses) {
|
|
89219
|
+
targetsByKey.set(`${candidate}
|
|
89220
|
+
${groupId}`, { address: candidate, groupId });
|
|
89221
|
+
}
|
|
89222
|
+
}
|
|
89223
|
+
const results = await Promise.all(
|
|
89224
|
+
[...targetsByKey.values()].map(async (target) => ({
|
|
89225
|
+
...target,
|
|
89226
|
+
denied: await params.service.denyGroup(target.address, target.groupId)
|
|
89227
|
+
}))
|
|
89228
|
+
);
|
|
89229
|
+
const deniedOn = results.filter((result) => result.denied).map(({ address, groupId }) => ({ address, groupId }));
|
|
89230
|
+
return {
|
|
89231
|
+
denied: deniedOn.length > 0,
|
|
89232
|
+
jobId,
|
|
89233
|
+
matched: matched.length,
|
|
89234
|
+
groupIds: [...groupIds],
|
|
89235
|
+
deniedClientCount: deniedOn.length,
|
|
89236
|
+
deniedOn
|
|
89237
|
+
};
|
|
89238
|
+
}
|
|
89186
89239
|
function filterKnownPendingGroups(items, sessionStore) {
|
|
89187
89240
|
if (!sessionStore) {
|
|
89188
89241
|
return items;
|
|
@@ -89337,7 +89390,8 @@ function formatCommandCompleted(command, result) {
|
|
|
89337
89390
|
return `[okx-agent-task] xmtp-get-pending-list command completed id=${command.id}`;
|
|
89338
89391
|
}
|
|
89339
89392
|
if (command.type === "xmtp-deny-pending-conversation") {
|
|
89340
|
-
|
|
89393
|
+
const target = command.jobId ? `job=${command.jobId}` : `group=${command.groupId}`;
|
|
89394
|
+
return `[okx-agent-task] xmtp-deny-pending-conversation command completed id=${command.id} ${target}`;
|
|
89341
89395
|
}
|
|
89342
89396
|
if (command.type === "xmtp-get-conversation-history") {
|
|
89343
89397
|
const rows = Array.isArray(result.payload) ? result.payload.length : 0;
|
|
@@ -90921,7 +90975,7 @@ function userWatchEventDeliveredSentryExtra(event) {
|
|
|
90921
90975
|
var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
90922
90976
|
var SENTRY_CONFIG = {
|
|
90923
90977
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
90924
|
-
release: "0.0.20
|
|
90978
|
+
release: "0.0.20",
|
|
90925
90979
|
environment
|
|
90926
90980
|
};
|
|
90927
90981
|
|
|
@@ -91148,12 +91202,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
91148
91202
|
}));
|
|
91149
91203
|
}
|
|
91150
91204
|
});
|
|
91151
|
-
service.setPluginVersion("0.0.20
|
|
91205
|
+
service.setPluginVersion("0.0.20");
|
|
91152
91206
|
await service.init();
|
|
91153
91207
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
91154
91208
|
if (pluginVersionStatus.unavailable) {
|
|
91155
91209
|
throw new Error(
|
|
91156
|
-
`@okxweb3/a2a-node v${"0.0.20
|
|
91210
|
+
`@okxweb3/a2a-node v${"0.0.20"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
91157
91211
|
);
|
|
91158
91212
|
}
|
|
91159
91213
|
const systemConfig = service.getSystemConfig();
|
|
@@ -91171,7 +91225,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
91171
91225
|
onchainosAgentId: "*",
|
|
91172
91226
|
reason: "system-config missing sentryDsn",
|
|
91173
91227
|
pluginId: "@okxweb3/a2a-node",
|
|
91174
|
-
pluginVersion: "0.0.20
|
|
91228
|
+
pluginVersion: "0.0.20"
|
|
91175
91229
|
});
|
|
91176
91230
|
}
|
|
91177
91231
|
logWithTimestamp(
|
package/package.json
CHANGED