@okxweb3/a2a-node 0.2.6-beta-5b74111b38-260814141953 → 0.2.6
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 +113 -38
- package/dist/index.js +111 -35
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2972,6 +2972,18 @@ function systemdUnitHasCurrentRestartPolicy(content2) {
|
|
|
2972
2972
|
function launchdPlistHasCurrentRestartPolicy(content2) {
|
|
2973
2973
|
return content2.includes("<key>SuccessfulExit</key>");
|
|
2974
2974
|
}
|
|
2975
|
+
function decodeXmlText(value) {
|
|
2976
|
+
return value.replace(/'/g, "'").replace(/"/g, '"').replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&");
|
|
2977
|
+
}
|
|
2978
|
+
function servicePathHasRequiredEntries(content2, platform, requiredEntries) {
|
|
2979
|
+
const pathValue = platform === "linux" ? content2.match(/^Environment="PATH=(.*)"$/m)?.[1] : content2.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/)?.[1];
|
|
2980
|
+
if (pathValue === void 0) {
|
|
2981
|
+
return false;
|
|
2982
|
+
}
|
|
2983
|
+
const decodedPath = platform === "darwin" ? decodeXmlText(pathValue) : pathValue;
|
|
2984
|
+
const entries = new Set(decodedPath.split(import_node_path9.delimiter).filter(Boolean));
|
|
2985
|
+
return requiredEntries.every((entry) => entries.has(entry));
|
|
2986
|
+
}
|
|
2975
2987
|
async function installedAutostartHasCurrentRestartPolicy() {
|
|
2976
2988
|
try {
|
|
2977
2989
|
if (process.platform === "linux") {
|
|
@@ -2992,11 +3004,11 @@ async function installedAutostartHasCurrentConfiguration() {
|
|
|
2992
3004
|
const requiredPathEntries = requiredServicePathEntries();
|
|
2993
3005
|
if (process.platform === "linux") {
|
|
2994
3006
|
const content2 = await (0, import_promises3.readFile)(resolveSystemdAutostartPaths().servicePath, "utf8");
|
|
2995
|
-
return systemdUnitHasCurrentRestartPolicy(content2) &&
|
|
3007
|
+
return systemdUnitHasCurrentRestartPolicy(content2) && servicePathHasRequiredEntries(content2, process.platform, requiredPathEntries);
|
|
2996
3008
|
}
|
|
2997
3009
|
if (process.platform === "darwin") {
|
|
2998
3010
|
const content2 = await (0, import_promises3.readFile)(resolveLaunchdAutostartPaths().plistPath, "utf8");
|
|
2999
|
-
return launchdPlistHasCurrentRestartPolicy(content2) &&
|
|
3011
|
+
return launchdPlistHasCurrentRestartPolicy(content2) && servicePathHasRequiredEntries(content2, process.platform, requiredPathEntries);
|
|
3000
3012
|
}
|
|
3001
3013
|
} catch {
|
|
3002
3014
|
return true;
|
|
@@ -26636,7 +26648,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26636
26648
|
client: {
|
|
26637
26649
|
id: "gateway-client",
|
|
26638
26650
|
displayName: "okx-a2a-node",
|
|
26639
|
-
version: "0.2.6
|
|
26651
|
+
version: "0.2.6",
|
|
26640
26652
|
platform: "node",
|
|
26641
26653
|
mode: "backend",
|
|
26642
26654
|
instanceId
|
|
@@ -26647,7 +26659,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26647
26659
|
commands: [],
|
|
26648
26660
|
permissions: {},
|
|
26649
26661
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
26650
|
-
userAgent: `okx-a2a-node/${"0.2.6
|
|
26662
|
+
userAgent: `okx-a2a-node/${"0.2.6"}`,
|
|
26651
26663
|
auth: {
|
|
26652
26664
|
...config.token ? { token: config.token } : {},
|
|
26653
26665
|
...config.password ? { password: config.password } : {}
|
|
@@ -28556,7 +28568,7 @@ var init_sentry_config = __esm({
|
|
|
28556
28568
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
28557
28569
|
SENTRY_CONFIG = {
|
|
28558
28570
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
28559
|
-
release: "0.2.6
|
|
28571
|
+
release: "0.2.6",
|
|
28560
28572
|
environment,
|
|
28561
28573
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
28562
28574
|
};
|
|
@@ -39726,7 +39738,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
39726
39738
|
node: process.version,
|
|
39727
39739
|
platform: process.platform,
|
|
39728
39740
|
arch: process.arch,
|
|
39729
|
-
packageVersion: true ? "0.2.6
|
|
39741
|
+
packageVersion: true ? "0.2.6" : "unknown",
|
|
39730
39742
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
39731
39743
|
listenerAndLlmContentIncluded: true,
|
|
39732
39744
|
credentialsAlwaysRedacted: true,
|
|
@@ -59808,6 +59820,30 @@ var init_a2a = __esm({
|
|
|
59808
59820
|
function isNonEmptyPlainObject(v) {
|
|
59809
59821
|
return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
|
|
59810
59822
|
}
|
|
59823
|
+
function readStringRecord(value) {
|
|
59824
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
59825
|
+
return {};
|
|
59826
|
+
}
|
|
59827
|
+
return Object.fromEntries(
|
|
59828
|
+
Object.entries(value).filter((entry) => typeof entry[1] === "string")
|
|
59829
|
+
);
|
|
59830
|
+
}
|
|
59831
|
+
function mergeA2AEnvelopeTips(payload, receiverTips) {
|
|
59832
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
59833
|
+
return payload;
|
|
59834
|
+
}
|
|
59835
|
+
const envelope = payload;
|
|
59836
|
+
if (envelope.msgType !== A2A_MESSAGE_TYPE) {
|
|
59837
|
+
return payload;
|
|
59838
|
+
}
|
|
59839
|
+
return {
|
|
59840
|
+
...envelope,
|
|
59841
|
+
tips: {
|
|
59842
|
+
...readStringRecord(envelope.tips),
|
|
59843
|
+
...readStringRecord(receiverTips)
|
|
59844
|
+
}
|
|
59845
|
+
};
|
|
59846
|
+
}
|
|
59811
59847
|
function buildA2AEnvelope(params) {
|
|
59812
59848
|
const envelope = {
|
|
59813
59849
|
msgType: A2A_MESSAGE_TYPE,
|
|
@@ -65611,11 +65647,11 @@ function extractXmtpSentAtMs2(msg) {
|
|
|
65611
65647
|
}
|
|
65612
65648
|
return Date.now();
|
|
65613
65649
|
}
|
|
65614
|
-
function
|
|
65650
|
+
function parseJson2(rawText) {
|
|
65615
65651
|
try {
|
|
65616
|
-
return {
|
|
65652
|
+
return { ok: true, data: JSON.parse(rawText) };
|
|
65617
65653
|
} catch {
|
|
65618
|
-
return {
|
|
65654
|
+
return { ok: false, data: null };
|
|
65619
65655
|
}
|
|
65620
65656
|
}
|
|
65621
65657
|
function readString5(value) {
|
|
@@ -66524,10 +66560,21 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66524
66560
|
}
|
|
66525
66561
|
}
|
|
66526
66562
|
const parseStartedAt = Date.now();
|
|
66527
|
-
const
|
|
66528
|
-
const
|
|
66563
|
+
const receivedRawText = extractRawText(ctx.message.content);
|
|
66564
|
+
const parseResult = parseJson2(receivedRawText);
|
|
66565
|
+
let rawText = receivedRawText;
|
|
66566
|
+
if (parseResult.ok) {
|
|
66567
|
+
const mergedPayload = mergeA2AEnvelopeTips(
|
|
66568
|
+
parseResult.data,
|
|
66569
|
+
XmtpService.getInstance().getSystemConfig().extConfig.tips
|
|
66570
|
+
);
|
|
66571
|
+
if (mergedPayload !== parseResult.data) {
|
|
66572
|
+
parseResult.data = mergedPayload;
|
|
66573
|
+
rawText = stringifySystemPayload(mergedPayload);
|
|
66574
|
+
}
|
|
66575
|
+
}
|
|
66529
66576
|
timing.mark("payloadParse", parseStartedAt);
|
|
66530
|
-
const directToUser = chatType === "dm" &&
|
|
66577
|
+
const directToUser = chatType === "dm" && parseResult.ok ? extractDirectToUserNotification(parseResult.data) : { kind: "none" };
|
|
66531
66578
|
if (directToUser.kind === "invalid") {
|
|
66532
66579
|
const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto14.randomUUID)()}`;
|
|
66533
66580
|
logger.error(
|
|
@@ -66559,7 +66606,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66559
66606
|
});
|
|
66560
66607
|
return true;
|
|
66561
66608
|
}
|
|
66562
|
-
const systemNotification = chatType === "dm" &&
|
|
66609
|
+
const systemNotification = chatType === "dm" && parseResult.ok ? extractSystemNotification(parseResult.data) : null;
|
|
66563
66610
|
if (systemNotification) {
|
|
66564
66611
|
const systemMessageId = messageId || `system-${(0, import_node_crypto14.randomUUID)()}`;
|
|
66565
66612
|
logWithTimestamp(
|
|
@@ -66667,7 +66714,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66667
66714
|
maybeNotifyInboundAgentMessage({
|
|
66668
66715
|
deps,
|
|
66669
66716
|
chatType,
|
|
66670
|
-
payload:
|
|
66717
|
+
payload: parseResult.data,
|
|
66671
66718
|
jobId: systemNotification.jobId ?? BACKUP_JOB_ID,
|
|
66672
66719
|
sessionKey: primaryTarget?.sessionKey ?? SYSTEM_NOTIFICATION_SESSION_KEY,
|
|
66673
66720
|
messageId: systemMessageId
|
|
@@ -66712,13 +66759,13 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66712
66759
|
}));
|
|
66713
66760
|
});
|
|
66714
66761
|
logWithTimestamp(
|
|
66715
|
-
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(
|
|
66762
|
+
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parseResult.data)}`
|
|
66716
66763
|
);
|
|
66717
66764
|
}
|
|
66718
66765
|
return true;
|
|
66719
66766
|
}
|
|
66720
66767
|
const routeStartedAt = Date.now();
|
|
66721
|
-
const route = routeMessage(chatType,
|
|
66768
|
+
const route = routeMessage(chatType, parseResult.ok, parseResult.data);
|
|
66722
66769
|
timing.mark("routeResolve", routeStartedAt);
|
|
66723
66770
|
if (route.route === "job") {
|
|
66724
66771
|
const providerBindStartedAt = Date.now();
|
|
@@ -66744,7 +66791,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66744
66791
|
}
|
|
66745
66792
|
const sessionAgentId = route.route === "job" ? resolveSessionAgentId({
|
|
66746
66793
|
chatType,
|
|
66747
|
-
payload:
|
|
66794
|
+
payload: parseResult.ok ? parseResult.data : null,
|
|
66748
66795
|
myXmtpAddress: deps.myXmtpAddress
|
|
66749
66796
|
}) : null;
|
|
66750
66797
|
const xmtpSentAtMs = extractXmtpSentAtMs2(ctx.message);
|
|
@@ -66760,7 +66807,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66760
66807
|
);
|
|
66761
66808
|
}
|
|
66762
66809
|
if (route.route === "job" && chatType === "group") {
|
|
66763
|
-
const payloadObject = isPlainObject3(
|
|
66810
|
+
const payloadObject = isPlainObject3(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
|
|
66764
66811
|
const service = XmtpService.getInstance();
|
|
66765
66812
|
const trustedSystemSender = service.isTrustedSystemAccountSender({
|
|
66766
66813
|
senderAddress,
|
|
@@ -66791,7 +66838,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66791
66838
|
const myAgentId = localAgent?.agentId ?? readString5(payloadObject?.receiverAgentId) ?? sessionAgentId ?? null;
|
|
66792
66839
|
const toAgentId = readString5(sender?.agentId);
|
|
66793
66840
|
const accepted = await verifyInboundA2AGroupMessage({
|
|
66794
|
-
payload:
|
|
66841
|
+
payload: parseResult.ok ? parseResult.data : null,
|
|
66795
66842
|
myXmtpAddress: deps.myXmtpAddress,
|
|
66796
66843
|
senderAddress,
|
|
66797
66844
|
senderInboxId: ctx.message.senderInboxId ?? "",
|
|
@@ -66858,7 +66905,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66858
66905
|
maybeNotifyInboundAgentMessage({
|
|
66859
66906
|
deps,
|
|
66860
66907
|
chatType,
|
|
66861
|
-
payload:
|
|
66908
|
+
payload: parseResult.data,
|
|
66862
66909
|
jobId: route.jobId,
|
|
66863
66910
|
sessionKey,
|
|
66864
66911
|
messageId: routedMessageId,
|
|
@@ -66867,7 +66914,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66867
66914
|
}
|
|
66868
66915
|
void maybeAllowProviderGroup(deps, chatType, conversationId);
|
|
66869
66916
|
logWithTimestamp(
|
|
66870
|
-
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(
|
|
66917
|
+
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parseResult.data)}`
|
|
66871
66918
|
);
|
|
66872
66919
|
return true;
|
|
66873
66920
|
}
|
|
@@ -66884,12 +66931,12 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
66884
66931
|
senderInboxId: ctx.message.senderInboxId ?? "",
|
|
66885
66932
|
conversationId,
|
|
66886
66933
|
rawText,
|
|
66887
|
-
payload:
|
|
66934
|
+
payload: parseResult.ok ? parseResult.data : null
|
|
66888
66935
|
};
|
|
66889
66936
|
const storeAppendStartedAt = Date.now();
|
|
66890
66937
|
await deps.store.append(route.jobId, stored, sessionAgentId);
|
|
66891
66938
|
timing.mark("storeAppend", storeAppendStartedAt);
|
|
66892
|
-
if ((route.route === "job" ||
|
|
66939
|
+
if ((route.route === "job" || parseResult.ok && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
|
|
66893
66940
|
const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
|
|
66894
66941
|
const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
|
|
66895
66942
|
const localAgent = XmtpService.getInstance().getAgentByAddress(deps.myXmtpAddress);
|
|
@@ -67079,6 +67126,7 @@ var init_message_handler = __esm({
|
|
|
67079
67126
|
import_node_crypto14 = require("node:crypto");
|
|
67080
67127
|
init_dist2();
|
|
67081
67128
|
init_a2a();
|
|
67129
|
+
init_envelope_shared();
|
|
67082
67130
|
init_xmtp_sdk();
|
|
67083
67131
|
init_onchainos();
|
|
67084
67132
|
init_sentry_logger();
|
|
@@ -67532,12 +67580,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
67532
67580
|
});
|
|
67533
67581
|
}
|
|
67534
67582
|
});
|
|
67535
|
-
service.setPluginVersion("0.2.6
|
|
67583
|
+
service.setPluginVersion("0.2.6");
|
|
67536
67584
|
await service.init();
|
|
67537
67585
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
67538
67586
|
if (pluginVersionStatus.unavailable) {
|
|
67539
67587
|
throw new Error(
|
|
67540
|
-
`@okxweb3/a2a-node v${"0.2.6
|
|
67588
|
+
`@okxweb3/a2a-node v${"0.2.6"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
67541
67589
|
);
|
|
67542
67590
|
}
|
|
67543
67591
|
const systemConfig = service.getSystemConfig();
|
|
@@ -67555,7 +67603,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
67555
67603
|
onchainosAgentId: "*",
|
|
67556
67604
|
reason: "system-config missing sentryDsn",
|
|
67557
67605
|
pluginId: "@okxweb3/a2a-node",
|
|
67558
|
-
pluginVersion: "0.2.6
|
|
67606
|
+
pluginVersion: "0.2.6"
|
|
67559
67607
|
});
|
|
67560
67608
|
}
|
|
67561
67609
|
logWithTimestamp(
|
|
@@ -115957,7 +116005,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
115957
116005
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
115958
116006
|
}
|
|
115959
116007
|
function getBundledNodeCliVersion() {
|
|
115960
|
-
return true ? "0.2.6
|
|
116008
|
+
return true ? "0.2.6" : null;
|
|
115961
116009
|
}
|
|
115962
116010
|
function readConfiguredAiProvider() {
|
|
115963
116011
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -116167,7 +116215,7 @@ async function updateHermes(release, options) {
|
|
|
116167
116215
|
}
|
|
116168
116216
|
}
|
|
116169
116217
|
async function installGatewayPluginForDoctor(target) {
|
|
116170
|
-
const release = isPrereleaseVersion("0.2.6
|
|
116218
|
+
const release = isPrereleaseVersion("0.2.6") ? "beta" : "latest";
|
|
116171
116219
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
116172
116220
|
const options = {
|
|
116173
116221
|
restart: !insideTargetGateway,
|
|
@@ -117182,7 +117230,10 @@ function resolveDoctorTarget(env = process.env) {
|
|
|
117182
117230
|
function skipped(id, title, severity, reason) {
|
|
117183
117231
|
return { id, title, status: "skipped", severity, detail: reason };
|
|
117184
117232
|
}
|
|
117185
|
-
function resolveProviderCliTarget(env, store) {
|
|
117233
|
+
function resolveProviderCliTarget(env, target, store) {
|
|
117234
|
+
if (target === "hermes") {
|
|
117235
|
+
return "hermes";
|
|
117236
|
+
}
|
|
117186
117237
|
const runtime = detectRuntime(env);
|
|
117187
117238
|
if (runtime === "codex" || runtime === "claude") {
|
|
117188
117239
|
return runtime;
|
|
@@ -117193,10 +117244,10 @@ function resolveProviderCliTarget(env, store) {
|
|
|
117193
117244
|
const storedDefault = store.getDefaultAiProvider();
|
|
117194
117245
|
return storedDefault === "codex" || storedDefault === "claude" ? storedDefault : null;
|
|
117195
117246
|
}
|
|
117196
|
-
function readProviderCliTarget(env) {
|
|
117247
|
+
function readProviderCliTarget(env, target) {
|
|
117197
117248
|
const store = new SessionStore();
|
|
117198
117249
|
try {
|
|
117199
|
-
const provider = resolveProviderCliTarget(env, store);
|
|
117250
|
+
const provider = resolveProviderCliTarget(env, target, store);
|
|
117200
117251
|
return {
|
|
117201
117252
|
provider,
|
|
117202
117253
|
storedCommand: provider ? store.getAiProviderCommand(provider) : null
|
|
@@ -117210,7 +117261,7 @@ async function runDoctor(options = {}) {
|
|
|
117210
117261
|
platform: options.platform ?? process.platform,
|
|
117211
117262
|
env: options.env ?? process.env,
|
|
117212
117263
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
117213
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.6
|
|
117264
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.6" : "0.0.0"),
|
|
117214
117265
|
fixMode: options.fix === true,
|
|
117215
117266
|
nonInteractive: options.nonInteractive === true,
|
|
117216
117267
|
packageChanged: false,
|
|
@@ -117675,12 +117726,26 @@ var init_doctor_cli = __esm({
|
|
|
117675
117726
|
id: "provider_cli",
|
|
117676
117727
|
title: "AI provider CLI",
|
|
117677
117728
|
run: async (ctx) => {
|
|
117678
|
-
const { provider, storedCommand } = readProviderCliTarget(ctx.env);
|
|
117729
|
+
const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
|
|
117679
117730
|
if (!provider) {
|
|
117680
117731
|
return null;
|
|
117681
117732
|
}
|
|
117682
117733
|
const resolved = provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
|
|
117683
117734
|
if (!resolved) {
|
|
117735
|
+
if (provider === "hermes") {
|
|
117736
|
+
return {
|
|
117737
|
+
id: "provider_cli",
|
|
117738
|
+
title: "AI provider CLI",
|
|
117739
|
+
status: "fail",
|
|
117740
|
+
severity: "required",
|
|
117741
|
+
detail: "hermes CLI is not installed or not usable on this machine",
|
|
117742
|
+
fix: {
|
|
117743
|
+
kind: "manual",
|
|
117744
|
+
description: "Install or repair the Hermes CLI, ensure the `hermes` executable is on PATH, then re-run okx-a2a doctor."
|
|
117745
|
+
},
|
|
117746
|
+
data: { provider }
|
|
117747
|
+
};
|
|
117748
|
+
}
|
|
117684
117749
|
const spec = provider === "codex" ? CODEX_INSTALL_SPEC : CLAUDE_INSTALL_SPEC;
|
|
117685
117750
|
return {
|
|
117686
117751
|
id: "provider_cli",
|
|
@@ -117696,6 +117761,16 @@ var init_doctor_cli = __esm({
|
|
|
117696
117761
|
data: { provider }
|
|
117697
117762
|
};
|
|
117698
117763
|
}
|
|
117764
|
+
if (provider === "hermes") {
|
|
117765
|
+
return {
|
|
117766
|
+
id: "provider_cli",
|
|
117767
|
+
title: "AI provider CLI",
|
|
117768
|
+
status: "pass",
|
|
117769
|
+
severity: "required",
|
|
117770
|
+
detail: "hermes CLI is installed and usable",
|
|
117771
|
+
data: { provider, command: resolved }
|
|
117772
|
+
};
|
|
117773
|
+
}
|
|
117699
117774
|
const auth = provider === "codex" ? await checkCodexCliAuthStatus(resolved) : await checkClaudeCliAuthStatus(resolved);
|
|
117700
117775
|
if (auth.ok) {
|
|
117701
117776
|
if (provider === "codex" && ctx.env.OKX_A2A_AI_CODEX_COMMAND && storedCommand !== resolved) {
|
|
@@ -117749,8 +117824,8 @@ var init_doctor_cli = __esm({
|
|
|
117749
117824
|
};
|
|
117750
117825
|
},
|
|
117751
117826
|
applyFix: async (ctx) => {
|
|
117752
|
-
const { provider, storedCommand } = readProviderCliTarget(ctx.env);
|
|
117753
|
-
if (!provider) {
|
|
117827
|
+
const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
|
|
117828
|
+
if (!provider || provider === "hermes") {
|
|
117754
117829
|
throw new Error("no codex/claude runtime detected and no codex/claude provider bound");
|
|
117755
117830
|
}
|
|
117756
117831
|
const resolveCli = () => provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
|
|
@@ -118208,7 +118283,7 @@ init_sentry_logger();
|
|
|
118208
118283
|
init_sentry_config();
|
|
118209
118284
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
118210
118285
|
function printUsage3() {
|
|
118211
|
-
console.log(`okx-a2a ${"0.2.6
|
|
118286
|
+
console.log(`okx-a2a ${"0.2.6"}
|
|
118212
118287
|
|
|
118213
118288
|
Usage:
|
|
118214
118289
|
okx-a2a <command> [options]
|
|
@@ -118248,7 +118323,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
118248
118323
|
`);
|
|
118249
118324
|
}
|
|
118250
118325
|
function printVersion() {
|
|
118251
|
-
console.log("0.2.6
|
|
118326
|
+
console.log("0.2.6");
|
|
118252
118327
|
}
|
|
118253
118328
|
function printDaemonUsage() {
|
|
118254
118329
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -119687,7 +119762,7 @@ async function main() {
|
|
|
119687
119762
|
if (command === "xmtp-test") {
|
|
119688
119763
|
const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
|
|
119689
119764
|
await handleXmtpTestCommand2(process.argv.slice(3), {
|
|
119690
|
-
packageVersion: "0.2.6
|
|
119765
|
+
packageVersion: "0.2.6",
|
|
119691
119766
|
agentSdkVersion: "2.3.0",
|
|
119692
119767
|
nodeSdkVersion: "6.1.0",
|
|
119693
119768
|
nodeBindingsVersion: "1.11.0"
|
package/dist/index.js
CHANGED
|
@@ -2993,6 +2993,18 @@ function systemdUnitHasCurrentRestartPolicy(content) {
|
|
|
2993
2993
|
function launchdPlistHasCurrentRestartPolicy(content) {
|
|
2994
2994
|
return content.includes("<key>SuccessfulExit</key>");
|
|
2995
2995
|
}
|
|
2996
|
+
function decodeXmlText(value) {
|
|
2997
|
+
return value.replace(/'/g, "'").replace(/"/g, '"').replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&");
|
|
2998
|
+
}
|
|
2999
|
+
function servicePathHasRequiredEntries(content, platform, requiredEntries) {
|
|
3000
|
+
const pathValue = platform === "linux" ? content.match(/^Environment="PATH=(.*)"$/m)?.[1] : content.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/)?.[1];
|
|
3001
|
+
if (pathValue === void 0) {
|
|
3002
|
+
return false;
|
|
3003
|
+
}
|
|
3004
|
+
const decodedPath = platform === "darwin" ? decodeXmlText(pathValue) : pathValue;
|
|
3005
|
+
const entries = new Set(decodedPath.split(import_node_path9.delimiter).filter(Boolean));
|
|
3006
|
+
return requiredEntries.every((entry) => entries.has(entry));
|
|
3007
|
+
}
|
|
2996
3008
|
async function installedAutostartHasCurrentRestartPolicy() {
|
|
2997
3009
|
try {
|
|
2998
3010
|
if (process.platform === "linux") {
|
|
@@ -3013,11 +3025,11 @@ async function installedAutostartHasCurrentConfiguration() {
|
|
|
3013
3025
|
const requiredPathEntries = requiredServicePathEntries();
|
|
3014
3026
|
if (process.platform === "linux") {
|
|
3015
3027
|
const content = await (0, import_promises3.readFile)(resolveSystemdAutostartPaths().servicePath, "utf8");
|
|
3016
|
-
return systemdUnitHasCurrentRestartPolicy(content) &&
|
|
3028
|
+
return systemdUnitHasCurrentRestartPolicy(content) && servicePathHasRequiredEntries(content, process.platform, requiredPathEntries);
|
|
3017
3029
|
}
|
|
3018
3030
|
if (process.platform === "darwin") {
|
|
3019
3031
|
const content = await (0, import_promises3.readFile)(resolveLaunchdAutostartPaths().plistPath, "utf8");
|
|
3020
|
-
return launchdPlistHasCurrentRestartPolicy(content) &&
|
|
3032
|
+
return launchdPlistHasCurrentRestartPolicy(content) && servicePathHasRequiredEntries(content, process.platform, requiredPathEntries);
|
|
3021
3033
|
}
|
|
3022
3034
|
} catch {
|
|
3023
3035
|
return true;
|
|
@@ -32136,7 +32148,7 @@ var init_sentry_config = __esm({
|
|
|
32136
32148
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
32137
32149
|
SENTRY_CONFIG = {
|
|
32138
32150
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
32139
|
-
release: "0.2.6
|
|
32151
|
+
release: "0.2.6",
|
|
32140
32152
|
environment,
|
|
32141
32153
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
32142
32154
|
};
|
|
@@ -33077,7 +33089,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
33077
33089
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
33078
33090
|
}
|
|
33079
33091
|
function getBundledNodeCliVersion() {
|
|
33080
|
-
return true ? "0.2.6
|
|
33092
|
+
return true ? "0.2.6" : null;
|
|
33081
33093
|
}
|
|
33082
33094
|
function readConfiguredAiProvider() {
|
|
33083
33095
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -33287,7 +33299,7 @@ async function updateHermes(release, options) {
|
|
|
33287
33299
|
}
|
|
33288
33300
|
}
|
|
33289
33301
|
async function installGatewayPluginForDoctor(target) {
|
|
33290
|
-
const release = isPrereleaseVersion("0.2.6
|
|
33302
|
+
const release = isPrereleaseVersion("0.2.6") ? "beta" : "latest";
|
|
33291
33303
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
33292
33304
|
const options = {
|
|
33293
33305
|
restart: !insideTargetGateway,
|
|
@@ -44140,6 +44152,7 @@ __export(index_exports, {
|
|
|
44140
44152
|
logWinCompat: () => logWinCompat,
|
|
44141
44153
|
logXmtpMessageSent: () => logXmtpMessageSent,
|
|
44142
44154
|
maybeRecommendOnchainosUpgrade: () => maybeRecommendOnchainosUpgrade,
|
|
44155
|
+
mergeA2AEnvelopeTips: () => mergeA2AEnvelopeTips,
|
|
44143
44156
|
messageEligibleHelpAdvertisesOfflineReplay: () => messageEligibleHelpAdvertisesOfflineReplay,
|
|
44144
44157
|
nodeVersionSatisfies: () => nodeVersionSatisfies,
|
|
44145
44158
|
normalizeAiProvider: () => normalizeAiProvider,
|
|
@@ -58583,6 +58596,30 @@ var DEFAULT_A2A_TIPS = {
|
|
|
58583
58596
|
function isNonEmptyPlainObject(v) {
|
|
58584
58597
|
return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
|
|
58585
58598
|
}
|
|
58599
|
+
function readStringRecord(value) {
|
|
58600
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
58601
|
+
return {};
|
|
58602
|
+
}
|
|
58603
|
+
return Object.fromEntries(
|
|
58604
|
+
Object.entries(value).filter((entry) => typeof entry[1] === "string")
|
|
58605
|
+
);
|
|
58606
|
+
}
|
|
58607
|
+
function mergeA2AEnvelopeTips(payload, receiverTips) {
|
|
58608
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
58609
|
+
return payload;
|
|
58610
|
+
}
|
|
58611
|
+
const envelope = payload;
|
|
58612
|
+
if (envelope.msgType !== A2A_MESSAGE_TYPE) {
|
|
58613
|
+
return payload;
|
|
58614
|
+
}
|
|
58615
|
+
return {
|
|
58616
|
+
...envelope,
|
|
58617
|
+
tips: {
|
|
58618
|
+
...readStringRecord(envelope.tips),
|
|
58619
|
+
...readStringRecord(receiverTips)
|
|
58620
|
+
}
|
|
58621
|
+
};
|
|
58622
|
+
}
|
|
58586
58623
|
function buildA2AEnvelope(params) {
|
|
58587
58624
|
const envelope = {
|
|
58588
58625
|
msgType: A2A_MESSAGE_TYPE,
|
|
@@ -60429,7 +60466,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60429
60466
|
client: {
|
|
60430
60467
|
id: "gateway-client",
|
|
60431
60468
|
displayName: "okx-a2a-node",
|
|
60432
|
-
version: "0.2.6
|
|
60469
|
+
version: "0.2.6",
|
|
60433
60470
|
platform: "node",
|
|
60434
60471
|
mode: "backend",
|
|
60435
60472
|
instanceId
|
|
@@ -60440,7 +60477,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60440
60477
|
commands: [],
|
|
60441
60478
|
permissions: {},
|
|
60442
60479
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
60443
|
-
userAgent: `okx-a2a-node/${"0.2.6
|
|
60480
|
+
userAgent: `okx-a2a-node/${"0.2.6"}`,
|
|
60444
60481
|
auth: {
|
|
60445
60482
|
...config.token ? { token: config.token } : {},
|
|
60446
60483
|
...config.password ? { password: config.password } : {}
|
|
@@ -64438,11 +64475,11 @@ function extractXmtpSentAtMs2(msg) {
|
|
|
64438
64475
|
}
|
|
64439
64476
|
return Date.now();
|
|
64440
64477
|
}
|
|
64441
|
-
function
|
|
64478
|
+
function parseJson2(rawText) {
|
|
64442
64479
|
try {
|
|
64443
|
-
return {
|
|
64480
|
+
return { ok: true, data: JSON.parse(rawText) };
|
|
64444
64481
|
} catch {
|
|
64445
|
-
return {
|
|
64482
|
+
return { ok: false, data: null };
|
|
64446
64483
|
}
|
|
64447
64484
|
}
|
|
64448
64485
|
function readString3(value) {
|
|
@@ -65360,10 +65397,21 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65360
65397
|
}
|
|
65361
65398
|
}
|
|
65362
65399
|
const parseStartedAt = Date.now();
|
|
65363
|
-
const
|
|
65364
|
-
const
|
|
65400
|
+
const receivedRawText = extractRawText(ctx.message.content);
|
|
65401
|
+
const parseResult = parseJson2(receivedRawText);
|
|
65402
|
+
let rawText = receivedRawText;
|
|
65403
|
+
if (parseResult.ok) {
|
|
65404
|
+
const mergedPayload = mergeA2AEnvelopeTips(
|
|
65405
|
+
parseResult.data,
|
|
65406
|
+
XmtpService.getInstance().getSystemConfig().extConfig.tips
|
|
65407
|
+
);
|
|
65408
|
+
if (mergedPayload !== parseResult.data) {
|
|
65409
|
+
parseResult.data = mergedPayload;
|
|
65410
|
+
rawText = stringifySystemPayload(mergedPayload);
|
|
65411
|
+
}
|
|
65412
|
+
}
|
|
65365
65413
|
timing.mark("payloadParse", parseStartedAt);
|
|
65366
|
-
const directToUser = chatType === "dm" &&
|
|
65414
|
+
const directToUser = chatType === "dm" && parseResult.ok ? extractDirectToUserNotification(parseResult.data) : { kind: "none" };
|
|
65367
65415
|
if (directToUser.kind === "invalid") {
|
|
65368
65416
|
const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto12.randomUUID)()}`;
|
|
65369
65417
|
logger.error(
|
|
@@ -65395,7 +65443,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65395
65443
|
});
|
|
65396
65444
|
return true;
|
|
65397
65445
|
}
|
|
65398
|
-
const systemNotification = chatType === "dm" &&
|
|
65446
|
+
const systemNotification = chatType === "dm" && parseResult.ok ? extractSystemNotification(parseResult.data) : null;
|
|
65399
65447
|
if (systemNotification) {
|
|
65400
65448
|
const systemMessageId = messageId || `system-${(0, import_node_crypto12.randomUUID)()}`;
|
|
65401
65449
|
logWithTimestamp(
|
|
@@ -65503,7 +65551,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65503
65551
|
maybeNotifyInboundAgentMessage({
|
|
65504
65552
|
deps,
|
|
65505
65553
|
chatType,
|
|
65506
|
-
payload:
|
|
65554
|
+
payload: parseResult.data,
|
|
65507
65555
|
jobId: systemNotification.jobId ?? BACKUP_JOB_ID,
|
|
65508
65556
|
sessionKey: primaryTarget?.sessionKey ?? SYSTEM_NOTIFICATION_SESSION_KEY,
|
|
65509
65557
|
messageId: systemMessageId
|
|
@@ -65548,13 +65596,13 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65548
65596
|
}));
|
|
65549
65597
|
});
|
|
65550
65598
|
logWithTimestamp(
|
|
65551
|
-
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(
|
|
65599
|
+
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parseResult.data)}`
|
|
65552
65600
|
);
|
|
65553
65601
|
}
|
|
65554
65602
|
return true;
|
|
65555
65603
|
}
|
|
65556
65604
|
const routeStartedAt = Date.now();
|
|
65557
|
-
const route = routeMessage(chatType,
|
|
65605
|
+
const route = routeMessage(chatType, parseResult.ok, parseResult.data);
|
|
65558
65606
|
timing.mark("routeResolve", routeStartedAt);
|
|
65559
65607
|
if (route.route === "job") {
|
|
65560
65608
|
const providerBindStartedAt = Date.now();
|
|
@@ -65580,7 +65628,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65580
65628
|
}
|
|
65581
65629
|
const sessionAgentId = route.route === "job" ? resolveSessionAgentId({
|
|
65582
65630
|
chatType,
|
|
65583
|
-
payload:
|
|
65631
|
+
payload: parseResult.ok ? parseResult.data : null,
|
|
65584
65632
|
myXmtpAddress: deps.myXmtpAddress
|
|
65585
65633
|
}) : null;
|
|
65586
65634
|
const xmtpSentAtMs = extractXmtpSentAtMs2(ctx.message);
|
|
@@ -65596,7 +65644,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65596
65644
|
);
|
|
65597
65645
|
}
|
|
65598
65646
|
if (route.route === "job" && chatType === "group") {
|
|
65599
|
-
const payloadObject = isPlainObject3(
|
|
65647
|
+
const payloadObject = isPlainObject3(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
|
|
65600
65648
|
const service = XmtpService.getInstance();
|
|
65601
65649
|
const trustedSystemSender = service.isTrustedSystemAccountSender({
|
|
65602
65650
|
senderAddress,
|
|
@@ -65627,7 +65675,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65627
65675
|
const myAgentId = localAgent?.agentId ?? readString3(payloadObject?.receiverAgentId) ?? sessionAgentId ?? null;
|
|
65628
65676
|
const toAgentId = readString3(sender?.agentId);
|
|
65629
65677
|
const accepted = await verifyInboundA2AGroupMessage({
|
|
65630
|
-
payload:
|
|
65678
|
+
payload: parseResult.ok ? parseResult.data : null,
|
|
65631
65679
|
myXmtpAddress: deps.myXmtpAddress,
|
|
65632
65680
|
senderAddress,
|
|
65633
65681
|
senderInboxId: ctx.message.senderInboxId ?? "",
|
|
@@ -65694,7 +65742,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65694
65742
|
maybeNotifyInboundAgentMessage({
|
|
65695
65743
|
deps,
|
|
65696
65744
|
chatType,
|
|
65697
|
-
payload:
|
|
65745
|
+
payload: parseResult.data,
|
|
65698
65746
|
jobId: route.jobId,
|
|
65699
65747
|
sessionKey,
|
|
65700
65748
|
messageId: routedMessageId,
|
|
@@ -65703,7 +65751,7 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65703
65751
|
}
|
|
65704
65752
|
void maybeAllowProviderGroup(deps, chatType, conversationId);
|
|
65705
65753
|
logWithTimestamp(
|
|
65706
|
-
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(
|
|
65754
|
+
`[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parseResult.data)}`
|
|
65707
65755
|
);
|
|
65708
65756
|
return true;
|
|
65709
65757
|
}
|
|
@@ -65720,12 +65768,12 @@ async function processFileMessage(ctx, deps, options = {}) {
|
|
|
65720
65768
|
senderInboxId: ctx.message.senderInboxId ?? "",
|
|
65721
65769
|
conversationId,
|
|
65722
65770
|
rawText,
|
|
65723
|
-
payload:
|
|
65771
|
+
payload: parseResult.ok ? parseResult.data : null
|
|
65724
65772
|
};
|
|
65725
65773
|
const storeAppendStartedAt = Date.now();
|
|
65726
65774
|
await deps.store.append(route.jobId, stored, sessionAgentId);
|
|
65727
65775
|
timing.mark("storeAppend", storeAppendStartedAt);
|
|
65728
|
-
if ((route.route === "job" ||
|
|
65776
|
+
if ((route.route === "job" || parseResult.ok && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
|
|
65729
65777
|
const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
|
|
65730
65778
|
const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
|
|
65731
65779
|
const localAgent = XmtpService.getInstance().getAgentByAddress(deps.myXmtpAddress);
|
|
@@ -66616,12 +66664,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
66616
66664
|
});
|
|
66617
66665
|
}
|
|
66618
66666
|
});
|
|
66619
|
-
service.setPluginVersion("0.2.6
|
|
66667
|
+
service.setPluginVersion("0.2.6");
|
|
66620
66668
|
await service.init();
|
|
66621
66669
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
66622
66670
|
if (pluginVersionStatus.unavailable) {
|
|
66623
66671
|
throw new Error(
|
|
66624
|
-
`@okxweb3/a2a-node v${"0.2.6
|
|
66672
|
+
`@okxweb3/a2a-node v${"0.2.6"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
66625
66673
|
);
|
|
66626
66674
|
}
|
|
66627
66675
|
const systemConfig = service.getSystemConfig();
|
|
@@ -66639,7 +66687,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
66639
66687
|
onchainosAgentId: "*",
|
|
66640
66688
|
reason: "system-config missing sentryDsn",
|
|
66641
66689
|
pluginId: "@okxweb3/a2a-node",
|
|
66642
|
-
pluginVersion: "0.2.6
|
|
66690
|
+
pluginVersion: "0.2.6"
|
|
66643
66691
|
});
|
|
66644
66692
|
}
|
|
66645
66693
|
logWithTimestamp(
|
|
@@ -69337,7 +69385,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
69337
69385
|
node: process.version,
|
|
69338
69386
|
platform: process.platform,
|
|
69339
69387
|
arch: process.arch,
|
|
69340
|
-
packageVersion: true ? "0.2.6
|
|
69388
|
+
packageVersion: true ? "0.2.6" : "unknown",
|
|
69341
69389
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
69342
69390
|
listenerAndLlmContentIncluded: true,
|
|
69343
69391
|
credentialsAlwaysRedacted: true,
|
|
@@ -70637,7 +70685,10 @@ var providerBindingChecker = {
|
|
|
70637
70685
|
}
|
|
70638
70686
|
}
|
|
70639
70687
|
};
|
|
70640
|
-
function resolveProviderCliTarget(env, store) {
|
|
70688
|
+
function resolveProviderCliTarget(env, target, store) {
|
|
70689
|
+
if (target === "hermes") {
|
|
70690
|
+
return "hermes";
|
|
70691
|
+
}
|
|
70641
70692
|
const runtime = detectRuntime(env);
|
|
70642
70693
|
if (runtime === "codex" || runtime === "claude") {
|
|
70643
70694
|
return runtime;
|
|
@@ -70648,10 +70699,10 @@ function resolveProviderCliTarget(env, store) {
|
|
|
70648
70699
|
const storedDefault = store.getDefaultAiProvider();
|
|
70649
70700
|
return storedDefault === "codex" || storedDefault === "claude" ? storedDefault : null;
|
|
70650
70701
|
}
|
|
70651
|
-
function readProviderCliTarget(env) {
|
|
70702
|
+
function readProviderCliTarget(env, target) {
|
|
70652
70703
|
const store = new SessionStore();
|
|
70653
70704
|
try {
|
|
70654
|
-
const provider = resolveProviderCliTarget(env, store);
|
|
70705
|
+
const provider = resolveProviderCliTarget(env, target, store);
|
|
70655
70706
|
return {
|
|
70656
70707
|
provider,
|
|
70657
70708
|
storedCommand: provider ? store.getAiProviderCommand(provider) : null
|
|
@@ -70664,12 +70715,26 @@ var providerCliChecker = {
|
|
|
70664
70715
|
id: "provider_cli",
|
|
70665
70716
|
title: "AI provider CLI",
|
|
70666
70717
|
run: async (ctx) => {
|
|
70667
|
-
const { provider, storedCommand } = readProviderCliTarget(ctx.env);
|
|
70718
|
+
const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
|
|
70668
70719
|
if (!provider) {
|
|
70669
70720
|
return null;
|
|
70670
70721
|
}
|
|
70671
70722
|
const resolved = provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
|
|
70672
70723
|
if (!resolved) {
|
|
70724
|
+
if (provider === "hermes") {
|
|
70725
|
+
return {
|
|
70726
|
+
id: "provider_cli",
|
|
70727
|
+
title: "AI provider CLI",
|
|
70728
|
+
status: "fail",
|
|
70729
|
+
severity: "required",
|
|
70730
|
+
detail: "hermes CLI is not installed or not usable on this machine",
|
|
70731
|
+
fix: {
|
|
70732
|
+
kind: "manual",
|
|
70733
|
+
description: "Install or repair the Hermes CLI, ensure the `hermes` executable is on PATH, then re-run okx-a2a doctor."
|
|
70734
|
+
},
|
|
70735
|
+
data: { provider }
|
|
70736
|
+
};
|
|
70737
|
+
}
|
|
70673
70738
|
const spec = provider === "codex" ? CODEX_INSTALL_SPEC : CLAUDE_INSTALL_SPEC;
|
|
70674
70739
|
return {
|
|
70675
70740
|
id: "provider_cli",
|
|
@@ -70685,6 +70750,16 @@ var providerCliChecker = {
|
|
|
70685
70750
|
data: { provider }
|
|
70686
70751
|
};
|
|
70687
70752
|
}
|
|
70753
|
+
if (provider === "hermes") {
|
|
70754
|
+
return {
|
|
70755
|
+
id: "provider_cli",
|
|
70756
|
+
title: "AI provider CLI",
|
|
70757
|
+
status: "pass",
|
|
70758
|
+
severity: "required",
|
|
70759
|
+
detail: "hermes CLI is installed and usable",
|
|
70760
|
+
data: { provider, command: resolved }
|
|
70761
|
+
};
|
|
70762
|
+
}
|
|
70688
70763
|
const auth = provider === "codex" ? await checkCodexCliAuthStatus(resolved) : await checkClaudeCliAuthStatus(resolved);
|
|
70689
70764
|
if (auth.ok) {
|
|
70690
70765
|
if (provider === "codex" && ctx.env.OKX_A2A_AI_CODEX_COMMAND && storedCommand !== resolved) {
|
|
@@ -70738,8 +70813,8 @@ var providerCliChecker = {
|
|
|
70738
70813
|
};
|
|
70739
70814
|
},
|
|
70740
70815
|
applyFix: async (ctx) => {
|
|
70741
|
-
const { provider, storedCommand } = readProviderCliTarget(ctx.env);
|
|
70742
|
-
if (!provider) {
|
|
70816
|
+
const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
|
|
70817
|
+
if (!provider || provider === "hermes") {
|
|
70743
70818
|
throw new Error("no codex/claude runtime detected and no codex/claude provider bound");
|
|
70744
70819
|
}
|
|
70745
70820
|
const resolveCli = () => provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
|
|
@@ -71173,7 +71248,7 @@ async function runDoctor(options = {}) {
|
|
|
71173
71248
|
platform: options.platform ?? process.platform,
|
|
71174
71249
|
env: options.env ?? process.env,
|
|
71175
71250
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
71176
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.6
|
|
71251
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.6" : "0.0.0"),
|
|
71177
71252
|
fixMode: options.fix === true,
|
|
71178
71253
|
nonInteractive: options.nonInteractive === true,
|
|
71179
71254
|
packageChanged: false,
|
|
@@ -71558,6 +71633,7 @@ init_autostart_windows();
|
|
|
71558
71633
|
logWinCompat,
|
|
71559
71634
|
logXmtpMessageSent,
|
|
71560
71635
|
maybeRecommendOnchainosUpgrade,
|
|
71636
|
+
mergeA2AEnvelopeTips,
|
|
71561
71637
|
messageEligibleHelpAdvertisesOfflineReplay,
|
|
71562
71638
|
nodeVersionSatisfies,
|
|
71563
71639
|
normalizeAiProvider,
|
package/package.json
CHANGED