@okxweb3/a2a-node 0.2.15 → 0.2.16
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 +155 -88
- package/dist/index.js +134 -72
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1851,12 +1851,12 @@ async function acquireDaemonLock(paths, entry) {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
return null;
|
|
1853
1853
|
}
|
|
1854
|
-
function activeDaemonPointerPath() {
|
|
1855
|
-
return (0, import_node_path4.join)(
|
|
1854
|
+
function activeDaemonPointerPath(homeDir = resolveA2aTaskHome()) {
|
|
1855
|
+
return (0, import_node_path4.join)(homeDir, "run", "active-daemon.json");
|
|
1856
1856
|
}
|
|
1857
|
-
async function readActiveDaemonPointer() {
|
|
1857
|
+
async function readActiveDaemonPointer(homeDir = resolveA2aTaskHome()) {
|
|
1858
1858
|
try {
|
|
1859
|
-
const raw = await (0, import_promises.readFile)(activeDaemonPointerPath(), "utf8");
|
|
1859
|
+
const raw = await (0, import_promises.readFile)(activeDaemonPointerPath(homeDir), "utf8");
|
|
1860
1860
|
const parsed = JSON.parse(raw);
|
|
1861
1861
|
return Number.isInteger(parsed.pid) && parsed.pid > 0 ? parsed : null;
|
|
1862
1862
|
} catch {
|
|
@@ -1865,14 +1865,14 @@ async function readActiveDaemonPointer() {
|
|
|
1865
1865
|
}
|
|
1866
1866
|
async function claimActiveDaemon(homeDir) {
|
|
1867
1867
|
let evictedPid = null;
|
|
1868
|
-
const current = await readActiveDaemonPointer();
|
|
1868
|
+
const current = await readActiveDaemonPointer(homeDir);
|
|
1869
1869
|
if (current && current.pid !== process.pid && isProcessAlive(current.pid)) {
|
|
1870
1870
|
if (await evictPid(current.pid)) {
|
|
1871
1871
|
evictedPid = current.pid;
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
|
-
const pointerPath = activeDaemonPointerPath();
|
|
1875
|
-
|
|
1874
|
+
const pointerPath = activeDaemonPointerPath(homeDir);
|
|
1875
|
+
ensureTaskDir((0, import_node_path4.dirname)(pointerPath));
|
|
1876
1876
|
await (0, import_promises.writeFile)(pointerPath, `${JSON.stringify({
|
|
1877
1877
|
pid: process.pid,
|
|
1878
1878
|
homeDir,
|
|
@@ -1881,10 +1881,10 @@ async function claimActiveDaemon(homeDir) {
|
|
|
1881
1881
|
`, "utf8");
|
|
1882
1882
|
return evictedPid;
|
|
1883
1883
|
}
|
|
1884
|
-
async function releaseActiveDaemon() {
|
|
1885
|
-
const current = await readActiveDaemonPointer();
|
|
1884
|
+
async function releaseActiveDaemon(homeDir = resolveA2aTaskHome()) {
|
|
1885
|
+
const current = await readActiveDaemonPointer(homeDir);
|
|
1886
1886
|
if (current?.pid === process.pid) {
|
|
1887
|
-
await (0, import_promises.rm)(activeDaemonPointerPath(), { force: true });
|
|
1887
|
+
await (0, import_promises.rm)(activeDaemonPointerPath(homeDir), { force: true });
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
1890
|
async function chmodBestEffort(path2, mode) {
|
|
@@ -1897,12 +1897,11 @@ async function chmodBestEffort(path2, mode) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
|
-
var import_promises,
|
|
1900
|
+
var import_promises, import_node_path4, OWNER_FILE, EMPTY_LOCK_STALE_MS, DEFAULT_TAKEOVER_GRACE_MS, TAKEOVER_GRACE_ENV, TAKEOVER_POLL_MS, DAEMON_CAPABILITY_AI_DISPATCH, DAEMON_CAPABILITIES;
|
|
1901
1901
|
var init_daemon_lock = __esm({
|
|
1902
1902
|
"src/daemon-lock.ts"() {
|
|
1903
1903
|
"use strict";
|
|
1904
1904
|
import_promises = require("node:fs/promises");
|
|
1905
|
-
import_node_os2 = require("node:os");
|
|
1906
1905
|
import_node_path4 = require("node:path");
|
|
1907
1906
|
init_paths();
|
|
1908
1907
|
init_a2a_paths();
|
|
@@ -2430,7 +2429,7 @@ function collectCodexAppBundledCandidates(env = process.env, platform = process.
|
|
|
2430
2429
|
}
|
|
2431
2430
|
const roots = (env[CODEX_APP_DIRS_ENV] ?? "").split(import_node_path8.delimiter).filter(Boolean);
|
|
2432
2431
|
if (platform === "darwin") {
|
|
2433
|
-
roots.push("/Applications", (0, import_node_path8.join)(env.HOME || (0,
|
|
2432
|
+
roots.push("/Applications", (0, import_node_path8.join)(env.HOME || (0, import_node_os2.homedir)(), "Applications"));
|
|
2434
2433
|
}
|
|
2435
2434
|
const candidates = [];
|
|
2436
2435
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2558,7 +2557,7 @@ function findExecutableCandidatesOnPath(command, pathValue, platform) {
|
|
|
2558
2557
|
return candidates;
|
|
2559
2558
|
}
|
|
2560
2559
|
function fallbackCandidates(command, env, platform = process.platform) {
|
|
2561
|
-
const home = (0,
|
|
2560
|
+
const home = (0, import_node_os2.homedir)();
|
|
2562
2561
|
const dirs = [
|
|
2563
2562
|
(0, import_node_path8.dirname)(process.execPath),
|
|
2564
2563
|
(0, import_node_path8.join)(home, ".local", "bin"),
|
|
@@ -2577,8 +2576,8 @@ function providerPathDirs(command, env) {
|
|
|
2577
2576
|
return [
|
|
2578
2577
|
(0, import_node_path8.isAbsolute)(command) ? (0, import_node_path8.dirname)(command) : void 0,
|
|
2579
2578
|
(0, import_node_path8.dirname)(process.execPath),
|
|
2580
|
-
(0, import_node_path8.join)((0,
|
|
2581
|
-
(0, import_node_path8.join)((0,
|
|
2579
|
+
(0, import_node_path8.join)((0, import_node_os2.homedir)(), ".local", "bin"),
|
|
2580
|
+
(0, import_node_path8.join)((0, import_node_os2.homedir)(), "Library", "pnpm"),
|
|
2582
2581
|
env.PNPM_HOME
|
|
2583
2582
|
].filter((dir) => !!dir);
|
|
2584
2583
|
}
|
|
@@ -2655,12 +2654,12 @@ function isCodexCommand(command) {
|
|
|
2655
2654
|
function isWindowsAppsPath(commandPath) {
|
|
2656
2655
|
return /(?:^|[\\/])WindowsApps(?:[\\/]|$)/i.test(commandPath);
|
|
2657
2656
|
}
|
|
2658
|
-
var import_node_fs5,
|
|
2657
|
+
var import_node_fs5, import_node_os2, import_node_path8, DEFAULT_AI_PROVIDER_TIMEOUT_MS, CODEX_PROBE_TIMEOUT_MS, CODEX_APP_DIRS_ENV, CODEX_COMMAND_OVERRIDE_ENV;
|
|
2659
2658
|
var init_ai_command = __esm({
|
|
2660
2659
|
"src/ai-command.ts"() {
|
|
2661
2660
|
"use strict";
|
|
2662
2661
|
import_node_fs5 = require("node:fs");
|
|
2663
|
-
|
|
2662
|
+
import_node_os2 = require("node:os");
|
|
2664
2663
|
import_node_path8 = require("node:path");
|
|
2665
2664
|
init_win_spawn();
|
|
2666
2665
|
DEFAULT_AI_PROVIDER_TIMEOUT_MS = null;
|
|
@@ -2708,14 +2707,14 @@ function isSystemdManagerUnavailableMessage(message) {
|
|
|
2708
2707
|
function isAutostartManagerUnavailableError(error) {
|
|
2709
2708
|
return error instanceof AutostartManagerUnavailableError || typeof error === "object" && error !== null && "code" in error && error.code === "AUTOSTART_MANAGER_UNAVAILABLE";
|
|
2710
2709
|
}
|
|
2711
|
-
function resolveSystemdAutostartPaths(home = (0,
|
|
2710
|
+
function resolveSystemdAutostartPaths(home = (0, import_node_os3.homedir)()) {
|
|
2712
2711
|
const serviceDir = (0, import_node_path9.join)(home, ".config", "systemd", "user");
|
|
2713
2712
|
return {
|
|
2714
2713
|
serviceDir,
|
|
2715
2714
|
servicePath: (0, import_node_path9.join)(serviceDir, SERVICE_NAME)
|
|
2716
2715
|
};
|
|
2717
2716
|
}
|
|
2718
|
-
function resolveLaunchdAutostartPaths(home = (0,
|
|
2717
|
+
function resolveLaunchdAutostartPaths(home = (0, import_node_os3.homedir)()) {
|
|
2719
2718
|
const agentDir = (0, import_node_path9.join)(home, "Library", "LaunchAgents");
|
|
2720
2719
|
return {
|
|
2721
2720
|
agentDir,
|
|
@@ -2735,13 +2734,13 @@ function resolveCliPath() {
|
|
|
2735
2734
|
}
|
|
2736
2735
|
return (0, import_node_path9.resolve)(entry);
|
|
2737
2736
|
}
|
|
2738
|
-
function requiredServicePathEntries(env = process.env, home = (0,
|
|
2737
|
+
function requiredServicePathEntries(env = process.env, home = (0, import_node_os3.homedir)(), platform = process.platform) {
|
|
2739
2738
|
const localBin = (0, import_node_path9.join)(home, ".local", "bin");
|
|
2740
2739
|
const explicit = env.ONCHAINOS_BIN?.trim();
|
|
2741
2740
|
const onchainosPath = (explicit ? resolveCommandPath(explicit, env, platform) : null) ?? resolveCommandPath("onchainos", env, platform);
|
|
2742
2741
|
return [...new Set([onchainosPath ? (0, import_node_path9.dirname)(onchainosPath) : null, localBin].filter((entry) => !!entry))];
|
|
2743
2742
|
}
|
|
2744
|
-
function buildServicePath(env = process.env, home = (0,
|
|
2743
|
+
function buildServicePath(env = process.env, home = (0, import_node_os3.homedir)(), platform = process.platform) {
|
|
2745
2744
|
const fallback = "/usr/local/bin:/usr/bin:/bin";
|
|
2746
2745
|
const entries = (env.PATH?.trim() || fallback).split(import_node_path9.delimiter).filter((entry) => !!entry);
|
|
2747
2746
|
const preferred = requiredServicePathEntries(env, home, platform);
|
|
@@ -2793,7 +2792,7 @@ ${args.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n")}
|
|
|
2793
2792
|
<key>PATH</key>
|
|
2794
2793
|
<string>${escapeXml(pathValue)}</string>
|
|
2795
2794
|
<key>HOME</key>
|
|
2796
|
-
<string>${escapeXml((0,
|
|
2795
|
+
<string>${escapeXml((0, import_node_os3.homedir)())}</string>
|
|
2797
2796
|
<key>OKX_AGENT_TASK_HOME</key>
|
|
2798
2797
|
<string>${escapeXml(paths.homeDir)}</string>
|
|
2799
2798
|
</dict>
|
|
@@ -3278,14 +3277,14 @@ function autostartStatus() {
|
|
|
3278
3277
|
}
|
|
3279
3278
|
throw new Error(`autostart is not supported on ${process.platform}`);
|
|
3280
3279
|
}
|
|
3281
|
-
var import_node_child_process3, import_node_fs6, import_promises3,
|
|
3280
|
+
var import_node_child_process3, import_node_fs6, import_promises3, import_node_os3, import_node_path9, import_node_util, execFileAsync, SERVICE_NAME, LAUNCHD_LABEL, LAUNCHD_PLIST_NAME, AutostartManagerUnavailableError;
|
|
3282
3281
|
var init_autostart = __esm({
|
|
3283
3282
|
"src/autostart.ts"() {
|
|
3284
3283
|
"use strict";
|
|
3285
3284
|
import_node_child_process3 = require("node:child_process");
|
|
3286
3285
|
import_node_fs6 = require("node:fs");
|
|
3287
3286
|
import_promises3 = require("node:fs/promises");
|
|
3288
|
-
|
|
3287
|
+
import_node_os3 = require("node:os");
|
|
3289
3288
|
import_node_path9 = require("node:path");
|
|
3290
3289
|
import_node_util = require("node:util");
|
|
3291
3290
|
init_autostart_windows();
|
|
@@ -3497,7 +3496,7 @@ async function startDaemon(homeDir) {
|
|
|
3497
3496
|
}
|
|
3498
3497
|
function isDefaultTaskHome(homeDir) {
|
|
3499
3498
|
const target = (0, import_node_path10.resolve)(homeDir ?? resolveTaskHome());
|
|
3500
|
-
return target === (0, import_node_path10.resolve)((0, import_node_path10.join)((0,
|
|
3499
|
+
return target === (0, import_node_path10.resolve)((0, import_node_path10.join)((0, import_node_os4.homedir)(), ".okx-agent-task"));
|
|
3501
3500
|
}
|
|
3502
3501
|
async function shouldDelegateToSupervisor(homeDir, ops) {
|
|
3503
3502
|
if (!isDefaultTaskHome(homeDir)) {
|
|
@@ -3725,14 +3724,14 @@ function readReadyTimeoutMs(env) {
|
|
|
3725
3724
|
function sleep2(ms) {
|
|
3726
3725
|
return new Promise((resolve14) => setTimeout(resolve14, ms));
|
|
3727
3726
|
}
|
|
3728
|
-
var import_node_fs7, import_promises4, import_node_child_process4,
|
|
3727
|
+
var import_node_fs7, import_promises4, import_node_child_process4, import_node_os4, import_node_path10, STOP_GRACE_MS, FORCE_KILL_GRACE_MS, START_EXIT_CHECK_MS, DEFAULT_READY_TIMEOUT_MS, READY_POLL_MS, DAEMON_READY_TIMEOUT_ENV, SUPERVISOR_START_RUNNING_TIMEOUT_MS, SUPERVISOR_START_POLL_MS;
|
|
3729
3728
|
var init_daemon = __esm({
|
|
3730
3729
|
"src/daemon.ts"() {
|
|
3731
3730
|
"use strict";
|
|
3732
3731
|
import_node_fs7 = require("node:fs");
|
|
3733
3732
|
import_promises4 = require("node:fs/promises");
|
|
3734
3733
|
import_node_child_process4 = require("node:child_process");
|
|
3735
|
-
|
|
3734
|
+
import_node_os4 = require("node:os");
|
|
3736
3735
|
import_node_path10 = require("node:path");
|
|
3737
3736
|
init_paths();
|
|
3738
3737
|
init_session_store();
|
|
@@ -26822,7 +26821,7 @@ async function callOpenClawGateway(opts) {
|
|
|
26822
26821
|
if (isRetryableOpenClawGatewayError(err2)) {
|
|
26823
26822
|
clearClient();
|
|
26824
26823
|
}
|
|
26825
|
-
if (isGatewayStartingError(err2) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
|
|
26824
|
+
if (opts.retryOnStarting !== false && isGatewayStartingError(err2) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
|
|
26826
26825
|
errorWithTimestamp(
|
|
26827
26826
|
`${LOG_PREFIX2} rpc retry method=${opts.method} attempt=${attempt + 1} delayMs=${delayMs}: ${message}`
|
|
26828
26827
|
);
|
|
@@ -26871,6 +26870,9 @@ async function callSessionsSend(params) {
|
|
|
26871
26870
|
try {
|
|
26872
26871
|
return await callOpenClawGateway({ method: "sessions.send", params: sendParams });
|
|
26873
26872
|
} catch (err2) {
|
|
26873
|
+
if (params.restoreArchived === true && isArchivedSessionSendError(err2, params.key)) {
|
|
26874
|
+
return restoreArchivedSessionAndSendOnce(params.key, sendParams);
|
|
26875
|
+
}
|
|
26874
26876
|
if (isSessionNotFound(err2)) {
|
|
26875
26877
|
await callSessionsCreate({ key: params.key });
|
|
26876
26878
|
return callOpenClawGateway({ method: "sessions.send", params: sendParams });
|
|
@@ -26878,6 +26880,62 @@ async function callSessionsSend(params) {
|
|
|
26878
26880
|
throw err2;
|
|
26879
26881
|
}
|
|
26880
26882
|
}
|
|
26883
|
+
function isArchivedSessionSendError(error, key) {
|
|
26884
|
+
const e = error;
|
|
26885
|
+
return (e?.gatewayCode ?? e?.code) === "INVALID_REQUEST" && String(e?.message) === `Session "${key}" is archived. Restore it before starting new work.`;
|
|
26886
|
+
}
|
|
26887
|
+
async function restoreArchivedSessionAndSendOnce(key, sendParams) {
|
|
26888
|
+
let stage = "lookup";
|
|
26889
|
+
try {
|
|
26890
|
+
let entry;
|
|
26891
|
+
let offset = 0;
|
|
26892
|
+
for (let page = 0; page < 10; page += 1) {
|
|
26893
|
+
const raw = await callOpenClawGateway({
|
|
26894
|
+
method: "sessions.list",
|
|
26895
|
+
params: { search: key, archived: "all", limit: 200, offset },
|
|
26896
|
+
retryOnStarting: false
|
|
26897
|
+
});
|
|
26898
|
+
const listPage = raw;
|
|
26899
|
+
if (!listPage || !Array.isArray(listPage.sessions)) {
|
|
26900
|
+
throw new Error("Invalid sessions.list response");
|
|
26901
|
+
}
|
|
26902
|
+
entry = listPage.sessions.find((row) => row?.key === key);
|
|
26903
|
+
if (entry || listPage.hasMore !== true) {
|
|
26904
|
+
break;
|
|
26905
|
+
}
|
|
26906
|
+
if (!(Number.isInteger(listPage.nextOffset) && listPage.nextOffset > offset)) {
|
|
26907
|
+
throw new Error("Invalid sessions.list pagination");
|
|
26908
|
+
}
|
|
26909
|
+
offset = listPage.nextOffset;
|
|
26910
|
+
}
|
|
26911
|
+
if (!entry || typeof entry.sessionId !== "string" || !entry.sessionId) {
|
|
26912
|
+
throw new Error("Exact session identity unavailable for archive recovery");
|
|
26913
|
+
}
|
|
26914
|
+
stage = "restore";
|
|
26915
|
+
if (entry.archivedAt !== void 0) {
|
|
26916
|
+
await callOpenClawGateway({
|
|
26917
|
+
method: "sessions.patch",
|
|
26918
|
+
params: {
|
|
26919
|
+
key,
|
|
26920
|
+
archived: false,
|
|
26921
|
+
expectedSessionId: entry.sessionId,
|
|
26922
|
+
...typeof entry.lifecycleRevision === "string" && entry.lifecycleRevision ? { expectedLifecycleRevision: entry.lifecycleRevision } : {}
|
|
26923
|
+
},
|
|
26924
|
+
retryOnStarting: false
|
|
26925
|
+
});
|
|
26926
|
+
}
|
|
26927
|
+
stage = "resend";
|
|
26928
|
+
return await callOpenClawGateway({ method: "sessions.send", params: sendParams, retryOnStarting: false });
|
|
26929
|
+
} catch (cause) {
|
|
26930
|
+
throw Object.assign(
|
|
26931
|
+
new Error(
|
|
26932
|
+
`Archived job session recovery failed at ${stage}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
26933
|
+
{ cause }
|
|
26934
|
+
),
|
|
26935
|
+
{ code: "A2A_ARCHIVE_RECOVERY_FAILED", retryable: false, recoveryStage: stage }
|
|
26936
|
+
);
|
|
26937
|
+
}
|
|
26938
|
+
}
|
|
26881
26939
|
async function callChatInject(params) {
|
|
26882
26940
|
try {
|
|
26883
26941
|
return await callOpenClawGateway({ method: "chat.inject", params });
|
|
@@ -26897,6 +26955,9 @@ async function callPromptUserToLatestSessions(params) {
|
|
|
26897
26955
|
}
|
|
26898
26956
|
function isRetryableOpenClawGatewayError(err2) {
|
|
26899
26957
|
const e = err2;
|
|
26958
|
+
if (e?.code === "A2A_ARCHIVE_RECOVERY_FAILED") {
|
|
26959
|
+
return false;
|
|
26960
|
+
}
|
|
26900
26961
|
if (e?.retryable || e?.details?.retryable) {
|
|
26901
26962
|
return true;
|
|
26902
26963
|
}
|
|
@@ -26940,7 +27001,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26940
27001
|
client: {
|
|
26941
27002
|
id: "gateway-client",
|
|
26942
27003
|
displayName: "okx-a2a-node",
|
|
26943
|
-
version: "0.2.
|
|
27004
|
+
version: "0.2.16",
|
|
26944
27005
|
platform: "node",
|
|
26945
27006
|
mode: "backend",
|
|
26946
27007
|
instanceId
|
|
@@ -26951,7 +27012,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26951
27012
|
commands: [],
|
|
26952
27013
|
permissions: {},
|
|
26953
27014
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
26954
|
-
userAgent: `okx-a2a-node/${"0.2.
|
|
27015
|
+
userAgent: `okx-a2a-node/${"0.2.16"}`,
|
|
26955
27016
|
auth: {
|
|
26956
27017
|
...config.token ? { token: config.token } : {},
|
|
26957
27018
|
...config.password ? { password: config.password } : {}
|
|
@@ -27646,7 +27707,7 @@ function readSingleActiveOriginSessionKey(env) {
|
|
|
27646
27707
|
}
|
|
27647
27708
|
}
|
|
27648
27709
|
function resolveTaskHome2(env) {
|
|
27649
|
-
return env.OKX_AGENT_TASK_HOME?.trim() || (0, import_node_path16.join)((0,
|
|
27710
|
+
return env.OKX_AGENT_TASK_HOME?.trim() || (0, import_node_path16.join)((0, import_node_os5.homedir)(), ".okx-agent-task");
|
|
27650
27711
|
}
|
|
27651
27712
|
function logOpenClawRouteSkip(reason, input) {
|
|
27652
27713
|
if (reason === "missing_gateway_session_key") {
|
|
@@ -27687,12 +27748,12 @@ function safeDecode2(value) {
|
|
|
27687
27748
|
return value;
|
|
27688
27749
|
}
|
|
27689
27750
|
}
|
|
27690
|
-
var import_node_fs12,
|
|
27751
|
+
var import_node_fs12, import_node_os5, import_node_path16, CURRENT_GATEWAY_SESSION_KEYS_ENV, NON_DELIVERY_CHANNELS, ACTIVE_ORIGIN_TTL_MS;
|
|
27691
27752
|
var init_openclaw_route = __esm({
|
|
27692
27753
|
"src/openclaw-route.ts"() {
|
|
27693
27754
|
"use strict";
|
|
27694
27755
|
import_node_fs12 = require("node:fs");
|
|
27695
|
-
|
|
27756
|
+
import_node_os5 = require("node:os");
|
|
27696
27757
|
import_node_path16 = require("node:path");
|
|
27697
27758
|
CURRENT_GATEWAY_SESSION_KEYS_ENV = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
27698
27759
|
NON_DELIVERY_CHANNELS = /* @__PURE__ */ new Set(["heartbeat", "cron", "webhook", "voice"]);
|
|
@@ -27990,6 +28051,7 @@ var init_outbound_behavior = __esm({
|
|
|
27990
28051
|
const sendResult = await this.gateway.callSessionsSend({
|
|
27991
28052
|
key: gatewaySessionKey,
|
|
27992
28053
|
message: input.content,
|
|
28054
|
+
restoreArchived: true,
|
|
27993
28055
|
...input.messageId ? { idempotencyKey: input.messageId } : {}
|
|
27994
28056
|
});
|
|
27995
28057
|
errorWithTimestamp(
|
|
@@ -29010,7 +29072,7 @@ var init_sentry_config = __esm({
|
|
|
29010
29072
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
29011
29073
|
SENTRY_CONFIG = {
|
|
29012
29074
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
29013
|
-
release: "0.2.
|
|
29075
|
+
release: "0.2.16",
|
|
29014
29076
|
environment,
|
|
29015
29077
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
29016
29078
|
};
|
|
@@ -39647,7 +39709,7 @@ function providerConfigCandidates(provider, taskHome2) {
|
|
|
39647
39709
|
if (provider === "codex") {
|
|
39648
39710
|
return [
|
|
39649
39711
|
{
|
|
39650
|
-
path: (0, import_node_path21.join)(process.env.CODEX_HOME ?? (0, import_node_path21.join)((0,
|
|
39712
|
+
path: (0, import_node_path21.join)(process.env.CODEX_HOME ?? (0, import_node_path21.join)((0, import_node_os6.homedir)(), ".codex"), "config.toml"),
|
|
39651
39713
|
archiveName: "config.redacted.toml"
|
|
39652
39714
|
}
|
|
39653
39715
|
];
|
|
@@ -39655,7 +39717,7 @@ function providerConfigCandidates(provider, taskHome2) {
|
|
|
39655
39717
|
if (provider === "claude") {
|
|
39656
39718
|
return [
|
|
39657
39719
|
{
|
|
39658
|
-
path: (0, import_node_path21.join)((0,
|
|
39720
|
+
path: (0, import_node_path21.join)((0, import_node_os6.homedir)(), ".claude", "settings.json"),
|
|
39659
39721
|
archiveName: "settings.redacted.json"
|
|
39660
39722
|
},
|
|
39661
39723
|
{
|
|
@@ -39686,10 +39748,10 @@ function providerConfigCandidates(provider, taskHome2) {
|
|
|
39686
39748
|
}
|
|
39687
39749
|
function resolveOpenClawStateDir() {
|
|
39688
39750
|
const configured = process.env.OPENCLAW_STATE_DIR?.trim() || process.env.OPENCLAW_HOME?.trim();
|
|
39689
|
-
return (0, import_node_path21.resolve)(configured || (0, import_node_path21.join)((0,
|
|
39751
|
+
return (0, import_node_path21.resolve)(configured || (0, import_node_path21.join)((0, import_node_os6.homedir)(), ".openclaw"));
|
|
39690
39752
|
}
|
|
39691
39753
|
function resolveHermesHome() {
|
|
39692
|
-
return (0, import_node_path21.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path21.join)((0,
|
|
39754
|
+
return (0, import_node_path21.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path21.join)((0, import_node_os6.homedir)(), ".hermes"));
|
|
39693
39755
|
}
|
|
39694
39756
|
function providerEnvironment(provider) {
|
|
39695
39757
|
const prefixes = provider === "codex" ? ["OKX_A2A_AI_CODEX_", "CODEX_"] : provider === "claude" ? ["OKX_A2A_AI_CLAUDE_", "ANTHROPIC_MODEL", "CLAUDE_"] : provider === "openclaw" ? ["OPENCLAW_", "OKX_A2A_OPENCLAW_"] : ["HERMES_", "OKX_A2A_HERMES_"];
|
|
@@ -39734,12 +39796,12 @@ function probeVersion(command) {
|
|
|
39734
39796
|
function isProvider2(value) {
|
|
39735
39797
|
return typeof value === "string" && PROVIDERS2.includes(value);
|
|
39736
39798
|
}
|
|
39737
|
-
var import_node_child_process6,
|
|
39799
|
+
var import_node_child_process6, import_node_os6, import_node_path21, PROVIDERS2;
|
|
39738
39800
|
var init_logs_export_provider = __esm({
|
|
39739
39801
|
"src/logs-export-provider.ts"() {
|
|
39740
39802
|
"use strict";
|
|
39741
39803
|
import_node_child_process6 = require("node:child_process");
|
|
39742
|
-
|
|
39804
|
+
import_node_os6 = require("node:os");
|
|
39743
39805
|
import_node_path21 = require("node:path");
|
|
39744
39806
|
init_logs_export_filter();
|
|
39745
39807
|
PROVIDERS2 = ["codex", "claude", "openclaw", "hermes"];
|
|
@@ -40180,7 +40242,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
40180
40242
|
node: process.version,
|
|
40181
40243
|
platform: process.platform,
|
|
40182
40244
|
arch: process.arch,
|
|
40183
|
-
packageVersion: true ? "0.2.
|
|
40245
|
+
packageVersion: true ? "0.2.16" : "unknown",
|
|
40184
40246
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
40185
40247
|
listenerAndLlmContentIncluded: true,
|
|
40186
40248
|
credentialsAlwaysRedacted: true,
|
|
@@ -40521,7 +40583,7 @@ async function collectCommands(state, paths, options) {
|
|
|
40521
40583
|
}
|
|
40522
40584
|
async function collectOnchainAudit(state, options, correlationIds) {
|
|
40523
40585
|
await runCollector(state, "onchainos-audit", async () => {
|
|
40524
|
-
const onchainHome = process.env.ONCHAINOS_HOME?.trim() ? (0, import_node_path23.resolve)(process.env.ONCHAINOS_HOME) : (0, import_node_path23.join)((0,
|
|
40586
|
+
const onchainHome = process.env.ONCHAINOS_HOME?.trim() ? (0, import_node_path23.resolve)(process.env.ONCHAINOS_HOME) : (0, import_node_path23.join)((0, import_node_os7.homedir)(), ".onchainos");
|
|
40525
40587
|
const auditPath = (0, import_node_path23.join)(onchainHome, "audit.jsonl");
|
|
40526
40588
|
const output5 = await readFilteredLog(
|
|
40527
40589
|
auditPath,
|
|
@@ -41038,14 +41100,14 @@ function readOption(args, name) {
|
|
|
41038
41100
|
const index2 = args.indexOf(name);
|
|
41039
41101
|
return index2 === -1 ? void 0 : args[index2 + 1];
|
|
41040
41102
|
}
|
|
41041
|
-
var import_node_child_process7, import_node_fs19, import_promises11,
|
|
41103
|
+
var import_node_child_process7, import_node_fs19, import_promises11, import_node_os7, import_node_path23, import_jszip, DEFAULT_MAX_SIZE_MB, MAX_HERMES_ROTATED_LOG_FILES, MAX_OPENCLAW_AGENTS, MAX_OPENCLAW_SESSION_FILES, ISO_TIMESTAMP_WITH_ZONE;
|
|
41042
41104
|
var init_logs_export = __esm({
|
|
41043
41105
|
"src/logs-export.ts"() {
|
|
41044
41106
|
"use strict";
|
|
41045
41107
|
import_node_child_process7 = require("node:child_process");
|
|
41046
41108
|
import_node_fs19 = require("node:fs");
|
|
41047
41109
|
import_promises11 = require("node:fs/promises");
|
|
41048
|
-
|
|
41110
|
+
import_node_os7 = require("node:os");
|
|
41049
41111
|
import_node_path23 = require("node:path");
|
|
41050
41112
|
import_jszip = __toESM(require_lib3());
|
|
41051
41113
|
init_logs_export_archive();
|
|
@@ -63207,10 +63269,10 @@ function readCodexAddDirs(env = process.env) {
|
|
|
63207
63269
|
}
|
|
63208
63270
|
function expandHomePath(value) {
|
|
63209
63271
|
if (value === "~") {
|
|
63210
|
-
return (0,
|
|
63272
|
+
return (0, import_node_os8.homedir)();
|
|
63211
63273
|
}
|
|
63212
63274
|
if (value.startsWith("~/")) {
|
|
63213
|
-
return (0, import_node_path30.join)((0,
|
|
63275
|
+
return (0, import_node_path30.join)((0, import_node_os8.homedir)(), value.slice(2));
|
|
63214
63276
|
}
|
|
63215
63277
|
return value;
|
|
63216
63278
|
}
|
|
@@ -63427,7 +63489,7 @@ function formatOpenClawSessionKey(sessionKey, agentId) {
|
|
|
63427
63489
|
function buildClaudeAddDirArgs(homeDir, env) {
|
|
63428
63490
|
const dirs = [
|
|
63429
63491
|
homeDir,
|
|
63430
|
-
(0, import_node_path30.join)((0,
|
|
63492
|
+
(0, import_node_path30.join)((0, import_node_os8.homedir)(), ".agents"),
|
|
63431
63493
|
(0, import_node_path30.join)(__dirname, ".."),
|
|
63432
63494
|
...env.OKX_A2A_AI_CLAUDE_ADD_DIRS ? env.OKX_A2A_AI_CLAUDE_ADD_DIRS.split(import_node_path30.delimiter).filter(Boolean) : []
|
|
63433
63495
|
];
|
|
@@ -63484,12 +63546,12 @@ function applyArgTemplate(template, options) {
|
|
|
63484
63546
|
return arg.replaceAll("{prompt}", options.prompt).replaceAll("{sessionId}", options.sessionId ?? "").replaceAll("{homeDir}", homeDir).replaceAll("{cwd}", cwd).replaceAll("{repoCli}", (0, import_node_path30.join)(__dirname, "cli.js"));
|
|
63485
63547
|
});
|
|
63486
63548
|
}
|
|
63487
|
-
var
|
|
63549
|
+
var import_node_os8, import_node_path30, CLAUDE_ALLOWED_TOOLS, CLAUDE_PERMISSION_MODES, CODEX_SANDBOX_MODES, CODEX_APPROVAL_POLICIES;
|
|
63488
63550
|
var init_ai_adapter = __esm({
|
|
63489
63551
|
"src/ai-adapter.ts"() {
|
|
63490
63552
|
"use strict";
|
|
63491
63553
|
init_log();
|
|
63492
|
-
|
|
63554
|
+
import_node_os8 = require("node:os");
|
|
63493
63555
|
import_node_path30 = require("node:path");
|
|
63494
63556
|
init_ai_command();
|
|
63495
63557
|
init_paths();
|
|
@@ -63970,7 +64032,7 @@ function extractDeniedFilesystemPath(text) {
|
|
|
63970
64032
|
}
|
|
63971
64033
|
function getPreferredCodexWritableRoot(target) {
|
|
63972
64034
|
const expanded = expandHomePath2(target);
|
|
63973
|
-
const home = (0,
|
|
64035
|
+
const home = (0, import_node_os9.homedir)();
|
|
63974
64036
|
const appRoots = [
|
|
63975
64037
|
(0, import_node_path31.join)(home, ".onchainos", "task"),
|
|
63976
64038
|
(0, import_node_path31.join)(home, ".onchainos", "deliverables"),
|
|
@@ -63989,16 +64051,16 @@ function inferAppOwnedCodexWritableRoot(failure) {
|
|
|
63989
64051
|
return void 0;
|
|
63990
64052
|
}
|
|
63991
64053
|
if (containsOnchainosCommand(command) && /\b0x[0-9a-fA-F]{16,}\b/.test(command)) {
|
|
63992
|
-
return (0, import_node_path31.join)((0,
|
|
64054
|
+
return (0, import_node_path31.join)((0, import_node_os9.homedir)(), ".onchainos", "task");
|
|
63993
64055
|
}
|
|
63994
64056
|
return void 0;
|
|
63995
64057
|
}
|
|
63996
64058
|
function expandHomePath2(value) {
|
|
63997
64059
|
if (value === "~") {
|
|
63998
|
-
return (0,
|
|
64060
|
+
return (0, import_node_os9.homedir)();
|
|
63999
64061
|
}
|
|
64000
64062
|
if (value.startsWith("~/")) {
|
|
64001
|
-
return (0, import_node_path31.join)((0,
|
|
64063
|
+
return (0, import_node_path31.join)((0, import_node_os9.homedir)(), value.slice(2));
|
|
64002
64064
|
}
|
|
64003
64065
|
return value;
|
|
64004
64066
|
}
|
|
@@ -64983,7 +65045,7 @@ function shortenJobId2(jobId) {
|
|
|
64983
65045
|
}
|
|
64984
65046
|
return `${jobId.slice(0, 6)}\u2026${jobId.slice(-4)}`;
|
|
64985
65047
|
}
|
|
64986
|
-
var import_node_crypto13, import_node_fs26, import_promises12,
|
|
65048
|
+
var import_node_crypto13, import_node_fs26, import_promises12, import_node_os9, import_node_path31, AiRunner, CODEX_TOOL_FAILURE_MARKER;
|
|
64987
65049
|
var init_ai_runner = __esm({
|
|
64988
65050
|
"src/ai-runner.ts"() {
|
|
64989
65051
|
"use strict";
|
|
@@ -64991,7 +65053,7 @@ var init_ai_runner = __esm({
|
|
|
64991
65053
|
import_node_crypto13 = require("node:crypto");
|
|
64992
65054
|
import_node_fs26 = require("node:fs");
|
|
64993
65055
|
import_promises12 = require("node:fs/promises");
|
|
64994
|
-
|
|
65056
|
+
import_node_os9 = require("node:os");
|
|
64995
65057
|
import_node_path31 = require("node:path");
|
|
64996
65058
|
init_ai_command();
|
|
64997
65059
|
init_paths();
|
|
@@ -65781,7 +65843,7 @@ var init_ai_runner = __esm({
|
|
|
65781
65843
|
process.env.OKX_AGENT_TASK_AI_CWD,
|
|
65782
65844
|
this.sessionStore.getSetting("ai_working_dir"),
|
|
65783
65845
|
safeProcessCwd(),
|
|
65784
|
-
(0,
|
|
65846
|
+
(0, import_node_os9.homedir)(),
|
|
65785
65847
|
this.homeDir
|
|
65786
65848
|
];
|
|
65787
65849
|
return candidates.find((candidate) => !!candidate && isDirectory(candidate)) ?? this.homeDir;
|
|
@@ -69449,7 +69511,7 @@ async function isGatewayAvailableForHeartbeat(options) {
|
|
|
69449
69511
|
}
|
|
69450
69512
|
async function getHermesGatewayPluginStatus(options = {}) {
|
|
69451
69513
|
const env = options.env ?? process.env;
|
|
69452
|
-
const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path32.join)((0,
|
|
69514
|
+
const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path32.join)((0, import_node_os10.homedir)(), ".hermes");
|
|
69453
69515
|
const pluginYamlPath = (0, import_node_path32.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
69454
69516
|
if (!(0, import_node_fs27.existsSync)(pluginYamlPath)) {
|
|
69455
69517
|
return { enabled: false, reason: "plugin_yaml_missing", hermesHome, checkedPath: pluginYamlPath };
|
|
@@ -69564,14 +69626,14 @@ async function runListener(options = {}) {
|
|
|
69564
69626
|
const evictedPid = await claimActiveDaemon(paths.homeDir);
|
|
69565
69627
|
if (evictedPid !== null) {
|
|
69566
69628
|
logWithTimestamp(
|
|
69567
|
-
`[okx-agent-task] stopped previous daemon pid=${evictedPid}
|
|
69629
|
+
`[okx-agent-task] stopped previous daemon pid=${evictedPid} for home=${paths.homeDir} (single-daemon-per-task-home policy)`
|
|
69568
69630
|
);
|
|
69569
69631
|
}
|
|
69570
69632
|
try {
|
|
69571
69633
|
await runListenerWithLock(options, paths);
|
|
69572
69634
|
} finally {
|
|
69573
69635
|
await daemonLock.release();
|
|
69574
|
-
await releaseActiveDaemon();
|
|
69636
|
+
await releaseActiveDaemon(paths.homeDir);
|
|
69575
69637
|
}
|
|
69576
69638
|
}
|
|
69577
69639
|
async function runListenerWithLock(options, paths) {
|
|
@@ -69686,12 +69748,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
69686
69748
|
});
|
|
69687
69749
|
}
|
|
69688
69750
|
});
|
|
69689
|
-
service.setPluginVersion("0.2.
|
|
69751
|
+
service.setPluginVersion("0.2.16");
|
|
69690
69752
|
await service.init();
|
|
69691
69753
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
69692
69754
|
if (pluginVersionStatus.unavailable) {
|
|
69693
69755
|
throw new Error(
|
|
69694
|
-
`@okxweb3/a2a-node v${"0.2.
|
|
69756
|
+
`@okxweb3/a2a-node v${"0.2.16"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
69695
69757
|
);
|
|
69696
69758
|
}
|
|
69697
69759
|
const systemConfig = service.getSystemConfig();
|
|
@@ -69719,7 +69781,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
69719
69781
|
onchainosAgentId: "*",
|
|
69720
69782
|
reason: "system-config missing sentryDsn",
|
|
69721
69783
|
pluginId: "@okxweb3/a2a-node",
|
|
69722
|
-
pluginVersion: "0.2.
|
|
69784
|
+
pluginVersion: "0.2.16"
|
|
69723
69785
|
});
|
|
69724
69786
|
}
|
|
69725
69787
|
logWithTimestamp(
|
|
@@ -70069,14 +70131,14 @@ async function timeSettled(fn) {
|
|
|
70069
70131
|
return { durationMs: Date.now() - startedAt, error };
|
|
70070
70132
|
}
|
|
70071
70133
|
}
|
|
70072
|
-
var import_node_fs27, import_promises13,
|
|
70134
|
+
var import_node_fs27, import_promises13, import_node_os10, import_node_path32, DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC, DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC, XMTP_CLIENT_RECYCLE_INTERVAL_ENV, HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS, AUTH_RECOVERY_PROBE_INTERVAL_MS, AUTH_RECOVERY_REFRESH_BACKOFF_MS, AgentRefreshAuthGate, AgentRefreshCoordinator, ListenerDeferredTaskScheduler, ListenerMaintenanceGate, UPGRADE_RECOMMENDATION_IDEMPOTENCY_KEY, SHUTDOWN_FORCE_RESOLVE_MS;
|
|
70073
70135
|
var init_listener = __esm({
|
|
70074
70136
|
"src/listener.ts"() {
|
|
70075
70137
|
"use strict";
|
|
70076
70138
|
init_log();
|
|
70077
70139
|
import_node_fs27 = require("node:fs");
|
|
70078
70140
|
import_promises13 = require("node:fs/promises");
|
|
70079
|
-
|
|
70141
|
+
import_node_os10 = require("node:os");
|
|
70080
70142
|
import_node_path32 = require("node:path");
|
|
70081
70143
|
init_onchainos();
|
|
70082
70144
|
init_system_config();
|
|
@@ -114163,7 +114225,7 @@ function getUnsafeFileUploadReason(filePath, sensitiveUploadReg = []) {
|
|
|
114163
114225
|
if (configuredRule) {
|
|
114164
114226
|
return `SENSITIVE_UPLOAD_REG:${configuredRule}`;
|
|
114165
114227
|
}
|
|
114166
|
-
const home = safeRealpath((0,
|
|
114228
|
+
const home = safeRealpath((0, import_node_os11.homedir)());
|
|
114167
114229
|
if (!home) {
|
|
114168
114230
|
return null;
|
|
114169
114231
|
}
|
|
@@ -114200,10 +114262,10 @@ function matchSensitiveUploadReg(paths, patterns) {
|
|
|
114200
114262
|
}
|
|
114201
114263
|
function expandHome(filePath) {
|
|
114202
114264
|
if (filePath === "~") {
|
|
114203
|
-
return (0,
|
|
114265
|
+
return (0, import_node_os11.homedir)();
|
|
114204
114266
|
}
|
|
114205
114267
|
if (filePath.startsWith(`~${import_node_path34.sep}`)) {
|
|
114206
|
-
return (0, import_node_path34.join)((0,
|
|
114268
|
+
return (0, import_node_path34.join)((0, import_node_os11.homedir)(), filePath.slice(2));
|
|
114207
114269
|
}
|
|
114208
114270
|
return filePath;
|
|
114209
114271
|
}
|
|
@@ -114216,12 +114278,12 @@ function safeRealpath(path2) {
|
|
|
114216
114278
|
function isPathInside(target, dir) {
|
|
114217
114279
|
return target === dir || target.startsWith(`${dir}${import_node_path34.sep}`);
|
|
114218
114280
|
}
|
|
114219
|
-
var import_node_fs28,
|
|
114281
|
+
var import_node_fs28, import_node_os11, import_node_path34, SENSITIVE_HOME_DIRS, SENSITIVE_HOME_FILES, UNSAFE_FILE_UPLOAD_MESSAGE;
|
|
114220
114282
|
var init_file_upload_safety = __esm({
|
|
114221
114283
|
"../core/src/file-upload-safety.ts"() {
|
|
114222
114284
|
"use strict";
|
|
114223
114285
|
import_node_fs28 = require("node:fs");
|
|
114224
|
-
|
|
114286
|
+
import_node_os11 = require("node:os");
|
|
114225
114287
|
import_node_path34 = require("node:path");
|
|
114226
114288
|
SENSITIVE_HOME_DIRS = [
|
|
114227
114289
|
".ssh",
|
|
@@ -117218,7 +117280,7 @@ async function installWindowsNativeLauncher(options) {
|
|
|
117218
117280
|
}
|
|
117219
117281
|
const exePath = (0, import_node_path36.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
|
|
117220
117282
|
(0, import_node_fs30.mkdirSync)(options.targetDir, { recursive: true });
|
|
117221
|
-
const work = (0, import_node_fs30.mkdtempSync)((0, import_node_path36.join)((0,
|
|
117283
|
+
const work = (0, import_node_fs30.mkdtempSync)((0, import_node_path36.join)((0, import_node_os12.tmpdir)(), "okx-a2a-sea-"));
|
|
117222
117284
|
try {
|
|
117223
117285
|
const entryPath = (0, import_node_path36.join)(work, "launcher-entry.js");
|
|
117224
117286
|
const blobPath = (0, import_node_path36.join)(work, "okx-a2a.blob");
|
|
@@ -117292,18 +117354,18 @@ async function ensureWindowsNativeLauncher(options = {}) {
|
|
|
117292
117354
|
if (existing) {
|
|
117293
117355
|
return { exePath: existing, installed: false };
|
|
117294
117356
|
}
|
|
117295
|
-
const targetDir = env.APPDATA ? (0, import_node_path36.join)(env.APPDATA, "npm") : (0, import_node_path36.join)(env.USERPROFILE ?? (0,
|
|
117357
|
+
const targetDir = env.APPDATA ? (0, import_node_path36.join)(env.APPDATA, "npm") : (0, import_node_path36.join)(env.USERPROFILE ?? (0, import_node_os12.homedir)(), ".local", "bin");
|
|
117296
117358
|
const result = await installWindowsNativeLauncher({ cliPath: resolveRunningCliPath(), targetDir });
|
|
117297
117359
|
return { exePath: result.exePath, installed: true };
|
|
117298
117360
|
}
|
|
117299
|
-
var import_node_child_process9, import_node_fs30, import_node_module,
|
|
117361
|
+
var import_node_child_process9, import_node_fs30, import_node_module, import_node_os12, import_node_path36, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
|
|
117300
117362
|
var init_win_native_launcher = __esm({
|
|
117301
117363
|
"src/win-native-launcher.ts"() {
|
|
117302
117364
|
"use strict";
|
|
117303
117365
|
import_node_child_process9 = require("node:child_process");
|
|
117304
117366
|
import_node_fs30 = require("node:fs");
|
|
117305
117367
|
import_node_module = require("node:module");
|
|
117306
|
-
|
|
117368
|
+
import_node_os12 = require("node:os");
|
|
117307
117369
|
import_node_path36 = require("node:path");
|
|
117308
117370
|
init_win_compat();
|
|
117309
117371
|
init_win_spawn();
|
|
@@ -118061,7 +118123,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
118061
118123
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
118062
118124
|
}
|
|
118063
118125
|
function getBundledNodeCliVersion() {
|
|
118064
|
-
return true ? "0.2.
|
|
118126
|
+
return true ? "0.2.16" : null;
|
|
118065
118127
|
}
|
|
118066
118128
|
function readConfiguredAiProvider() {
|
|
118067
118129
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -118246,7 +118308,7 @@ async function updateHermes(release, options) {
|
|
|
118246
118308
|
assertNotRunningInsideGateway("hermes");
|
|
118247
118309
|
}
|
|
118248
118310
|
const spec = buildNpmPackageSpec("hermes", release);
|
|
118249
|
-
const workDir = await (0, import_promises15.mkdtemp)((0, import_node_path37.join)((0,
|
|
118311
|
+
const workDir = await (0, import_promises15.mkdtemp)((0, import_node_path37.join)((0, import_node_os13.tmpdir)(), `okx-a2a-${label}-hermes-`));
|
|
118250
118312
|
try {
|
|
118251
118313
|
console.log(`[${label}] downloading ${spec}`);
|
|
118252
118314
|
const npmTarball = await npmPack(spec, workDir);
|
|
@@ -118271,7 +118333,7 @@ async function updateHermes(release, options) {
|
|
|
118271
118333
|
}
|
|
118272
118334
|
}
|
|
118273
118335
|
async function installGatewayPluginForDoctor(target) {
|
|
118274
|
-
const release = isPrereleaseVersion("0.2.
|
|
118336
|
+
const release = isPrereleaseVersion("0.2.16") ? "beta" : "latest";
|
|
118275
118337
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
118276
118338
|
const options = {
|
|
118277
118339
|
restart: !insideTargetGateway,
|
|
@@ -118562,7 +118624,7 @@ function findFirstEnabledListItem(lines, startIndex, enabledIndent) {
|
|
|
118562
118624
|
return null;
|
|
118563
118625
|
}
|
|
118564
118626
|
function resolveHermesConfigPath() {
|
|
118565
|
-
return (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0,
|
|
118627
|
+
return (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0, import_node_os13.homedir)(), ".hermes"), "config.yaml");
|
|
118566
118628
|
}
|
|
118567
118629
|
function lineIndent(line) {
|
|
118568
118630
|
const match = line.match(/^\s*/);
|
|
@@ -118640,7 +118702,7 @@ async function assertGatewayPluginInstalled(target) {
|
|
|
118640
118702
|
);
|
|
118641
118703
|
}
|
|
118642
118704
|
function resolveHermesPluginYamlPath() {
|
|
118643
|
-
return (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0,
|
|
118705
|
+
return (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0, import_node_os13.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
118644
118706
|
}
|
|
118645
118707
|
async function isGatewayPluginInstalled(target) {
|
|
118646
118708
|
if (target === "openclaw") {
|
|
@@ -118733,7 +118795,7 @@ function parsePackageVersionFromText(output5) {
|
|
|
118733
118795
|
return output5.match(/@okxweb3\/a2a-openclaw@([0-9A-Za-z.+-]+)/)?.[1] ?? null;
|
|
118734
118796
|
}
|
|
118735
118797
|
async function getInstalledHermesPluginVersion() {
|
|
118736
|
-
const pluginYaml = (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0,
|
|
118798
|
+
const pluginYaml = (0, import_node_path37.join)(process.env.HERMES_HOME ?? (0, import_node_path37.join)((0, import_node_os13.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
118737
118799
|
try {
|
|
118738
118800
|
const content2 = await (0, import_promises15.readFile)(pluginYaml, "utf8");
|
|
118739
118801
|
return parsePluginYamlVersion(content2);
|
|
@@ -119028,14 +119090,14 @@ function buildExternalCommandInvocation(command, args, platform = process.platfo
|
|
|
119028
119090
|
function formatExternalCommand(command, args) {
|
|
119029
119091
|
return [command, ...args].join(" ");
|
|
119030
119092
|
}
|
|
119031
|
-
var import_node_child_process10, import_node_fs31, import_promises15,
|
|
119093
|
+
var import_node_child_process10, import_node_fs31, import_promises15, import_node_os13, import_node_path37, 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, PROVIDER_CLI_AUTH_PROBE_TIMEOUT_MS, SetupBlockedError, redirectCommandStdoutToStderr;
|
|
119032
119094
|
var init_update_cli = __esm({
|
|
119033
119095
|
"src/update-cli.ts"() {
|
|
119034
119096
|
"use strict";
|
|
119035
119097
|
import_node_child_process10 = require("node:child_process");
|
|
119036
119098
|
import_node_fs31 = require("node:fs");
|
|
119037
119099
|
import_promises15 = require("node:fs/promises");
|
|
119038
|
-
|
|
119100
|
+
import_node_os13 = require("node:os");
|
|
119039
119101
|
import_node_path37 = require("node:path");
|
|
119040
119102
|
init_ai_command();
|
|
119041
119103
|
init_win_spawn();
|
|
@@ -119324,7 +119386,7 @@ async function runDoctor(options = {}) {
|
|
|
119324
119386
|
platform: options.platform ?? process.platform,
|
|
119325
119387
|
env: options.env ?? process.env,
|
|
119326
119388
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
119327
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.
|
|
119389
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.16" : "0.0.0"),
|
|
119328
119390
|
fixMode: options.fix === true,
|
|
119329
119391
|
nonInteractive: options.nonInteractive === true,
|
|
119330
119392
|
packageChanged: false,
|
|
@@ -120362,7 +120424,7 @@ var init_doctor_cli = __esm({
|
|
|
120362
120424
|
|
|
120363
120425
|
// src/cli.ts
|
|
120364
120426
|
var import_node_fs32 = require("node:fs");
|
|
120365
|
-
var
|
|
120427
|
+
var import_node_os14 = require("node:os");
|
|
120366
120428
|
var import_node_path39 = require("node:path");
|
|
120367
120429
|
init_daemon();
|
|
120368
120430
|
init_command_store();
|
|
@@ -120431,7 +120493,7 @@ init_sentry_config();
|
|
|
120431
120493
|
init_runtime_metadata();
|
|
120432
120494
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
120433
120495
|
function printUsage3() {
|
|
120434
|
-
console.log(`okx-a2a ${"0.2.
|
|
120496
|
+
console.log(`okx-a2a ${"0.2.16"}
|
|
120435
120497
|
|
|
120436
120498
|
Usage:
|
|
120437
120499
|
okx-a2a <command> [options]
|
|
@@ -120473,7 +120535,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
120473
120535
|
`);
|
|
120474
120536
|
}
|
|
120475
120537
|
function printVersion() {
|
|
120476
|
-
console.log("0.2.
|
|
120538
|
+
console.log("0.2.16");
|
|
120477
120539
|
}
|
|
120478
120540
|
function printDaemonUsage() {
|
|
120479
120541
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -120489,6 +120551,11 @@ Commands:
|
|
|
120489
120551
|
Print writer process status
|
|
120490
120552
|
daemon autostart <install|uninstall|status>
|
|
120491
120553
|
Manage OS autostart for okx-a2a run
|
|
120554
|
+
|
|
120555
|
+
Note: OKX_AGENT_TASK_HOME isolates each task home's local daemon state (pid, lock,
|
|
120556
|
+
logs, sqlite, xmtp) so daemons under different task homes run concurrently.
|
|
120557
|
+
This is LOCAL-STATE isolation only \u2014 it does not make it safe to run two
|
|
120558
|
+
daemons for the same real agent; use isolated test accounts/agents for that.
|
|
120492
120559
|
`);
|
|
120493
120560
|
}
|
|
120494
120561
|
function printLogsUsage() {
|
|
@@ -121844,7 +121911,7 @@ function resolveTaskHomeForSentryConfig() {
|
|
|
121844
121911
|
return process.env.OKX_AGENT_TASK_HOME;
|
|
121845
121912
|
}
|
|
121846
121913
|
try {
|
|
121847
|
-
const home = (0,
|
|
121914
|
+
const home = (0, import_node_os14.homedir)();
|
|
121848
121915
|
if (home) {
|
|
121849
121916
|
return (0, import_node_path39.join)(home, ".okx-agent-task");
|
|
121850
121917
|
}
|
|
@@ -121963,7 +122030,7 @@ async function main() {
|
|
|
121963
122030
|
if (command === "xmtp-test") {
|
|
121964
122031
|
const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
|
|
121965
122032
|
await handleXmtpTestCommand2(process.argv.slice(3), {
|
|
121966
|
-
packageVersion: "0.2.
|
|
122033
|
+
packageVersion: "0.2.16",
|
|
121967
122034
|
agentSdkVersion: "2.3.0",
|
|
121968
122035
|
nodeSdkVersion: "6.1.0",
|
|
121969
122036
|
nodeBindingsVersion: "1.11.0"
|