@okxweb3/a2a-node 0.1.4 → 0.1.6-beta-c3024b2b0b-260706164140
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 +375 -266
- package/dist/index.js +902 -773
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1824,6 +1824,13 @@ var init_daemon_lock = __esm({
|
|
|
1824
1824
|
});
|
|
1825
1825
|
|
|
1826
1826
|
// src/daemon.ts
|
|
1827
|
+
var daemon_exports = {};
|
|
1828
|
+
__export(daemon_exports, {
|
|
1829
|
+
ensureDaemonReady: () => ensureDaemonReady,
|
|
1830
|
+
getDaemonStatus: () => getDaemonStatus,
|
|
1831
|
+
startDaemon: () => startDaemon,
|
|
1832
|
+
stopDaemon: () => stopDaemon
|
|
1833
|
+
});
|
|
1827
1834
|
async function readPid(pidPath) {
|
|
1828
1835
|
try {
|
|
1829
1836
|
const raw = await (0, import_promises2.readFile)(pidPath, "utf8");
|
|
@@ -3376,11 +3383,25 @@ function switchProvider(options) {
|
|
|
3376
3383
|
readParentProcessCommand: options.readParentProcessCommand
|
|
3377
3384
|
});
|
|
3378
3385
|
if (runtime === "unknown") {
|
|
3386
|
+
const stored = options.store.getDefaultAiProvider();
|
|
3387
|
+
if (stored) {
|
|
3388
|
+
return {
|
|
3389
|
+
ok: true,
|
|
3390
|
+
runtime: "unknown",
|
|
3391
|
+
provider: stored,
|
|
3392
|
+
previousProvider: stored,
|
|
3393
|
+
changed: false,
|
|
3394
|
+
action: "kept_existing",
|
|
3395
|
+
userMessage: `No AI runtime detected for the current environment; keeping the existing default provider (${formatAiProviderDisplayName(stored)}).`
|
|
3396
|
+
};
|
|
3397
|
+
}
|
|
3379
3398
|
return {
|
|
3380
3399
|
ok: false,
|
|
3381
3400
|
runtime: "unknown",
|
|
3382
3401
|
reason: "unknown_runtime",
|
|
3383
|
-
|
|
3402
|
+
state: "blocked",
|
|
3403
|
+
message: "Could not determine the current AI provider.",
|
|
3404
|
+
userMessage: "Could not detect the current AI runtime and no default AI provider is configured. Run this from your AI environment (OpenClaw / Codex / Claude / Hermes), or set a provider manually: `okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>`."
|
|
3384
3405
|
};
|
|
3385
3406
|
}
|
|
3386
3407
|
const previousProvider = options.store.getDefaultAiProvider();
|
|
@@ -3392,6 +3413,7 @@ function switchProvider(options) {
|
|
|
3392
3413
|
provider: runtime,
|
|
3393
3414
|
previousProvider,
|
|
3394
3415
|
changed,
|
|
3416
|
+
action: "switched",
|
|
3395
3417
|
userMessage: changed ? `Switched to ${formatAiProviderDisplayName(runtime)}\uFF5CNew tasks will be handled here; unfinished tasks should be continued in their original session` : ""
|
|
3396
3418
|
};
|
|
3397
3419
|
}
|
|
@@ -8278,7 +8300,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
8278
8300
|
client: {
|
|
8279
8301
|
id: "gateway-client",
|
|
8280
8302
|
displayName: "okx-a2a-node",
|
|
8281
|
-
version: "0.1.
|
|
8303
|
+
version: "0.1.6-beta-c3024b2b0b-260706164140",
|
|
8282
8304
|
platform: "node",
|
|
8283
8305
|
mode: "backend",
|
|
8284
8306
|
instanceId
|
|
@@ -8289,7 +8311,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
8289
8311
|
commands: [],
|
|
8290
8312
|
permissions: {},
|
|
8291
8313
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
8292
|
-
userAgent: `okx-a2a-node/${"0.1.
|
|
8314
|
+
userAgent: `okx-a2a-node/${"0.1.6-beta-c3024b2b0b-260706164140"}`,
|
|
8293
8315
|
auth: {
|
|
8294
8316
|
...config.token ? { token: config.token } : {},
|
|
8295
8317
|
...config.password ? { password: config.password } : {}
|
|
@@ -24332,6 +24354,7 @@ var init_events = __esm({
|
|
|
24332
24354
|
ONCHAINOS_CLI_ERROR: "Onchainos CLI error",
|
|
24333
24355
|
HEARTBEAT_FAILED: "Heartbeat failed",
|
|
24334
24356
|
HEARTBEAT_SKIPPED: "Heartbeat skipped",
|
|
24357
|
+
HEARTBEAT_GATEWAY_CHECK_FAILED: "Heartbeat gateway check failed",
|
|
24335
24358
|
MESSAGE_PARSE_FAILED: "Message parse failed",
|
|
24336
24359
|
MESSAGE_HANDLER_ERROR: "Message handler error",
|
|
24337
24360
|
OFFLINE_REPLAY_FAILED: "Offline replay failed",
|
|
@@ -25545,7 +25568,7 @@ var init_sentry_config = __esm({
|
|
|
25545
25568
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
25546
25569
|
SENTRY_CONFIG = {
|
|
25547
25570
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
25548
|
-
release: "0.1.
|
|
25571
|
+
release: "0.1.6-beta-c3024b2b0b-260706164140",
|
|
25549
25572
|
environment
|
|
25550
25573
|
};
|
|
25551
25574
|
}
|
|
@@ -85166,7 +85189,7 @@ function isAgentXmtpCommunicable(agent) {
|
|
|
85166
85189
|
if (!agent) {
|
|
85167
85190
|
return false;
|
|
85168
85191
|
}
|
|
85169
|
-
return
|
|
85192
|
+
return true;
|
|
85170
85193
|
}
|
|
85171
85194
|
function isAgentXmtpBlocked(agent) {
|
|
85172
85195
|
if (!agent) {
|
|
@@ -85174,14 +85197,10 @@ function isAgentXmtpBlocked(agent) {
|
|
|
85174
85197
|
}
|
|
85175
85198
|
return XMTP_BLOCKED_AGENT_STATUSES.has(Number(agent.status));
|
|
85176
85199
|
}
|
|
85177
|
-
var
|
|
85200
|
+
var XMTP_BLOCKED_AGENT_STATUSES;
|
|
85178
85201
|
var init_agent_status = __esm({
|
|
85179
85202
|
"../core/src/xmtp-sdk/onchainos/agent-status.ts"() {
|
|
85180
85203
|
"use strict";
|
|
85181
|
-
XMTP_COMMUNICABLE_AGENT_STATUSES = /* @__PURE__ */ new Set([
|
|
85182
|
-
1 /* ACTIVE */,
|
|
85183
|
-
2 /* USER_OFFLINE */
|
|
85184
|
-
]);
|
|
85185
85204
|
XMTP_BLOCKED_AGENT_STATUSES = /* @__PURE__ */ new Set([
|
|
85186
85205
|
3 /* SECURITY_BLACKLISTED */,
|
|
85187
85206
|
4 /* RISK_BLACKLISTED */,
|
|
@@ -93831,6 +93850,7 @@ __export(listener_exports, {
|
|
|
93831
93850
|
DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC: () => DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC,
|
|
93832
93851
|
HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS: () => HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS,
|
|
93833
93852
|
XMTP_CLIENT_RECYCLE_INTERVAL_ENV: () => XMTP_CLIENT_RECYCLE_INTERVAL_ENV,
|
|
93853
|
+
getHermesGatewayPluginStatus: () => getHermesGatewayPluginStatus,
|
|
93834
93854
|
hermesConfigEnablesOkxA2a: () => hermesConfigEnablesOkxA2a,
|
|
93835
93855
|
isGatewayAvailableForHeartbeat: () => isGatewayAvailableForHeartbeat,
|
|
93836
93856
|
isHermesGatewayPluginEnabled: () => isHermesGatewayPluginEnabled,
|
|
@@ -93869,20 +93889,31 @@ async function isGatewayAvailableForHeartbeat(options) {
|
|
|
93869
93889
|
}
|
|
93870
93890
|
return isHermesGatewayPluginEnabled({ env: options.env });
|
|
93871
93891
|
}
|
|
93872
|
-
async function
|
|
93892
|
+
async function getHermesGatewayPluginStatus(options = {}) {
|
|
93873
93893
|
const env = options.env ?? process.env;
|
|
93874
|
-
if (options.requireGatewayRuntime && detectGatewayInvocation(env) !== "hermes") {
|
|
93875
|
-
return false;
|
|
93876
|
-
}
|
|
93877
93894
|
const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path23.join)((0, import_node_os7.homedir)(), ".hermes");
|
|
93878
|
-
|
|
93879
|
-
|
|
93895
|
+
const pluginYamlPath = (0, import_node_path23.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
93896
|
+
if (!(0, import_node_fs18.existsSync)(pluginYamlPath)) {
|
|
93897
|
+
return { enabled: false, reason: "plugin_yaml_missing", hermesHome, checkedPath: pluginYamlPath };
|
|
93880
93898
|
}
|
|
93899
|
+
const configPath = (0, import_node_path23.join)(hermesHome, "config.yaml");
|
|
93900
|
+
let content3;
|
|
93881
93901
|
try {
|
|
93882
|
-
|
|
93902
|
+
content3 = await (0, import_promises9.readFile)(configPath, "utf8");
|
|
93883
93903
|
} catch {
|
|
93904
|
+
return { enabled: false, reason: "config_read_error", hermesHome, checkedPath: configPath };
|
|
93905
|
+
}
|
|
93906
|
+
if (!hermesConfigEnablesOkxA2a(content3)) {
|
|
93907
|
+
return { enabled: false, reason: "config_disabled", hermesHome, checkedPath: configPath };
|
|
93908
|
+
}
|
|
93909
|
+
return { enabled: true, hermesHome, checkedPath: pluginYamlPath };
|
|
93910
|
+
}
|
|
93911
|
+
async function isHermesGatewayPluginEnabled(options = {}) {
|
|
93912
|
+
const env = options.env ?? process.env;
|
|
93913
|
+
if (options.requireGatewayRuntime && detectGatewayInvocation(env) !== "hermes") {
|
|
93884
93914
|
return false;
|
|
93885
93915
|
}
|
|
93916
|
+
return (await getHermesGatewayPluginStatus({ env })).enabled;
|
|
93886
93917
|
}
|
|
93887
93918
|
function hermesConfigEnablesOkxA2a(content3) {
|
|
93888
93919
|
let inPlugins = false;
|
|
@@ -94055,12 +94086,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
94055
94086
|
}));
|
|
94056
94087
|
}
|
|
94057
94088
|
});
|
|
94058
|
-
service.setPluginVersion("0.1.
|
|
94089
|
+
service.setPluginVersion("0.1.6-beta-c3024b2b0b-260706164140");
|
|
94059
94090
|
await service.init();
|
|
94060
94091
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
94061
94092
|
if (pluginVersionStatus.unavailable) {
|
|
94062
94093
|
throw new Error(
|
|
94063
|
-
`@okxweb3/a2a-node v${"0.1.
|
|
94094
|
+
`@okxweb3/a2a-node v${"0.1.6-beta-c3024b2b0b-260706164140"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
94064
94095
|
);
|
|
94065
94096
|
}
|
|
94066
94097
|
const systemConfig = service.getSystemConfig();
|
|
@@ -94078,7 +94109,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
94078
94109
|
onchainosAgentId: "*",
|
|
94079
94110
|
reason: "system-config missing sentryDsn",
|
|
94080
94111
|
pluginId: "@okxweb3/a2a-node",
|
|
94081
|
-
pluginVersion: "0.1.
|
|
94112
|
+
pluginVersion: "0.1.6-beta-c3024b2b0b-260706164140"
|
|
94082
94113
|
});
|
|
94083
94114
|
}
|
|
94084
94115
|
logWithTimestamp(
|
|
@@ -94118,7 +94149,28 @@ async function runListenerWithLock(options, paths) {
|
|
|
94118
94149
|
const hasActiveAgents = service.getClients().size > 0;
|
|
94119
94150
|
let shouldHeartbeat = hasActiveAgents;
|
|
94120
94151
|
const heartbeatProvider = resolveConfiguredAiProvider({ store: sessionStore }) ?? detectGatewayInvocation();
|
|
94121
|
-
if (hasActiveAgents) {
|
|
94152
|
+
if (hasActiveAgents && heartbeatProvider === "hermes") {
|
|
94153
|
+
const hermesStatus = await getHermesGatewayPluginStatus();
|
|
94154
|
+
if (!hermesStatus.enabled) {
|
|
94155
|
+
logWithTimestamp(
|
|
94156
|
+
`[okx-agent-task] provider=hermes gateway check failed (${hermesStatus.reason}), sending heartbeat anyway`
|
|
94157
|
+
);
|
|
94158
|
+
logger.error(
|
|
94159
|
+
LogEvent.HEARTBEAT_GATEWAY_CHECK_FAILED,
|
|
94160
|
+
new Error(`heartbeat gateway check failed: provider=hermes reason=${hermesStatus.reason}`),
|
|
94161
|
+
{
|
|
94162
|
+
component: "node_listener",
|
|
94163
|
+
stage: "sync_tick",
|
|
94164
|
+
reason: hermesStatus.reason ?? "unknown",
|
|
94165
|
+
provider: "hermes",
|
|
94166
|
+
hermesHome: hermesStatus.hermesHome,
|
|
94167
|
+
checkedPath: hermesStatus.checkedPath,
|
|
94168
|
+
chainIndex: ONCHAINOS_CHAIN_INDEX,
|
|
94169
|
+
communicationClass: "gateway_or_plugin"
|
|
94170
|
+
}
|
|
94171
|
+
);
|
|
94172
|
+
}
|
|
94173
|
+
} else if (hasActiveAgents) {
|
|
94122
94174
|
const gatewayAvailable = await isGatewayAvailableForHeartbeat({
|
|
94123
94175
|
provider: heartbeatProvider
|
|
94124
94176
|
});
|
|
@@ -97156,6 +97208,207 @@ var init_ai_cli = __esm({
|
|
|
97156
97208
|
}
|
|
97157
97209
|
});
|
|
97158
97210
|
|
|
97211
|
+
// src/win-native-launcher.ts
|
|
97212
|
+
var win_native_launcher_exports = {};
|
|
97213
|
+
__export(win_native_launcher_exports, {
|
|
97214
|
+
NATIVE_LAUNCHER_EXE_NAME: () => NATIVE_LAUNCHER_EXE_NAME,
|
|
97215
|
+
buildLauncherEntryJs: () => buildLauncherEntryJs,
|
|
97216
|
+
buildSeaConfig: () => buildSeaConfig,
|
|
97217
|
+
ensureWindowsNativeLauncher: () => ensureWindowsNativeLauncher,
|
|
97218
|
+
findWindowsNativeOkxA2aExe: () => findWindowsNativeOkxA2aExe,
|
|
97219
|
+
installWindowsNativeLauncher: () => installWindowsNativeLauncher,
|
|
97220
|
+
resolveRunningCliPath: () => resolveRunningCliPath
|
|
97221
|
+
});
|
|
97222
|
+
function isPostjectRunnable() {
|
|
97223
|
+
try {
|
|
97224
|
+
const probe = spawnSyncCompat(POSTJECT_BIN, ["--help"], {
|
|
97225
|
+
stdio: "ignore",
|
|
97226
|
+
windowsHide: true,
|
|
97227
|
+
timeout: 3e4
|
|
97228
|
+
});
|
|
97229
|
+
return probe.status === 0;
|
|
97230
|
+
} catch {
|
|
97231
|
+
return false;
|
|
97232
|
+
}
|
|
97233
|
+
}
|
|
97234
|
+
function resolvePostjectCommand() {
|
|
97235
|
+
try {
|
|
97236
|
+
const cliPath = (0, import_node_module.createRequire)(__filename).resolve("postject/dist/cli.js");
|
|
97237
|
+
if ((0, import_node_fs21.existsSync)(cliPath)) {
|
|
97238
|
+
return { command: process.execPath, prefixArgs: [cliPath] };
|
|
97239
|
+
}
|
|
97240
|
+
} catch {
|
|
97241
|
+
}
|
|
97242
|
+
if (!isPostjectRunnable()) {
|
|
97243
|
+
logWinCompat(`${WIN_COMPAT_LOG_PREFIX} native launcher: installing ${POSTJECT_SPEC} globally`);
|
|
97244
|
+
const install = spawnSyncCompat("npm", [
|
|
97245
|
+
"install",
|
|
97246
|
+
"-g",
|
|
97247
|
+
POSTJECT_SPEC,
|
|
97248
|
+
"--no-audit",
|
|
97249
|
+
"--no-fund",
|
|
97250
|
+
"--loglevel=error"
|
|
97251
|
+
], { encoding: "utf8", windowsHide: true, timeout: 18e4 });
|
|
97252
|
+
if (install.status !== 0 || !isPostjectRunnable()) {
|
|
97253
|
+
throw new Error(
|
|
97254
|
+
`failed to install ${POSTJECT_SPEC} (needed to build okx-a2a.exe): ${String(install.stderr || install.error?.message || "unknown error").slice(0, 300)}`
|
|
97255
|
+
);
|
|
97256
|
+
}
|
|
97257
|
+
}
|
|
97258
|
+
return { command: POSTJECT_BIN, prefixArgs: [] };
|
|
97259
|
+
}
|
|
97260
|
+
function injectSeaBlob(exePath, blobPath, isMac) {
|
|
97261
|
+
const { command, prefixArgs: prefixArgs2 } = resolvePostjectCommand();
|
|
97262
|
+
const args = [
|
|
97263
|
+
...prefixArgs2,
|
|
97264
|
+
exePath,
|
|
97265
|
+
"NODE_SEA_BLOB",
|
|
97266
|
+
blobPath,
|
|
97267
|
+
"--sentinel-fuse",
|
|
97268
|
+
SEA_SENTINEL_FUSE,
|
|
97269
|
+
"--overwrite"
|
|
97270
|
+
];
|
|
97271
|
+
if (isMac) {
|
|
97272
|
+
args.push("--macho-segment-name", "NODE_SEA");
|
|
97273
|
+
}
|
|
97274
|
+
const result = spawnSyncCompat(command, args, {
|
|
97275
|
+
encoding: "utf8",
|
|
97276
|
+
windowsHide: true,
|
|
97277
|
+
timeout: 12e4
|
|
97278
|
+
});
|
|
97279
|
+
if (result.status !== 0) {
|
|
97280
|
+
throw new Error(
|
|
97281
|
+
`postject injection failed: ${String(result.stderr || result.error?.message || `exit ${result.status}`).slice(0, 300)}`
|
|
97282
|
+
);
|
|
97283
|
+
}
|
|
97284
|
+
}
|
|
97285
|
+
function buildLauncherEntryJs(cliPath) {
|
|
97286
|
+
const target = JSON.stringify(cliPath);
|
|
97287
|
+
return [
|
|
97288
|
+
'const { createRequire } = require("node:module");',
|
|
97289
|
+
`const nodeRequire = createRequire(${target});`,
|
|
97290
|
+
`nodeRequire(${target});`,
|
|
97291
|
+
""
|
|
97292
|
+
].join("\n");
|
|
97293
|
+
}
|
|
97294
|
+
function buildSeaConfig(entryPath, blobPath) {
|
|
97295
|
+
return `${JSON.stringify(
|
|
97296
|
+
{
|
|
97297
|
+
main: entryPath,
|
|
97298
|
+
output: blobPath,
|
|
97299
|
+
disableExperimentalSEAWarning: true
|
|
97300
|
+
},
|
|
97301
|
+
null,
|
|
97302
|
+
2
|
|
97303
|
+
)}
|
|
97304
|
+
`;
|
|
97305
|
+
}
|
|
97306
|
+
async function installWindowsNativeLauncher(options) {
|
|
97307
|
+
const nodeExe = options.nodeExe ?? process.execPath;
|
|
97308
|
+
if (!(0, import_node_fs21.existsSync)(options.cliPath)) {
|
|
97309
|
+
throw new Error(`cannot build okx-a2a.exe: CLI entry not found at ${options.cliPath}`);
|
|
97310
|
+
}
|
|
97311
|
+
if (!(0, import_node_fs21.existsSync)(nodeExe)) {
|
|
97312
|
+
throw new Error(`cannot build okx-a2a.exe: node executable not found at ${nodeExe}`);
|
|
97313
|
+
}
|
|
97314
|
+
const exePath = (0, import_node_path26.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
|
|
97315
|
+
(0, import_node_fs21.mkdirSync)(options.targetDir, { recursive: true });
|
|
97316
|
+
const work = (0, import_node_fs21.mkdtempSync)((0, import_node_path26.join)((0, import_node_os9.tmpdir)(), "okx-a2a-sea-"));
|
|
97317
|
+
try {
|
|
97318
|
+
const entryPath = (0, import_node_path26.join)(work, "launcher-entry.js");
|
|
97319
|
+
const blobPath = (0, import_node_path26.join)(work, "okx-a2a.blob");
|
|
97320
|
+
const configPath = (0, import_node_path26.join)(work, "sea-config.json");
|
|
97321
|
+
(0, import_node_fs21.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
|
|
97322
|
+
(0, import_node_fs21.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
|
|
97323
|
+
(0, import_node_child_process7.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
|
|
97324
|
+
stdio: "ignore",
|
|
97325
|
+
windowsHide: true
|
|
97326
|
+
});
|
|
97327
|
+
(0, import_node_fs21.copyFileSync)(nodeExe, exePath);
|
|
97328
|
+
const isMac = process.platform === "darwin";
|
|
97329
|
+
if (isMac) {
|
|
97330
|
+
try {
|
|
97331
|
+
(0, import_node_child_process7.execFileSync)("codesign", ["--remove-signature", exePath], { stdio: "ignore" });
|
|
97332
|
+
} catch {
|
|
97333
|
+
}
|
|
97334
|
+
}
|
|
97335
|
+
injectSeaBlob(exePath, blobPath, isMac);
|
|
97336
|
+
if (isMac) {
|
|
97337
|
+
try {
|
|
97338
|
+
(0, import_node_child_process7.execFileSync)("codesign", ["--sign", "-", exePath], { stdio: "ignore" });
|
|
97339
|
+
} catch {
|
|
97340
|
+
}
|
|
97341
|
+
}
|
|
97342
|
+
logWinCompat(
|
|
97343
|
+
`${WIN_COMPAT_LOG_PREFIX} native launcher: built ${exePath} from node=${nodeExe} cli=${options.cliPath}`
|
|
97344
|
+
);
|
|
97345
|
+
return { exePath, cliPath: options.cliPath, nodeExe };
|
|
97346
|
+
} finally {
|
|
97347
|
+
(0, import_node_fs21.rmSync)(work, { recursive: true, force: true });
|
|
97348
|
+
}
|
|
97349
|
+
}
|
|
97350
|
+
function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs21.existsSync) {
|
|
97351
|
+
const dirs = pathValue.split(";").map((d) => d.trim()).filter(Boolean);
|
|
97352
|
+
if (appData) {
|
|
97353
|
+
dirs.push((0, import_node_path26.join)(appData, "npm"));
|
|
97354
|
+
}
|
|
97355
|
+
if (userProfile) {
|
|
97356
|
+
dirs.push((0, import_node_path26.join)(userProfile, ".local", "bin"));
|
|
97357
|
+
}
|
|
97358
|
+
for (const dir of dirs) {
|
|
97359
|
+
const candidate = (0, import_node_path26.join)(dir, NATIVE_LAUNCHER_EXE_NAME);
|
|
97360
|
+
if (fileExists2(candidate)) {
|
|
97361
|
+
return candidate;
|
|
97362
|
+
}
|
|
97363
|
+
}
|
|
97364
|
+
return null;
|
|
97365
|
+
}
|
|
97366
|
+
function resolveRunningCliPath() {
|
|
97367
|
+
const fromArgv = process.argv[1];
|
|
97368
|
+
if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs21.existsSync)(fromArgv)) {
|
|
97369
|
+
return fromArgv;
|
|
97370
|
+
}
|
|
97371
|
+
const beside = (0, import_node_path26.join)(__dirname, "cli.js");
|
|
97372
|
+
if ((0, import_node_fs21.existsSync)(beside)) {
|
|
97373
|
+
return beside;
|
|
97374
|
+
}
|
|
97375
|
+
if (fromArgv) {
|
|
97376
|
+
return fromArgv;
|
|
97377
|
+
}
|
|
97378
|
+
throw new Error("could not resolve the running okx-a2a CLI path for the native launcher");
|
|
97379
|
+
}
|
|
97380
|
+
async function ensureWindowsNativeLauncher(options = {}) {
|
|
97381
|
+
const platform = options.platform ?? process.platform;
|
|
97382
|
+
if (platform !== "win32") {
|
|
97383
|
+
return null;
|
|
97384
|
+
}
|
|
97385
|
+
const env = options.env ?? process.env;
|
|
97386
|
+
const existing = findWindowsNativeOkxA2aExe(env.PATH ?? env.Path ?? "", env.APPDATA, env.USERPROFILE);
|
|
97387
|
+
if (existing) {
|
|
97388
|
+
return { exePath: existing, installed: false };
|
|
97389
|
+
}
|
|
97390
|
+
const targetDir = env.APPDATA ? (0, import_node_path26.join)(env.APPDATA, "npm") : (0, import_node_path26.join)(env.USERPROFILE ?? (0, import_node_os9.homedir)(), ".local", "bin");
|
|
97391
|
+
const result = await installWindowsNativeLauncher({ cliPath: resolveRunningCliPath(), targetDir });
|
|
97392
|
+
return { exePath: result.exePath, installed: true };
|
|
97393
|
+
}
|
|
97394
|
+
var import_node_child_process7, import_node_fs21, import_node_module, import_node_os9, import_node_path26, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
|
|
97395
|
+
var init_win_native_launcher = __esm({
|
|
97396
|
+
"src/win-native-launcher.ts"() {
|
|
97397
|
+
"use strict";
|
|
97398
|
+
import_node_child_process7 = require("node:child_process");
|
|
97399
|
+
import_node_fs21 = require("node:fs");
|
|
97400
|
+
import_node_module = require("node:module");
|
|
97401
|
+
import_node_os9 = require("node:os");
|
|
97402
|
+
import_node_path26 = require("node:path");
|
|
97403
|
+
init_win_compat();
|
|
97404
|
+
init_win_spawn();
|
|
97405
|
+
SEA_SENTINEL_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
|
|
97406
|
+
NATIVE_LAUNCHER_EXE_NAME = "okx-a2a.exe";
|
|
97407
|
+
POSTJECT_SPEC = "postject@1.0.0-alpha.6";
|
|
97408
|
+
POSTJECT_BIN = "postject";
|
|
97409
|
+
}
|
|
97410
|
+
});
|
|
97411
|
+
|
|
97159
97412
|
// src/update-cli.ts
|
|
97160
97413
|
var update_cli_exports = {};
|
|
97161
97414
|
__export(update_cli_exports, {
|
|
@@ -97181,6 +97434,8 @@ __export(update_cli_exports, {
|
|
|
97181
97434
|
parseUpdateArgs: () => parseUpdateArgs,
|
|
97182
97435
|
printSetupUsage: () => printSetupUsage,
|
|
97183
97436
|
printUpdateUsage: () => printUpdateUsage,
|
|
97437
|
+
resolveHermesConfigPath: () => resolveHermesConfigPath,
|
|
97438
|
+
resolveHermesPluginYamlPath: () => resolveHermesPluginYamlPath,
|
|
97184
97439
|
runProviderLoginInteractive: () => runProviderLoginInteractive,
|
|
97185
97440
|
setRedirectCommandStdoutToStderr: () => setRedirectCommandStdoutToStderr
|
|
97186
97441
|
});
|
|
@@ -97394,6 +97649,7 @@ async function runSetup(options) {
|
|
|
97394
97649
|
if (nodeChange.nodeChanged && provider) {
|
|
97395
97650
|
await restartNodeDaemonAfterNodeSetup();
|
|
97396
97651
|
}
|
|
97652
|
+
await ensureWindowsNativeLauncherForSetup();
|
|
97397
97653
|
return {
|
|
97398
97654
|
ok: true,
|
|
97399
97655
|
state: "ready",
|
|
@@ -97427,6 +97683,7 @@ async function runSetup(options) {
|
|
|
97427
97683
|
if (changes.pluginChanged) {
|
|
97428
97684
|
await restartGatewayAfterSetup(resolvedTarget);
|
|
97429
97685
|
}
|
|
97686
|
+
await ensureWindowsNativeLauncherForSetup();
|
|
97430
97687
|
warnIfProviderMismatch(resolvedTarget);
|
|
97431
97688
|
return {
|
|
97432
97689
|
ok: true,
|
|
@@ -97873,7 +98130,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
97873
98130
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
97874
98131
|
}
|
|
97875
98132
|
function getBundledNodeCliVersion() {
|
|
97876
|
-
return true ? "0.1.
|
|
98133
|
+
return true ? "0.1.6-beta-c3024b2b0b-260706164140" : null;
|
|
97877
98134
|
}
|
|
97878
98135
|
function readConfiguredAiProvider() {
|
|
97879
98136
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -97904,10 +98161,29 @@ async function restartNodeDaemonAfterUpdate() {
|
|
|
97904
98161
|
}
|
|
97905
98162
|
async function installNode(release, label) {
|
|
97906
98163
|
const spec = buildNpmPackageSpec("node", release);
|
|
98164
|
+
if (process.platform === "win32") {
|
|
98165
|
+
const { getDaemonStatus: getDaemonStatus2, stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_daemon(), daemon_exports));
|
|
98166
|
+
const status = await getDaemonStatus2();
|
|
98167
|
+
if (status.running) {
|
|
98168
|
+
console.log(`[${label}] stopping the running daemon before reinstalling on Windows (its native addons lock the package dir)`);
|
|
98169
|
+
await stopDaemon2();
|
|
98170
|
+
}
|
|
98171
|
+
}
|
|
97907
98172
|
console.log(`[${label}] installing ${spec}`);
|
|
97908
98173
|
await runCommand("npm", ["install", "-g", spec]);
|
|
97909
98174
|
console.log(`[${label}] okx-a2a node CLI ${label === "setup" ? "setup" : "update"} done`);
|
|
97910
98175
|
}
|
|
98176
|
+
async function ensureWindowsNativeLauncherForSetup() {
|
|
98177
|
+
if (process.platform !== "win32") {
|
|
98178
|
+
return;
|
|
98179
|
+
}
|
|
98180
|
+
const { ensureWindowsNativeLauncher: ensureWindowsNativeLauncher2 } = await Promise.resolve().then(() => (init_win_native_launcher(), win_native_launcher_exports));
|
|
98181
|
+
const result = await ensureWindowsNativeLauncher2();
|
|
98182
|
+
if (!result) {
|
|
98183
|
+
return;
|
|
98184
|
+
}
|
|
98185
|
+
console.log(result.installed ? `[setup] built native okx-a2a.exe launcher at ${result.exePath}` : `[setup] native okx-a2a.exe launcher already present at ${result.exePath}`);
|
|
98186
|
+
}
|
|
97911
98187
|
async function restartNodeDaemonAfterSetup(provider) {
|
|
97912
98188
|
console.log(`[setup] restarting okx-a2a daemon after node CLI setup with provider=${provider}`);
|
|
97913
98189
|
await runCommand("okx-a2a", ["daemon", "restart", "--provider", provider]);
|
|
@@ -98039,17 +98315,17 @@ async function updateHermes(release, options) {
|
|
|
98039
98315
|
assertNotRunningInsideGateway("hermes");
|
|
98040
98316
|
}
|
|
98041
98317
|
const spec = buildNpmPackageSpec("hermes", release);
|
|
98042
|
-
const workDir = await (0, import_promises10.mkdtemp)((0,
|
|
98318
|
+
const workDir = await (0, import_promises10.mkdtemp)((0, import_node_path27.join)((0, import_node_os10.tmpdir)(), `okx-a2a-${label}-hermes-`));
|
|
98043
98319
|
try {
|
|
98044
98320
|
console.log(`[${label}] downloading ${spec}`);
|
|
98045
98321
|
const npmTarball = await npmPack(spec, workDir);
|
|
98046
|
-
const npmPackageDir = (0,
|
|
98322
|
+
const npmPackageDir = (0, import_node_path27.join)(workDir, "npm-package");
|
|
98047
98323
|
await runCommand("tar", ["-xzf", npmTarball, "-C", npmPackageDir], { ensureDir: npmPackageDir });
|
|
98048
|
-
const pluginTarball = await findHermesPluginTarball((0,
|
|
98049
|
-
const pluginDir = (0,
|
|
98324
|
+
const pluginTarball = await findHermesPluginTarball((0, import_node_path27.join)(npmPackageDir, "package", "dist"));
|
|
98325
|
+
const pluginDir = (0, import_node_path27.join)(workDir, "plugin");
|
|
98050
98326
|
await runCommand("tar", ["-xzf", pluginTarball, "-C", pluginDir], { ensureDir: pluginDir });
|
|
98051
98327
|
const unpackedPluginDir = await findFirstDirectory(pluginDir);
|
|
98052
|
-
const installer = (0,
|
|
98328
|
+
const installer = (0, import_node_path27.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
|
|
98053
98329
|
console.log(`[${label}] running ${installer}`);
|
|
98054
98330
|
await runCommand("bash", [installer, ...options.restart ? ["--restart"] : []], { cwd: unpackedPluginDir });
|
|
98055
98331
|
await normalizeHermesOkxA2aPluginConfig();
|
|
@@ -98064,7 +98340,7 @@ async function updateHermes(release, options) {
|
|
|
98064
98340
|
}
|
|
98065
98341
|
}
|
|
98066
98342
|
async function installGatewayPluginForDoctor(target) {
|
|
98067
|
-
const release = isPrereleaseVersion("0.1.
|
|
98343
|
+
const release = isPrereleaseVersion("0.1.6-beta-c3024b2b0b-260706164140") ? "beta" : "latest";
|
|
98068
98344
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
98069
98345
|
const options = {
|
|
98070
98346
|
restart: !insideTargetGateway,
|
|
@@ -98115,7 +98391,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
|
|
|
98115
98391
|
if (options.dryRun) {
|
|
98116
98392
|
return true;
|
|
98117
98393
|
}
|
|
98118
|
-
await (0, import_promises10.mkdir)((0,
|
|
98394
|
+
await (0, import_promises10.mkdir)((0, import_node_path27.resolve)(configFile, ".."), { recursive: true });
|
|
98119
98395
|
await (0, import_promises10.writeFile)(configFile, "plugins:\n enabled:\n - okx-a2a\n");
|
|
98120
98396
|
console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
98121
98397
|
return true;
|
|
@@ -98355,7 +98631,7 @@ function findFirstEnabledListItem(lines, startIndex, enabledIndent) {
|
|
|
98355
98631
|
return null;
|
|
98356
98632
|
}
|
|
98357
98633
|
function resolveHermesConfigPath() {
|
|
98358
|
-
return (0,
|
|
98634
|
+
return (0, import_node_path27.join)(process.env.HERMES_HOME ?? (0, import_node_path27.join)((0, import_node_os10.homedir)(), ".hermes"), "config.yaml");
|
|
98359
98635
|
}
|
|
98360
98636
|
function lineIndent(line) {
|
|
98361
98637
|
const match = line.match(/^\s*/);
|
|
@@ -98432,22 +98708,18 @@ async function assertGatewayPluginInstalled(target) {
|
|
|
98432
98708
|
`okx-a2a ${target} plugin is not installed. Run \`okx-a2a setup ${target}\` first; use \`okx-a2a update ${target}\` only for an existing installation.`
|
|
98433
98709
|
);
|
|
98434
98710
|
}
|
|
98711
|
+
function resolveHermesPluginYamlPath() {
|
|
98712
|
+
return (0, import_node_path27.join)(process.env.HERMES_HOME ?? (0, import_node_path27.join)((0, import_node_os10.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
98713
|
+
}
|
|
98435
98714
|
async function isGatewayPluginInstalled(target) {
|
|
98436
98715
|
if (target === "openclaw") {
|
|
98437
98716
|
return (await getInstalledOpenClawPluginInfo()).installed;
|
|
98438
98717
|
}
|
|
98439
|
-
|
|
98440
|
-
return true;
|
|
98441
|
-
}
|
|
98442
|
-
return await isGlobalNpmPackageInstalled(UPDATE_PACKAGES.hermes);
|
|
98443
|
-
}
|
|
98444
|
-
async function isGlobalNpmPackageInstalled(packageName) {
|
|
98445
|
-
const result = await runCommandCaptureOptional("npm", ["list", "-g", packageName, "--depth=0"]);
|
|
98446
|
-
return result.ok && result.stdout.includes(packageName);
|
|
98718
|
+
return (0, import_node_fs22.existsSync)(resolveHermesPluginYamlPath());
|
|
98447
98719
|
}
|
|
98448
98720
|
async function getInstalledGatewayPluginVersion(target) {
|
|
98449
98721
|
if (target === "hermes") {
|
|
98450
|
-
return await getInstalledHermesPluginVersion()
|
|
98722
|
+
return await getInstalledHermesPluginVersion();
|
|
98451
98723
|
}
|
|
98452
98724
|
return (await getInstalledOpenClawPluginInfo()).version;
|
|
98453
98725
|
}
|
|
@@ -98530,7 +98802,7 @@ function parsePackageVersionFromText(output4) {
|
|
|
98530
98802
|
return output4.match(/@okxweb3\/a2a-openclaw@([0-9A-Za-z.+-]+)/)?.[1] ?? null;
|
|
98531
98803
|
}
|
|
98532
98804
|
async function getInstalledHermesPluginVersion() {
|
|
98533
|
-
const pluginYaml = (0,
|
|
98805
|
+
const pluginYaml = (0, import_node_path27.join)(process.env.HERMES_HOME ?? (0, import_node_path27.join)((0, import_node_os10.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
98534
98806
|
try {
|
|
98535
98807
|
const content3 = await (0, import_promises10.readFile)(pluginYaml, "utf8");
|
|
98536
98808
|
return parsePluginYamlVersion(content3);
|
|
@@ -98588,7 +98860,7 @@ async function npmPack(spec, destination) {
|
|
|
98588
98860
|
if (!tarballName) {
|
|
98589
98861
|
throw new Error(`Unable to detect npm pack tarball from output: ${output4.trim()}`);
|
|
98590
98862
|
}
|
|
98591
|
-
return (0,
|
|
98863
|
+
return (0, import_node_path27.resolve)(destination, (0, import_node_path27.basename)(tarballName));
|
|
98592
98864
|
}
|
|
98593
98865
|
async function findHermesPluginTarball(distDir) {
|
|
98594
98866
|
const entries = await (0, import_promises10.readdir)(distDir);
|
|
@@ -98596,7 +98868,7 @@ async function findHermesPluginTarball(distDir) {
|
|
|
98596
98868
|
if (!tarball) {
|
|
98597
98869
|
throw new Error(`Hermes npm package did not contain dist/okx-a2a-hermes-plugin-*.tar.gz`);
|
|
98598
98870
|
}
|
|
98599
|
-
return (0,
|
|
98871
|
+
return (0, import_node_path27.join)(distDir, tarball);
|
|
98600
98872
|
}
|
|
98601
98873
|
async function findFirstDirectory(parent) {
|
|
98602
98874
|
const entries = await (0, import_promises10.readdir)(parent, { withFileTypes: true });
|
|
@@ -98604,7 +98876,7 @@ async function findFirstDirectory(parent) {
|
|
|
98604
98876
|
if (!dir) {
|
|
98605
98877
|
throw new Error(`No unpacked plugin directory found under ${parent}`);
|
|
98606
98878
|
}
|
|
98607
|
-
return (0,
|
|
98879
|
+
return (0, import_node_path27.join)(parent, dir.name);
|
|
98608
98880
|
}
|
|
98609
98881
|
function readOption2(args, name2) {
|
|
98610
98882
|
const index2 = args.indexOf(name2);
|
|
@@ -98655,7 +98927,7 @@ async function runCommand(command, args, options = {}) {
|
|
|
98655
98927
|
await new Promise((resolvePromise, reject) => {
|
|
98656
98928
|
const invocation = buildExternalCommandInvocation(command, args);
|
|
98657
98929
|
const redirect = redirectCommandStdoutToStderr || options.redirectStdoutToStderr === true;
|
|
98658
|
-
const child = (0,
|
|
98930
|
+
const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
|
|
98659
98931
|
cwd: options.cwd,
|
|
98660
98932
|
stdio: redirect ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit",
|
|
98661
98933
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
@@ -98699,7 +98971,7 @@ async function runCommand(command, args, options = {}) {
|
|
|
98699
98971
|
async function runCommandCapture(command, args) {
|
|
98700
98972
|
return await new Promise((resolvePromise, reject) => {
|
|
98701
98973
|
const invocation = buildExternalCommandInvocation(command, args);
|
|
98702
|
-
const child = (0,
|
|
98974
|
+
const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
|
|
98703
98975
|
stdio: ["ignore", "pipe", "pipe"],
|
|
98704
98976
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
98705
98977
|
});
|
|
@@ -98732,7 +99004,7 @@ ${stderr}`));
|
|
|
98732
99004
|
async function runCommandCaptureOptional(command, args) {
|
|
98733
99005
|
return await new Promise((resolvePromise) => {
|
|
98734
99006
|
const invocation = buildExternalCommandInvocation(command, args);
|
|
98735
|
-
const child = (0,
|
|
99007
|
+
const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
|
|
98736
99008
|
stdio: ["ignore", "pipe", "ignore"],
|
|
98737
99009
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
98738
99010
|
});
|
|
@@ -98752,7 +99024,7 @@ async function runCommandCaptureOptional(command, args) {
|
|
|
98752
99024
|
async function runCommandCaptureStatus(command, args) {
|
|
98753
99025
|
return await new Promise((resolvePromise) => {
|
|
98754
99026
|
const invocation = buildExternalCommandInvocation(command, args);
|
|
98755
|
-
const child = (0,
|
|
99027
|
+
const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
|
|
98756
99028
|
stdio: ["ignore", "pipe", "pipe"],
|
|
98757
99029
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
98758
99030
|
});
|
|
@@ -98794,15 +99066,15 @@ function buildExternalCommandInvocation(command, args, platform = process.platfo
|
|
|
98794
99066
|
function formatExternalCommand(command, args) {
|
|
98795
99067
|
return [command, ...args].join(" ");
|
|
98796
99068
|
}
|
|
98797
|
-
var
|
|
99069
|
+
var import_node_child_process8, import_node_fs22, import_promises10, import_node_os10, import_node_path27, UPDATE_PACKAGES, CODEX_NPM_PACKAGE, OPENCLAW_FORCE_INSTALL_FLAG, OPENCLAW_UNSAFE_INSTALL_FLAG, OKX_A2A_PLUGIN_ID, OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE, OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH, DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS, SetupBlockedError, redirectCommandStdoutToStderr;
|
|
98798
99070
|
var init_update_cli = __esm({
|
|
98799
99071
|
"src/update-cli.ts"() {
|
|
98800
99072
|
"use strict";
|
|
98801
|
-
|
|
98802
|
-
|
|
99073
|
+
import_node_child_process8 = require("node:child_process");
|
|
99074
|
+
import_node_fs22 = require("node:fs");
|
|
98803
99075
|
import_promises10 = require("node:fs/promises");
|
|
98804
|
-
|
|
98805
|
-
|
|
99076
|
+
import_node_os10 = require("node:os");
|
|
99077
|
+
import_node_path27 = require("node:path");
|
|
98806
99078
|
init_ai_command();
|
|
98807
99079
|
init_win_spawn();
|
|
98808
99080
|
init_ai_provider();
|
|
@@ -98866,160 +99138,6 @@ var init_daemon_ops = __esm({
|
|
|
98866
99138
|
}
|
|
98867
99139
|
});
|
|
98868
99140
|
|
|
98869
|
-
// src/win-native-launcher.ts
|
|
98870
|
-
var win_native_launcher_exports = {};
|
|
98871
|
-
__export(win_native_launcher_exports, {
|
|
98872
|
-
NATIVE_LAUNCHER_EXE_NAME: () => NATIVE_LAUNCHER_EXE_NAME,
|
|
98873
|
-
buildLauncherEntryJs: () => buildLauncherEntryJs,
|
|
98874
|
-
buildSeaConfig: () => buildSeaConfig,
|
|
98875
|
-
installWindowsNativeLauncher: () => installWindowsNativeLauncher
|
|
98876
|
-
});
|
|
98877
|
-
function isPostjectRunnable() {
|
|
98878
|
-
try {
|
|
98879
|
-
const probe = spawnSyncCompat(POSTJECT_BIN, ["--help"], {
|
|
98880
|
-
stdio: "ignore",
|
|
98881
|
-
windowsHide: true,
|
|
98882
|
-
timeout: 3e4
|
|
98883
|
-
});
|
|
98884
|
-
return probe.status === 0;
|
|
98885
|
-
} catch {
|
|
98886
|
-
return false;
|
|
98887
|
-
}
|
|
98888
|
-
}
|
|
98889
|
-
function resolvePostjectCommand() {
|
|
98890
|
-
try {
|
|
98891
|
-
const cliPath = (0, import_node_module.createRequire)(__filename).resolve("postject/dist/cli.js");
|
|
98892
|
-
if ((0, import_node_fs22.existsSync)(cliPath)) {
|
|
98893
|
-
return { command: process.execPath, prefixArgs: [cliPath] };
|
|
98894
|
-
}
|
|
98895
|
-
} catch {
|
|
98896
|
-
}
|
|
98897
|
-
if (!isPostjectRunnable()) {
|
|
98898
|
-
logWinCompat(`${WIN_COMPAT_LOG_PREFIX} native launcher: installing ${POSTJECT_SPEC} globally`);
|
|
98899
|
-
const install = spawnSyncCompat("npm", [
|
|
98900
|
-
"install",
|
|
98901
|
-
"-g",
|
|
98902
|
-
POSTJECT_SPEC,
|
|
98903
|
-
"--no-audit",
|
|
98904
|
-
"--no-fund",
|
|
98905
|
-
"--loglevel=error"
|
|
98906
|
-
], { encoding: "utf8", windowsHide: true, timeout: 18e4 });
|
|
98907
|
-
if (install.status !== 0 || !isPostjectRunnable()) {
|
|
98908
|
-
throw new Error(
|
|
98909
|
-
`failed to install ${POSTJECT_SPEC} (needed to build okx-a2a.exe): ${String(install.stderr || install.error?.message || "unknown error").slice(0, 300)}`
|
|
98910
|
-
);
|
|
98911
|
-
}
|
|
98912
|
-
}
|
|
98913
|
-
return { command: POSTJECT_BIN, prefixArgs: [] };
|
|
98914
|
-
}
|
|
98915
|
-
function injectSeaBlob(exePath, blobPath, isMac) {
|
|
98916
|
-
const { command, prefixArgs: prefixArgs2 } = resolvePostjectCommand();
|
|
98917
|
-
const args = [
|
|
98918
|
-
...prefixArgs2,
|
|
98919
|
-
exePath,
|
|
98920
|
-
"NODE_SEA_BLOB",
|
|
98921
|
-
blobPath,
|
|
98922
|
-
"--sentinel-fuse",
|
|
98923
|
-
SEA_SENTINEL_FUSE,
|
|
98924
|
-
"--overwrite"
|
|
98925
|
-
];
|
|
98926
|
-
if (isMac) {
|
|
98927
|
-
args.push("--macho-segment-name", "NODE_SEA");
|
|
98928
|
-
}
|
|
98929
|
-
const result = spawnSyncCompat(command, args, {
|
|
98930
|
-
encoding: "utf8",
|
|
98931
|
-
windowsHide: true,
|
|
98932
|
-
timeout: 12e4
|
|
98933
|
-
});
|
|
98934
|
-
if (result.status !== 0) {
|
|
98935
|
-
throw new Error(
|
|
98936
|
-
`postject injection failed: ${String(result.stderr || result.error?.message || `exit ${result.status}`).slice(0, 300)}`
|
|
98937
|
-
);
|
|
98938
|
-
}
|
|
98939
|
-
}
|
|
98940
|
-
function buildLauncherEntryJs(cliPath) {
|
|
98941
|
-
const target = JSON.stringify(cliPath);
|
|
98942
|
-
return [
|
|
98943
|
-
'const { createRequire } = require("node:module");',
|
|
98944
|
-
`const nodeRequire = createRequire(${target});`,
|
|
98945
|
-
`nodeRequire(${target});`,
|
|
98946
|
-
""
|
|
98947
|
-
].join("\n");
|
|
98948
|
-
}
|
|
98949
|
-
function buildSeaConfig(entryPath, blobPath) {
|
|
98950
|
-
return `${JSON.stringify(
|
|
98951
|
-
{
|
|
98952
|
-
main: entryPath,
|
|
98953
|
-
output: blobPath,
|
|
98954
|
-
disableExperimentalSEAWarning: true
|
|
98955
|
-
},
|
|
98956
|
-
null,
|
|
98957
|
-
2
|
|
98958
|
-
)}
|
|
98959
|
-
`;
|
|
98960
|
-
}
|
|
98961
|
-
async function installWindowsNativeLauncher(options) {
|
|
98962
|
-
const nodeExe = options.nodeExe ?? process.execPath;
|
|
98963
|
-
if (!(0, import_node_fs22.existsSync)(options.cliPath)) {
|
|
98964
|
-
throw new Error(`cannot build okx-a2a.exe: CLI entry not found at ${options.cliPath}`);
|
|
98965
|
-
}
|
|
98966
|
-
if (!(0, import_node_fs22.existsSync)(nodeExe)) {
|
|
98967
|
-
throw new Error(`cannot build okx-a2a.exe: node executable not found at ${nodeExe}`);
|
|
98968
|
-
}
|
|
98969
|
-
const exePath = (0, import_node_path27.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
|
|
98970
|
-
(0, import_node_fs22.mkdirSync)(options.targetDir, { recursive: true });
|
|
98971
|
-
const work = (0, import_node_fs22.mkdtempSync)((0, import_node_path27.join)((0, import_node_os10.tmpdir)(), "okx-a2a-sea-"));
|
|
98972
|
-
try {
|
|
98973
|
-
const entryPath = (0, import_node_path27.join)(work, "launcher-entry.js");
|
|
98974
|
-
const blobPath = (0, import_node_path27.join)(work, "okx-a2a.blob");
|
|
98975
|
-
const configPath = (0, import_node_path27.join)(work, "sea-config.json");
|
|
98976
|
-
(0, import_node_fs22.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
|
|
98977
|
-
(0, import_node_fs22.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
|
|
98978
|
-
(0, import_node_child_process8.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
|
|
98979
|
-
stdio: "ignore",
|
|
98980
|
-
windowsHide: true
|
|
98981
|
-
});
|
|
98982
|
-
(0, import_node_fs22.copyFileSync)(nodeExe, exePath);
|
|
98983
|
-
const isMac = process.platform === "darwin";
|
|
98984
|
-
if (isMac) {
|
|
98985
|
-
try {
|
|
98986
|
-
(0, import_node_child_process8.execFileSync)("codesign", ["--remove-signature", exePath], { stdio: "ignore" });
|
|
98987
|
-
} catch {
|
|
98988
|
-
}
|
|
98989
|
-
}
|
|
98990
|
-
injectSeaBlob(exePath, blobPath, isMac);
|
|
98991
|
-
if (isMac) {
|
|
98992
|
-
try {
|
|
98993
|
-
(0, import_node_child_process8.execFileSync)("codesign", ["--sign", "-", exePath], { stdio: "ignore" });
|
|
98994
|
-
} catch {
|
|
98995
|
-
}
|
|
98996
|
-
}
|
|
98997
|
-
logWinCompat(
|
|
98998
|
-
`${WIN_COMPAT_LOG_PREFIX} native launcher: built ${exePath} from node=${nodeExe} cli=${options.cliPath}`
|
|
98999
|
-
);
|
|
99000
|
-
return { exePath, cliPath: options.cliPath, nodeExe };
|
|
99001
|
-
} finally {
|
|
99002
|
-
(0, import_node_fs22.rmSync)(work, { recursive: true, force: true });
|
|
99003
|
-
}
|
|
99004
|
-
}
|
|
99005
|
-
var import_node_child_process8, import_node_fs22, import_node_module, import_node_os10, import_node_path27, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
|
|
99006
|
-
var init_win_native_launcher = __esm({
|
|
99007
|
-
"src/win-native-launcher.ts"() {
|
|
99008
|
-
"use strict";
|
|
99009
|
-
import_node_child_process8 = require("node:child_process");
|
|
99010
|
-
import_node_fs22 = require("node:fs");
|
|
99011
|
-
import_node_module = require("node:module");
|
|
99012
|
-
import_node_os10 = require("node:os");
|
|
99013
|
-
import_node_path27 = require("node:path");
|
|
99014
|
-
init_win_compat();
|
|
99015
|
-
init_win_spawn();
|
|
99016
|
-
SEA_SENTINEL_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
|
|
99017
|
-
NATIVE_LAUNCHER_EXE_NAME = "okx-a2a.exe";
|
|
99018
|
-
POSTJECT_SPEC = "postject@1.0.0-alpha.6";
|
|
99019
|
-
POSTJECT_BIN = "postject";
|
|
99020
|
-
}
|
|
99021
|
-
});
|
|
99022
|
-
|
|
99023
99141
|
// src/doctor-cli.ts
|
|
99024
99142
|
var doctor_cli_exports = {};
|
|
99025
99143
|
__export(doctor_cli_exports, {
|
|
@@ -99102,43 +99220,14 @@ function resolveDoctorTarget(env = process.env) {
|
|
|
99102
99220
|
function skipped(id, title, severity, reason) {
|
|
99103
99221
|
return { id, title, status: "skipped", severity, detail: reason };
|
|
99104
99222
|
}
|
|
99105
|
-
function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs23.existsSync) {
|
|
99106
|
-
const dirs = pathValue.split(";").map((d) => d.trim()).filter(Boolean);
|
|
99107
|
-
if (appData) {
|
|
99108
|
-
dirs.push((0, import_node_path28.join)(appData, "npm"));
|
|
99109
|
-
}
|
|
99110
|
-
if (userProfile) {
|
|
99111
|
-
dirs.push((0, import_node_path28.join)(userProfile, ".local", "bin"));
|
|
99112
|
-
}
|
|
99113
|
-
for (const dir of dirs) {
|
|
99114
|
-
const candidate = (0, import_node_path28.join)(dir, "okx-a2a.exe");
|
|
99115
|
-
if (fileExists2(candidate)) {
|
|
99116
|
-
return candidate;
|
|
99117
|
-
}
|
|
99118
|
-
}
|
|
99119
|
-
return null;
|
|
99120
|
-
}
|
|
99121
|
-
function resolveRunningCliPath() {
|
|
99122
|
-
const fromArgv = process.argv[1];
|
|
99123
|
-
if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs23.existsSync)(fromArgv)) {
|
|
99124
|
-
return fromArgv;
|
|
99125
|
-
}
|
|
99126
|
-
const beside = (0, import_node_path28.join)(__dirname, "cli.js");
|
|
99127
|
-
if ((0, import_node_fs23.existsSync)(beside)) {
|
|
99128
|
-
return beside;
|
|
99129
|
-
}
|
|
99130
|
-
if (fromArgv) {
|
|
99131
|
-
return fromArgv;
|
|
99132
|
-
}
|
|
99133
|
-
throw new Error("could not resolve the running okx-a2a CLI path for the native launcher");
|
|
99134
|
-
}
|
|
99135
99223
|
async function runDoctor(options = {}) {
|
|
99136
99224
|
const ctx = {
|
|
99137
99225
|
platform: options.platform ?? process.platform,
|
|
99138
99226
|
env: options.env ?? process.env,
|
|
99139
99227
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
99140
|
-
cliVersion: options.cliVersion ?? (true ? "0.1.
|
|
99228
|
+
cliVersion: options.cliVersion ?? (true ? "0.1.6-beta-c3024b2b0b-260706164140" : "0.0.0"),
|
|
99141
99229
|
fixMode: options.fix === true,
|
|
99230
|
+
nonInteractive: options.nonInteractive === true,
|
|
99142
99231
|
packageChanged: false
|
|
99143
99232
|
};
|
|
99144
99233
|
const checkers = options.checkers ?? CHECKERS;
|
|
@@ -99279,6 +99368,7 @@ function formatDoctorReportForHumans(report) {
|
|
|
99279
99368
|
async function handleDoctorCommand(args) {
|
|
99280
99369
|
const json = args.includes("--json");
|
|
99281
99370
|
const fix = args.includes("--fix");
|
|
99371
|
+
const nonInteractive = args.includes("--non-interactive");
|
|
99282
99372
|
const targetIndex = args.indexOf("--target");
|
|
99283
99373
|
const rawTarget = targetIndex >= 0 ? args[targetIndex + 1] : void 0;
|
|
99284
99374
|
if (targetIndex >= 0 && (rawTarget === void 0 || rawTarget.startsWith("--"))) {
|
|
@@ -99302,7 +99392,7 @@ async function handleDoctorCommand(args) {
|
|
|
99302
99392
|
};
|
|
99303
99393
|
let report;
|
|
99304
99394
|
try {
|
|
99305
|
-
report = await runDoctor({ fix, ...rawTarget ? { target: rawTarget } : {} });
|
|
99395
|
+
report = await runDoctor({ fix, nonInteractive, ...rawTarget ? { target: rawTarget } : {} });
|
|
99306
99396
|
} catch (error) {
|
|
99307
99397
|
restoreStdout();
|
|
99308
99398
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -99332,12 +99422,10 @@ async function writeStdoutAndExit(output4, code2) {
|
|
|
99332
99422
|
});
|
|
99333
99423
|
process.exit(code2);
|
|
99334
99424
|
}
|
|
99335
|
-
var
|
|
99425
|
+
var import_node_path28, DOCTOR_MIN_NODE_VERSION, DOCTOR_DAEMON_READY_TIMEOUT_MS, NODE_PACKAGE_SPEC, CODEX_INSTALL_SPEC, CLAUDE_INSTALL_SPEC, nodeVersionChecker, npmChecker, cliVersionChecker, windowsNativeLauncherChecker, providerBindingChecker, providerCliChecker, gatewayPluginChecker, gatewayConfigChecker, daemonChecker, agentRefreshChecker, gatewayReachableChecker, autostartChecker, CHECKERS, STATUS_MARK;
|
|
99336
99426
|
var init_doctor_cli = __esm({
|
|
99337
99427
|
"src/doctor-cli.ts"() {
|
|
99338
99428
|
"use strict";
|
|
99339
|
-
import_node_fs23 = require("node:fs");
|
|
99340
|
-
import_node_os11 = require("node:os");
|
|
99341
99429
|
import_node_path28 = require("node:path");
|
|
99342
99430
|
init_log();
|
|
99343
99431
|
init_win_compat();
|
|
@@ -99351,7 +99439,9 @@ var init_doctor_cli = __esm({
|
|
|
99351
99439
|
init_runtime_switch();
|
|
99352
99440
|
init_session_store();
|
|
99353
99441
|
init_update_cli();
|
|
99442
|
+
init_win_native_launcher();
|
|
99354
99443
|
init_win_spawn();
|
|
99444
|
+
init_win_native_launcher();
|
|
99355
99445
|
DOCTOR_MIN_NODE_VERSION = "22.14.0";
|
|
99356
99446
|
DOCTOR_DAEMON_READY_TIMEOUT_MS = 2e4;
|
|
99357
99447
|
NODE_PACKAGE_SPEC = "@okxweb3/a2a-node";
|
|
@@ -99526,11 +99616,11 @@ var init_doctor_cli = __esm({
|
|
|
99526
99616
|
};
|
|
99527
99617
|
},
|
|
99528
99618
|
applyFix: async (ctx) => {
|
|
99529
|
-
const
|
|
99530
|
-
|
|
99531
|
-
|
|
99532
|
-
|
|
99533
|
-
return `built native launcher ${result.exePath} (SEA over
|
|
99619
|
+
const result = await ensureWindowsNativeLauncher({ env: ctx.env, platform: "win32" });
|
|
99620
|
+
if (!result) {
|
|
99621
|
+
throw new Error("native launcher fix is only applicable on Windows");
|
|
99622
|
+
}
|
|
99623
|
+
return result.installed ? `built native launcher ${result.exePath} (SEA over your node.exe)` : `native launcher already present at ${result.exePath}`;
|
|
99534
99624
|
}
|
|
99535
99625
|
};
|
|
99536
99626
|
providerBindingChecker = {
|
|
@@ -99552,13 +99642,18 @@ var init_doctor_cli = __esm({
|
|
|
99552
99642
|
data: { bound, detectedRuntime: runtime }
|
|
99553
99643
|
};
|
|
99554
99644
|
}
|
|
99645
|
+
const autoFixCanSucceed = !!expected;
|
|
99555
99646
|
return {
|
|
99556
99647
|
id: "provider_binding",
|
|
99557
99648
|
title: "Default AI provider binding",
|
|
99558
99649
|
status: "fail",
|
|
99559
99650
|
severity: "required",
|
|
99560
99651
|
detail: bound ? `default provider ${bound} does not match the detected runtime ${runtime}` : "no default AI provider is bound",
|
|
99561
|
-
fix: { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." }
|
|
99652
|
+
fix: autoFixCanSucceed ? { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." } : {
|
|
99653
|
+
kind: "manual",
|
|
99654
|
+
description: "No AI runtime detected and no default provider is bound. Run doctor from your AI environment (OpenClaw / Codex / Claude / Hermes), or bind one manually first.",
|
|
99655
|
+
command: "okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>"
|
|
99656
|
+
},
|
|
99562
99657
|
data: { bound, detectedRuntime: runtime }
|
|
99563
99658
|
};
|
|
99564
99659
|
} finally {
|
|
@@ -99570,7 +99665,7 @@ var init_doctor_cli = __esm({
|
|
|
99570
99665
|
try {
|
|
99571
99666
|
const result = await performRuntimeSwitch(store);
|
|
99572
99667
|
if (!result.ok) {
|
|
99573
|
-
throw new Error(result.message || "runtime switch failed");
|
|
99668
|
+
throw new Error(result.userMessage || result.message || "runtime switch failed");
|
|
99574
99669
|
}
|
|
99575
99670
|
return `runtime switch: provider=${result.provider} ${result.changed ? "(switched)" : "(already current)"}`;
|
|
99576
99671
|
} finally {
|
|
@@ -99631,7 +99726,14 @@ var init_doctor_cli = __esm({
|
|
|
99631
99726
|
status: "fail",
|
|
99632
99727
|
severity: "required",
|
|
99633
99728
|
detail: `${provider} CLI at ${resolved} is not logged in (${auth.reason})`,
|
|
99634
|
-
|
|
99729
|
+
// Logging in needs a human (device/browser auth). In --non-interactive
|
|
99730
|
+
// mode never launch it — degrade to a manual instruction so unattended
|
|
99731
|
+
// callers (install scripts) cannot hang waiting on stdin.
|
|
99732
|
+
fix: ctx.nonInteractive ? {
|
|
99733
|
+
kind: "manual",
|
|
99734
|
+
description: "Log in with the command below, then re-run okx-a2a doctor.",
|
|
99735
|
+
command: loginCommand
|
|
99736
|
+
} : {
|
|
99635
99737
|
kind: "auto",
|
|
99636
99738
|
description: "--fix launches the interactive login flow (same as setup: device/browser auth, waits for completion). You can also log in yourself with the command below, then re-run okx-a2a doctor.",
|
|
99637
99739
|
command: loginCommand
|
|
@@ -99670,6 +99772,11 @@ var init_doctor_cli = __esm({
|
|
|
99670
99772
|
}
|
|
99671
99773
|
const auth = provider === "codex" ? await checkCodexCliAuthStatus(resolved) : await checkClaudeCliAuthStatus(resolved);
|
|
99672
99774
|
if (!auth.ok) {
|
|
99775
|
+
if (ctx.nonInteractive) {
|
|
99776
|
+
throw new Error(
|
|
99777
|
+
`${provider} CLI is installed but not logged in; non-interactive mode skips the login flow \u2014 log in yourself and re-run okx-a2a doctor`
|
|
99778
|
+
);
|
|
99779
|
+
}
|
|
99673
99780
|
errorWithTimestamp(`[doctor] launching ${provider} CLI login (interactive; waiting for completion)`);
|
|
99674
99781
|
const login = await runProviderLoginInteractive(provider, resolved);
|
|
99675
99782
|
if (!login.ok) {
|
|
@@ -99693,13 +99800,14 @@ var init_doctor_cli = __esm({
|
|
|
99693
99800
|
return null;
|
|
99694
99801
|
}
|
|
99695
99802
|
const installed = await isGatewayPluginInstalled(ctx.target);
|
|
99803
|
+
const hermesPathSuffix = ctx.target === "hermes" ? ` (checked ${resolveHermesPluginYamlPath()})` : "";
|
|
99696
99804
|
if (installed) {
|
|
99697
99805
|
return {
|
|
99698
99806
|
id: "gateway_plugin",
|
|
99699
99807
|
title: "Gateway plugin installed",
|
|
99700
99808
|
status: "pass",
|
|
99701
99809
|
severity: "required",
|
|
99702
|
-
detail: `${ctx.target} okx-a2a plugin is installed`
|
|
99810
|
+
detail: `${ctx.target} okx-a2a plugin is installed${hermesPathSuffix}`
|
|
99703
99811
|
};
|
|
99704
99812
|
}
|
|
99705
99813
|
const hermesOnWindows = ctx.target === "hermes" && ctx.platform === "win32";
|
|
@@ -99708,7 +99816,7 @@ var init_doctor_cli = __esm({
|
|
|
99708
99816
|
title: "Gateway plugin installed",
|
|
99709
99817
|
status: "fail",
|
|
99710
99818
|
severity: "required",
|
|
99711
|
-
detail: `${ctx.target} okx-a2a plugin is not installed`,
|
|
99819
|
+
detail: `${ctx.target} okx-a2a plugin is not installed${hermesPathSuffix}`,
|
|
99712
99820
|
fix: hermesOnWindows ? {
|
|
99713
99821
|
kind: "manual",
|
|
99714
99822
|
description: "Hermes plugin installation requires bash and is not supported on Windows. Use WSL or run setup on macOS/Linux."
|
|
@@ -99737,13 +99845,14 @@ var init_doctor_cli = __esm({
|
|
|
99737
99845
|
return null;
|
|
99738
99846
|
}
|
|
99739
99847
|
const drift = ctx.target === "openclaw" ? await ensureOpenClawOkxA2aPluginConfig({ dryRun: true }) : await ensureHermesOkxA2aPluginConfig(void 0, { dryRun: true });
|
|
99848
|
+
const hermesPathSuffix = ctx.target === "hermes" ? ` (checked ${resolveHermesConfigPath()})` : "";
|
|
99740
99849
|
if (!drift) {
|
|
99741
99850
|
return {
|
|
99742
99851
|
id: "gateway_config",
|
|
99743
99852
|
title: "Gateway plugin config",
|
|
99744
99853
|
status: "pass",
|
|
99745
99854
|
severity: "required",
|
|
99746
|
-
detail: `${ctx.target} okx-a2a plugin config is normalized`
|
|
99855
|
+
detail: `${ctx.target} okx-a2a plugin config is normalized${hermesPathSuffix}`
|
|
99747
99856
|
};
|
|
99748
99857
|
}
|
|
99749
99858
|
return {
|
|
@@ -99751,7 +99860,7 @@ var init_doctor_cli = __esm({
|
|
|
99751
99860
|
title: "Gateway plugin config",
|
|
99752
99861
|
status: "fail",
|
|
99753
99862
|
severity: "required",
|
|
99754
|
-
detail: `${ctx.target} okx-a2a plugin config needs normalization`,
|
|
99863
|
+
detail: `${ctx.target} okx-a2a plugin config needs normalization${hermesPathSuffix}`,
|
|
99755
99864
|
fix: { kind: "auto", description: `Apply the ${ctx.target} config normalization in-process.` }
|
|
99756
99865
|
};
|
|
99757
99866
|
},
|
|
@@ -100005,8 +100114,8 @@ var init_doctor_cli = __esm({
|
|
|
100005
100114
|
|
|
100006
100115
|
// src/cli.ts
|
|
100007
100116
|
var import_node_child_process9 = require("node:child_process");
|
|
100008
|
-
var
|
|
100009
|
-
var
|
|
100117
|
+
var import_node_fs23 = require("node:fs");
|
|
100118
|
+
var import_node_os11 = require("node:os");
|
|
100010
100119
|
var import_node_path29 = require("node:path");
|
|
100011
100120
|
init_daemon();
|
|
100012
100121
|
init_command_store();
|
|
@@ -100209,7 +100318,7 @@ init_sentry_logger();
|
|
|
100209
100318
|
init_sentry_config();
|
|
100210
100319
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
100211
100320
|
function printUsage2() {
|
|
100212
|
-
console.log(`okx-a2a ${"0.1.
|
|
100321
|
+
console.log(`okx-a2a ${"0.1.6-beta-c3024b2b0b-260706164140"}
|
|
100213
100322
|
|
|
100214
100323
|
Usage:
|
|
100215
100324
|
okx-a2a <command> [options]
|
|
@@ -100229,7 +100338,7 @@ Commands:
|
|
|
100229
100338
|
file Upload or download encrypted XMTP attachments
|
|
100230
100339
|
ai Run the configured AI CLI adapter
|
|
100231
100340
|
setup Detect runtime/platform and install missing OpenClaw/Hermes okx-a2a components
|
|
100232
|
-
doctor Diagnose the whole A2A environment; --fix repairs what it can
|
|
100341
|
+
doctor Diagnose the whole A2A environment; --fix repairs what it can (--non-interactive skips login flows)
|
|
100233
100342
|
update Manually update existing okx-a2a packages
|
|
100234
100343
|
config Configure provider and permission defaults
|
|
100235
100344
|
ai-provider Legacy AI provider configuration
|
|
@@ -100247,7 +100356,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
100247
100356
|
`);
|
|
100248
100357
|
}
|
|
100249
100358
|
function printVersion() {
|
|
100250
|
-
console.log("0.1.
|
|
100359
|
+
console.log("0.1.6-beta-c3024b2b0b-260706164140");
|
|
100251
100360
|
}
|
|
100252
100361
|
function printDaemonUsage() {
|
|
100253
100362
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -100514,14 +100623,14 @@ function maybeRedirectDaemonSelfLog() {
|
|
|
100514
100623
|
}
|
|
100515
100624
|
try {
|
|
100516
100625
|
const logPath = resolveTaskPaths().listenerLogPath;
|
|
100517
|
-
(0,
|
|
100518
|
-
const fd = (0,
|
|
100626
|
+
(0, import_node_fs23.mkdirSync)((0, import_node_path29.join)(logPath, ".."), { recursive: true });
|
|
100627
|
+
const fd = (0, import_node_fs23.openSync)(logPath, "a");
|
|
100519
100628
|
const writeToLog = ((chunk, encoding, cb) => {
|
|
100520
100629
|
try {
|
|
100521
100630
|
if (typeof chunk === "string") {
|
|
100522
|
-
(0,
|
|
100631
|
+
(0, import_node_fs23.writeSync)(fd, chunk);
|
|
100523
100632
|
} else {
|
|
100524
|
-
(0,
|
|
100633
|
+
(0, import_node_fs23.writeSync)(fd, chunk);
|
|
100525
100634
|
}
|
|
100526
100635
|
} catch {
|
|
100527
100636
|
}
|
|
@@ -101272,7 +101381,7 @@ async function handleRuntimeSwitch(args) {
|
|
|
101272
101381
|
console.log(result.userMessage);
|
|
101273
101382
|
}
|
|
101274
101383
|
} else {
|
|
101275
|
-
console.log(result.message);
|
|
101384
|
+
console.log(result.userMessage || result.message);
|
|
101276
101385
|
}
|
|
101277
101386
|
if (!result.ok) {
|
|
101278
101387
|
process.exitCode = 1;
|
|
@@ -101492,10 +101601,10 @@ function initDirectCliSentry() {
|
|
|
101492
101601
|
cliSentryInitAttempted = true;
|
|
101493
101602
|
try {
|
|
101494
101603
|
const configPath = (0, import_node_path29.join)(resolveTaskHomeForSentryConfig(), "xmtp", "system-config.json");
|
|
101495
|
-
if (!(0,
|
|
101604
|
+
if (!(0, import_node_fs23.existsSync)(configPath)) {
|
|
101496
101605
|
return;
|
|
101497
101606
|
}
|
|
101498
|
-
const config = JSON.parse((0,
|
|
101607
|
+
const config = JSON.parse((0, import_node_fs23.readFileSync)(configPath, "utf8"));
|
|
101499
101608
|
if (typeof config.sentryDsn !== "string" || !config.sentryDsn) {
|
|
101500
101609
|
return;
|
|
101501
101610
|
}
|
|
@@ -101513,7 +101622,7 @@ function resolveTaskHomeForSentryConfig() {
|
|
|
101513
101622
|
return process.env.OKX_AGENT_TASK_HOME;
|
|
101514
101623
|
}
|
|
101515
101624
|
try {
|
|
101516
|
-
const home = (0,
|
|
101625
|
+
const home = (0, import_node_os11.homedir)();
|
|
101517
101626
|
if (home) {
|
|
101518
101627
|
return (0, import_node_path29.join)(home, ".okx-agent-task");
|
|
101519
101628
|
}
|