@okxweb3/a2a-node 0.0.17-beta-db5dca184d-260624230509 → 0.0.17
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 +39 -92
- package/dist/index.js +77 -88
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7551,7 +7551,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7551
7551
|
client: {
|
|
7552
7552
|
id: "gateway-client",
|
|
7553
7553
|
displayName: "okx-a2a-node",
|
|
7554
|
-
version: "0.0.17
|
|
7554
|
+
version: "0.0.17",
|
|
7555
7555
|
platform: "node",
|
|
7556
7556
|
mode: "backend",
|
|
7557
7557
|
instanceId
|
|
@@ -7562,7 +7562,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7562
7562
|
commands: [],
|
|
7563
7563
|
permissions: {},
|
|
7564
7564
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
7565
|
-
userAgent: `okx-a2a-node/${"0.0.17
|
|
7565
|
+
userAgent: `okx-a2a-node/${"0.0.17"}`,
|
|
7566
7566
|
auth: {
|
|
7567
7567
|
...config.token ? { token: config.token } : {},
|
|
7568
7568
|
...config.password ? { password: config.password } : {}
|
|
@@ -10119,7 +10119,7 @@ var require_path = __commonJS({
|
|
|
10119
10119
|
function join23(...args) {
|
|
10120
10120
|
return normalizePath(args.join("/"));
|
|
10121
10121
|
}
|
|
10122
|
-
function
|
|
10122
|
+
function dirname6(path) {
|
|
10123
10123
|
const result = splitPath(path);
|
|
10124
10124
|
const root = result[0];
|
|
10125
10125
|
let dir = result[1];
|
|
@@ -10139,7 +10139,7 @@ var require_path = __commonJS({
|
|
|
10139
10139
|
return f;
|
|
10140
10140
|
}
|
|
10141
10141
|
exports2.basename = basename5;
|
|
10142
|
-
exports2.dirname =
|
|
10142
|
+
exports2.dirname = dirname6;
|
|
10143
10143
|
exports2.isAbsolute = isAbsolute2;
|
|
10144
10144
|
exports2.join = join23;
|
|
10145
10145
|
exports2.normalizePath = normalizePath;
|
|
@@ -24708,7 +24708,7 @@ var init_sentry_config = __esm({
|
|
|
24708
24708
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
24709
24709
|
SENTRY_CONFIG = {
|
|
24710
24710
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
24711
|
-
release: "0.0.17
|
|
24711
|
+
release: "0.0.17",
|
|
24712
24712
|
environment
|
|
24713
24713
|
};
|
|
24714
24714
|
}
|
|
@@ -92460,12 +92460,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
92460
92460
|
}));
|
|
92461
92461
|
}
|
|
92462
92462
|
});
|
|
92463
|
-
service.setPluginVersion("0.0.17
|
|
92463
|
+
service.setPluginVersion("0.0.17");
|
|
92464
92464
|
await service.init();
|
|
92465
92465
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
92466
92466
|
if (pluginVersionStatus.unavailable) {
|
|
92467
92467
|
throw new Error(
|
|
92468
|
-
`@okxweb3/a2a-node v${"0.0.17
|
|
92468
|
+
`@okxweb3/a2a-node v${"0.0.17"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
92469
92469
|
);
|
|
92470
92470
|
}
|
|
92471
92471
|
const systemConfig = service.getSystemConfig();
|
|
@@ -92483,7 +92483,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
92483
92483
|
onchainosAgentId: "*",
|
|
92484
92484
|
reason: "system-config missing sentryDsn",
|
|
92485
92485
|
pluginId: "@okxweb3/a2a-node",
|
|
92486
|
-
pluginVersion: "0.0.17
|
|
92486
|
+
pluginVersion: "0.0.17"
|
|
92487
92487
|
});
|
|
92488
92488
|
}
|
|
92489
92489
|
logWithTimestamp(
|
|
@@ -95482,7 +95482,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
95482
95482
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
95483
95483
|
}
|
|
95484
95484
|
function getBundledNodeCliVersion() {
|
|
95485
|
-
return true ? "0.0.17
|
|
95485
|
+
return true ? "0.0.17" : null;
|
|
95486
95486
|
}
|
|
95487
95487
|
function readConfiguredAiProvider() {
|
|
95488
95488
|
const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
|
|
@@ -95564,91 +95564,45 @@ async function updateOpenClaw(release, options) {
|
|
|
95564
95564
|
}
|
|
95565
95565
|
console.log(`[${label}] openclaw ${label} done`);
|
|
95566
95566
|
}
|
|
95567
|
-
async function ensureOpenClawOkxA2aPluginConfig(
|
|
95567
|
+
async function ensureOpenClawOkxA2aPluginConfig() {
|
|
95568
95568
|
try {
|
|
95569
|
-
|
|
95570
|
-
|
|
95571
|
-
|
|
95572
|
-
|
|
95573
|
-
|
|
95574
|
-
|
|
95575
|
-
|
|
95576
|
-
|
|
95577
|
-
|
|
95578
|
-
`);
|
|
95579
|
-
console.log(`[update] added OpenClaw plugins.entries/allow okx-a2a config in ${configFile}`);
|
|
95580
|
-
return true;
|
|
95581
|
-
}
|
|
95582
|
-
throw error;
|
|
95569
|
+
const dmScope = await getOpenClawConfigValue(OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH);
|
|
95570
|
+
const allow = await getOpenClawConfigValue(OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH);
|
|
95571
|
+
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.found ? allow.value : void 0);
|
|
95572
|
+
const operations = [];
|
|
95573
|
+
if (dmScope.value !== OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE) {
|
|
95574
|
+
operations.push({ path: OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, value: OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE });
|
|
95575
|
+
}
|
|
95576
|
+
if (!allow.found || normalizedAllow.changed) {
|
|
95577
|
+
operations.push({ path: OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, value: normalizedAllow.value });
|
|
95583
95578
|
}
|
|
95584
|
-
|
|
95585
|
-
if (!normalized.changed) {
|
|
95579
|
+
if (operations.length === 0) {
|
|
95586
95580
|
return false;
|
|
95587
95581
|
}
|
|
95588
|
-
await (
|
|
95589
|
-
console.log(
|
|
95582
|
+
await runCommand("openclaw", ["config", "set", "--batch-json", JSON.stringify(operations)]);
|
|
95583
|
+
console.log("[update] normalized OpenClaw session.dmScope/plugins.allow okx-a2a config through openclaw config set");
|
|
95590
95584
|
return true;
|
|
95591
95585
|
} catch (error) {
|
|
95592
95586
|
const detail = error instanceof Error ? error.message : String(error);
|
|
95593
|
-
console.warn(`[update] skipped OpenClaw plugins.
|
|
95587
|
+
console.warn(`[update] skipped OpenClaw session.dmScope/plugins.allow okx-a2a config normalization through openclaw CLI: ${detail}`);
|
|
95594
95588
|
return false;
|
|
95595
95589
|
}
|
|
95596
95590
|
}
|
|
95597
|
-
function
|
|
95598
|
-
|
|
95591
|
+
async function getOpenClawConfigValue(path) {
|
|
95592
|
+
const result = await runCommandCaptureOptional("openclaw", ["config", "get", path, "--json"]);
|
|
95593
|
+
if (!result.ok) {
|
|
95594
|
+
return { found: false, value: void 0 };
|
|
95595
|
+
}
|
|
95599
95596
|
try {
|
|
95600
|
-
|
|
95597
|
+
return { found: true, value: JSON.parse(result.stdout) };
|
|
95601
95598
|
} catch (error) {
|
|
95602
95599
|
const detail = error instanceof Error ? error.message : String(error);
|
|
95603
|
-
throw new Error(`OpenClaw config ${
|
|
95604
|
-
}
|
|
95605
|
-
if (!isJsonRecord(parsed)) {
|
|
95606
|
-
throw new Error(`OpenClaw config ${configFile} must be a JSON object`);
|
|
95600
|
+
throw new Error(`OpenClaw config get ${path} returned invalid JSON: ${detail}`);
|
|
95607
95601
|
}
|
|
95608
|
-
const changed = normalizeOpenClawPluginConfigObject(parsed);
|
|
95609
|
-
return {
|
|
95610
|
-
content: `${JSON.stringify(parsed, null, 2)}
|
|
95611
|
-
`,
|
|
95612
|
-
changed
|
|
95613
|
-
};
|
|
95614
95602
|
}
|
|
95615
|
-
function
|
|
95616
|
-
let changed = false;
|
|
95617
|
-
let plugins;
|
|
95618
|
-
const currentPlugins = config.plugins;
|
|
95619
|
-
if (isJsonRecord(currentPlugins)) {
|
|
95620
|
-
plugins = currentPlugins;
|
|
95621
|
-
} else {
|
|
95622
|
-
plugins = {};
|
|
95623
|
-
config.plugins = plugins;
|
|
95624
|
-
changed = true;
|
|
95625
|
-
}
|
|
95626
|
-
let entries;
|
|
95627
|
-
const currentEntries = plugins.entries;
|
|
95628
|
-
if (isJsonRecord(currentEntries)) {
|
|
95629
|
-
entries = currentEntries;
|
|
95630
|
-
} else {
|
|
95631
|
-
entries = {};
|
|
95632
|
-
plugins.entries = entries;
|
|
95633
|
-
changed = true;
|
|
95634
|
-
}
|
|
95635
|
-
let entry;
|
|
95636
|
-
const currentEntry = entries[OKX_A2A_PLUGIN_ID];
|
|
95637
|
-
if (isJsonRecord(currentEntry)) {
|
|
95638
|
-
entry = currentEntry;
|
|
95639
|
-
} else {
|
|
95640
|
-
entry = {};
|
|
95641
|
-
entries[OKX_A2A_PLUGIN_ID] = entry;
|
|
95642
|
-
changed = true;
|
|
95643
|
-
}
|
|
95644
|
-
if (entry.enabled !== true) {
|
|
95645
|
-
entry.enabled = true;
|
|
95646
|
-
changed = true;
|
|
95647
|
-
}
|
|
95648
|
-
const allow = plugins.allow;
|
|
95603
|
+
function normalizeOpenClawPluginAllowValue(allow) {
|
|
95649
95604
|
if (!Array.isArray(allow)) {
|
|
95650
|
-
|
|
95651
|
-
return true;
|
|
95605
|
+
return { value: [OKX_A2A_PLUGIN_ID], changed: true };
|
|
95652
95606
|
}
|
|
95653
95607
|
const nextAllow = [];
|
|
95654
95608
|
let allowChanged = false;
|
|
@@ -95667,14 +95621,7 @@ function normalizeOpenClawPluginConfigObject(config) {
|
|
|
95667
95621
|
nextAllow.push(OKX_A2A_PLUGIN_ID);
|
|
95668
95622
|
allowChanged = true;
|
|
95669
95623
|
}
|
|
95670
|
-
|
|
95671
|
-
plugins.allow = nextAllow;
|
|
95672
|
-
changed = true;
|
|
95673
|
-
}
|
|
95674
|
-
return changed;
|
|
95675
|
-
}
|
|
95676
|
-
function isJsonRecord(value) {
|
|
95677
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
95624
|
+
return { value: nextAllow, changed: allowChanged };
|
|
95678
95625
|
}
|
|
95679
95626
|
async function updateHermes(release, options) {
|
|
95680
95627
|
const label = options.label ?? "update";
|
|
@@ -95901,9 +95848,6 @@ function addHermesOkxA2aEnabled(content3) {
|
|
|
95901
95848
|
function resolveHermesConfigPath() {
|
|
95902
95849
|
return (0, import_node_path22.join)(process.env.HERMES_HOME ?? (0, import_node_path22.join)((0, import_node_os9.homedir)(), ".hermes"), "config.yaml");
|
|
95903
95850
|
}
|
|
95904
|
-
function resolveOpenClawConfigPath() {
|
|
95905
|
-
return (0, import_node_path22.join)(process.env.OPENCLAW_HOME ?? (0, import_node_path22.join)((0, import_node_os9.homedir)(), ".openclaw"), "openclaw.json");
|
|
95906
|
-
}
|
|
95907
95851
|
function lineIndent(line) {
|
|
95908
95852
|
const match = line.match(/^\s*/);
|
|
95909
95853
|
return match?.[0].length ?? 0;
|
|
@@ -96253,7 +96197,7 @@ async function runCommandCaptureOptional(command, args) {
|
|
|
96253
96197
|
});
|
|
96254
96198
|
});
|
|
96255
96199
|
}
|
|
96256
|
-
var import_node_child_process8, import_node_fs18, import_promises8, import_node_os9, import_node_path22, UPDATE_PACKAGES, OPENCLAW_FORCE_INSTALL_FLAG, OPENCLAW_UNSAFE_INSTALL_FLAG, OKX_A2A_PLUGIN_ID, redirectCommandStdoutToStderr;
|
|
96200
|
+
var import_node_child_process8, import_node_fs18, import_promises8, import_node_os9, import_node_path22, UPDATE_PACKAGES, 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, redirectCommandStdoutToStderr;
|
|
96257
96201
|
var init_update_cli = __esm({
|
|
96258
96202
|
"src/update-cli.ts"() {
|
|
96259
96203
|
"use strict";
|
|
@@ -96273,6 +96217,9 @@ var init_update_cli = __esm({
|
|
|
96273
96217
|
OPENCLAW_FORCE_INSTALL_FLAG = "--force";
|
|
96274
96218
|
OPENCLAW_UNSAFE_INSTALL_FLAG = "--dangerously-force-unsafe-install";
|
|
96275
96219
|
OKX_A2A_PLUGIN_ID = "okx-a2a";
|
|
96220
|
+
OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH = "session.dmScope";
|
|
96221
|
+
OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE = "per-channel-peer";
|
|
96222
|
+
OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH = "plugins.allow";
|
|
96276
96223
|
redirectCommandStdoutToStderr = false;
|
|
96277
96224
|
}
|
|
96278
96225
|
});
|
|
@@ -96295,7 +96242,7 @@ init_sentry_logger();
|
|
|
96295
96242
|
init_sentry_config();
|
|
96296
96243
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV2 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
96297
96244
|
function printUsage2() {
|
|
96298
|
-
console.log(`okx-a2a ${"0.0.17
|
|
96245
|
+
console.log(`okx-a2a ${"0.0.17"}
|
|
96299
96246
|
|
|
96300
96247
|
Usage:
|
|
96301
96248
|
okx-a2a <command> [options]
|
|
@@ -96332,7 +96279,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
96332
96279
|
`);
|
|
96333
96280
|
}
|
|
96334
96281
|
function printVersion() {
|
|
96335
|
-
console.log("0.0.17
|
|
96282
|
+
console.log("0.0.17");
|
|
96336
96283
|
}
|
|
96337
96284
|
function printDaemonUsage() {
|
|
96338
96285
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
package/dist/index.js
CHANGED
|
@@ -1916,7 +1916,7 @@ var require_path = __commonJS({
|
|
|
1916
1916
|
function join20(...args) {
|
|
1917
1917
|
return normalizePath(args.join("/"));
|
|
1918
1918
|
}
|
|
1919
|
-
function
|
|
1919
|
+
function dirname6(path) {
|
|
1920
1920
|
const result = splitPath(path);
|
|
1921
1921
|
const root = result[0];
|
|
1922
1922
|
let dir = result[1];
|
|
@@ -1936,7 +1936,7 @@ var require_path = __commonJS({
|
|
|
1936
1936
|
return f;
|
|
1937
1937
|
}
|
|
1938
1938
|
exports2.basename = basename3;
|
|
1939
|
-
exports2.dirname =
|
|
1939
|
+
exports2.dirname = dirname6;
|
|
1940
1940
|
exports2.isAbsolute = isAbsolute2;
|
|
1941
1941
|
exports2.join = join20;
|
|
1942
1942
|
exports2.normalizePath = normalizePath;
|
|
@@ -86392,7 +86392,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86392
86392
|
client: {
|
|
86393
86393
|
id: "gateway-client",
|
|
86394
86394
|
displayName: "okx-a2a-node",
|
|
86395
|
-
version: "0.0.17
|
|
86395
|
+
version: "0.0.17",
|
|
86396
86396
|
platform: "node",
|
|
86397
86397
|
mode: "backend",
|
|
86398
86398
|
instanceId
|
|
@@ -86403,7 +86403,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
86403
86403
|
commands: [],
|
|
86404
86404
|
permissions: {},
|
|
86405
86405
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
86406
|
-
userAgent: `okx-a2a-node/${"0.0.17
|
|
86406
|
+
userAgent: `okx-a2a-node/${"0.0.17"}`,
|
|
86407
86407
|
auth: {
|
|
86408
86408
|
...config.token ? { token: config.token } : {},
|
|
86409
86409
|
...config.password ? { password: config.password } : {}
|
|
@@ -90558,7 +90558,7 @@ function userWatchEventDeliveredSentryExtra(event) {
|
|
|
90558
90558
|
var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
90559
90559
|
var SENTRY_CONFIG = {
|
|
90560
90560
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
90561
|
-
release: "0.0.17
|
|
90561
|
+
release: "0.0.17",
|
|
90562
90562
|
environment
|
|
90563
90563
|
};
|
|
90564
90564
|
|
|
@@ -90785,12 +90785,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
90785
90785
|
}));
|
|
90786
90786
|
}
|
|
90787
90787
|
});
|
|
90788
|
-
service.setPluginVersion("0.0.17
|
|
90788
|
+
service.setPluginVersion("0.0.17");
|
|
90789
90789
|
await service.init();
|
|
90790
90790
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
90791
90791
|
if (pluginVersionStatus.unavailable) {
|
|
90792
90792
|
throw new Error(
|
|
90793
|
-
`@okxweb3/a2a-node v${"0.0.17
|
|
90793
|
+
`@okxweb3/a2a-node v${"0.0.17"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
90794
90794
|
);
|
|
90795
90795
|
}
|
|
90796
90796
|
const systemConfig = service.getSystemConfig();
|
|
@@ -90808,7 +90808,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
90808
90808
|
onchainosAgentId: "*",
|
|
90809
90809
|
reason: "system-config missing sentryDsn",
|
|
90810
90810
|
pluginId: "@okxweb3/a2a-node",
|
|
90811
|
-
pluginVersion: "0.0.17
|
|
90811
|
+
pluginVersion: "0.0.17"
|
|
90812
90812
|
});
|
|
90813
90813
|
}
|
|
90814
90814
|
logWithTimestamp(
|
|
@@ -91139,98 +91139,57 @@ async function timeSettled(fn) {
|
|
|
91139
91139
|
}
|
|
91140
91140
|
|
|
91141
91141
|
// src/update-cli.ts
|
|
91142
|
+
var import_node_child_process6 = require("node:child_process");
|
|
91142
91143
|
var import_promises7 = require("node:fs/promises");
|
|
91143
91144
|
var import_node_os7 = require("node:os");
|
|
91144
91145
|
var import_node_path19 = require("node:path");
|
|
91145
91146
|
var OKX_A2A_PLUGIN_ID = "okx-a2a";
|
|
91147
|
+
var OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH = "session.dmScope";
|
|
91148
|
+
var OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE = "per-channel-peer";
|
|
91149
|
+
var OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH = "plugins.allow";
|
|
91150
|
+
var redirectCommandStdoutToStderr = false;
|
|
91146
91151
|
function isPrereleaseVersion(version2) {
|
|
91147
91152
|
return /\d+\.\d+\.\d+-[0-9A-Za-z.-]+/.test(version2);
|
|
91148
91153
|
}
|
|
91149
|
-
async function ensureOpenClawOkxA2aPluginConfig(
|
|
91154
|
+
async function ensureOpenClawOkxA2aPluginConfig() {
|
|
91150
91155
|
try {
|
|
91151
|
-
|
|
91152
|
-
|
|
91153
|
-
|
|
91154
|
-
|
|
91155
|
-
|
|
91156
|
-
|
|
91157
|
-
normalizeOpenClawPluginConfigObject(config);
|
|
91158
|
-
await (0, import_promises7.mkdir)((0, import_node_path19.dirname)(configFile), { recursive: true });
|
|
91159
|
-
await (0, import_promises7.writeFile)(configFile, `${JSON.stringify(config, null, 2)}
|
|
91160
|
-
`);
|
|
91161
|
-
console.log(`[update] added OpenClaw plugins.entries/allow okx-a2a config in ${configFile}`);
|
|
91162
|
-
return true;
|
|
91163
|
-
}
|
|
91164
|
-
throw error;
|
|
91156
|
+
const dmScope = await getOpenClawConfigValue(OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH);
|
|
91157
|
+
const allow = await getOpenClawConfigValue(OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH);
|
|
91158
|
+
const normalizedAllow = normalizeOpenClawPluginAllowValue(allow.found ? allow.value : void 0);
|
|
91159
|
+
const operations = [];
|
|
91160
|
+
if (dmScope.value !== OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE) {
|
|
91161
|
+
operations.push({ path: OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, value: OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE });
|
|
91165
91162
|
}
|
|
91166
|
-
|
|
91167
|
-
|
|
91163
|
+
if (!allow.found || normalizedAllow.changed) {
|
|
91164
|
+
operations.push({ path: OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, value: normalizedAllow.value });
|
|
91165
|
+
}
|
|
91166
|
+
if (operations.length === 0) {
|
|
91168
91167
|
return false;
|
|
91169
91168
|
}
|
|
91170
|
-
await (
|
|
91171
|
-
console.log(
|
|
91169
|
+
await runCommand("openclaw", ["config", "set", "--batch-json", JSON.stringify(operations)]);
|
|
91170
|
+
console.log("[update] normalized OpenClaw session.dmScope/plugins.allow okx-a2a config through openclaw config set");
|
|
91172
91171
|
return true;
|
|
91173
91172
|
} catch (error) {
|
|
91174
91173
|
const detail = error instanceof Error ? error.message : String(error);
|
|
91175
|
-
console.warn(`[update] skipped OpenClaw plugins.
|
|
91174
|
+
console.warn(`[update] skipped OpenClaw session.dmScope/plugins.allow okx-a2a config normalization through openclaw CLI: ${detail}`);
|
|
91176
91175
|
return false;
|
|
91177
91176
|
}
|
|
91178
91177
|
}
|
|
91179
|
-
function
|
|
91180
|
-
|
|
91178
|
+
async function getOpenClawConfigValue(path) {
|
|
91179
|
+
const result = await runCommandCaptureOptional("openclaw", ["config", "get", path, "--json"]);
|
|
91180
|
+
if (!result.ok) {
|
|
91181
|
+
return { found: false, value: void 0 };
|
|
91182
|
+
}
|
|
91181
91183
|
try {
|
|
91182
|
-
|
|
91184
|
+
return { found: true, value: JSON.parse(result.stdout) };
|
|
91183
91185
|
} catch (error) {
|
|
91184
91186
|
const detail = error instanceof Error ? error.message : String(error);
|
|
91185
|
-
throw new Error(`OpenClaw config ${
|
|
91186
|
-
}
|
|
91187
|
-
if (!isJsonRecord(parsed)) {
|
|
91188
|
-
throw new Error(`OpenClaw config ${configFile} must be a JSON object`);
|
|
91187
|
+
throw new Error(`OpenClaw config get ${path} returned invalid JSON: ${detail}`);
|
|
91189
91188
|
}
|
|
91190
|
-
const changed = normalizeOpenClawPluginConfigObject(parsed);
|
|
91191
|
-
return {
|
|
91192
|
-
content: `${JSON.stringify(parsed, null, 2)}
|
|
91193
|
-
`,
|
|
91194
|
-
changed
|
|
91195
|
-
};
|
|
91196
91189
|
}
|
|
91197
|
-
function
|
|
91198
|
-
let changed = false;
|
|
91199
|
-
let plugins;
|
|
91200
|
-
const currentPlugins = config.plugins;
|
|
91201
|
-
if (isJsonRecord(currentPlugins)) {
|
|
91202
|
-
plugins = currentPlugins;
|
|
91203
|
-
} else {
|
|
91204
|
-
plugins = {};
|
|
91205
|
-
config.plugins = plugins;
|
|
91206
|
-
changed = true;
|
|
91207
|
-
}
|
|
91208
|
-
let entries;
|
|
91209
|
-
const currentEntries = plugins.entries;
|
|
91210
|
-
if (isJsonRecord(currentEntries)) {
|
|
91211
|
-
entries = currentEntries;
|
|
91212
|
-
} else {
|
|
91213
|
-
entries = {};
|
|
91214
|
-
plugins.entries = entries;
|
|
91215
|
-
changed = true;
|
|
91216
|
-
}
|
|
91217
|
-
let entry;
|
|
91218
|
-
const currentEntry = entries[OKX_A2A_PLUGIN_ID];
|
|
91219
|
-
if (isJsonRecord(currentEntry)) {
|
|
91220
|
-
entry = currentEntry;
|
|
91221
|
-
} else {
|
|
91222
|
-
entry = {};
|
|
91223
|
-
entries[OKX_A2A_PLUGIN_ID] = entry;
|
|
91224
|
-
changed = true;
|
|
91225
|
-
}
|
|
91226
|
-
if (entry.enabled !== true) {
|
|
91227
|
-
entry.enabled = true;
|
|
91228
|
-
changed = true;
|
|
91229
|
-
}
|
|
91230
|
-
const allow = plugins.allow;
|
|
91190
|
+
function normalizeOpenClawPluginAllowValue(allow) {
|
|
91231
91191
|
if (!Array.isArray(allow)) {
|
|
91232
|
-
|
|
91233
|
-
return true;
|
|
91192
|
+
return { value: [OKX_A2A_PLUGIN_ID], changed: true };
|
|
91234
91193
|
}
|
|
91235
91194
|
const nextAllow = [];
|
|
91236
91195
|
let allowChanged = false;
|
|
@@ -91249,14 +91208,7 @@ function normalizeOpenClawPluginConfigObject(config) {
|
|
|
91249
91208
|
nextAllow.push(OKX_A2A_PLUGIN_ID);
|
|
91250
91209
|
allowChanged = true;
|
|
91251
91210
|
}
|
|
91252
|
-
|
|
91253
|
-
plugins.allow = nextAllow;
|
|
91254
|
-
changed = true;
|
|
91255
|
-
}
|
|
91256
|
-
return changed;
|
|
91257
|
-
}
|
|
91258
|
-
function isJsonRecord(value) {
|
|
91259
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
91211
|
+
return { value: nextAllow, changed: allowChanged };
|
|
91260
91212
|
}
|
|
91261
91213
|
async function normalizeHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPath()) {
|
|
91262
91214
|
let content3;
|
|
@@ -91387,9 +91339,6 @@ function isEmptyInlineEnabledList(line) {
|
|
|
91387
91339
|
function resolveHermesConfigPath() {
|
|
91388
91340
|
return (0, import_node_path19.join)(process.env.HERMES_HOME ?? (0, import_node_path19.join)((0, import_node_os7.homedir)(), ".hermes"), "config.yaml");
|
|
91389
91341
|
}
|
|
91390
|
-
function resolveOpenClawConfigPath() {
|
|
91391
|
-
return (0, import_node_path19.join)(process.env.OPENCLAW_HOME ?? (0, import_node_path19.join)((0, import_node_os7.homedir)(), ".openclaw"), "openclaw.json");
|
|
91392
|
-
}
|
|
91393
91342
|
function lineIndent(line) {
|
|
91394
91343
|
const match = line.match(/^\s*/);
|
|
91395
91344
|
return match?.[0].length ?? 0;
|
|
@@ -91449,6 +91398,46 @@ function parsePluginYamlVersion(content3) {
|
|
|
91449
91398
|
}
|
|
91450
91399
|
return null;
|
|
91451
91400
|
}
|
|
91401
|
+
async function runCommand(command, args, options = {}) {
|
|
91402
|
+
if (options.ensureDir) {
|
|
91403
|
+
const { mkdir: mkdir4 } = await import("node:fs/promises");
|
|
91404
|
+
await mkdir4(options.ensureDir, { recursive: true });
|
|
91405
|
+
}
|
|
91406
|
+
await new Promise((resolvePromise, reject) => {
|
|
91407
|
+
const child = (0, import_node_child_process6.spawn)(command, args, {
|
|
91408
|
+
cwd: options.cwd,
|
|
91409
|
+
stdio: redirectCommandStdoutToStderr ? ["ignore", "pipe", "pipe"] : "inherit"
|
|
91410
|
+
});
|
|
91411
|
+
if (redirectCommandStdoutToStderr && child.stdout && child.stderr) {
|
|
91412
|
+
child.stdout.pipe(process.stderr);
|
|
91413
|
+
child.stderr.pipe(process.stderr);
|
|
91414
|
+
}
|
|
91415
|
+
child.on("error", reject);
|
|
91416
|
+
child.on("close", (code2, signal) => {
|
|
91417
|
+
if (code2 === 0) {
|
|
91418
|
+
resolvePromise();
|
|
91419
|
+
return;
|
|
91420
|
+
}
|
|
91421
|
+
reject(new Error(`${command} ${args.join(" ")} failed with ${signal ? `signal=${signal}` : `code=${code2}`}`));
|
|
91422
|
+
});
|
|
91423
|
+
});
|
|
91424
|
+
}
|
|
91425
|
+
async function runCommandCaptureOptional(command, args) {
|
|
91426
|
+
return await new Promise((resolvePromise) => {
|
|
91427
|
+
const child = (0, import_node_child_process6.spawn)(command, args, { stdio: ["ignore", "pipe", "ignore"] });
|
|
91428
|
+
let stdout = "";
|
|
91429
|
+
child.stdout.setEncoding("utf8");
|
|
91430
|
+
child.stdout.on("data", (chunk) => {
|
|
91431
|
+
stdout += chunk;
|
|
91432
|
+
});
|
|
91433
|
+
child.on("error", () => {
|
|
91434
|
+
resolvePromise({ ok: false, stdout });
|
|
91435
|
+
});
|
|
91436
|
+
child.on("close", (code2) => {
|
|
91437
|
+
resolvePromise({ ok: code2 === 0, stdout });
|
|
91438
|
+
});
|
|
91439
|
+
});
|
|
91440
|
+
}
|
|
91452
91441
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91453
91442
|
0 && (module.exports = {
|
|
91454
91443
|
AI_PROVIDERS,
|
package/package.json
CHANGED