@okxweb3/a2a-node 0.0.10 → 0.0.11-beta-5ac51a9b48-260619235922
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 +150 -66
- package/dist/index.js +26 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7074,8 +7074,8 @@ async function callOpenClawGateway(opts) {
|
|
|
7074
7074
|
async function callSessionsCreate(params) {
|
|
7075
7075
|
return callOpenClawGateway({ method: "sessions.create", params });
|
|
7076
7076
|
}
|
|
7077
|
-
async function
|
|
7078
|
-
return callOpenClawGateway({ method: "
|
|
7077
|
+
async function callDeleteSessions(params) {
|
|
7078
|
+
return await callOpenClawGateway({ method: "okx-a2a.delete_sessions", params });
|
|
7079
7079
|
}
|
|
7080
7080
|
async function callSessionsSend(params) {
|
|
7081
7081
|
const idempotencyKey = params.idempotencyKey ?? (0, import_node_crypto3.randomUUID)();
|
|
@@ -7152,7 +7152,7 @@ function buildConnectParams(config, instanceId) {
|
|
|
7152
7152
|
client: {
|
|
7153
7153
|
id: "gateway-client",
|
|
7154
7154
|
displayName: "okx-a2a-node",
|
|
7155
|
-
version: "0.0.
|
|
7155
|
+
version: "0.0.11-beta-5ac51a9b48-260619235922",
|
|
7156
7156
|
platform: "node",
|
|
7157
7157
|
mode: "backend",
|
|
7158
7158
|
instanceId
|
|
@@ -7163,7 +7163,7 @@ function buildConnectParams(config, instanceId) {
|
|
|
7163
7163
|
commands: [],
|
|
7164
7164
|
permissions: {},
|
|
7165
7165
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
7166
|
-
userAgent: `okx-a2a-node/${"0.0.
|
|
7166
|
+
userAgent: `okx-a2a-node/${"0.0.11-beta-5ac51a9b48-260619235922"}`,
|
|
7167
7167
|
auth: {
|
|
7168
7168
|
...config.token ? { token: config.token } : {},
|
|
7169
7169
|
...config.password ? { password: config.password } : {}
|
|
@@ -7404,8 +7404,7 @@ function toOpenClawGatewaySessionKey(input) {
|
|
|
7404
7404
|
return buildOpenClawGroupSessionKey(buildXmtpScopeKey({
|
|
7405
7405
|
jobId: input.jobId || peer.jobId,
|
|
7406
7406
|
myAgentId: input.myAgentId || peer.myAgentId,
|
|
7407
|
-
toAgentId: input.toAgentId || peer.toAgentId
|
|
7408
|
-
groupId: input.groupId || "_"
|
|
7407
|
+
toAgentId: input.toAgentId || peer.toAgentId
|
|
7409
7408
|
}));
|
|
7410
7409
|
}
|
|
7411
7410
|
return buildOpenClawGroupSessionKey(input.sessionKey);
|
|
@@ -7431,8 +7430,7 @@ function buildXmtpScopeKey(input) {
|
|
|
7431
7430
|
const qs = new URLSearchParams({
|
|
7432
7431
|
my: input.myAgentId,
|
|
7433
7432
|
to: input.toAgentId,
|
|
7434
|
-
job: input.jobId
|
|
7435
|
-
gid: input.groupId
|
|
7433
|
+
job: input.jobId
|
|
7436
7434
|
});
|
|
7437
7435
|
return `${XMTP_SCOPE_PREFIX}:${qs.toString()}`;
|
|
7438
7436
|
}
|
|
@@ -23317,7 +23315,7 @@ var init_outbound_behavior = __esm({
|
|
|
23317
23315
|
};
|
|
23318
23316
|
DEFAULT_GATEWAY_PORT2 = {
|
|
23319
23317
|
callSessionsCreate,
|
|
23320
|
-
|
|
23318
|
+
callDeleteSessions,
|
|
23321
23319
|
callSessionsSend,
|
|
23322
23320
|
callChatInject,
|
|
23323
23321
|
callDispatchUserToLatestSessions,
|
|
@@ -23355,17 +23353,24 @@ var init_outbound_behavior = __esm({
|
|
|
23355
23353
|
}
|
|
23356
23354
|
}
|
|
23357
23355
|
async deleteSession(input) {
|
|
23356
|
+
const stored = this.sessionMetaStore?.getSession(input.sessionKey);
|
|
23358
23357
|
const gatewaySessionKey = this.resolveGatewaySessionKey(input);
|
|
23359
23358
|
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey}`);
|
|
23360
23359
|
try {
|
|
23361
|
-
await this.gateway.
|
|
23362
|
-
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession ok sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey}`);
|
|
23363
|
-
logger.info(LogEvent.SESSION_DELETED, gatewayOutboundExtra("sessions.delete", {
|
|
23360
|
+
const result = await this.gateway.callDeleteSessions({
|
|
23364
23361
|
sessionKey: input.sessionKey,
|
|
23365
|
-
|
|
23362
|
+
...stored?.jobId ? { jobId: stored.jobId } : {},
|
|
23363
|
+
...stored?.myAgentId ? { myAgentId: stored.myAgentId } : {},
|
|
23364
|
+
...stored?.toAgentId ? { toAgentId: stored.toAgentId } : {}
|
|
23365
|
+
});
|
|
23366
|
+
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession ok sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey} deleted=${result.deleted ?? "(unknown)"}`);
|
|
23367
|
+
logger.info(LogEvent.SESSION_DELETED, gatewayOutboundExtra("okx-a2a.delete_sessions", {
|
|
23368
|
+
sessionKey: input.sessionKey,
|
|
23369
|
+
gatewaySessionKey,
|
|
23370
|
+
deleted: result.deleted ?? ""
|
|
23366
23371
|
}));
|
|
23367
23372
|
} catch (err2) {
|
|
23368
|
-
logger.error(LogEvent.GATEWAY_REQUEST_FAILED, err2 instanceof Error ? err2 : new Error(String(err2)), gatewayOutboundExtra("
|
|
23373
|
+
logger.error(LogEvent.GATEWAY_REQUEST_FAILED, err2 instanceof Error ? err2 : new Error(String(err2)), gatewayOutboundExtra("okx-a2a.delete_sessions", {
|
|
23369
23374
|
sessionKey: input.sessionKey,
|
|
23370
23375
|
gatewaySessionKey
|
|
23371
23376
|
}));
|
|
@@ -23657,7 +23662,7 @@ var init_sentry_config = __esm({
|
|
|
23657
23662
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
23658
23663
|
SENTRY_CONFIG = {
|
|
23659
23664
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
23660
|
-
release: "0.0.
|
|
23665
|
+
release: "0.0.11-beta-5ac51a9b48-260619235922",
|
|
23661
23666
|
environment
|
|
23662
23667
|
};
|
|
23663
23668
|
}
|
|
@@ -90585,12 +90590,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
90585
90590
|
}));
|
|
90586
90591
|
}
|
|
90587
90592
|
});
|
|
90588
|
-
service.setPluginVersion("0.0.
|
|
90593
|
+
service.setPluginVersion("0.0.11-beta-5ac51a9b48-260619235922");
|
|
90589
90594
|
await service.init();
|
|
90590
90595
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
90591
90596
|
if (pluginVersionStatus.unavailable) {
|
|
90592
90597
|
throw new Error(
|
|
90593
|
-
`@okxweb3/a2a-node v${"0.0.
|
|
90598
|
+
`@okxweb3/a2a-node v${"0.0.11-beta-5ac51a9b48-260619235922"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
90594
90599
|
);
|
|
90595
90600
|
}
|
|
90596
90601
|
const systemConfig = service.getSystemConfig();
|
|
@@ -90608,7 +90613,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
90608
90613
|
onchainosAgentId: "*",
|
|
90609
90614
|
reason: "system-config missing sentryDsn",
|
|
90610
90615
|
pluginId: "@okxweb3/a2a-node",
|
|
90611
|
-
pluginVersion: "0.0.
|
|
90616
|
+
pluginVersion: "0.0.11-beta-5ac51a9b48-260619235922"
|
|
90612
90617
|
});
|
|
90613
90618
|
}
|
|
90614
90619
|
console.log(
|
|
@@ -91718,21 +91723,40 @@ function readProviderFilter(store, parsed, jobId) {
|
|
|
91718
91723
|
return detectCurrentAiProvider(process.env) ?? void 0;
|
|
91719
91724
|
}
|
|
91720
91725
|
function resolveUserAttentionProvider(store, jobId) {
|
|
91721
|
-
|
|
91722
|
-
|
|
91726
|
+
const normalizedJobId = normalizeOptionalText2(jobId);
|
|
91727
|
+
if (normalizedJobId) {
|
|
91728
|
+
const binding = store.getJobProviderBinding(normalizedJobId);
|
|
91729
|
+
if (binding) {
|
|
91730
|
+
return binding.provider;
|
|
91731
|
+
}
|
|
91723
91732
|
}
|
|
91724
|
-
const
|
|
91725
|
-
if (
|
|
91726
|
-
return
|
|
91733
|
+
const explicit = readExplicitUserAttentionProvider();
|
|
91734
|
+
if (explicit) {
|
|
91735
|
+
return bindUserAttentionProviderIfNeeded(store, normalizedJobId, explicit);
|
|
91736
|
+
}
|
|
91737
|
+
const currentRuntime = detectCurrentAiProvider(process.env) ?? normalizeOptionalAiProvider(process.env.OKX_AGENT_TASK_AI_PROVIDER);
|
|
91738
|
+
if (currentRuntime) {
|
|
91739
|
+
return bindUserAttentionProviderIfNeeded(store, normalizedJobId, currentRuntime);
|
|
91740
|
+
}
|
|
91741
|
+
const defaultProvider = store.getDefaultAiProvider();
|
|
91742
|
+
if (defaultProvider) {
|
|
91743
|
+
return bindUserAttentionProviderIfNeeded(store, normalizedJobId, defaultProvider);
|
|
91727
91744
|
}
|
|
91728
91745
|
if (readSyncedOpenClawGatewayConfig(store.homeDir)) {
|
|
91729
|
-
|
|
91730
|
-
return store.bindJobProviderIfMissing({ jobId: jobId.trim(), provider: "openclaw" }).binding.provider;
|
|
91731
|
-
}
|
|
91732
|
-
return "openclaw";
|
|
91746
|
+
return bindUserAttentionProviderIfNeeded(store, normalizedJobId, "openclaw");
|
|
91733
91747
|
}
|
|
91734
91748
|
return "codex";
|
|
91735
91749
|
}
|
|
91750
|
+
function readExplicitUserAttentionProvider() {
|
|
91751
|
+
return normalizeOptionalAiProvider(process.env.OKX_AGENT_TASK_AI_CLI?.trim() || process.env.OKX_A2A_AI_PROVIDER?.trim());
|
|
91752
|
+
}
|
|
91753
|
+
function normalizeOptionalAiProvider(value) {
|
|
91754
|
+
const normalized = normalizeOptionalText2(value);
|
|
91755
|
+
return normalized ? normalizeAiProvider(normalized) : null;
|
|
91756
|
+
}
|
|
91757
|
+
function bindUserAttentionProviderIfNeeded(store, jobId, provider) {
|
|
91758
|
+
return jobId ? store.bindJobProviderIfMissing({ jobId, provider }).binding.provider : provider;
|
|
91759
|
+
}
|
|
91736
91760
|
function bindHermesAttentionRouteIfAvailable(input) {
|
|
91737
91761
|
const envRoute = currentHermesRouteFromEnv();
|
|
91738
91762
|
logHermesRouteBinding("hermes_route_bind_attempt", {
|
|
@@ -91862,12 +91886,19 @@ function writeHermesRouteStore(path, store) {
|
|
|
91862
91886
|
(0, import_node_fs15.renameSync)(tempPath, path);
|
|
91863
91887
|
}
|
|
91864
91888
|
function logHermesRouteBinding(event, fields) {
|
|
91889
|
+
if (!isHermesRouteBindingDebugEnabled()) {
|
|
91890
|
+
return;
|
|
91891
|
+
}
|
|
91865
91892
|
console.error(JSON.stringify({
|
|
91866
91893
|
component: "user_attention_cli",
|
|
91867
91894
|
event,
|
|
91868
91895
|
...fields
|
|
91869
91896
|
}));
|
|
91870
91897
|
}
|
|
91898
|
+
function isHermesRouteBindingDebugEnabled() {
|
|
91899
|
+
const value = process.env.OKX_A2A_DEBUG_HERMES_ROUTE_BINDING ?? "";
|
|
91900
|
+
return value === "1" || value.toLowerCase() === "true";
|
|
91901
|
+
}
|
|
91871
91902
|
function isRecord2(value) {
|
|
91872
91903
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
91873
91904
|
}
|
|
@@ -92013,19 +92044,28 @@ async function handleSessionCommand(args) {
|
|
|
92013
92044
|
const missingSessionKeys = [];
|
|
92014
92045
|
let lastProvider = null;
|
|
92015
92046
|
let gatewayDeleted = 0;
|
|
92047
|
+
const exactSessionKey = parsed.options.get("session-key") ?? null;
|
|
92048
|
+
const jobId = parsed.options.get("job-id") ?? null;
|
|
92049
|
+
const toAgentId = parsed.options.get("to-agent-id") ?? null;
|
|
92050
|
+
const exactExisting = exactSessionKey ? store.getSession(exactSessionKey) : null;
|
|
92051
|
+
const provider = resolveSessionDeleteProvider(
|
|
92052
|
+
store,
|
|
92053
|
+
exactExisting?.jobId ?? (exactSessionKey ? inferJobIdFromSessionKey3(exactSessionKey) : jobId)
|
|
92054
|
+
);
|
|
92055
|
+
if (provider === "openclaw") {
|
|
92056
|
+
usedOpenClawGateway = true;
|
|
92057
|
+
lastProvider = provider;
|
|
92058
|
+
const result = await callDeleteSessions({
|
|
92059
|
+
...exactSessionKey ? { sessionKey: exactSessionKey } : {},
|
|
92060
|
+
...jobId ? { jobId } : {},
|
|
92061
|
+
...toAgentId ? { toAgentId } : {},
|
|
92062
|
+
...exactExisting?.jobId ? { jobId: exactExisting.jobId } : {},
|
|
92063
|
+
...exactExisting?.myAgentId ? { myAgentId: exactExisting.myAgentId } : {},
|
|
92064
|
+
...exactExisting?.toAgentId ? { toAgentId: exactExisting.toAgentId } : {}
|
|
92065
|
+
});
|
|
92066
|
+
gatewayDeleted = Number.isFinite(result.deleted) ? Number(result.deleted) : 0;
|
|
92067
|
+
}
|
|
92016
92068
|
for (const target of targets) {
|
|
92017
|
-
const existing = store.getSession(target.sessionKey);
|
|
92018
|
-
const provider = resolveSessionLifecycleProvider(
|
|
92019
|
-
store,
|
|
92020
|
-
existing?.jobId ?? inferJobIdFromSessionKey3(target.sessionKey)
|
|
92021
|
-
);
|
|
92022
|
-
const behavior = provider === "openclaw" ? createOutboundBehavior(provider, { store }) : null;
|
|
92023
|
-
if (existing && behavior) {
|
|
92024
|
-
usedOpenClawGateway = true;
|
|
92025
|
-
lastProvider = provider;
|
|
92026
|
-
await behavior.deleteSession({ sessionKey: target.sessionKey });
|
|
92027
|
-
gatewayDeleted += 1;
|
|
92028
|
-
}
|
|
92029
92069
|
const deleted = store.deleteSession(target.sessionKey);
|
|
92030
92070
|
if (deleted) {
|
|
92031
92071
|
deletedSessionKeys.push(target.sessionKey);
|
|
@@ -92033,25 +92073,26 @@ async function handleSessionCommand(args) {
|
|
|
92033
92073
|
missingSessionKeys.push(target.sessionKey);
|
|
92034
92074
|
}
|
|
92035
92075
|
}
|
|
92036
|
-
const
|
|
92076
|
+
const deleteSucceeded = deletedSessionKeys.length > 0 || gatewayDeleted > 0;
|
|
92077
|
+
const jobProviderBindingDeleted = deleteSucceeded && parsed.options.has("job-id") && !parsed.options.has("to-agent-id") ? store.deleteJobProviderBinding(readRequiredOption3(parsed, "job-id")) : false;
|
|
92037
92078
|
logger.info(LogEvent.SESSION_DELETED, sessionCliSentryExtra("session_delete", {
|
|
92038
92079
|
sessionKey: targets.map((target) => target.sessionKey).join(","),
|
|
92039
92080
|
status: deletedSessionKeys.length > 0 ? "deleted" : "not_found",
|
|
92040
92081
|
provider: lastProvider ?? ""
|
|
92041
92082
|
}));
|
|
92042
|
-
const
|
|
92043
|
-
if (
|
|
92044
|
-
const deleted = deletedSessionKeys.length === 1;
|
|
92083
|
+
const exactOutputSessionKey = targets.length === 1 && parsed.options.has("session-key") ? targets[0].sessionKey : null;
|
|
92084
|
+
if (exactOutputSessionKey) {
|
|
92085
|
+
const deleted = deletedSessionKeys.length === 1 || gatewayDeleted > 0;
|
|
92045
92086
|
output2(
|
|
92046
92087
|
json,
|
|
92047
|
-
{ ok: deleted, deleted, sessionKey:
|
|
92048
|
-
deleted ? `deleted ${
|
|
92088
|
+
{ ok: deleted, deleted, sessionKey: exactOutputSessionKey, provider: lastProvider, gatewayDeleted },
|
|
92089
|
+
deleted ? `deleted ${exactOutputSessionKey}` : `session not found: ${exactOutputSessionKey}`
|
|
92049
92090
|
);
|
|
92050
92091
|
} else {
|
|
92051
92092
|
output2(
|
|
92052
92093
|
json,
|
|
92053
92094
|
{
|
|
92054
|
-
ok:
|
|
92095
|
+
ok: deleteSucceeded,
|
|
92055
92096
|
deleted: deletedSessionKeys.length,
|
|
92056
92097
|
deletedSessionKeys,
|
|
92057
92098
|
missingSessionKeys,
|
|
@@ -92061,10 +92102,10 @@ async function handleSessionCommand(args) {
|
|
|
92061
92102
|
gatewayDeleted,
|
|
92062
92103
|
jobProviderBindingDeleted
|
|
92063
92104
|
},
|
|
92064
|
-
|
|
92105
|
+
deleteSucceeded ? formatDeleteSummary(deletedSessionKeys.length, gatewayDeleted) : "session not found"
|
|
92065
92106
|
);
|
|
92066
92107
|
}
|
|
92067
|
-
if (
|
|
92108
|
+
if (!deleteSucceeded) {
|
|
92068
92109
|
process.exitCode = 2;
|
|
92069
92110
|
}
|
|
92070
92111
|
return;
|
|
@@ -92108,7 +92149,7 @@ Commands:
|
|
|
92108
92149
|
delete (--session-key <key> | --job-id <id> [--to-agent-id <id>]) [--json]
|
|
92109
92150
|
dispatch --job-id <id> [--session-agent-id <id>] [--message-id <id>] [--json]
|
|
92110
92151
|
send (--session-key <key> | --job-id <id> [--to-agent-id <id>]) --content <text> [--agent-id <id>] [--message-id <id>] [--retry] [--json]
|
|
92111
|
-
gen-key --job-id <id>
|
|
92152
|
+
gen-key --job-id <id> (--my-agent-id <id> --to-agent-id <id> | --my-xmtp-address <address> --to-xmtp-address <address>) [--json]
|
|
92112
92153
|
`);
|
|
92113
92154
|
}
|
|
92114
92155
|
function printSessionSubcommandUsage(subcommand) {
|
|
@@ -92221,13 +92262,12 @@ Options:
|
|
|
92221
92262
|
return true;
|
|
92222
92263
|
}
|
|
92223
92264
|
if (subcommand === "gen-key") {
|
|
92224
|
-
console.log(`Usage: okx-a2a session gen-key --job-id <id>
|
|
92265
|
+
console.log(`Usage: okx-a2a session gen-key --job-id <id> (--my-agent-id <id> --to-agent-id <id> | --my-xmtp-address <address> --to-xmtp-address <address>) [--json]
|
|
92225
92266
|
|
|
92226
92267
|
Generate a deterministic local session key.
|
|
92227
92268
|
|
|
92228
92269
|
Options:
|
|
92229
92270
|
--job-id <id> Job id.
|
|
92230
|
-
--group-id <id> XMTP group id.
|
|
92231
92271
|
--my-agent-id <id> Local agent id.
|
|
92232
92272
|
--to-agent-id <id> Peer agent id.
|
|
92233
92273
|
--my-xmtp-address <addr> Local XMTP address.
|
|
@@ -92468,18 +92508,58 @@ function sessionCliSentryExtra(operation, extra = {}) {
|
|
|
92468
92508
|
};
|
|
92469
92509
|
}
|
|
92470
92510
|
function resolveSessionLifecycleProvider(store, jobId) {
|
|
92471
|
-
const
|
|
92511
|
+
const normalizedJobId = jobId?.trim() || null;
|
|
92512
|
+
if (normalizedJobId) {
|
|
92513
|
+
const binding = store.getJobProviderBinding(normalizedJobId);
|
|
92514
|
+
if (binding) {
|
|
92515
|
+
return binding.provider;
|
|
92516
|
+
}
|
|
92517
|
+
}
|
|
92518
|
+
const explicit = readExplicitSessionCommandProvider();
|
|
92519
|
+
if (explicit) {
|
|
92520
|
+
return bindSessionProviderIfNeeded(store, normalizedJobId, explicit);
|
|
92521
|
+
}
|
|
92522
|
+
const currentRuntime = detectCurrentSessionCommandProvider();
|
|
92523
|
+
if (currentRuntime) {
|
|
92524
|
+
return bindSessionProviderIfNeeded(store, normalizedJobId, currentRuntime);
|
|
92525
|
+
}
|
|
92526
|
+
const defaultProvider = store.getDefaultAiProvider();
|
|
92527
|
+
if (defaultProvider) {
|
|
92528
|
+
return bindSessionProviderIfNeeded(store, normalizedJobId, defaultProvider);
|
|
92529
|
+
}
|
|
92530
|
+
if (readSyncedOpenClawGatewayConfig()) {
|
|
92531
|
+
return bindSessionProviderIfNeeded(store, normalizedJobId, "openclaw");
|
|
92532
|
+
}
|
|
92533
|
+
return null;
|
|
92534
|
+
}
|
|
92535
|
+
function readExplicitSessionCommandProvider() {
|
|
92536
|
+
const explicit = process.env.OKX_AGENT_TASK_AI_CLI?.trim() || process.env.OKX_A2A_AI_PROVIDER?.trim();
|
|
92537
|
+
return explicit ? normalizeAiProvider(explicit) : null;
|
|
92538
|
+
}
|
|
92539
|
+
function detectCurrentSessionCommandProvider() {
|
|
92540
|
+
const detected = detectCurrentAiProvider(process.env);
|
|
92541
|
+
if (detected) {
|
|
92542
|
+
return detected;
|
|
92543
|
+
}
|
|
92544
|
+
const aiSessionProvider = process.env.OKX_AGENT_TASK_AI_PROVIDER?.trim();
|
|
92545
|
+
return aiSessionProvider ? normalizeAiProvider(aiSessionProvider) : null;
|
|
92546
|
+
}
|
|
92547
|
+
function bindSessionProviderIfNeeded(store, jobId, provider) {
|
|
92548
|
+
return jobId ? store.bindJobProviderIfMissing({ jobId, provider }).binding.provider : provider;
|
|
92549
|
+
}
|
|
92550
|
+
function resolveSessionDeleteProvider(store, jobId) {
|
|
92551
|
+
const normalizedJobId = jobId?.trim() || null;
|
|
92552
|
+
if (normalizedJobId) {
|
|
92553
|
+
const binding = store.getJobProviderBinding(normalizedJobId);
|
|
92554
|
+
if (binding) {
|
|
92555
|
+
return binding.provider === "openclaw" ? "openclaw" : null;
|
|
92556
|
+
}
|
|
92557
|
+
}
|
|
92558
|
+
const configured = resolveConfiguredAiProvider({ store });
|
|
92472
92559
|
if (configured === "openclaw") {
|
|
92473
92560
|
return "openclaw";
|
|
92474
92561
|
}
|
|
92475
92562
|
if (!configured && readSyncedOpenClawGatewayConfig()) {
|
|
92476
|
-
if (jobId?.trim()) {
|
|
92477
|
-
const binding = store.bindJobProviderIfMissing({
|
|
92478
|
-
jobId: jobId.trim(),
|
|
92479
|
-
provider: "openclaw"
|
|
92480
|
-
}).binding;
|
|
92481
|
-
return binding.provider === "openclaw" ? "openclaw" : null;
|
|
92482
|
-
}
|
|
92483
92563
|
return "openclaw";
|
|
92484
92564
|
}
|
|
92485
92565
|
return null;
|
|
@@ -92551,7 +92631,6 @@ function resolveSendSessionTargets(parsed, store) {
|
|
|
92551
92631
|
}
|
|
92552
92632
|
function generateSessionKey(parsed) {
|
|
92553
92633
|
const jobId = readRequiredOption3(parsed, "job-id");
|
|
92554
|
-
const groupId = readRequiredOption3(parsed, "group-id");
|
|
92555
92634
|
const myAgentId = parsed.options.get("my-agent-id");
|
|
92556
92635
|
const toAgentId = parsed.options.get("to-agent-id");
|
|
92557
92636
|
if (myAgentId || toAgentId) {
|
|
@@ -92568,8 +92647,7 @@ function generateSessionKey(parsed) {
|
|
|
92568
92647
|
const qs = new URLSearchParams({
|
|
92569
92648
|
my: myXmtpAddress,
|
|
92570
92649
|
to: toXmtpAddress,
|
|
92571
|
-
job: jobId
|
|
92572
|
-
gid: groupId
|
|
92650
|
+
job: jobId
|
|
92573
92651
|
});
|
|
92574
92652
|
return `okx-xmtp:${qs.toString()}`;
|
|
92575
92653
|
}
|
|
@@ -92586,6 +92664,12 @@ function output2(json, payload, human) {
|
|
|
92586
92664
|
}
|
|
92587
92665
|
console.log(human);
|
|
92588
92666
|
}
|
|
92667
|
+
function formatDeleteSummary(localDeleted, gatewayDeleted) {
|
|
92668
|
+
if (gatewayDeleted > 0) {
|
|
92669
|
+
return `deleted ${localDeleted} local session(s), ${gatewayDeleted} openclaw session(s)`;
|
|
92670
|
+
}
|
|
92671
|
+
return `deleted ${localDeleted} session(s)`;
|
|
92672
|
+
}
|
|
92589
92673
|
function outputHistory(_json, rows) {
|
|
92590
92674
|
console.log(JSON.stringify(rows, null, 2));
|
|
92591
92675
|
}
|
|
@@ -93194,7 +93278,7 @@ function isPrereleaseVersion(version2) {
|
|
|
93194
93278
|
}
|
|
93195
93279
|
function getCurrentNodeCliVersion() {
|
|
93196
93280
|
try {
|
|
93197
|
-
return "0.0.
|
|
93281
|
+
return "0.0.11-beta-5ac51a9b48-260619235922";
|
|
93198
93282
|
} catch {
|
|
93199
93283
|
return null;
|
|
93200
93284
|
}
|
|
@@ -93657,7 +93741,7 @@ init_task_config();
|
|
|
93657
93741
|
init_sentry_logger();
|
|
93658
93742
|
init_sentry_config();
|
|
93659
93743
|
function printUsage2() {
|
|
93660
|
-
console.log(`okx-a2a ${"0.0.
|
|
93744
|
+
console.log(`okx-a2a ${"0.0.11-beta-5ac51a9b48-260619235922"}
|
|
93661
93745
|
|
|
93662
93746
|
Usage:
|
|
93663
93747
|
okx-a2a <command> [options]
|
|
@@ -93694,7 +93778,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
93694
93778
|
`);
|
|
93695
93779
|
}
|
|
93696
93780
|
function printVersion() {
|
|
93697
|
-
console.log("0.0.
|
|
93781
|
+
console.log("0.0.11-beta-5ac51a9b48-260619235922");
|
|
93698
93782
|
}
|
|
93699
93783
|
function printDaemonUsage() {
|
|
93700
93784
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status> [options]
|
|
@@ -93840,7 +93924,7 @@ Commands:
|
|
|
93840
93924
|
delete (--session-key <key> | --job-id <id> [--to-agent-id <id>]) [--json]
|
|
93841
93925
|
dispatch --job-id <id> [--session-agent-id <id>] [--message-id <id>] [--json]
|
|
93842
93926
|
send (--session-key <key> | --job-id <id> [--to-agent-id <id>]) --content <text> [--agent-id <id>] [--message-id <id>] [--retry] [--json]
|
|
93843
|
-
gen-key --job-id <id>
|
|
93927
|
+
gen-key --job-id <id> (--my-agent-id <id> --to-agent-id <id> | --my-xmtp-address <address> --to-xmtp-address <address>) [--json]
|
|
93844
93928
|
`);
|
|
93845
93929
|
}
|
|
93846
93930
|
function printFileUsageProxy() {
|
package/dist/index.js
CHANGED
|
@@ -67955,6 +67955,7 @@ __export(index_exports, {
|
|
|
67955
67955
|
buildSystemMessageNotice: () => buildSystemMessageNotice,
|
|
67956
67956
|
buildSystemStoredMessage: () => buildSystemStoredMessage,
|
|
67957
67957
|
callChatInject: () => callChatInject,
|
|
67958
|
+
callDeleteSessions: () => callDeleteSessions,
|
|
67958
67959
|
callOpenClawGateway: () => callOpenClawGateway,
|
|
67959
67960
|
callSessionsCreate: () => callSessionsCreate,
|
|
67960
67961
|
callSessionsDelete: () => callSessionsDelete,
|
|
@@ -85545,6 +85546,9 @@ async function callSessionsCreate(params) {
|
|
|
85545
85546
|
async function callSessionsDelete(params) {
|
|
85546
85547
|
return callOpenClawGateway({ method: "sessions.delete", params });
|
|
85547
85548
|
}
|
|
85549
|
+
async function callDeleteSessions(params) {
|
|
85550
|
+
return await callOpenClawGateway({ method: "okx-a2a.delete_sessions", params });
|
|
85551
|
+
}
|
|
85548
85552
|
async function callSessionsSend(params) {
|
|
85549
85553
|
const idempotencyKey = params.idempotencyKey ?? (0, import_node_crypto6.randomUUID)();
|
|
85550
85554
|
const sendParams = { key: params.key, message: params.message, idempotencyKey };
|
|
@@ -85801,7 +85805,7 @@ function buildConnectParams(config, instanceId) {
|
|
|
85801
85805
|
client: {
|
|
85802
85806
|
id: "gateway-client",
|
|
85803
85807
|
displayName: "okx-a2a-node",
|
|
85804
|
-
version: "0.0.
|
|
85808
|
+
version: "0.0.11-beta-5ac51a9b48-260619235922",
|
|
85805
85809
|
platform: "node",
|
|
85806
85810
|
mode: "backend",
|
|
85807
85811
|
instanceId
|
|
@@ -85812,7 +85816,7 @@ function buildConnectParams(config, instanceId) {
|
|
|
85812
85816
|
commands: [],
|
|
85813
85817
|
permissions: {},
|
|
85814
85818
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
85815
|
-
userAgent: `okx-a2a-node/${"0.0.
|
|
85819
|
+
userAgent: `okx-a2a-node/${"0.0.11-beta-5ac51a9b48-260619235922"}`,
|
|
85816
85820
|
auth: {
|
|
85817
85821
|
...config.token ? { token: config.token } : {},
|
|
85818
85822
|
...config.password ? { password: config.password } : {}
|
|
@@ -85859,8 +85863,7 @@ function toOpenClawGatewaySessionKey(input) {
|
|
|
85859
85863
|
return buildOpenClawGroupSessionKey(buildXmtpScopeKey({
|
|
85860
85864
|
jobId: input.jobId || peer.jobId,
|
|
85861
85865
|
myAgentId: input.myAgentId || peer.myAgentId,
|
|
85862
|
-
toAgentId: input.toAgentId || peer.toAgentId
|
|
85863
|
-
groupId: input.groupId || "_"
|
|
85866
|
+
toAgentId: input.toAgentId || peer.toAgentId
|
|
85864
85867
|
}));
|
|
85865
85868
|
}
|
|
85866
85869
|
return buildOpenClawGroupSessionKey(input.sessionKey);
|
|
@@ -85886,8 +85889,7 @@ function buildXmtpScopeKey(input) {
|
|
|
85886
85889
|
const qs = new URLSearchParams({
|
|
85887
85890
|
my: input.myAgentId,
|
|
85888
85891
|
to: input.toAgentId,
|
|
85889
|
-
job: input.jobId
|
|
85890
|
-
gid: input.groupId
|
|
85892
|
+
job: input.jobId
|
|
85891
85893
|
});
|
|
85892
85894
|
return `${XMTP_SCOPE_PREFIX}:${qs.toString()}`;
|
|
85893
85895
|
}
|
|
@@ -85967,7 +85969,7 @@ var SqliteOutboundBehavior = class {
|
|
|
85967
85969
|
};
|
|
85968
85970
|
var DEFAULT_GATEWAY_PORT2 = {
|
|
85969
85971
|
callSessionsCreate,
|
|
85970
|
-
|
|
85972
|
+
callDeleteSessions,
|
|
85971
85973
|
callSessionsSend,
|
|
85972
85974
|
callChatInject,
|
|
85973
85975
|
callDispatchUserToLatestSessions,
|
|
@@ -86029,17 +86031,24 @@ var GatewayOutboundBehavior = class {
|
|
|
86029
86031
|
}
|
|
86030
86032
|
}
|
|
86031
86033
|
async deleteSession(input) {
|
|
86034
|
+
const stored = this.sessionMetaStore?.getSession(input.sessionKey);
|
|
86032
86035
|
const gatewaySessionKey = this.resolveGatewaySessionKey(input);
|
|
86033
86036
|
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey}`);
|
|
86034
86037
|
try {
|
|
86035
|
-
await this.gateway.
|
|
86036
|
-
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession ok sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey}`);
|
|
86037
|
-
logger.info(LogEvent.SESSION_DELETED, gatewayOutboundExtra("sessions.delete", {
|
|
86038
|
+
const result = await this.gateway.callDeleteSessions({
|
|
86038
86039
|
sessionKey: input.sessionKey,
|
|
86039
|
-
|
|
86040
|
+
...stored?.jobId ? { jobId: stored.jobId } : {},
|
|
86041
|
+
...stored?.myAgentId ? { myAgentId: stored.myAgentId } : {},
|
|
86042
|
+
...stored?.toAgentId ? { toAgentId: stored.toAgentId } : {}
|
|
86043
|
+
});
|
|
86044
|
+
console.error(`${GATEWAY_OUTBOUND_LOG_PREFIX} deleteSession ok sessionKey=${input.sessionKey} gatewaySessionKey=${gatewaySessionKey} deleted=${result.deleted ?? "(unknown)"}`);
|
|
86045
|
+
logger.info(LogEvent.SESSION_DELETED, gatewayOutboundExtra("okx-a2a.delete_sessions", {
|
|
86046
|
+
sessionKey: input.sessionKey,
|
|
86047
|
+
gatewaySessionKey,
|
|
86048
|
+
deleted: result.deleted ?? ""
|
|
86040
86049
|
}));
|
|
86041
86050
|
} catch (err2) {
|
|
86042
|
-
logger.error(LogEvent.GATEWAY_REQUEST_FAILED, err2 instanceof Error ? err2 : new Error(String(err2)), gatewayOutboundExtra("
|
|
86051
|
+
logger.error(LogEvent.GATEWAY_REQUEST_FAILED, err2 instanceof Error ? err2 : new Error(String(err2)), gatewayOutboundExtra("okx-a2a.delete_sessions", {
|
|
86043
86052
|
sessionKey: input.sessionKey,
|
|
86044
86053
|
gatewaySessionKey
|
|
86045
86054
|
}));
|
|
@@ -89163,7 +89172,7 @@ function userWatchEventDeliveredSentryExtra(event) {
|
|
|
89163
89172
|
var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
89164
89173
|
var SENTRY_CONFIG = {
|
|
89165
89174
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
89166
|
-
release: "0.0.
|
|
89175
|
+
release: "0.0.11-beta-5ac51a9b48-260619235922",
|
|
89167
89176
|
environment
|
|
89168
89177
|
};
|
|
89169
89178
|
|
|
@@ -89282,12 +89291,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
89282
89291
|
}));
|
|
89283
89292
|
}
|
|
89284
89293
|
});
|
|
89285
|
-
service.setPluginVersion("0.0.
|
|
89294
|
+
service.setPluginVersion("0.0.11-beta-5ac51a9b48-260619235922");
|
|
89286
89295
|
await service.init();
|
|
89287
89296
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
89288
89297
|
if (pluginVersionStatus.unavailable) {
|
|
89289
89298
|
throw new Error(
|
|
89290
|
-
`@okxweb3/a2a-node v${"0.0.
|
|
89299
|
+
`@okxweb3/a2a-node v${"0.0.11-beta-5ac51a9b48-260619235922"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
89291
89300
|
);
|
|
89292
89301
|
}
|
|
89293
89302
|
const systemConfig = service.getSystemConfig();
|
|
@@ -89305,7 +89314,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
89305
89314
|
onchainosAgentId: "*",
|
|
89306
89315
|
reason: "system-config missing sentryDsn",
|
|
89307
89316
|
pluginId: "@okxweb3/a2a-node",
|
|
89308
|
-
pluginVersion: "0.0.
|
|
89317
|
+
pluginVersion: "0.0.11-beta-5ac51a9b48-260619235922"
|
|
89309
89318
|
});
|
|
89310
89319
|
}
|
|
89311
89320
|
console.log(
|
|
@@ -89616,6 +89625,7 @@ function parsePluginYamlVersion(content3) {
|
|
|
89616
89625
|
buildSystemMessageNotice,
|
|
89617
89626
|
buildSystemStoredMessage,
|
|
89618
89627
|
callChatInject,
|
|
89628
|
+
callDeleteSessions,
|
|
89619
89629
|
callOpenClawGateway,
|
|
89620
89630
|
callSessionsCreate,
|
|
89621
89631
|
callSessionsDelete,
|
package/package.json
CHANGED