@okxweb3/a2a-node 0.2.19-beta-fe6942ad54-261125201445 → 0.2.19
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 +199 -1558
- package/dist/index.js +109 -1470
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -114,8 +114,7 @@ function resolveTaskPaths(homeDir = resolveTaskHome()) {
|
|
|
114
114
|
completedCommandsDir: (0, import_node_path2.join)(homeDir, "commands", "completed"),
|
|
115
115
|
pidPath: (0, import_node_path2.join)(homeDir, "run", "listener.pid"),
|
|
116
116
|
daemonLockPath: (0, import_node_path2.join)(homeDir, "run", "daemon.lock"),
|
|
117
|
-
listenerLogPath: (0, import_node_path2.join)(homeDir, "logs", "listener.log")
|
|
118
|
-
devkitServerDbPath: (0, import_node_path2.join)(homeDir, "sqlite", DEVKIT_SERVER_DB_NAME)
|
|
117
|
+
listenerLogPath: (0, import_node_path2.join)(homeDir, "logs", "listener.log")
|
|
119
118
|
};
|
|
120
119
|
}
|
|
121
120
|
function ensureTaskHome(homeDir) {
|
|
@@ -127,14 +126,13 @@ function encodeJobIdForFile(jobId) {
|
|
|
127
126
|
function ensureTaskDir(dir) {
|
|
128
127
|
return ensureA2aTaskDir(dir);
|
|
129
128
|
}
|
|
130
|
-
var import_node_path2, BACKUP_JOB_ID
|
|
129
|
+
var import_node_path2, BACKUP_JOB_ID;
|
|
131
130
|
var init_paths = __esm({
|
|
132
131
|
"src/paths.ts"() {
|
|
133
132
|
"use strict";
|
|
134
133
|
import_node_path2 = require("node:path");
|
|
135
134
|
init_a2a_paths();
|
|
136
135
|
BACKUP_JOB_ID = "backup";
|
|
137
|
-
DEVKIT_SERVER_DB_NAME = "devkit-server.sqlite";
|
|
138
136
|
}
|
|
139
137
|
});
|
|
140
138
|
|
|
@@ -19379,25 +19377,7 @@ var init_events = __esm({
|
|
|
19379
19377
|
XMTP_DEBUG_SYNC_FAILED: "XMTP debug sync failed",
|
|
19380
19378
|
// Underlying XMTP SDK client close failed during recycle/removal/shutdown
|
|
19381
19379
|
// (DEXMARKET-9116). Error-level → NOT added to SENTRY_INFO_ALLOWLIST.
|
|
19382
|
-
XMTP_CLIENT_CLOSE_FAILED: "XMTP client close failed"
|
|
19383
|
-
// ── devkit custom-server registry + delivery (DEXMARKET-9165) ──────────────
|
|
19384
|
-
// info-level (registered in SENTRY_INFO_ALLOWLIST below):
|
|
19385
|
-
DEVKIT_REGISTER_REQUESTED: "Devkit register requested",
|
|
19386
|
-
DEVKIT_REGISTER_COMPLETED: "Devkit register completed",
|
|
19387
|
-
DEVKIT_UNREGISTER_REQUESTED: "Devkit unregister requested",
|
|
19388
|
-
DEVKIT_UNREGISTER_COMPLETED: "Devkit unregister completed",
|
|
19389
|
-
DEVKIT_DAEMON_STATUS_UNKNOWN: "Devkit daemon status unknown",
|
|
19390
|
-
DEVKIT_ROUTE_DEFAULT_AI: "Devkit route default AI",
|
|
19391
|
-
DEVKIT_ROUTE_CUSTOM_SERVER: "Devkit route custom server",
|
|
19392
|
-
DEVKIT_DELIVERY_ACCEPTED: "Devkit delivery accepted",
|
|
19393
|
-
DEVKIT_DELIVERY_HTTP_ACCEPTED: "Devkit delivery http accepted",
|
|
19394
|
-
DEVKIT_DELIVERY_DROPPED: "Devkit delivery dropped",
|
|
19395
|
-
DEVKIT_DELIVERY_CANCELLED: "Devkit delivery cancelled",
|
|
19396
|
-
// error-level (NOT allowlisted — logger.error):
|
|
19397
|
-
DEVKIT_REGISTER_REJECTED: "Devkit register rejected",
|
|
19398
|
-
DEVKIT_CONFIG_PERSIST_FAILED: "Devkit config persist failed",
|
|
19399
|
-
DEVKIT_ROUTE_CONFIG_READ_FAILED: "Devkit route config read failed",
|
|
19400
|
-
DEVKIT_DELIVERY_HTTP_FAILED: "Devkit delivery http failed"
|
|
19380
|
+
XMTP_CLIENT_CLOSE_FAILED: "XMTP client close failed"
|
|
19401
19381
|
};
|
|
19402
19382
|
}
|
|
19403
19383
|
});
|
|
@@ -20248,20 +20228,7 @@ var init_sentry_logger = __esm({
|
|
|
20248
20228
|
LogEvent.XMTP_RATE_LIMIT_COOLDOWN_STARTED,
|
|
20249
20229
|
LogEvent.XMTP_RATE_LIMIT_CREATE_SUPPRESSED,
|
|
20250
20230
|
LogEvent.XMTP_RATE_LIMIT_PROBE,
|
|
20251
|
-
LogEvent.XMTP_RATE_LIMIT_RECOVERED
|
|
20252
|
-
// devkit custom-server registry + delivery info checkpoints (DEXMARKET-9165).
|
|
20253
|
-
// info() drops any event not listed here, so these must stay registered.
|
|
20254
|
-
LogEvent.DEVKIT_REGISTER_REQUESTED,
|
|
20255
|
-
LogEvent.DEVKIT_REGISTER_COMPLETED,
|
|
20256
|
-
LogEvent.DEVKIT_UNREGISTER_REQUESTED,
|
|
20257
|
-
LogEvent.DEVKIT_UNREGISTER_COMPLETED,
|
|
20258
|
-
LogEvent.DEVKIT_DAEMON_STATUS_UNKNOWN,
|
|
20259
|
-
LogEvent.DEVKIT_ROUTE_DEFAULT_AI,
|
|
20260
|
-
LogEvent.DEVKIT_ROUTE_CUSTOM_SERVER,
|
|
20261
|
-
LogEvent.DEVKIT_DELIVERY_ACCEPTED,
|
|
20262
|
-
LogEvent.DEVKIT_DELIVERY_HTTP_ACCEPTED,
|
|
20263
|
-
LogEvent.DEVKIT_DELIVERY_DROPPED,
|
|
20264
|
-
LogEvent.DEVKIT_DELIVERY_CANCELLED
|
|
20231
|
+
LogEvent.XMTP_RATE_LIMIT_RECOVERED
|
|
20265
20232
|
]);
|
|
20266
20233
|
MAX_EXTRA_STRING_LENGTH = 256;
|
|
20267
20234
|
MAX_TAG_VALUE_LENGTH = 128;
|
|
@@ -32497,7 +32464,7 @@ var init_sentry_config = __esm({
|
|
|
32497
32464
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
32498
32465
|
SENTRY_CONFIG = {
|
|
32499
32466
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
32500
|
-
release: "0.2.19
|
|
32467
|
+
release: "0.2.19",
|
|
32501
32468
|
environment,
|
|
32502
32469
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
32503
32470
|
};
|
|
@@ -32531,7 +32498,7 @@ function isPostjectRunnable() {
|
|
|
32531
32498
|
function resolvePostjectCommand() {
|
|
32532
32499
|
try {
|
|
32533
32500
|
const cliPath = (0, import_node_module.createRequire)(__filename).resolve("postject/dist/cli.js");
|
|
32534
|
-
if ((0,
|
|
32501
|
+
if ((0, import_node_fs21.existsSync)(cliPath)) {
|
|
32535
32502
|
return { command: process.execPath, prefixArgs: [cliPath] };
|
|
32536
32503
|
}
|
|
32537
32504
|
} catch {
|
|
@@ -32602,26 +32569,26 @@ function buildSeaConfig(entryPath, blobPath) {
|
|
|
32602
32569
|
}
|
|
32603
32570
|
async function installWindowsNativeLauncher(options) {
|
|
32604
32571
|
const nodeExe = options.nodeExe ?? process.execPath;
|
|
32605
|
-
if (!(0,
|
|
32572
|
+
if (!(0, import_node_fs21.existsSync)(options.cliPath)) {
|
|
32606
32573
|
throw new Error(`cannot build okx-a2a.exe: CLI entry not found at ${options.cliPath}`);
|
|
32607
32574
|
}
|
|
32608
|
-
if (!(0,
|
|
32575
|
+
if (!(0, import_node_fs21.existsSync)(nodeExe)) {
|
|
32609
32576
|
throw new Error(`cannot build okx-a2a.exe: node executable not found at ${nodeExe}`);
|
|
32610
32577
|
}
|
|
32611
32578
|
const exePath = (0, import_node_path28.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
|
|
32612
|
-
(0,
|
|
32613
|
-
const work = (0,
|
|
32579
|
+
(0, import_node_fs21.mkdirSync)(options.targetDir, { recursive: true });
|
|
32580
|
+
const work = (0, import_node_fs21.mkdtempSync)((0, import_node_path28.join)((0, import_node_os9.tmpdir)(), "okx-a2a-sea-"));
|
|
32614
32581
|
try {
|
|
32615
32582
|
const entryPath = (0, import_node_path28.join)(work, "launcher-entry.js");
|
|
32616
32583
|
const blobPath = (0, import_node_path28.join)(work, "okx-a2a.blob");
|
|
32617
32584
|
const configPath = (0, import_node_path28.join)(work, "sea-config.json");
|
|
32618
|
-
(0,
|
|
32619
|
-
(0,
|
|
32585
|
+
(0, import_node_fs21.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
|
|
32586
|
+
(0, import_node_fs21.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
|
|
32620
32587
|
(0, import_node_child_process7.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
|
|
32621
32588
|
stdio: "ignore",
|
|
32622
32589
|
windowsHide: true
|
|
32623
32590
|
});
|
|
32624
|
-
(0,
|
|
32591
|
+
(0, import_node_fs21.copyFileSync)(nodeExe, exePath);
|
|
32625
32592
|
const isMac = process.platform === "darwin";
|
|
32626
32593
|
if (isMac) {
|
|
32627
32594
|
try {
|
|
@@ -32641,10 +32608,10 @@ async function installWindowsNativeLauncher(options) {
|
|
|
32641
32608
|
);
|
|
32642
32609
|
return { exePath, cliPath: options.cliPath, nodeExe };
|
|
32643
32610
|
} finally {
|
|
32644
|
-
(0,
|
|
32611
|
+
(0, import_node_fs21.rmSync)(work, { recursive: true, force: true });
|
|
32645
32612
|
}
|
|
32646
32613
|
}
|
|
32647
|
-
function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 =
|
|
32614
|
+
function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs21.existsSync) {
|
|
32648
32615
|
const dirs = pathValue.split(";").map((d) => d.trim()).filter(Boolean);
|
|
32649
32616
|
if (appData) {
|
|
32650
32617
|
dirs.push((0, import_node_path28.join)(appData, "npm"));
|
|
@@ -32662,11 +32629,11 @@ function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2
|
|
|
32662
32629
|
}
|
|
32663
32630
|
function resolveRunningCliPath() {
|
|
32664
32631
|
const fromArgv = process.argv[1];
|
|
32665
|
-
if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0,
|
|
32632
|
+
if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs21.existsSync)(fromArgv)) {
|
|
32666
32633
|
return fromArgv;
|
|
32667
32634
|
}
|
|
32668
32635
|
const beside = (0, import_node_path28.join)(__dirname, "cli.js");
|
|
32669
|
-
if ((0,
|
|
32636
|
+
if ((0, import_node_fs21.existsSync)(beside)) {
|
|
32670
32637
|
return beside;
|
|
32671
32638
|
}
|
|
32672
32639
|
if (fromArgv) {
|
|
@@ -32688,12 +32655,12 @@ async function ensureWindowsNativeLauncher(options = {}) {
|
|
|
32688
32655
|
const result = await installWindowsNativeLauncher({ cliPath: resolveRunningCliPath(), targetDir });
|
|
32689
32656
|
return { exePath: result.exePath, installed: true };
|
|
32690
32657
|
}
|
|
32691
|
-
var import_node_child_process7,
|
|
32658
|
+
var import_node_child_process7, import_node_fs21, import_node_module, import_node_os9, import_node_path28, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
|
|
32692
32659
|
var init_win_native_launcher = __esm({
|
|
32693
32660
|
"src/win-native-launcher.ts"() {
|
|
32694
32661
|
"use strict";
|
|
32695
32662
|
import_node_child_process7 = require("node:child_process");
|
|
32696
|
-
|
|
32663
|
+
import_node_fs21 = require("node:fs");
|
|
32697
32664
|
import_node_module = require("node:module");
|
|
32698
32665
|
import_node_os9 = require("node:os");
|
|
32699
32666
|
import_node_path28 = require("node:path");
|
|
@@ -32835,7 +32802,7 @@ function buildProviderMismatchWarning(target, provider) {
|
|
|
32835
32802
|
].join("\n");
|
|
32836
32803
|
}
|
|
32837
32804
|
async function handleUpdateCommand(args) {
|
|
32838
|
-
if (args.some(
|
|
32805
|
+
if (args.some(isHelpArg)) {
|
|
32839
32806
|
printUpdateUsage();
|
|
32840
32807
|
return;
|
|
32841
32808
|
}
|
|
@@ -32876,7 +32843,7 @@ function resolveUpdateTarget(target) {
|
|
|
32876
32843
|
return detectGatewayInvocation() ?? "node";
|
|
32877
32844
|
}
|
|
32878
32845
|
async function handleSetupCommand(args) {
|
|
32879
|
-
if (args.some(
|
|
32846
|
+
if (args.some(isHelpArg)) {
|
|
32880
32847
|
printSetupUsage();
|
|
32881
32848
|
return;
|
|
32882
32849
|
}
|
|
@@ -33453,7 +33420,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
33453
33420
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
33454
33421
|
}
|
|
33455
33422
|
function getBundledNodeCliVersion() {
|
|
33456
|
-
return true ? "0.2.19
|
|
33423
|
+
return true ? "0.2.19" : null;
|
|
33457
33424
|
}
|
|
33458
33425
|
function readConfiguredAiProvider() {
|
|
33459
33426
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -33638,7 +33605,7 @@ async function updateHermes(release, options) {
|
|
|
33638
33605
|
assertNotRunningInsideGateway("hermes");
|
|
33639
33606
|
}
|
|
33640
33607
|
const spec = buildNpmPackageSpec("hermes", release);
|
|
33641
|
-
const workDir = await (0,
|
|
33608
|
+
const workDir = await (0, import_promises11.mkdtemp)((0, import_node_path29.join)((0, import_node_os10.tmpdir)(), `okx-a2a-${label}-hermes-`));
|
|
33642
33609
|
try {
|
|
33643
33610
|
console.log(`[${label}] downloading ${spec}`);
|
|
33644
33611
|
const npmTarball = await npmPack(spec, workDir);
|
|
@@ -33659,11 +33626,11 @@ async function updateHermes(release, options) {
|
|
|
33659
33626
|
}
|
|
33660
33627
|
console.log(`[${label}] hermes ${label} done`);
|
|
33661
33628
|
} finally {
|
|
33662
|
-
await (0,
|
|
33629
|
+
await (0, import_promises11.rm)(workDir, { recursive: true, force: true });
|
|
33663
33630
|
}
|
|
33664
33631
|
}
|
|
33665
33632
|
async function installGatewayPluginForDoctor(target) {
|
|
33666
|
-
const release = isPrereleaseVersion("0.2.19
|
|
33633
|
+
const release = isPrereleaseVersion("0.2.19") ? "beta" : "latest";
|
|
33667
33634
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
33668
33635
|
const options = {
|
|
33669
33636
|
restart: !insideTargetGateway,
|
|
@@ -33690,7 +33657,7 @@ function setupReadyMessage(target) {
|
|
|
33690
33657
|
async function normalizeHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPath()) {
|
|
33691
33658
|
let content;
|
|
33692
33659
|
try {
|
|
33693
|
-
content = await (0,
|
|
33660
|
+
content = await (0, import_promises11.readFile)(configFile, "utf8");
|
|
33694
33661
|
} catch (error) {
|
|
33695
33662
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
33696
33663
|
return false;
|
|
@@ -33701,21 +33668,21 @@ async function normalizeHermesOkxA2aPluginConfig(configFile = resolveHermesConfi
|
|
|
33701
33668
|
if (!normalized.changed) {
|
|
33702
33669
|
return false;
|
|
33703
33670
|
}
|
|
33704
|
-
await (0,
|
|
33671
|
+
await (0, import_promises11.writeFile)(configFile, normalized.content);
|
|
33705
33672
|
console.log(`[update] normalized Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
33706
33673
|
return true;
|
|
33707
33674
|
}
|
|
33708
33675
|
async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPath(), options = {}) {
|
|
33709
33676
|
let content;
|
|
33710
33677
|
try {
|
|
33711
|
-
content = await (0,
|
|
33678
|
+
content = await (0, import_promises11.readFile)(configFile, "utf8");
|
|
33712
33679
|
} catch (error) {
|
|
33713
33680
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
33714
33681
|
if (options.dryRun) {
|
|
33715
33682
|
return true;
|
|
33716
33683
|
}
|
|
33717
|
-
await (0,
|
|
33718
|
-
await (0,
|
|
33684
|
+
await (0, import_promises11.mkdir)((0, import_node_path29.resolve)(configFile, ".."), { recursive: true });
|
|
33685
|
+
await (0, import_promises11.writeFile)(configFile, "plugins:\n enabled:\n - okx-a2a\n");
|
|
33719
33686
|
console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
33720
33687
|
return true;
|
|
33721
33688
|
}
|
|
@@ -33726,7 +33693,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
|
|
|
33726
33693
|
if (options.dryRun) {
|
|
33727
33694
|
return true;
|
|
33728
33695
|
}
|
|
33729
|
-
await (0,
|
|
33696
|
+
await (0, import_promises11.writeFile)(configFile, normalized.content);
|
|
33730
33697
|
console.log(`[update] normalized Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
33731
33698
|
return true;
|
|
33732
33699
|
}
|
|
@@ -33737,7 +33704,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
|
|
|
33737
33704
|
return true;
|
|
33738
33705
|
}
|
|
33739
33706
|
const updated = addHermesOkxA2aEnabled(content);
|
|
33740
|
-
await (0,
|
|
33707
|
+
await (0, import_promises11.writeFile)(configFile, updated);
|
|
33741
33708
|
console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
33742
33709
|
return true;
|
|
33743
33710
|
}
|
|
@@ -34038,7 +34005,7 @@ async function isGatewayPluginInstalled(target) {
|
|
|
34038
34005
|
if (target === "openclaw") {
|
|
34039
34006
|
return (await getInstalledOpenClawPluginInfo()).installed;
|
|
34040
34007
|
}
|
|
34041
|
-
return (0,
|
|
34008
|
+
return (0, import_node_fs22.existsSync)(resolveHermesPluginYamlPath());
|
|
34042
34009
|
}
|
|
34043
34010
|
async function getInstalledGatewayPluginVersion(target) {
|
|
34044
34011
|
if (target === "hermes") {
|
|
@@ -34127,7 +34094,7 @@ function parsePackageVersionFromText(output) {
|
|
|
34127
34094
|
async function getInstalledHermesPluginVersion() {
|
|
34128
34095
|
const pluginYaml = (0, import_node_path29.join)(process.env.HERMES_HOME ?? (0, import_node_path29.join)((0, import_node_os10.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
34129
34096
|
try {
|
|
34130
|
-
const content = await (0,
|
|
34097
|
+
const content = await (0, import_promises11.readFile)(pluginYaml, "utf8");
|
|
34131
34098
|
return parsePluginYamlVersion(content);
|
|
34132
34099
|
} catch (error) {
|
|
34133
34100
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
@@ -34186,7 +34153,7 @@ async function npmPack(spec, destination) {
|
|
|
34186
34153
|
return (0, import_node_path29.resolve)(destination, (0, import_node_path29.basename)(tarballName));
|
|
34187
34154
|
}
|
|
34188
34155
|
async function findHermesPluginTarball(distDir) {
|
|
34189
|
-
const entries = await (0,
|
|
34156
|
+
const entries = await (0, import_promises11.readdir)(distDir);
|
|
34190
34157
|
const tarball = entries.find((entry) => /^okx-a2a-hermes-plugin-.+\.tar\.gz$/.test(entry));
|
|
34191
34158
|
if (!tarball) {
|
|
34192
34159
|
throw new Error(`Hermes npm package did not contain dist/okx-a2a-hermes-plugin-*.tar.gz`);
|
|
@@ -34194,7 +34161,7 @@ async function findHermesPluginTarball(distDir) {
|
|
|
34194
34161
|
return (0, import_node_path29.join)(distDir, tarball);
|
|
34195
34162
|
}
|
|
34196
34163
|
async function findFirstDirectory(parent) {
|
|
34197
|
-
const entries = await (0,
|
|
34164
|
+
const entries = await (0, import_promises11.readdir)(parent, { withFileTypes: true });
|
|
34198
34165
|
const dir = entries.find((entry) => entry.isDirectory());
|
|
34199
34166
|
if (!dir) {
|
|
34200
34167
|
throw new Error(`No unpacked plugin directory found under ${parent}`);
|
|
@@ -34211,7 +34178,7 @@ function readOption2(args, name) {
|
|
|
34211
34178
|
function hasFlag(args, name) {
|
|
34212
34179
|
return args.includes(name);
|
|
34213
34180
|
}
|
|
34214
|
-
function
|
|
34181
|
+
function isHelpArg(value) {
|
|
34215
34182
|
return value === "-h" || value === "--help" || value === "help";
|
|
34216
34183
|
}
|
|
34217
34184
|
function isSupportedRelease(value) {
|
|
@@ -34420,13 +34387,13 @@ function buildExternalCommandInvocation(command, args, platform = process.platfo
|
|
|
34420
34387
|
function formatExternalCommand(command, args) {
|
|
34421
34388
|
return [command, ...args].join(" ");
|
|
34422
34389
|
}
|
|
34423
|
-
var import_node_child_process8,
|
|
34390
|
+
var import_node_child_process8, import_node_fs22, import_promises11, import_node_os10, import_node_path29, 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;
|
|
34424
34391
|
var init_update_cli = __esm({
|
|
34425
34392
|
"src/update-cli.ts"() {
|
|
34426
34393
|
"use strict";
|
|
34427
34394
|
import_node_child_process8 = require("node:child_process");
|
|
34428
|
-
|
|
34429
|
-
|
|
34395
|
+
import_node_fs22 = require("node:fs");
|
|
34396
|
+
import_promises11 = require("node:fs/promises");
|
|
34430
34397
|
import_node_os10 = require("node:os");
|
|
34431
34398
|
import_node_path29 = require("node:path");
|
|
34432
34399
|
init_ai_command();
|
|
@@ -44379,23 +44346,7 @@ __export(index_exports, {
|
|
|
44379
44346
|
DEFAULT_LOG_TAIL_LIMIT: () => DEFAULT_LOG_TAIL_LIMIT,
|
|
44380
44347
|
DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC: () => DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC,
|
|
44381
44348
|
DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC: () => DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC,
|
|
44382
|
-
DEVKIT_DROP_REASON: () => DEVKIT_DROP_REASON,
|
|
44383
|
-
DEVKIT_MAX_CONCURRENCY: () => DEVKIT_MAX_CONCURRENCY,
|
|
44384
|
-
DEVKIT_MAX_MESSAGE_BYTES: () => DEVKIT_MAX_MESSAGE_BYTES,
|
|
44385
|
-
DEVKIT_MAX_PENDING: () => DEVKIT_MAX_PENDING,
|
|
44386
|
-
DEVKIT_MAX_PENDING_BYTES: () => DEVKIT_MAX_PENDING_BYTES,
|
|
44387
|
-
DEVKIT_OUTCOME: () => DEVKIT_OUTCOME,
|
|
44388
|
-
DEVKIT_REQUEST_BUDGET_MS: () => DEVKIT_REQUEST_BUDGET_MS,
|
|
44389
|
-
DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES: () => DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES,
|
|
44390
|
-
DEVKIT_RESPONSE_SUMMARY_MAX_CHARS: () => DEVKIT_RESPONSE_SUMMARY_MAX_CHARS,
|
|
44391
|
-
DEVKIT_SERVER_APPLICATION_ID: () => DEVKIT_SERVER_APPLICATION_ID,
|
|
44392
|
-
DEVKIT_SERVER_DB_NAME: () => DEVKIT_SERVER_DB_NAME,
|
|
44393
|
-
DEVKIT_SERVER_SCHEMA_VERSION: () => DEVKIT_SERVER_SCHEMA_VERSION,
|
|
44394
44349
|
DOCTOR_MIN_NODE_VERSION: () => DOCTOR_MIN_NODE_VERSION,
|
|
44395
|
-
DevkitDeliveryDispatcher: () => DevkitDeliveryDispatcher,
|
|
44396
|
-
DevkitServerStore: () => DevkitServerStore,
|
|
44397
|
-
DevkitServerStoreError: () => DevkitServerStoreError,
|
|
44398
|
-
DevkitTargetError: () => DevkitTargetError,
|
|
44399
44350
|
GatewayOutboundBehavior: () => GatewayOutboundBehavior,
|
|
44400
44351
|
HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS: () => HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS,
|
|
44401
44352
|
InboundReplayGate: () => InboundReplayGate,
|
|
@@ -44453,7 +44404,6 @@ __export(index_exports, {
|
|
|
44453
44404
|
buildExternalCommandInvocation: () => buildExternalCommandInvocation,
|
|
44454
44405
|
buildGatewayOutboundExtra: () => buildGatewayOutboundExtra,
|
|
44455
44406
|
buildInboundTerminalExtras: () => buildInboundTerminalExtras,
|
|
44456
|
-
buildJobEnvelope: () => buildJobEnvelope,
|
|
44457
44407
|
buildLaunchdPlist: () => buildLaunchdPlist,
|
|
44458
44408
|
buildLauncherEntryJs: () => buildLauncherEntryJs,
|
|
44459
44409
|
buildMessageEligibleArgs: () => buildMessageEligibleArgs,
|
|
@@ -44464,7 +44414,6 @@ __export(index_exports, {
|
|
|
44464
44414
|
buildSchtasksRunArgs: () => buildSchtasksRunArgs,
|
|
44465
44415
|
buildSeaConfig: () => buildSeaConfig,
|
|
44466
44416
|
buildServicePath: () => buildServicePath,
|
|
44467
|
-
buildSessionEnvelope: () => buildSessionEnvelope,
|
|
44468
44417
|
buildSessionKey: () => buildSessionKey,
|
|
44469
44418
|
buildSystemMessageNotice: () => buildSystemMessageNotice,
|
|
44470
44419
|
buildSystemStoredMessage: () => buildSystemStoredMessage,
|
|
@@ -44482,8 +44431,6 @@ __export(index_exports, {
|
|
|
44482
44431
|
checkCodexCliAuthStatus: () => checkCodexCliAuthStatus,
|
|
44483
44432
|
checkCodexReadiness: () => checkCodexReadiness,
|
|
44484
44433
|
claimActiveDaemon: () => claimActiveDaemon,
|
|
44485
|
-
classifyFetchFailure: () => classifyFetchFailure,
|
|
44486
|
-
classifyHttpOutcome: () => classifyHttpOutcome,
|
|
44487
44434
|
classifyJobBindingSource: () => classifyJobBindingSource,
|
|
44488
44435
|
clearCodexReadinessCache: () => clearCodexReadinessCache,
|
|
44489
44436
|
codexCommandResolvesWithoutOverride: () => codexCommandResolvesWithoutOverride,
|
|
@@ -44492,7 +44439,6 @@ __export(index_exports, {
|
|
|
44492
44439
|
collectCodexCommandCandidates: () => collectCodexCommandCandidates,
|
|
44493
44440
|
commandExists: () => commandExists,
|
|
44494
44441
|
createAiToolFailureTracker: () => createAiToolFailureTracker,
|
|
44495
|
-
createDevkitAutoRouter: () => createDevkitAutoRouter,
|
|
44496
44442
|
createFileMessageHandler: () => createFileMessageHandler,
|
|
44497
44443
|
createOutboundBehavior: () => createOutboundBehavior,
|
|
44498
44444
|
createUserAttentionWatchParentMonitor: () => createUserAttentionWatchParentMonitor,
|
|
@@ -44503,7 +44449,6 @@ __export(index_exports, {
|
|
|
44503
44449
|
detectGatewayInvocation: () => detectGatewayInvocation,
|
|
44504
44450
|
detectMessageEligibleOfflineReplaySupport: () => detectMessageEligibleOfflineReplaySupport,
|
|
44505
44451
|
detectRuntime: () => detectRuntime,
|
|
44506
|
-
devkitServerDbExists: () => devkitServerDbExists,
|
|
44507
44452
|
ensureDaemonReady: () => ensureDaemonReady,
|
|
44508
44453
|
ensureDefaultAiProvider: () => ensureDefaultAiProvider,
|
|
44509
44454
|
ensureOpenClawOkxA2aPluginConfig: () => ensureOpenClawOkxA2aPluginConfig,
|
|
@@ -44526,7 +44471,6 @@ __export(index_exports, {
|
|
|
44526
44471
|
getSessionBusyTracker: () => getSessionBusyTracker,
|
|
44527
44472
|
getXmtpCreationCooldown: () => getXmtpCreationCooldown,
|
|
44528
44473
|
handleCapabilitiesCommand: () => handleCapabilitiesCommand,
|
|
44529
|
-
handleDevkitCommand: () => handleDevkitCommand,
|
|
44530
44474
|
handleDoctorCommand: () => handleDoctorCommand,
|
|
44531
44475
|
handleXmtpDebugCommand: () => handleXmtpDebugCommand,
|
|
44532
44476
|
handleXmtpSendCommand: () => handleXmtpSendCommand,
|
|
@@ -44568,7 +44512,6 @@ __export(index_exports, {
|
|
|
44568
44512
|
nodeVersionSatisfies: () => nodeVersionSatisfies,
|
|
44569
44513
|
normalizeAiProvider: () => normalizeAiProvider,
|
|
44570
44514
|
normalizeAiRuntimeProvider: () => normalizeAiRuntimeProvider,
|
|
44571
|
-
normalizeDevkitTarget: () => normalizeDevkitTarget,
|
|
44572
44515
|
normalizeHermesOkxA2aPluginConfig: () => normalizeHermesOkxA2aPluginConfig,
|
|
44573
44516
|
notifyAgentMessageToUserAttention: () => notifyAgentMessageToUserAttention,
|
|
44574
44517
|
notifyDirectToUserAttention: () => notifyDirectToUserAttention,
|
|
@@ -44585,7 +44528,6 @@ __export(index_exports, {
|
|
|
44585
44528
|
persistCurrentRuntimeSelectionForNewJob: () => persistCurrentRuntimeSelectionForNewJob,
|
|
44586
44529
|
pickOnchainosWin32Candidate: () => pickOnchainosWin32Candidate,
|
|
44587
44530
|
prepareAndBindCurrentRuntimeForNewJob: () => prepareAndBindCurrentRuntimeForNewJob,
|
|
44588
|
-
printDevkitUsage: () => printDevkitUsage,
|
|
44589
44531
|
printLogsExportUsage: () => printLogsExportUsage,
|
|
44590
44532
|
printXmtpTestUsage: () => printXmtpTestUsage,
|
|
44591
44533
|
probeCodexAuthStatus: () => probeCodexAuthStatus,
|
|
@@ -44597,7 +44539,6 @@ __export(index_exports, {
|
|
|
44597
44539
|
readLastLines: () => readLastLines,
|
|
44598
44540
|
readParentProcessCommandForPlatform: () => readParentProcessCommandForPlatform,
|
|
44599
44541
|
readUserAttentionWatcherEvent: () => readUserAttentionWatcherEvent,
|
|
44600
|
-
redactSummary: () => redactSummary,
|
|
44601
44542
|
refreshAgentsAndWait: () => refreshAgentsAndWait,
|
|
44602
44543
|
refreshOnchainosVersionMetadata: () => refreshOnchainosVersionMetadata,
|
|
44603
44544
|
registerUserAttentionWatcher: () => registerUserAttentionWatcher,
|
|
@@ -44620,7 +44561,6 @@ __export(index_exports, {
|
|
|
44620
44561
|
resolveCodexCommandSource: () => resolveCodexCommandSource,
|
|
44621
44562
|
resolveConfiguredAiProvider: () => resolveConfiguredAiProvider,
|
|
44622
44563
|
resolveConfiguredAiProviderForJob: () => resolveConfiguredAiProviderForJob,
|
|
44623
|
-
resolveDevkitServerDbPath: () => resolveDevkitServerDbPath,
|
|
44624
44564
|
resolveDirectCommunicationSessionTarget: () => resolveDirectCommunicationSessionTarget,
|
|
44625
44565
|
resolveDoctorTarget: () => resolveDoctorTarget,
|
|
44626
44566
|
resolveEnvelopePayload: () => resolveEnvelopePayload,
|
|
@@ -62191,7 +62131,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
62191
62131
|
client: {
|
|
62192
62132
|
id: "gateway-client",
|
|
62193
62133
|
displayName: "okx-a2a-node",
|
|
62194
|
-
version: "0.2.19
|
|
62134
|
+
version: "0.2.19",
|
|
62195
62135
|
platform: "node",
|
|
62196
62136
|
mode: "backend",
|
|
62197
62137
|
instanceId
|
|
@@ -62202,7 +62142,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
62202
62142
|
commands: [],
|
|
62203
62143
|
permissions: {},
|
|
62204
62144
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
62205
|
-
userAgent: `okx-a2a-node/${"0.2.19
|
|
62145
|
+
userAgent: `okx-a2a-node/${"0.2.19"}`,
|
|
62206
62146
|
auth: {
|
|
62207
62147
|
...config.token ? { token: config.token } : {},
|
|
62208
62148
|
...config.password ? { password: config.password } : {}
|
|
@@ -67795,8 +67735,8 @@ function isA2AEnvelope(payload) {
|
|
|
67795
67735
|
|
|
67796
67736
|
// src/listener.ts
|
|
67797
67737
|
init_log();
|
|
67798
|
-
var
|
|
67799
|
-
var
|
|
67738
|
+
var import_node_fs19 = require("node:fs");
|
|
67739
|
+
var import_promises8 = require("node:fs/promises");
|
|
67800
67740
|
var import_node_os8 = require("node:os");
|
|
67801
67741
|
var import_node_path25 = require("node:path");
|
|
67802
67742
|
|
|
@@ -67907,472 +67847,6 @@ function createOnchainosSigner(agent) {
|
|
|
67907
67847
|
// src/listener.ts
|
|
67908
67848
|
init_session_store();
|
|
67909
67849
|
|
|
67910
|
-
// src/devkit-delivery.ts
|
|
67911
|
-
var import_promises8 = require("node:dns/promises");
|
|
67912
|
-
|
|
67913
|
-
// src/devkit-target.ts
|
|
67914
|
-
var import_node_net2 = require("node:net");
|
|
67915
|
-
var DevkitTargetError = class extends Error {
|
|
67916
|
-
constructor(field, message) {
|
|
67917
|
-
super(message);
|
|
67918
|
-
this.field = field;
|
|
67919
|
-
this.name = "DevkitTargetError";
|
|
67920
|
-
}
|
|
67921
|
-
field;
|
|
67922
|
-
};
|
|
67923
|
-
function normalizeDevkitTarget(origin, port) {
|
|
67924
|
-
if (typeof origin !== "string" || origin.includes("\\")) {
|
|
67925
|
-
throw new DevkitTargetError("url", "URL must be an HTTP or HTTPS loopback origin");
|
|
67926
|
-
}
|
|
67927
|
-
const originParts = /^(https?):\/\/([^/?#]*)(.*)$/i.exec(origin);
|
|
67928
|
-
if (!originParts) {
|
|
67929
|
-
throw new DevkitTargetError("url", "URL must be an HTTP or HTTPS loopback origin");
|
|
67930
|
-
}
|
|
67931
|
-
let parsedUrl;
|
|
67932
|
-
try {
|
|
67933
|
-
parsedUrl = new URL(origin);
|
|
67934
|
-
} catch {
|
|
67935
|
-
throw new DevkitTargetError("url", "URL must be a valid HTTP or HTTPS loopback origin");
|
|
67936
|
-
}
|
|
67937
|
-
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
67938
|
-
throw new DevkitTargetError("url", "URL protocol must be HTTP or HTTPS");
|
|
67939
|
-
}
|
|
67940
|
-
const rawAuthority = originParts[2];
|
|
67941
|
-
const rawHost = rawAuthority.slice(rawAuthority.lastIndexOf("@") + 1);
|
|
67942
|
-
const hasEmbeddedPort = rawHost.startsWith("[") ? /^\[[^\]]+\]:/.test(rawHost) : rawHost.includes(":");
|
|
67943
|
-
if (rawAuthority.includes("@") || hasEmbeddedPort || originParts[3] !== "" && originParts[3] !== "/") {
|
|
67944
|
-
throw new DevkitTargetError("url", "URL must not include credentials, a port, or a path, query, or fragment");
|
|
67945
|
-
}
|
|
67946
|
-
const hostname = parsedUrl.hostname.toLowerCase();
|
|
67947
|
-
if (!isDevkitLoopbackHostname(hostname)) {
|
|
67948
|
-
throw new DevkitTargetError("url", "URL hostname must be localhost or a loopback address");
|
|
67949
|
-
}
|
|
67950
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
67951
|
-
throw new DevkitTargetError("port", "Port must be an integer from 1 to 65535");
|
|
67952
|
-
}
|
|
67953
|
-
const normalizedHostname = hostname === "localhost" ? "127.0.0.1" : hostname;
|
|
67954
|
-
return {
|
|
67955
|
-
origin: `${parsedUrl.protocol}//${normalizedHostname}`,
|
|
67956
|
-
port
|
|
67957
|
-
};
|
|
67958
|
-
}
|
|
67959
|
-
function isDevkitLoopbackHostname(hostname) {
|
|
67960
|
-
const address = hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
|
|
67961
|
-
if (address.toLowerCase() === "localhost") {
|
|
67962
|
-
return true;
|
|
67963
|
-
}
|
|
67964
|
-
return (0, import_node_net2.isIP)(address) === 4 ? address.startsWith("127.") : (0, import_node_net2.isIP)(address) === 6 && address === "::1";
|
|
67965
|
-
}
|
|
67966
|
-
|
|
67967
|
-
// src/devkit-delivery.ts
|
|
67968
|
-
init_sentry_logger();
|
|
67969
|
-
init_error_diagnostics();
|
|
67970
|
-
|
|
67971
|
-
// src/devkit-types.ts
|
|
67972
|
-
var DEVKIT_MAX_CONCURRENCY = 16;
|
|
67973
|
-
var DEVKIT_MAX_PENDING = 256;
|
|
67974
|
-
var DEVKIT_MAX_PENDING_BYTES = 16 * 1024 * 1024;
|
|
67975
|
-
var DEVKIT_MAX_MESSAGE_BYTES = 1 * 1024 * 1024;
|
|
67976
|
-
var DEVKIT_REQUEST_BUDGET_MS = 5e3;
|
|
67977
|
-
var DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES = 4 * 1024;
|
|
67978
|
-
var DEVKIT_RESPONSE_SUMMARY_MAX_CHARS = 256;
|
|
67979
|
-
var DEVKIT_OUTCOME = {
|
|
67980
|
-
HTTP_ACCEPTED: "http_accepted",
|
|
67981
|
-
DROPPED: "dropped"
|
|
67982
|
-
};
|
|
67983
|
-
var DEVKIT_DROP_REASON = {
|
|
67984
|
-
REQUEST_TOO_LARGE: "request_too_large",
|
|
67985
|
-
// serialized > 1 MiB (FR-3-AC-6)
|
|
67986
|
-
PENDING_OVERFLOW: "pending_overflow",
|
|
67987
|
-
// > 256 items or > 16 MiB total pending (NFR-2-AC-1)
|
|
67988
|
-
CONFIG_CHANGED: "config_changed",
|
|
67989
|
-
// snapshot version changed/removed before send (FR-2-AC-6)
|
|
67990
|
-
CONFIG_READ_FAILED: "config_read_failed",
|
|
67991
|
-
// snapshot unreadable/corrupt (FR-2-AC-5)
|
|
67992
|
-
HTTP_STATUS: "http_status",
|
|
67993
|
-
// non-2xx response (FR-3-AC-3)
|
|
67994
|
-
REDIRECT_BLOCKED: "redirect_blocked",
|
|
67995
|
-
// 3xx response, not followed (NFR-3-AC-2)
|
|
67996
|
-
CONNECTION_FAILED: "connection_failed",
|
|
67997
|
-
// ECONNREFUSED / reset / unreachable (FR-3-AC-4)
|
|
67998
|
-
TIMEOUT: "timeout",
|
|
67999
|
-
// exceeded the 5 s budget (FR-3-AC-4)
|
|
68000
|
-
REQUEST_BUILD_ERROR: "request_build_error",
|
|
68001
|
-
// serialization / target build failure
|
|
68002
|
-
RESPONSE_READ_ERROR: "response_read_error",
|
|
68003
|
-
// diagnostic read failure
|
|
68004
|
-
SHUTDOWN_CANCELLED: "shutdown_cancelled"
|
|
68005
|
-
// daemon stopped before send (NFR-2-AC-3)
|
|
68006
|
-
};
|
|
68007
|
-
|
|
68008
|
-
// src/devkit-delivery.ts
|
|
68009
|
-
var COMPONENT = "node_devkit";
|
|
68010
|
-
var SECRET_KEYS = "authorization|bearer|basic|jwt|password|api[_-]?key|secret|token";
|
|
68011
|
-
var SECRET_SCHEME_PATTERN = new RegExp(`\\b(?:${SECRET_KEYS})\\s+\\S+`, "gi");
|
|
68012
|
-
var SECRET_KV_PATTERN = new RegExp(
|
|
68013
|
-
`("?)(${SECRET_KEYS})("?)\\s*([:=])\\s*"?[^"\\s,}]+`,
|
|
68014
|
-
"gi"
|
|
68015
|
-
);
|
|
68016
|
-
function fallbackDeliveryId(parts) {
|
|
68017
|
-
return `devkit-${parts.jobId ?? "none"}-${parts.sessionKey ?? "none"}-${parts.receivedAt}`;
|
|
68018
|
-
}
|
|
68019
|
-
function buildSessionEnvelope(ev, ctx = {}) {
|
|
68020
|
-
const now = ctx.now ?? Date.now;
|
|
68021
|
-
const receivedAt = Math.floor(now() / 1e3);
|
|
68022
|
-
const jobId = ev.jobId ?? null;
|
|
68023
|
-
const agentId = ev.agentId ?? null;
|
|
68024
|
-
const deliveryId = ev.messageId ?? fallbackDeliveryId({ jobId, sessionKey: ev.sessionKey, receivedAt });
|
|
68025
|
-
const messageId = ev.messageId ?? deliveryId;
|
|
68026
|
-
return {
|
|
68027
|
-
deliveryId,
|
|
68028
|
-
receivedAt,
|
|
68029
|
-
kind: "session",
|
|
68030
|
-
agentId,
|
|
68031
|
-
event: {
|
|
68032
|
-
sessionKey: ev.sessionKey,
|
|
68033
|
-
content: ev.content,
|
|
68034
|
-
messageId,
|
|
68035
|
-
jobId,
|
|
68036
|
-
agentId
|
|
68037
|
-
}
|
|
68038
|
-
};
|
|
68039
|
-
}
|
|
68040
|
-
function buildJobEnvelope(ev, _ctx = {}) {
|
|
68041
|
-
const sessionAgentId = ev.sessionAgentId ?? null;
|
|
68042
|
-
const receivedAt = Math.floor(ev.message.receivedAtMs / 1e3);
|
|
68043
|
-
return {
|
|
68044
|
-
deliveryId: ev.message.id,
|
|
68045
|
-
receivedAt,
|
|
68046
|
-
kind: "job",
|
|
68047
|
-
agentId: sessionAgentId,
|
|
68048
|
-
event: {
|
|
68049
|
-
jobId: ev.jobId,
|
|
68050
|
-
sessionAgentId,
|
|
68051
|
-
message: {
|
|
68052
|
-
...ev.message,
|
|
68053
|
-
content: ev.message.rawText
|
|
68054
|
-
}
|
|
68055
|
-
}
|
|
68056
|
-
};
|
|
68057
|
-
}
|
|
68058
|
-
function classifyHttpOutcome(status) {
|
|
68059
|
-
if (status >= 200 && status < 300) {
|
|
68060
|
-
return { outcome: DEVKIT_OUTCOME.HTTP_ACCEPTED };
|
|
68061
|
-
}
|
|
68062
|
-
if (status >= 300 && status < 400) {
|
|
68063
|
-
return { outcome: DEVKIT_OUTCOME.DROPPED, reason: DEVKIT_DROP_REASON.REDIRECT_BLOCKED };
|
|
68064
|
-
}
|
|
68065
|
-
return { outcome: DEVKIT_OUTCOME.DROPPED, reason: DEVKIT_DROP_REASON.HTTP_STATUS };
|
|
68066
|
-
}
|
|
68067
|
-
function classifyFetchFailure(params) {
|
|
68068
|
-
if (params.cancelledByShutdown) {
|
|
68069
|
-
return DEVKIT_DROP_REASON.SHUTDOWN_CANCELLED;
|
|
68070
|
-
}
|
|
68071
|
-
if (params.timedOut || params.errorCategory === "timeout") {
|
|
68072
|
-
return DEVKIT_DROP_REASON.TIMEOUT;
|
|
68073
|
-
}
|
|
68074
|
-
return DEVKIT_DROP_REASON.CONNECTION_FAILED;
|
|
68075
|
-
}
|
|
68076
|
-
function redactSummary(raw) {
|
|
68077
|
-
const collapsed = raw.replace(/\s+/g, " ").trim();
|
|
68078
|
-
const redacted = collapsed.replace(SECRET_SCHEME_PATTERN, "[REDACTED]").replace(
|
|
68079
|
-
SECRET_KV_PATTERN,
|
|
68080
|
-
(_match, keyQuote, key, keyQuoteClose, sep3) => `${keyQuote}${key}${keyQuoteClose}${sep3}[REDACTED]`
|
|
68081
|
-
);
|
|
68082
|
-
const truncated = redacted.length > DEVKIT_RESPONSE_SUMMARY_MAX_CHARS;
|
|
68083
|
-
return { text: redacted.slice(0, DEVKIT_RESPONSE_SUMMARY_MAX_CHARS), truncated };
|
|
68084
|
-
}
|
|
68085
|
-
async function readRedactedResponse(response) {
|
|
68086
|
-
let bodyText;
|
|
68087
|
-
try {
|
|
68088
|
-
bodyText = await response.text();
|
|
68089
|
-
} catch {
|
|
68090
|
-
return { responseBytesRead: 0, responseTruncated: false, responseSummary: "" };
|
|
68091
|
-
}
|
|
68092
|
-
const bytes = Buffer.from(bodyText, "utf8");
|
|
68093
|
-
const diagnosticSlice = bytes.subarray(0, DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES);
|
|
68094
|
-
const sliceTruncated = bytes.byteLength > DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES;
|
|
68095
|
-
const summary = redactSummary(diagnosticSlice.toString("utf8"));
|
|
68096
|
-
return {
|
|
68097
|
-
responseBytesRead: diagnosticSlice.byteLength,
|
|
68098
|
-
responseTruncated: sliceTruncated || summary.truncated,
|
|
68099
|
-
responseSummary: summary.text
|
|
68100
|
-
};
|
|
68101
|
-
}
|
|
68102
|
-
async function isLoopbackTarget(origin) {
|
|
68103
|
-
let hostname;
|
|
68104
|
-
try {
|
|
68105
|
-
hostname = new URL(origin).hostname;
|
|
68106
|
-
} catch {
|
|
68107
|
-
return false;
|
|
68108
|
-
}
|
|
68109
|
-
if (!isDevkitLoopbackHostname(hostname)) {
|
|
68110
|
-
return false;
|
|
68111
|
-
}
|
|
68112
|
-
if (hostname.toLowerCase() !== "localhost") {
|
|
68113
|
-
return true;
|
|
68114
|
-
}
|
|
68115
|
-
try {
|
|
68116
|
-
const resolved = await (0, import_promises8.lookup)(hostname);
|
|
68117
|
-
return isDevkitLoopbackHostname(resolved.address);
|
|
68118
|
-
} catch {
|
|
68119
|
-
return false;
|
|
68120
|
-
}
|
|
68121
|
-
}
|
|
68122
|
-
function orderingKeyFor(envelope, config) {
|
|
68123
|
-
const routeKey = envelope.kind === "session" ? envelope.event.sessionKey : envelope.event.jobId;
|
|
68124
|
-
return JSON.stringify([config.origin, config.port, envelope.kind, routeKey]);
|
|
68125
|
-
}
|
|
68126
|
-
function targetFields(config) {
|
|
68127
|
-
return {
|
|
68128
|
-
targetOrigin: config.origin,
|
|
68129
|
-
targetPort: config.port,
|
|
68130
|
-
targetId: JSON.stringify([config.origin, config.port])
|
|
68131
|
-
};
|
|
68132
|
-
}
|
|
68133
|
-
function copyConfig(config) {
|
|
68134
|
-
return { ...config };
|
|
68135
|
-
}
|
|
68136
|
-
function sleep4(ms) {
|
|
68137
|
-
return new Promise((resolve11) => setTimeout(resolve11, Math.max(0, ms)));
|
|
68138
|
-
}
|
|
68139
|
-
var DevkitDeliveryDispatcher = class {
|
|
68140
|
-
now;
|
|
68141
|
-
fetchImpl;
|
|
68142
|
-
diagnosticLogger;
|
|
68143
|
-
pendingQueue = [];
|
|
68144
|
-
pendingBytes = 0;
|
|
68145
|
-
activeKeys = /* @__PURE__ */ new Set();
|
|
68146
|
-
inFlight = /* @__PURE__ */ new Set();
|
|
68147
|
-
activeControllers = /* @__PURE__ */ new Map();
|
|
68148
|
-
shuttingDown = false;
|
|
68149
|
-
constructor(options) {
|
|
68150
|
-
this.now = options.now ?? Date.now;
|
|
68151
|
-
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
68152
|
-
this.diagnosticLogger = options.diagnosticLogger ?? logger;
|
|
68153
|
-
}
|
|
68154
|
-
enqueue(input) {
|
|
68155
|
-
const config = copyConfig(input.config);
|
|
68156
|
-
const serialized = JSON.stringify(input.envelope);
|
|
68157
|
-
const envelope = JSON.parse(serialized);
|
|
68158
|
-
const bytes = Buffer.byteLength(serialized, "utf8");
|
|
68159
|
-
const kind = envelope.kind;
|
|
68160
|
-
const deliveryId = envelope.deliveryId;
|
|
68161
|
-
const item = {
|
|
68162
|
-
envelope,
|
|
68163
|
-
config,
|
|
68164
|
-
serialized,
|
|
68165
|
-
bytes,
|
|
68166
|
-
cancelledByShutdown: false,
|
|
68167
|
-
timedOut: false
|
|
68168
|
-
};
|
|
68169
|
-
if (this.shuttingDown) {
|
|
68170
|
-
this.emitCancelled(item, 0);
|
|
68171
|
-
return false;
|
|
68172
|
-
}
|
|
68173
|
-
if (bytes > DEVKIT_MAX_MESSAGE_BYTES) {
|
|
68174
|
-
this.emitDropped({
|
|
68175
|
-
...targetFields(config),
|
|
68176
|
-
deliveryId,
|
|
68177
|
-
kind,
|
|
68178
|
-
reason: DEVKIT_DROP_REASON.REQUEST_TOO_LARGE,
|
|
68179
|
-
durationMs: 0
|
|
68180
|
-
});
|
|
68181
|
-
return true;
|
|
68182
|
-
}
|
|
68183
|
-
if (this.pendingQueue.length >= DEVKIT_MAX_PENDING || this.pendingBytes + bytes > DEVKIT_MAX_PENDING_BYTES) {
|
|
68184
|
-
this.emitDropped({
|
|
68185
|
-
...targetFields(config),
|
|
68186
|
-
deliveryId,
|
|
68187
|
-
kind,
|
|
68188
|
-
reason: DEVKIT_DROP_REASON.PENDING_OVERFLOW,
|
|
68189
|
-
durationMs: 0
|
|
68190
|
-
});
|
|
68191
|
-
return false;
|
|
68192
|
-
}
|
|
68193
|
-
this.pendingQueue.push(item);
|
|
68194
|
-
this.pendingBytes += bytes;
|
|
68195
|
-
this.diagnosticLogger.info(LogEvent.DEVKIT_DELIVERY_ACCEPTED, {
|
|
68196
|
-
component: COMPONENT,
|
|
68197
|
-
deliveryId,
|
|
68198
|
-
kind,
|
|
68199
|
-
...targetFields(config),
|
|
68200
|
-
agentId: envelope.agentId ?? void 0
|
|
68201
|
-
});
|
|
68202
|
-
this.pump();
|
|
68203
|
-
return true;
|
|
68204
|
-
}
|
|
68205
|
-
pump() {
|
|
68206
|
-
if (this.shuttingDown) {
|
|
68207
|
-
return;
|
|
68208
|
-
}
|
|
68209
|
-
while (this.activeKeys.size < DEVKIT_MAX_CONCURRENCY) {
|
|
68210
|
-
const index2 = this.pendingQueue.findIndex(
|
|
68211
|
-
(item2) => !this.activeKeys.has(orderingKeyFor(item2.envelope, item2.config))
|
|
68212
|
-
);
|
|
68213
|
-
if (index2 === -1) {
|
|
68214
|
-
break;
|
|
68215
|
-
}
|
|
68216
|
-
const [item] = this.pendingQueue.splice(index2, 1);
|
|
68217
|
-
this.pendingBytes -= item.bytes;
|
|
68218
|
-
const key = orderingKeyFor(item.envelope, item.config);
|
|
68219
|
-
this.activeKeys.add(key);
|
|
68220
|
-
const promise = this.send(item).finally(() => {
|
|
68221
|
-
this.activeKeys.delete(key);
|
|
68222
|
-
this.inFlight.delete(promise);
|
|
68223
|
-
this.pump();
|
|
68224
|
-
});
|
|
68225
|
-
this.inFlight.add(promise);
|
|
68226
|
-
}
|
|
68227
|
-
}
|
|
68228
|
-
async send(item) {
|
|
68229
|
-
const startedAt = this.now();
|
|
68230
|
-
const { envelope } = item;
|
|
68231
|
-
const { config } = item;
|
|
68232
|
-
const controller = new AbortController();
|
|
68233
|
-
this.activeControllers.set(item, controller);
|
|
68234
|
-
const loopbackOk = await isLoopbackTarget(config.origin);
|
|
68235
|
-
if (item.cancelledByShutdown) {
|
|
68236
|
-
this.activeControllers.delete(item);
|
|
68237
|
-
this.emitCancelled(item, this.now() - startedAt);
|
|
68238
|
-
return;
|
|
68239
|
-
}
|
|
68240
|
-
if (!loopbackOk) {
|
|
68241
|
-
this.activeControllers.delete(item);
|
|
68242
|
-
this.emitHttpFailed(
|
|
68243
|
-
item,
|
|
68244
|
-
DEVKIT_DROP_REASON.CONNECTION_FAILED,
|
|
68245
|
-
{ errorCategory: "network_unavailable" },
|
|
68246
|
-
this.now() - startedAt
|
|
68247
|
-
);
|
|
68248
|
-
return;
|
|
68249
|
-
}
|
|
68250
|
-
const url = `${config.origin}:${config.port}${config.eventPath}`;
|
|
68251
|
-
const timeoutTimer = setTimeout(() => {
|
|
68252
|
-
item.timedOut = true;
|
|
68253
|
-
controller.abort();
|
|
68254
|
-
}, DEVKIT_REQUEST_BUDGET_MS);
|
|
68255
|
-
let response;
|
|
68256
|
-
try {
|
|
68257
|
-
response = await this.fetchImpl(url, {
|
|
68258
|
-
method: "POST",
|
|
68259
|
-
headers: { "content-type": "application/json" },
|
|
68260
|
-
body: item.serialized,
|
|
68261
|
-
redirect: "manual",
|
|
68262
|
-
signal: controller.signal
|
|
68263
|
-
});
|
|
68264
|
-
} catch (err) {
|
|
68265
|
-
clearTimeout(timeoutTimer);
|
|
68266
|
-
this.activeControllers.delete(item);
|
|
68267
|
-
const durationMs2 = this.now() - startedAt;
|
|
68268
|
-
if (item.cancelledByShutdown) {
|
|
68269
|
-
this.emitCancelled(item, durationMs2);
|
|
68270
|
-
return;
|
|
68271
|
-
}
|
|
68272
|
-
const diagnostics = buildErrorDiagnostics(
|
|
68273
|
-
LogEvent.DEVKIT_DELIVERY_HTTP_FAILED,
|
|
68274
|
-
err instanceof Error ? err : void 0,
|
|
68275
|
-
{}
|
|
68276
|
-
);
|
|
68277
|
-
const reason = classifyFetchFailure({
|
|
68278
|
-
cancelledByShutdown: item.cancelledByShutdown,
|
|
68279
|
-
timedOut: item.timedOut,
|
|
68280
|
-
errorCategory: diagnostics.errorCategory
|
|
68281
|
-
});
|
|
68282
|
-
this.emitHttpFailed(item, reason, diagnostics, durationMs2, err instanceof Error ? err : void 0);
|
|
68283
|
-
return;
|
|
68284
|
-
}
|
|
68285
|
-
clearTimeout(timeoutTimer);
|
|
68286
|
-
this.activeControllers.delete(item);
|
|
68287
|
-
const durationMs = this.now() - startedAt;
|
|
68288
|
-
if (item.cancelledByShutdown) {
|
|
68289
|
-
this.emitCancelled(item, durationMs);
|
|
68290
|
-
return;
|
|
68291
|
-
}
|
|
68292
|
-
const status = response.status;
|
|
68293
|
-
const classified = classifyHttpOutcome(status);
|
|
68294
|
-
if (classified.outcome === DEVKIT_OUTCOME.HTTP_ACCEPTED) {
|
|
68295
|
-
this.diagnosticLogger.info(LogEvent.DEVKIT_DELIVERY_HTTP_ACCEPTED, {
|
|
68296
|
-
component: COMPONENT,
|
|
68297
|
-
deliveryId: envelope.deliveryId,
|
|
68298
|
-
kind: envelope.kind,
|
|
68299
|
-
...targetFields(config),
|
|
68300
|
-
statusCode: status,
|
|
68301
|
-
durationMs
|
|
68302
|
-
});
|
|
68303
|
-
return;
|
|
68304
|
-
}
|
|
68305
|
-
const redaction = await readRedactedResponse(response);
|
|
68306
|
-
this.emitDropped({
|
|
68307
|
-
...targetFields(config),
|
|
68308
|
-
deliveryId: envelope.deliveryId,
|
|
68309
|
-
kind: envelope.kind,
|
|
68310
|
-
reason: classified.reason,
|
|
68311
|
-
statusCode: status,
|
|
68312
|
-
durationMs,
|
|
68313
|
-
...redaction
|
|
68314
|
-
});
|
|
68315
|
-
}
|
|
68316
|
-
async shutdown(deadlineMs) {
|
|
68317
|
-
this.shuttingDown = true;
|
|
68318
|
-
const deadline = this.now() + Math.max(0, deadlineMs);
|
|
68319
|
-
if (this.inFlight.size > 0) {
|
|
68320
|
-
const remaining = Math.max(0, deadline - this.now());
|
|
68321
|
-
await Promise.race([Promise.allSettled(Array.from(this.inFlight)), sleep4(remaining)]);
|
|
68322
|
-
}
|
|
68323
|
-
for (const [item, controller] of this.activeControllers) {
|
|
68324
|
-
item.cancelledByShutdown = true;
|
|
68325
|
-
controller.abort();
|
|
68326
|
-
}
|
|
68327
|
-
const stillPending = this.pendingQueue.splice(0, this.pendingQueue.length);
|
|
68328
|
-
this.pendingBytes = 0;
|
|
68329
|
-
for (const item of stillPending) {
|
|
68330
|
-
this.emitCancelled(item, 0);
|
|
68331
|
-
}
|
|
68332
|
-
}
|
|
68333
|
-
emitDropped(params) {
|
|
68334
|
-
this.diagnosticLogger.info(LogEvent.DEVKIT_DELIVERY_DROPPED, {
|
|
68335
|
-
component: COMPONENT,
|
|
68336
|
-
outcome: DEVKIT_OUTCOME.DROPPED,
|
|
68337
|
-
deliveryId: params.deliveryId,
|
|
68338
|
-
kind: params.kind,
|
|
68339
|
-
targetOrigin: params.targetOrigin,
|
|
68340
|
-
targetPort: params.targetPort,
|
|
68341
|
-
targetId: params.targetId,
|
|
68342
|
-
reason: params.reason,
|
|
68343
|
-
durationMs: params.durationMs,
|
|
68344
|
-
...params.statusCode !== void 0 ? { statusCode: params.statusCode } : {},
|
|
68345
|
-
...params.responseBytesRead !== void 0 ? { responseBytesRead: params.responseBytesRead } : {},
|
|
68346
|
-
...params.responseTruncated !== void 0 ? { responseTruncated: params.responseTruncated } : {},
|
|
68347
|
-
...params.responseSummary !== void 0 ? { responseSummary: params.responseSummary } : {}
|
|
68348
|
-
});
|
|
68349
|
-
}
|
|
68350
|
-
emitHttpFailed(item, reason, diagnostics, durationMs, err) {
|
|
68351
|
-
this.diagnosticLogger.error(LogEvent.DEVKIT_DELIVERY_HTTP_FAILED, err, {
|
|
68352
|
-
component: COMPONENT,
|
|
68353
|
-
outcome: DEVKIT_OUTCOME.DROPPED,
|
|
68354
|
-
deliveryId: item.envelope.deliveryId,
|
|
68355
|
-
kind: item.envelope.kind,
|
|
68356
|
-
...targetFields(item.config),
|
|
68357
|
-
reason,
|
|
68358
|
-
durationMs,
|
|
68359
|
-
...diagnostics.errorCategory ? { errorCategory: diagnostics.errorCategory } : {},
|
|
68360
|
-
...diagnostics.errorCode ? { errorCode: diagnostics.errorCode } : {}
|
|
68361
|
-
});
|
|
68362
|
-
}
|
|
68363
|
-
emitCancelled(item, durationMs) {
|
|
68364
|
-
this.diagnosticLogger.info(LogEvent.DEVKIT_DELIVERY_CANCELLED, {
|
|
68365
|
-
component: COMPONENT,
|
|
68366
|
-
outcome: DEVKIT_OUTCOME.DROPPED,
|
|
68367
|
-
deliveryId: item.envelope.deliveryId,
|
|
68368
|
-
kind: item.envelope.kind,
|
|
68369
|
-
...targetFields(item.config),
|
|
68370
|
-
reason: DEVKIT_DROP_REASON.SHUTDOWN_CANCELLED,
|
|
68371
|
-
durationMs
|
|
68372
|
-
});
|
|
68373
|
-
}
|
|
68374
|
-
};
|
|
68375
|
-
|
|
68376
67850
|
// src/ai-dispatch-queue.ts
|
|
68377
67851
|
async function enqueueAiJobMessageDispatch(params) {
|
|
68378
67852
|
const commands = params.commands ?? new CommandStore(params.homeDir);
|
|
@@ -68398,475 +67872,6 @@ async function enqueueAiSessionMessageDispatch(params) {
|
|
|
68398
67872
|
return command;
|
|
68399
67873
|
}
|
|
68400
67874
|
|
|
68401
|
-
// src/devkit-router.ts
|
|
68402
|
-
init_sentry_logger();
|
|
68403
|
-
function createDevkitAutoRouter(deps) {
|
|
68404
|
-
const { commands, dispatcher, readSnapshots } = deps;
|
|
68405
|
-
const diagnosticLogger = deps.diagnosticLogger ?? logger;
|
|
68406
|
-
function readConfigSnapshots(phase) {
|
|
68407
|
-
try {
|
|
68408
|
-
const configs = readSnapshots();
|
|
68409
|
-
return {
|
|
68410
|
-
ok: true,
|
|
68411
|
-
// Capture detached, shallow immutable copies before any enqueue can trigger a registry
|
|
68412
|
-
// update. Delivery then owns the exact target/path selected for this inbound message.
|
|
68413
|
-
configs: configs.map((config) => Object.freeze({ ...config }))
|
|
68414
|
-
};
|
|
68415
|
-
} catch (err) {
|
|
68416
|
-
diagnosticLogger.error(
|
|
68417
|
-
LogEvent.DEVKIT_ROUTE_CONFIG_READ_FAILED,
|
|
68418
|
-
err instanceof Error ? err : new Error(String(err)),
|
|
68419
|
-
{
|
|
68420
|
-
component: "node_devkit",
|
|
68421
|
-
phase,
|
|
68422
|
-
outcome: "dropped",
|
|
68423
|
-
reason: "config_read_failed"
|
|
68424
|
-
}
|
|
68425
|
-
);
|
|
68426
|
-
return { ok: false };
|
|
68427
|
-
}
|
|
68428
|
-
}
|
|
68429
|
-
function enqueueForTargets(phase, envelope, configs, eventFields) {
|
|
68430
|
-
for (const config of configs) {
|
|
68431
|
-
const targetId = JSON.stringify([config.origin, config.port]);
|
|
68432
|
-
const targetFields2 = {
|
|
68433
|
-
targetOrigin: config.origin,
|
|
68434
|
-
targetPort: config.port,
|
|
68435
|
-
targetId
|
|
68436
|
-
};
|
|
68437
|
-
try {
|
|
68438
|
-
const accepted = dispatcher.enqueue({ envelope, config });
|
|
68439
|
-
diagnosticLogger.info(LogEvent.DEVKIT_ROUTE_CUSTOM_SERVER, {
|
|
68440
|
-
component: "node_devkit",
|
|
68441
|
-
phase,
|
|
68442
|
-
kind: envelope.kind,
|
|
68443
|
-
deliveryId: envelope.deliveryId,
|
|
68444
|
-
...targetFields2,
|
|
68445
|
-
outcome: accepted ? "accepted" : "dropped",
|
|
68446
|
-
...eventFields
|
|
68447
|
-
});
|
|
68448
|
-
} catch (err) {
|
|
68449
|
-
diagnosticLogger.error(
|
|
68450
|
-
LogEvent.DEVKIT_ROUTE_CUSTOM_SERVER,
|
|
68451
|
-
err instanceof Error ? err : new Error(String(err)),
|
|
68452
|
-
{
|
|
68453
|
-
component: "node_devkit",
|
|
68454
|
-
phase,
|
|
68455
|
-
kind: envelope.kind,
|
|
68456
|
-
deliveryId: envelope.deliveryId,
|
|
68457
|
-
...targetFields2,
|
|
68458
|
-
outcome: "dropped",
|
|
68459
|
-
reason: "enqueue_failed"
|
|
68460
|
-
}
|
|
68461
|
-
);
|
|
68462
|
-
}
|
|
68463
|
-
}
|
|
68464
|
-
}
|
|
68465
|
-
async function routeSession(event) {
|
|
68466
|
-
const read = readConfigSnapshots("session");
|
|
68467
|
-
if (!read.ok) {
|
|
68468
|
-
return;
|
|
68469
|
-
}
|
|
68470
|
-
if (read.configs.length === 0) {
|
|
68471
|
-
await enqueueAiSessionMessageDispatch({ commands, event });
|
|
68472
|
-
diagnosticLogger.info(LogEvent.DEVKIT_ROUTE_DEFAULT_AI, {
|
|
68473
|
-
component: "node_devkit",
|
|
68474
|
-
phase: "session",
|
|
68475
|
-
kind: "session",
|
|
68476
|
-
messageId: event.messageId ?? "",
|
|
68477
|
-
jobId: event.jobId ?? "",
|
|
68478
|
-
agentId: event.agentId ?? ""
|
|
68479
|
-
});
|
|
68480
|
-
return;
|
|
68481
|
-
}
|
|
68482
|
-
const envelope = buildSessionEnvelope(event);
|
|
68483
|
-
enqueueForTargets("session", envelope, read.configs, {
|
|
68484
|
-
messageId: event.messageId ?? "",
|
|
68485
|
-
jobId: event.jobId ?? "",
|
|
68486
|
-
agentId: event.agentId ?? ""
|
|
68487
|
-
});
|
|
68488
|
-
}
|
|
68489
|
-
async function routeJob(event) {
|
|
68490
|
-
const read = readConfigSnapshots("job");
|
|
68491
|
-
if (!read.ok) {
|
|
68492
|
-
return;
|
|
68493
|
-
}
|
|
68494
|
-
if (read.configs.length === 0) {
|
|
68495
|
-
await enqueueAiJobMessageDispatch({ commands, event });
|
|
68496
|
-
diagnosticLogger.info(LogEvent.DEVKIT_ROUTE_DEFAULT_AI, {
|
|
68497
|
-
component: "node_devkit",
|
|
68498
|
-
phase: "job",
|
|
68499
|
-
kind: "job",
|
|
68500
|
-
jobId: event.jobId,
|
|
68501
|
-
agentId: event.sessionAgentId ?? ""
|
|
68502
|
-
});
|
|
68503
|
-
return;
|
|
68504
|
-
}
|
|
68505
|
-
const envelope = buildJobEnvelope(event);
|
|
68506
|
-
enqueueForTargets("job", envelope, read.configs, {
|
|
68507
|
-
messageId: event.message.id,
|
|
68508
|
-
jobId: event.jobId,
|
|
68509
|
-
agentId: event.sessionAgentId ?? ""
|
|
68510
|
-
});
|
|
68511
|
-
}
|
|
68512
|
-
return { routeJob, routeSession };
|
|
68513
|
-
}
|
|
68514
|
-
|
|
68515
|
-
// src/devkit-server-store.ts
|
|
68516
|
-
var import_node_fs19 = require("node:fs");
|
|
68517
|
-
init_paths();
|
|
68518
|
-
init_session_store();
|
|
68519
|
-
var { DatabaseSync: DatabaseSync4 } = loadSqlite4();
|
|
68520
|
-
var DEVKIT_SERVER_APPLICATION_ID = 1329677395;
|
|
68521
|
-
var DEVKIT_SERVER_SCHEMA_VERSION = 2;
|
|
68522
|
-
var TABLE_NAME = `"devkit-server"`;
|
|
68523
|
-
var WRITE_RETRY_ATTEMPTS = 6;
|
|
68524
|
-
var DevkitServerStoreError = class extends Error {
|
|
68525
|
-
code;
|
|
68526
|
-
constructor(code, message) {
|
|
68527
|
-
super(message);
|
|
68528
|
-
this.name = "DevkitServerStoreError";
|
|
68529
|
-
this.code = code;
|
|
68530
|
-
}
|
|
68531
|
-
};
|
|
68532
|
-
function resolveDevkitServerDbPath(homeDir) {
|
|
68533
|
-
return resolveTaskPaths(homeDir).devkitServerDbPath;
|
|
68534
|
-
}
|
|
68535
|
-
function devkitServerDbExists(homeDir) {
|
|
68536
|
-
return (0, import_node_fs19.existsSync)(resolveDevkitServerDbPath(homeDir));
|
|
68537
|
-
}
|
|
68538
|
-
var DevkitServerStore = class _DevkitServerStore {
|
|
68539
|
-
dbPath;
|
|
68540
|
-
db;
|
|
68541
|
-
constructor(dbPath, db) {
|
|
68542
|
-
this.dbPath = dbPath;
|
|
68543
|
-
this.db = db;
|
|
68544
|
-
}
|
|
68545
|
-
static openForWrite(homeDir) {
|
|
68546
|
-
const paths = resolveTaskPaths(homeDir);
|
|
68547
|
-
const dbPath = paths.devkitServerDbPath;
|
|
68548
|
-
assertNotSymlink(paths.sqliteDir, "devkit server directory");
|
|
68549
|
-
ensureTaskDir(paths.sqliteDir);
|
|
68550
|
-
assertNotSymlink(paths.sqliteDir, "devkit server directory");
|
|
68551
|
-
assertSafeDatabasePath(dbPath);
|
|
68552
|
-
const db = new DatabaseSync4(dbPath);
|
|
68553
|
-
const store = new _DevkitServerStore(dbPath, db);
|
|
68554
|
-
try {
|
|
68555
|
-
store.configureConnectionForWrite();
|
|
68556
|
-
store.ensureSchemaForWrite();
|
|
68557
|
-
return store;
|
|
68558
|
-
} catch (error) {
|
|
68559
|
-
db.close();
|
|
68560
|
-
throw error;
|
|
68561
|
-
}
|
|
68562
|
-
}
|
|
68563
|
-
static openForRead(homeDir) {
|
|
68564
|
-
const dbPath = resolveDevkitServerDbPath(homeDir);
|
|
68565
|
-
if (!(0, import_node_fs19.existsSync)(dbPath)) {
|
|
68566
|
-
return null;
|
|
68567
|
-
}
|
|
68568
|
-
assertSafeDatabaseFile(dbPath);
|
|
68569
|
-
const db = new DatabaseSync4(dbPath, { readOnly: true });
|
|
68570
|
-
const store = new _DevkitServerStore(dbPath, db);
|
|
68571
|
-
try {
|
|
68572
|
-
db.exec("PRAGMA query_only=ON");
|
|
68573
|
-
store.assertReadableSchema();
|
|
68574
|
-
return store;
|
|
68575
|
-
} catch (error) {
|
|
68576
|
-
db.close();
|
|
68577
|
-
throw error;
|
|
68578
|
-
}
|
|
68579
|
-
}
|
|
68580
|
-
close() {
|
|
68581
|
-
this.db.close();
|
|
68582
|
-
}
|
|
68583
|
-
register(input) {
|
|
68584
|
-
const target = normalizeDevkitTarget(input.origin, input.port);
|
|
68585
|
-
assertValidPath(input.eventPath, "event path");
|
|
68586
|
-
assertValidPath(input.healthPath, "health path");
|
|
68587
|
-
return this.withWriteTransaction(() => {
|
|
68588
|
-
const existing = this.db.prepare(`SELECT config_version FROM ${TABLE_NAME} WHERE origin = ? AND port = ?`).get(target.origin, target.port);
|
|
68589
|
-
const configVersion = (existing?.config_version ?? 0) + 1;
|
|
68590
|
-
const updatedAt = Date.now();
|
|
68591
|
-
this.db.prepare(`
|
|
68592
|
-
INSERT INTO ${TABLE_NAME} (
|
|
68593
|
-
origin, port, event_path, health_path, config_version, updated_at
|
|
68594
|
-
) VALUES (?, ?, ?, ?, ?, ?)
|
|
68595
|
-
ON CONFLICT(origin, port) DO UPDATE SET
|
|
68596
|
-
event_path = excluded.event_path,
|
|
68597
|
-
health_path = excluded.health_path,
|
|
68598
|
-
config_version = excluded.config_version,
|
|
68599
|
-
updated_at = excluded.updated_at
|
|
68600
|
-
`).run(target.origin, target.port, input.eventPath, input.healthPath, configVersion, updatedAt);
|
|
68601
|
-
return {
|
|
68602
|
-
origin: target.origin,
|
|
68603
|
-
port: target.port,
|
|
68604
|
-
eventPath: input.eventPath,
|
|
68605
|
-
healthPath: input.healthPath,
|
|
68606
|
-
configVersion,
|
|
68607
|
-
updatedAt
|
|
68608
|
-
};
|
|
68609
|
-
});
|
|
68610
|
-
}
|
|
68611
|
-
unregister(targetInput) {
|
|
68612
|
-
const target = targetInput ? normalizeDevkitTarget(targetInput.origin, targetInput.port) : void 0;
|
|
68613
|
-
return this.withWriteTransaction(() => {
|
|
68614
|
-
const result = target ? this.db.prepare(`DELETE FROM ${TABLE_NAME} WHERE origin = ? AND port = ?`).run(target.origin, target.port) : this.db.prepare(`DELETE FROM ${TABLE_NAME}`).run();
|
|
68615
|
-
const removedCount = Number(result.changes);
|
|
68616
|
-
return { removed: removedCount > 0, removedCount };
|
|
68617
|
-
});
|
|
68618
|
-
}
|
|
68619
|
-
readSnapshot() {
|
|
68620
|
-
return this.readSnapshots()[0] ?? null;
|
|
68621
|
-
}
|
|
68622
|
-
readSnapshots() {
|
|
68623
|
-
let rows;
|
|
68624
|
-
try {
|
|
68625
|
-
rows = this.db.prepare(`
|
|
68626
|
-
SELECT origin, port, event_path, health_path, config_version, updated_at
|
|
68627
|
-
FROM ${TABLE_NAME} ORDER BY origin ASC, port ASC, id ASC
|
|
68628
|
-
`).all().map(parseDevkitServerRow);
|
|
68629
|
-
} catch (error) {
|
|
68630
|
-
throw new DevkitServerStoreError(
|
|
68631
|
-
"DATABASE_READ_FAILED",
|
|
68632
|
-
`failed to read devkit server configs: ${error instanceof Error ? error.message : String(error)}`
|
|
68633
|
-
);
|
|
68634
|
-
}
|
|
68635
|
-
return rows.map((snapshot) => ({
|
|
68636
|
-
origin: snapshot.origin,
|
|
68637
|
-
port: snapshot.port,
|
|
68638
|
-
eventPath: snapshot.event_path,
|
|
68639
|
-
healthPath: snapshot.health_path,
|
|
68640
|
-
configVersion: snapshot.config_version,
|
|
68641
|
-
updatedAt: snapshot.updated_at
|
|
68642
|
-
}));
|
|
68643
|
-
}
|
|
68644
|
-
configureConnectionForWrite() {
|
|
68645
|
-
this.db.exec("PRAGMA busy_timeout=5000");
|
|
68646
|
-
}
|
|
68647
|
-
ensureSchemaForWrite() {
|
|
68648
|
-
withBusyRetry(() => {
|
|
68649
|
-
this.db.exec("BEGIN IMMEDIATE");
|
|
68650
|
-
try {
|
|
68651
|
-
const applicationId = readPragmaNumber(this.db, "application_id");
|
|
68652
|
-
const userVersion = readPragmaNumber(this.db, "user_version");
|
|
68653
|
-
const hasTables = Boolean(
|
|
68654
|
-
this.db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' LIMIT 1").get()
|
|
68655
|
-
);
|
|
68656
|
-
if (applicationId === 0 && !hasTables && userVersion === 0) {
|
|
68657
|
-
this.db.exec(`PRAGMA application_id=${DEVKIT_SERVER_APPLICATION_ID}`);
|
|
68658
|
-
} else if (applicationId !== DEVKIT_SERVER_APPLICATION_ID) {
|
|
68659
|
-
throw new DevkitServerStoreError(
|
|
68660
|
-
"DATABASE_IDENTITY_MISMATCH",
|
|
68661
|
-
"devkit server database identity does not match"
|
|
68662
|
-
);
|
|
68663
|
-
}
|
|
68664
|
-
if (userVersion > DEVKIT_SERVER_SCHEMA_VERSION) {
|
|
68665
|
-
throw new DevkitServerStoreError(
|
|
68666
|
-
"DATABASE_SCHEMA_TOO_NEW",
|
|
68667
|
-
`devkit server schema version ${userVersion} is newer than supported ${DEVKIT_SERVER_SCHEMA_VERSION}`
|
|
68668
|
-
);
|
|
68669
|
-
}
|
|
68670
|
-
if (userVersion === 0) {
|
|
68671
|
-
applyMigrationV2(this.db);
|
|
68672
|
-
this.db.exec("PRAGMA user_version=2");
|
|
68673
|
-
} else if (userVersion === 1) {
|
|
68674
|
-
migrateV1ToV2(this.db);
|
|
68675
|
-
this.db.exec("PRAGMA user_version=2");
|
|
68676
|
-
}
|
|
68677
|
-
this.db.exec("COMMIT");
|
|
68678
|
-
} catch (error) {
|
|
68679
|
-
rollbackQuietly(this.db);
|
|
68680
|
-
throw error;
|
|
68681
|
-
}
|
|
68682
|
-
});
|
|
68683
|
-
withBusyRetry(() => {
|
|
68684
|
-
this.db.exec("PRAGMA journal_mode=WAL");
|
|
68685
|
-
this.db.exec("PRAGMA synchronous=FULL");
|
|
68686
|
-
});
|
|
68687
|
-
}
|
|
68688
|
-
assertReadableSchema() {
|
|
68689
|
-
const applicationId = readPragmaNumber(this.db, "application_id");
|
|
68690
|
-
if (applicationId !== DEVKIT_SERVER_APPLICATION_ID) {
|
|
68691
|
-
throw new DevkitServerStoreError(
|
|
68692
|
-
"DATABASE_IDENTITY_MISMATCH",
|
|
68693
|
-
"devkit server database identity does not match"
|
|
68694
|
-
);
|
|
68695
|
-
}
|
|
68696
|
-
const userVersion = readPragmaNumber(this.db, "user_version");
|
|
68697
|
-
if (userVersion > DEVKIT_SERVER_SCHEMA_VERSION) {
|
|
68698
|
-
throw new DevkitServerStoreError(
|
|
68699
|
-
"DATABASE_SCHEMA_TOO_NEW",
|
|
68700
|
-
`devkit server schema version ${userVersion} is newer than supported ${DEVKIT_SERVER_SCHEMA_VERSION}`
|
|
68701
|
-
);
|
|
68702
|
-
}
|
|
68703
|
-
if (userVersion < DEVKIT_SERVER_SCHEMA_VERSION) {
|
|
68704
|
-
throw new DevkitServerStoreError(
|
|
68705
|
-
"DATABASE_MIGRATION_REQUIRED",
|
|
68706
|
-
"devkit server database requires a write command to finish migration"
|
|
68707
|
-
);
|
|
68708
|
-
}
|
|
68709
|
-
}
|
|
68710
|
-
withWriteTransaction(operation) {
|
|
68711
|
-
return withBusyRetry(() => {
|
|
68712
|
-
this.db.exec("BEGIN IMMEDIATE");
|
|
68713
|
-
try {
|
|
68714
|
-
const result = operation();
|
|
68715
|
-
this.db.exec("COMMIT");
|
|
68716
|
-
return result;
|
|
68717
|
-
} catch (error) {
|
|
68718
|
-
rollbackQuietly(this.db);
|
|
68719
|
-
throw error;
|
|
68720
|
-
}
|
|
68721
|
-
});
|
|
68722
|
-
}
|
|
68723
|
-
};
|
|
68724
|
-
function applyMigrationV2(db) {
|
|
68725
|
-
db.exec(`
|
|
68726
|
-
CREATE TABLE ${TABLE_NAME} (
|
|
68727
|
-
id INTEGER PRIMARY KEY,
|
|
68728
|
-
origin TEXT NOT NULL,
|
|
68729
|
-
port INTEGER NOT NULL CHECK (port >= 1 AND port <= 65535),
|
|
68730
|
-
event_path TEXT NOT NULL,
|
|
68731
|
-
health_path TEXT NOT NULL,
|
|
68732
|
-
config_version INTEGER NOT NULL,
|
|
68733
|
-
updated_at INTEGER NOT NULL,
|
|
68734
|
-
CHECK (length(origin) > 0),
|
|
68735
|
-
CHECK (substr(event_path,1,1) = '/'),
|
|
68736
|
-
CHECK (substr(health_path,1,1) = '/'),
|
|
68737
|
-
UNIQUE (origin, port)
|
|
68738
|
-
)
|
|
68739
|
-
`);
|
|
68740
|
-
}
|
|
68741
|
-
function migrateV1ToV2(db) {
|
|
68742
|
-
const legacyRows = db.prepare(`
|
|
68743
|
-
SELECT id, origin, port, event_path, health_path, config_version, updated_at
|
|
68744
|
-
FROM ${TABLE_NAME} ORDER BY id ASC
|
|
68745
|
-
`).all().map((row) => ({ ...parseDevkitServerRow(row), id: readRowNumber(row, "id") }));
|
|
68746
|
-
db.exec(`ALTER TABLE ${TABLE_NAME} RENAME TO "devkit-server-v1"`);
|
|
68747
|
-
applyMigrationV2(db);
|
|
68748
|
-
const insert = db.prepare(`
|
|
68749
|
-
INSERT INTO ${TABLE_NAME} (
|
|
68750
|
-
id, origin, port, event_path, health_path, config_version, updated_at
|
|
68751
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
68752
|
-
`);
|
|
68753
|
-
for (const row of legacyRows) {
|
|
68754
|
-
const target = normalizeDevkitTarget(row.origin, row.port);
|
|
68755
|
-
insert.run(
|
|
68756
|
-
row.id,
|
|
68757
|
-
target.origin,
|
|
68758
|
-
target.port,
|
|
68759
|
-
row.event_path,
|
|
68760
|
-
row.health_path,
|
|
68761
|
-
row.config_version,
|
|
68762
|
-
row.updated_at
|
|
68763
|
-
);
|
|
68764
|
-
}
|
|
68765
|
-
db.exec('DROP TABLE "devkit-server-v1"');
|
|
68766
|
-
}
|
|
68767
|
-
function readRowNumber(row, field) {
|
|
68768
|
-
const value = row[field];
|
|
68769
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value)) {
|
|
68770
|
-
throw new DevkitServerStoreError("DATABASE_READ_FAILED", `invalid devkit server field: ${field}`);
|
|
68771
|
-
}
|
|
68772
|
-
return value;
|
|
68773
|
-
}
|
|
68774
|
-
function readRowString(row, field) {
|
|
68775
|
-
const value = row[field];
|
|
68776
|
-
if (typeof value !== "string") {
|
|
68777
|
-
throw new DevkitServerStoreError("DATABASE_READ_FAILED", `invalid devkit server field: ${field}`);
|
|
68778
|
-
}
|
|
68779
|
-
return value;
|
|
68780
|
-
}
|
|
68781
|
-
function parseDevkitServerRow(row) {
|
|
68782
|
-
return {
|
|
68783
|
-
origin: readRowString(row, "origin"),
|
|
68784
|
-
port: readRowNumber(row, "port"),
|
|
68785
|
-
event_path: readRowString(row, "event_path"),
|
|
68786
|
-
health_path: readRowString(row, "health_path"),
|
|
68787
|
-
config_version: readRowNumber(row, "config_version"),
|
|
68788
|
-
updated_at: readRowNumber(row, "updated_at")
|
|
68789
|
-
};
|
|
68790
|
-
}
|
|
68791
|
-
function assertValidPath(path2, label) {
|
|
68792
|
-
if (typeof path2 !== "string" || !path2.startsWith("/") || path2.length === 0) {
|
|
68793
|
-
throw new DevkitServerStoreError("INVALID_CONFIG_PATH", `${label} must start with /`);
|
|
68794
|
-
}
|
|
68795
|
-
}
|
|
68796
|
-
function readPragmaNumber(db, name) {
|
|
68797
|
-
const row = db.prepare(`PRAGMA ${name}`).get();
|
|
68798
|
-
return Number(row[name] ?? 0);
|
|
68799
|
-
}
|
|
68800
|
-
function assertNotSymlink(path2, label) {
|
|
68801
|
-
if (!(0, import_node_fs19.existsSync)(path2)) {
|
|
68802
|
-
return;
|
|
68803
|
-
}
|
|
68804
|
-
if ((0, import_node_fs19.lstatSync)(path2).isSymbolicLink()) {
|
|
68805
|
-
throw new DevkitServerStoreError("DATABASE_PATH_UNSAFE", `${label} must not be a symbolic link`);
|
|
68806
|
-
}
|
|
68807
|
-
}
|
|
68808
|
-
function assertSafeDatabasePath(dbPath) {
|
|
68809
|
-
assertSafeDatabaseFile(dbPath);
|
|
68810
|
-
for (const suffix of ["-journal", "-wal", "-shm"]) {
|
|
68811
|
-
assertNotSymlink(`${dbPath}${suffix}`, `devkit server database sidecar ${suffix}`);
|
|
68812
|
-
}
|
|
68813
|
-
}
|
|
68814
|
-
function assertSafeDatabaseFile(dbPath) {
|
|
68815
|
-
if (!(0, import_node_fs19.existsSync)(dbPath)) {
|
|
68816
|
-
return;
|
|
68817
|
-
}
|
|
68818
|
-
const stat4 = (0, import_node_fs19.lstatSync)(dbPath);
|
|
68819
|
-
if (stat4.isSymbolicLink()) {
|
|
68820
|
-
throw new DevkitServerStoreError(
|
|
68821
|
-
"DATABASE_PATH_UNSAFE",
|
|
68822
|
-
"devkit server database must not be a symbolic link"
|
|
68823
|
-
);
|
|
68824
|
-
}
|
|
68825
|
-
if (!stat4.isFile() || stat4.nlink !== 1) {
|
|
68826
|
-
throw new DevkitServerStoreError(
|
|
68827
|
-
"DATABASE_PATH_UNSAFE",
|
|
68828
|
-
"devkit server database must be a regular file with one hard link"
|
|
68829
|
-
);
|
|
68830
|
-
}
|
|
68831
|
-
}
|
|
68832
|
-
function rollbackQuietly(db) {
|
|
68833
|
-
try {
|
|
68834
|
-
db.exec("ROLLBACK");
|
|
68835
|
-
} catch {
|
|
68836
|
-
}
|
|
68837
|
-
}
|
|
68838
|
-
function withBusyRetry(operation) {
|
|
68839
|
-
for (let attempt = 1; ; attempt += 1) {
|
|
68840
|
-
try {
|
|
68841
|
-
return operation();
|
|
68842
|
-
} catch (error) {
|
|
68843
|
-
if (!isSqliteBusyError(error) || attempt >= WRITE_RETRY_ATTEMPTS) {
|
|
68844
|
-
throw error;
|
|
68845
|
-
}
|
|
68846
|
-
sleepSyncMs2(Math.min(100 * 2 ** (attempt - 1), 1600));
|
|
68847
|
-
}
|
|
68848
|
-
}
|
|
68849
|
-
}
|
|
68850
|
-
function sleepSyncMs2(ms) {
|
|
68851
|
-
const buffer2 = new Int32Array(new SharedArrayBuffer(4));
|
|
68852
|
-
Atomics.wait(buffer2, 0, 0, ms);
|
|
68853
|
-
}
|
|
68854
|
-
function loadSqlite4() {
|
|
68855
|
-
const originalEmitWarning = process.emitWarning;
|
|
68856
|
-
process.emitWarning = ((warning, ...args) => {
|
|
68857
|
-
const message = typeof warning === "string" ? warning : warning.message;
|
|
68858
|
-
if (message.includes("SQLite is an experimental feature") && args.some((arg) => arg === "ExperimentalWarning")) {
|
|
68859
|
-
return;
|
|
68860
|
-
}
|
|
68861
|
-
return originalEmitWarning.call(process, warning, ...args);
|
|
68862
|
-
});
|
|
68863
|
-
try {
|
|
68864
|
-
return require("node:sqlite");
|
|
68865
|
-
} finally {
|
|
68866
|
-
process.emitWarning = originalEmitWarning;
|
|
68867
|
-
}
|
|
68868
|
-
}
|
|
68869
|
-
|
|
68870
67875
|
// src/listener.ts
|
|
68871
67876
|
init_paths();
|
|
68872
67877
|
|
|
@@ -69241,13 +68246,13 @@ async function getHermesGatewayPluginStatus(options = {}) {
|
|
|
69241
68246
|
const env = options.env ?? process.env;
|
|
69242
68247
|
const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path25.join)((0, import_node_os8.homedir)(), ".hermes");
|
|
69243
68248
|
const pluginYamlPath = (0, import_node_path25.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
69244
|
-
if (!(0,
|
|
68249
|
+
if (!(0, import_node_fs19.existsSync)(pluginYamlPath)) {
|
|
69245
68250
|
return { enabled: false, reason: "plugin_yaml_missing", hermesHome, checkedPath: pluginYamlPath };
|
|
69246
68251
|
}
|
|
69247
68252
|
const configPath = (0, import_node_path25.join)(hermesHome, "config.yaml");
|
|
69248
68253
|
let content;
|
|
69249
68254
|
try {
|
|
69250
|
-
content = await (0,
|
|
68255
|
+
content = await (0, import_promises8.readFile)(configPath, "utf8");
|
|
69251
68256
|
} catch {
|
|
69252
68257
|
return { enabled: false, reason: "config_read_error", hermesHome, checkedPath: configPath };
|
|
69253
68258
|
}
|
|
@@ -69369,27 +68374,6 @@ async function runListenerWithLock(options, paths) {
|
|
|
69369
68374
|
const store = new TaskMessageStore(options.homeDir);
|
|
69370
68375
|
const sessionStore = new SessionStore({ homeDir: options.homeDir });
|
|
69371
68376
|
const commands = new CommandStore(options.homeDir);
|
|
69372
|
-
const devkitInitializer = DevkitServerStore.openForWrite(options.homeDir);
|
|
69373
|
-
devkitInitializer.close();
|
|
69374
|
-
const devkitReadSnapshots = () => {
|
|
69375
|
-
const snapshotStore = DevkitServerStore.openForRead(options.homeDir);
|
|
69376
|
-
if (!snapshotStore) {
|
|
69377
|
-
return [];
|
|
69378
|
-
}
|
|
69379
|
-
try {
|
|
69380
|
-
return snapshotStore.readSnapshots();
|
|
69381
|
-
} finally {
|
|
69382
|
-
snapshotStore.close();
|
|
69383
|
-
}
|
|
69384
|
-
};
|
|
69385
|
-
const devkitDispatcher = new DevkitDeliveryDispatcher({
|
|
69386
|
-
homeDir: options.homeDir
|
|
69387
|
-
});
|
|
69388
|
-
const devkitRouter = createDevkitAutoRouter({
|
|
69389
|
-
commands,
|
|
69390
|
-
dispatcher: devkitDispatcher,
|
|
69391
|
-
readSnapshots: devkitReadSnapshots
|
|
69392
|
-
});
|
|
69393
68377
|
await store.ensureReady();
|
|
69394
68378
|
let userAttentionEvents = null;
|
|
69395
68379
|
try {
|
|
@@ -69453,20 +68437,20 @@ async function runListenerWithLock(options, paths) {
|
|
|
69453
68437
|
createInboundMiddleware: (deps) => createMiddlewareFromCoreDeps(store, deps, {
|
|
69454
68438
|
sessionStore,
|
|
69455
68439
|
onJobMessageStored: async (event) => {
|
|
69456
|
-
await
|
|
68440
|
+
await enqueueAiJobMessageDispatch({ commands, event });
|
|
69457
68441
|
},
|
|
69458
68442
|
onSessionMessage: async (event) => {
|
|
69459
|
-
await
|
|
68443
|
+
await enqueueAiSessionMessageDispatch({ commands, event });
|
|
69460
68444
|
}
|
|
69461
68445
|
}),
|
|
69462
68446
|
processOfflineMessage: (ctx, deps, replayOptions) => processOfflineFromCoreDeps(store, ctx, deps, {
|
|
69463
68447
|
...replayOptions,
|
|
69464
68448
|
sessionStore,
|
|
69465
68449
|
onJobMessageStored: async (event) => {
|
|
69466
|
-
await
|
|
68450
|
+
await enqueueAiJobMessageDispatch({ commands, event });
|
|
69467
68451
|
},
|
|
69468
68452
|
onSessionMessage: async (event) => {
|
|
69469
|
-
await
|
|
68453
|
+
await enqueueAiSessionMessageDispatch({ commands, event });
|
|
69470
68454
|
}
|
|
69471
68455
|
}),
|
|
69472
68456
|
notifySessionExpired: (command) => {
|
|
@@ -69498,12 +68482,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
69498
68482
|
});
|
|
69499
68483
|
}
|
|
69500
68484
|
});
|
|
69501
|
-
service.setPluginVersion("0.2.19
|
|
68485
|
+
service.setPluginVersion("0.2.19");
|
|
69502
68486
|
await service.init();
|
|
69503
68487
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
69504
68488
|
if (pluginVersionStatus.unavailable) {
|
|
69505
68489
|
throw new Error(
|
|
69506
|
-
`@okxweb3/a2a-node v${"0.2.19
|
|
68490
|
+
`@okxweb3/a2a-node v${"0.2.19"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
69507
68491
|
);
|
|
69508
68492
|
}
|
|
69509
68493
|
const systemConfig = service.getSystemConfig();
|
|
@@ -69531,7 +68515,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
69531
68515
|
onchainosAgentId: "*",
|
|
69532
68516
|
reason: "system-config missing sentryDsn",
|
|
69533
68517
|
pluginId: "@okxweb3/a2a-node",
|
|
69534
|
-
pluginVersion: "0.2.19
|
|
68518
|
+
pluginVersion: "0.2.19"
|
|
69535
68519
|
});
|
|
69536
68520
|
}
|
|
69537
68521
|
logWithTimestamp(
|
|
@@ -69863,7 +68847,6 @@ async function runListenerWithLock(options, paths) {
|
|
|
69863
68847
|
logWithTimestamp("[okx-agent-task] failed to close user_attention IPC wake:", err);
|
|
69864
68848
|
}
|
|
69865
68849
|
stopClients(service);
|
|
69866
|
-
await devkitDispatcher.shutdown(SHUTDOWN_FORCE_RESOLVE_MS);
|
|
69867
68850
|
sessionStore.close();
|
|
69868
68851
|
clearTimeout(forceResolve);
|
|
69869
68852
|
resolve11();
|
|
@@ -69886,331 +68869,14 @@ async function timeSettled(fn) {
|
|
|
69886
68869
|
// src/index.ts
|
|
69887
68870
|
init_paths();
|
|
69888
68871
|
|
|
69889
|
-
// src/devkit-cli.ts
|
|
69890
|
-
var import_node_crypto14 = require("node:crypto");
|
|
69891
|
-
init_daemon();
|
|
69892
|
-
init_sentry_logger();
|
|
69893
|
-
var DAEMON_NOT_RUNNING_MESSAGE = "\u5F53\u524D daemon \u672A\u8FD0\u884C,\u8BF7\u4F7F\u7528 okx-a2a start \u542F\u52A8 daemon";
|
|
69894
|
-
var DAEMON_STATUS_UNKNOWN_MESSAGE = "\u914D\u7F6E\u5DF2\u5199\u5165,\u4F46\u65E0\u6CD5\u786E\u8BA4 daemon \u8FD0\u884C\u72B6\u6001";
|
|
69895
|
-
var DevkitCliError = class extends Error {
|
|
69896
|
-
field;
|
|
69897
|
-
constructor(field, reason) {
|
|
69898
|
-
super(reason);
|
|
69899
|
-
this.name = "DevkitCliError";
|
|
69900
|
-
this.field = field;
|
|
69901
|
-
}
|
|
69902
|
-
toValidationError() {
|
|
69903
|
-
return { field: this.field, reason: this.message };
|
|
69904
|
-
}
|
|
69905
|
-
};
|
|
69906
|
-
async function handleDevkitCommand(args) {
|
|
69907
|
-
const wantsJson = args.includes("--json");
|
|
69908
|
-
const subcommand = args[0];
|
|
69909
|
-
if (!subcommand || isHelpArg(subcommand)) {
|
|
69910
|
-
printDevkitUsage();
|
|
69911
|
-
return;
|
|
69912
|
-
}
|
|
69913
|
-
if (args.slice(1).some(isHelpArg)) {
|
|
69914
|
-
printDevkitUsage();
|
|
69915
|
-
return;
|
|
69916
|
-
}
|
|
69917
|
-
if (subcommand === "register") {
|
|
69918
|
-
await handleRegister(args.slice(1), wantsJson);
|
|
69919
|
-
return;
|
|
69920
|
-
}
|
|
69921
|
-
if (subcommand === "unregister") {
|
|
69922
|
-
await handleUnregister(args.slice(1), wantsJson);
|
|
69923
|
-
return;
|
|
69924
|
-
}
|
|
69925
|
-
outputError(wantsJson, { field: "command", reason: `unknown devkit command: ${subcommand}` });
|
|
69926
|
-
process.exitCode = 1;
|
|
69927
|
-
}
|
|
69928
|
-
function printDevkitUsage() {
|
|
69929
|
-
console.log(`Usage: okx-a2a devkit <register|unregister> [options]
|
|
69930
|
-
|
|
69931
|
-
Commands:
|
|
69932
|
-
register Register a local custom server for daemon auto-message delivery.
|
|
69933
|
-
--url <origin> --port <n> --paths '{"event":"/path","health":"/path"}'
|
|
69934
|
-
Multiple loopback targets are allowed; localhost is stored as IPv4 127.0.0.1.
|
|
69935
|
-
unregister Remove one target with paired --url and --port, or omit both to unregister all.
|
|
69936
|
-
Already queued deliveries keep their captured target snapshot and are not retracted.
|
|
69937
|
-
|
|
69938
|
-
Options:
|
|
69939
|
-
--json Print machine-readable output.`);
|
|
69940
|
-
}
|
|
69941
|
-
async function handleRegister(args, wantsJson) {
|
|
69942
|
-
const operationId = (0, import_node_crypto14.randomUUID)();
|
|
69943
|
-
const startedAt = Date.now();
|
|
69944
|
-
logger.info(LogEvent.DEVKIT_REGISTER_REQUESTED, devkitSentryExtra({ operationId, phase: "requested" }));
|
|
69945
|
-
try {
|
|
69946
|
-
const parsed = parseArgs(args, { options: /* @__PURE__ */ new Set(["url", "port", "paths"]), flags: /* @__PURE__ */ new Set(["json"]) });
|
|
69947
|
-
const rawOrigin = requireOption(parsed, "url");
|
|
69948
|
-
const rawPort = requireOption(parsed, "port");
|
|
69949
|
-
const target = normalizeDevkitTarget(rawOrigin, parsePortValue(rawPort));
|
|
69950
|
-
const { eventPath, healthPath } = validatePaths(requireOption(parsed, "paths"));
|
|
69951
|
-
let config;
|
|
69952
|
-
try {
|
|
69953
|
-
const store = DevkitServerStore.openForWrite();
|
|
69954
|
-
try {
|
|
69955
|
-
config = store.register({ ...target, eventPath, healthPath });
|
|
69956
|
-
} finally {
|
|
69957
|
-
store.close();
|
|
69958
|
-
}
|
|
69959
|
-
} catch (error) {
|
|
69960
|
-
logger.error(
|
|
69961
|
-
LogEvent.DEVKIT_CONFIG_PERSIST_FAILED,
|
|
69962
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
69963
|
-
devkitSentryExtra({ operationId, phase: "persist_failed", durationMs: Date.now() - startedAt })
|
|
69964
|
-
);
|
|
69965
|
-
outputError(wantsJson, {
|
|
69966
|
-
field: "config",
|
|
69967
|
-
reason: error instanceof DevkitServerStoreError ? error.message : "failed to persist devkit configuration"
|
|
69968
|
-
});
|
|
69969
|
-
process.exitCode = 1;
|
|
69970
|
-
return;
|
|
69971
|
-
}
|
|
69972
|
-
const outcome = config.configVersion === 1 ? "created" : "updated";
|
|
69973
|
-
const { daemonRunning, warning } = await resolveDaemonStatus(operationId);
|
|
69974
|
-
logger.info(
|
|
69975
|
-
LogEvent.DEVKIT_REGISTER_COMPLETED,
|
|
69976
|
-
devkitSentryExtra({
|
|
69977
|
-
operationId,
|
|
69978
|
-
phase: "completed",
|
|
69979
|
-
outcome,
|
|
69980
|
-
registrationId: String(config.configVersion),
|
|
69981
|
-
daemonRunning: String(daemonRunning),
|
|
69982
|
-
durationMs: Date.now() - startedAt
|
|
69983
|
-
})
|
|
69984
|
-
);
|
|
69985
|
-
outputSuccess(wantsJson, { daemonRunning, warning, configVersion: config.configVersion });
|
|
69986
|
-
} catch (error) {
|
|
69987
|
-
const detail = normalizeError(error);
|
|
69988
|
-
logger.error(
|
|
69989
|
-
LogEvent.DEVKIT_REGISTER_REJECTED,
|
|
69990
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
69991
|
-
devkitSentryExtra({ operationId, phase: "rejected", reason: detail.field, durationMs: Date.now() - startedAt })
|
|
69992
|
-
);
|
|
69993
|
-
outputError(wantsJson, detail);
|
|
69994
|
-
process.exitCode = 1;
|
|
69995
|
-
}
|
|
69996
|
-
}
|
|
69997
|
-
async function handleUnregister(args, wantsJson) {
|
|
69998
|
-
const operationId = (0, import_node_crypto14.randomUUID)();
|
|
69999
|
-
const startedAt = Date.now();
|
|
70000
|
-
logger.info(LogEvent.DEVKIT_UNREGISTER_REQUESTED, devkitSentryExtra({ operationId, phase: "requested" }));
|
|
70001
|
-
try {
|
|
70002
|
-
const parsed = parseArgs(args, { options: /* @__PURE__ */ new Set(["url", "port"]), flags: /* @__PURE__ */ new Set(["json"]) });
|
|
70003
|
-
const rawOrigin = parsed.options.get("url")?.[0];
|
|
70004
|
-
const rawPort = parsed.options.get("port")?.[0];
|
|
70005
|
-
if (rawOrigin === void 0 !== (rawPort === void 0)) {
|
|
70006
|
-
throw new DevkitCliError("command", "--url and --port must be provided together");
|
|
70007
|
-
}
|
|
70008
|
-
const target = rawOrigin === void 0 || rawPort === void 0 ? void 0 : normalizeDevkitTarget(rawOrigin, parsePortValue(rawPort));
|
|
70009
|
-
let result;
|
|
70010
|
-
try {
|
|
70011
|
-
const store = DevkitServerStore.openForWrite();
|
|
70012
|
-
try {
|
|
70013
|
-
result = store.unregister(target);
|
|
70014
|
-
} finally {
|
|
70015
|
-
store.close();
|
|
70016
|
-
}
|
|
70017
|
-
} catch (error) {
|
|
70018
|
-
logger.error(
|
|
70019
|
-
LogEvent.DEVKIT_CONFIG_PERSIST_FAILED,
|
|
70020
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
70021
|
-
devkitSentryExtra({ operationId, phase: "persist_failed", durationMs: Date.now() - startedAt })
|
|
70022
|
-
);
|
|
70023
|
-
outputError(wantsJson, {
|
|
70024
|
-
field: "config",
|
|
70025
|
-
reason: error instanceof DevkitServerStoreError ? error.message : "failed to persist devkit configuration"
|
|
70026
|
-
});
|
|
70027
|
-
process.exitCode = 1;
|
|
70028
|
-
return;
|
|
70029
|
-
}
|
|
70030
|
-
const outcome = result.removed ? "removed" : "noop";
|
|
70031
|
-
const { daemonRunning, warning } = await resolveDaemonStatus(operationId);
|
|
70032
|
-
logger.info(
|
|
70033
|
-
LogEvent.DEVKIT_UNREGISTER_COMPLETED,
|
|
70034
|
-
devkitSentryExtra({
|
|
70035
|
-
operationId,
|
|
70036
|
-
phase: "completed",
|
|
70037
|
-
outcome,
|
|
70038
|
-
removedCount: result.removedCount,
|
|
70039
|
-
...target ? { targetOrigin: target.origin, targetPort: target.port } : {},
|
|
70040
|
-
daemonRunning: String(daemonRunning),
|
|
70041
|
-
durationMs: Date.now() - startedAt
|
|
70042
|
-
})
|
|
70043
|
-
);
|
|
70044
|
-
outputSuccess(wantsJson, { daemonRunning, warning, removedCount: result.removedCount });
|
|
70045
|
-
} catch (error) {
|
|
70046
|
-
const detail = normalizeError(error);
|
|
70047
|
-
logger.error(
|
|
70048
|
-
LogEvent.DEVKIT_REGISTER_REJECTED,
|
|
70049
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
70050
|
-
devkitSentryExtra({ operationId, phase: "rejected", reason: detail.field, durationMs: Date.now() - startedAt })
|
|
70051
|
-
);
|
|
70052
|
-
outputError(wantsJson, detail);
|
|
70053
|
-
process.exitCode = 1;
|
|
70054
|
-
}
|
|
70055
|
-
}
|
|
70056
|
-
async function resolveDaemonStatus(operationId) {
|
|
70057
|
-
try {
|
|
70058
|
-
const status = await getDaemonStatus();
|
|
70059
|
-
if (status.running) {
|
|
70060
|
-
return { daemonRunning: true };
|
|
70061
|
-
}
|
|
70062
|
-
return {
|
|
70063
|
-
daemonRunning: false,
|
|
70064
|
-
warning: { code: "DAEMON_NOT_RUNNING", message: DAEMON_NOT_RUNNING_MESSAGE }
|
|
70065
|
-
};
|
|
70066
|
-
} catch {
|
|
70067
|
-
logger.info(LogEvent.DEVKIT_DAEMON_STATUS_UNKNOWN, devkitSentryExtra({ operationId, phase: "status_unknown" }));
|
|
70068
|
-
return {
|
|
70069
|
-
daemonRunning: null,
|
|
70070
|
-
warning: { code: "DAEMON_STATUS_UNKNOWN", message: DAEMON_STATUS_UNKNOWN_MESSAGE }
|
|
70071
|
-
};
|
|
70072
|
-
}
|
|
70073
|
-
}
|
|
70074
|
-
function parsePortValue(raw) {
|
|
70075
|
-
if (!/^(0|[1-9][0-9]*)$/.test(raw)) {
|
|
70076
|
-
throw new DevkitCliError("port", "--port must be an integer between 1 and 65535");
|
|
70077
|
-
}
|
|
70078
|
-
return Number(raw);
|
|
70079
|
-
}
|
|
70080
|
-
function validatePaths(raw) {
|
|
70081
|
-
let parsed;
|
|
70082
|
-
try {
|
|
70083
|
-
parsed = JSON.parse(raw);
|
|
70084
|
-
} catch {
|
|
70085
|
-
throw new DevkitCliError("paths", "--paths must be valid JSON");
|
|
70086
|
-
}
|
|
70087
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
70088
|
-
throw new DevkitCliError("paths", "--paths must be a JSON object");
|
|
70089
|
-
}
|
|
70090
|
-
const record = parsed;
|
|
70091
|
-
const keys = Object.keys(record);
|
|
70092
|
-
if (keys.length !== 2 || !keys.includes("event") || !keys.includes("health")) {
|
|
70093
|
-
throw new DevkitCliError("paths", '--paths must contain exactly the keys "event" and "health"');
|
|
70094
|
-
}
|
|
70095
|
-
const eventPath = validatePathValue(record.event, "event");
|
|
70096
|
-
const healthPath = validatePathValue(record.health, "health");
|
|
70097
|
-
return { eventPath, healthPath };
|
|
70098
|
-
}
|
|
70099
|
-
function validatePathValue(value, key) {
|
|
70100
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
70101
|
-
throw new DevkitCliError("paths", `--paths.${key} must be a non-empty string`);
|
|
70102
|
-
}
|
|
70103
|
-
if (!value.startsWith("/") || value.startsWith("//")) {
|
|
70104
|
-
throw new DevkitCliError("paths", `--paths.${key} must start with a single "/"`);
|
|
70105
|
-
}
|
|
70106
|
-
if (value.includes("\\") || value.includes("?") || value.includes("#") || value.includes("..")) {
|
|
70107
|
-
throw new DevkitCliError(
|
|
70108
|
-
"paths",
|
|
70109
|
-
`--paths.${key} must not contain a query, fragment, backslash, "..", or an absolute URL`
|
|
70110
|
-
);
|
|
70111
|
-
}
|
|
70112
|
-
if (/^\/[a-zA-Z][a-zA-Z0-9+.-]*:/.test(value)) {
|
|
70113
|
-
throw new DevkitCliError("paths", `--paths.${key} must not be an absolute URL`);
|
|
70114
|
-
}
|
|
70115
|
-
return value;
|
|
70116
|
-
}
|
|
70117
|
-
function parseArgs(args, spec) {
|
|
70118
|
-
const options = /* @__PURE__ */ new Map();
|
|
70119
|
-
const flags = /* @__PURE__ */ new Set();
|
|
70120
|
-
for (let index2 = 0; index2 < args.length; index2 += 1) {
|
|
70121
|
-
const token = args[index2];
|
|
70122
|
-
if (!token.startsWith("--")) {
|
|
70123
|
-
throw new DevkitCliError("command", `unexpected positional argument: ${token}`);
|
|
70124
|
-
}
|
|
70125
|
-
const name = token.slice(2);
|
|
70126
|
-
if (spec.flags.has(name)) {
|
|
70127
|
-
if (flags.has(name)) {
|
|
70128
|
-
throw new DevkitCliError("command", `${token} must not be repeated`);
|
|
70129
|
-
}
|
|
70130
|
-
flags.add(name);
|
|
70131
|
-
continue;
|
|
70132
|
-
}
|
|
70133
|
-
if (!spec.options.has(name)) {
|
|
70134
|
-
throw new DevkitCliError("command", `unknown option ${token}`);
|
|
70135
|
-
}
|
|
70136
|
-
if (index2 + 1 >= args.length) {
|
|
70137
|
-
throw new DevkitCliError("command", `${token} requires a value`);
|
|
70138
|
-
}
|
|
70139
|
-
const value = args[++index2];
|
|
70140
|
-
if (value.startsWith("--")) {
|
|
70141
|
-
throw new DevkitCliError("command", `${token} requires a value`);
|
|
70142
|
-
}
|
|
70143
|
-
if (options.has(name)) {
|
|
70144
|
-
throw new DevkitCliError("command", `${token} must not be repeated`);
|
|
70145
|
-
}
|
|
70146
|
-
options.set(name, [value]);
|
|
70147
|
-
}
|
|
70148
|
-
return { options, flags };
|
|
70149
|
-
}
|
|
70150
|
-
function requireOption(parsed, name) {
|
|
70151
|
-
const value = parsed.options.get(name)?.[0];
|
|
70152
|
-
if (value === void 0 || value.length === 0) {
|
|
70153
|
-
throw new DevkitCliError(name, `--${name} is required`);
|
|
70154
|
-
}
|
|
70155
|
-
return value;
|
|
70156
|
-
}
|
|
70157
|
-
function outputSuccess(json, result) {
|
|
70158
|
-
if (json) {
|
|
70159
|
-
console.log(JSON.stringify({
|
|
70160
|
-
ok: true,
|
|
70161
|
-
daemonRunning: result.daemonRunning,
|
|
70162
|
-
...result.warning ? { warning: result.warning } : {},
|
|
70163
|
-
...result.configVersion === void 0 ? {} : { configVersion: result.configVersion },
|
|
70164
|
-
...result.removedCount === void 0 ? {} : { removedCount: result.removedCount }
|
|
70165
|
-
}));
|
|
70166
|
-
return;
|
|
70167
|
-
}
|
|
70168
|
-
const daemonText = result.daemonRunning === null ? "unknown" : String(result.daemonRunning);
|
|
70169
|
-
console.log(`ok=true daemonRunning=${daemonText}${result.warning ? ` warning=${result.warning.code}` : ""}${result.removedCount === void 0 ? "" : ` removedCount=${result.removedCount}`}`);
|
|
70170
|
-
if (result.warning) {
|
|
70171
|
-
console.log(result.warning.message);
|
|
70172
|
-
}
|
|
70173
|
-
}
|
|
70174
|
-
function outputError(json, detail) {
|
|
70175
|
-
if (json) {
|
|
70176
|
-
console.log(JSON.stringify({ ok: false, error: detail.reason }));
|
|
70177
|
-
return;
|
|
70178
|
-
}
|
|
70179
|
-
console.error(`ok=false field=${detail.field} error=${detail.reason}`);
|
|
70180
|
-
}
|
|
70181
|
-
function normalizeError(error) {
|
|
70182
|
-
if (error instanceof DevkitCliError) {
|
|
70183
|
-
return error.toValidationError();
|
|
70184
|
-
}
|
|
70185
|
-
if (error instanceof DevkitTargetError) {
|
|
70186
|
-
return { field: error.field, reason: error.message };
|
|
70187
|
-
}
|
|
70188
|
-
if (error instanceof DevkitServerStoreError) {
|
|
70189
|
-
return { field: "config", reason: error.message };
|
|
70190
|
-
}
|
|
70191
|
-
return { field: "unknown", reason: error instanceof Error ? error.message : String(error) };
|
|
70192
|
-
}
|
|
70193
|
-
function devkitSentryExtra(extra) {
|
|
70194
|
-
const normalized = { component: "node_devkit" };
|
|
70195
|
-
for (const [key, value] of Object.entries(extra)) {
|
|
70196
|
-
if (value !== void 0) {
|
|
70197
|
-
normalized[key] = String(value);
|
|
70198
|
-
}
|
|
70199
|
-
}
|
|
70200
|
-
return normalized;
|
|
70201
|
-
}
|
|
70202
|
-
function isHelpArg(value) {
|
|
70203
|
-
return value === "help" || value === "-h" || value === "--help";
|
|
70204
|
-
}
|
|
70205
|
-
|
|
70206
68872
|
// src/xmtp-test-cli.ts
|
|
70207
|
-
var
|
|
68873
|
+
var import_promises10 = require("node:fs/promises");
|
|
70208
68874
|
var import_node_path27 = require("node:path");
|
|
70209
68875
|
init_daemon();
|
|
70210
68876
|
|
|
70211
68877
|
// src/log-tail.ts
|
|
70212
|
-
var
|
|
70213
|
-
var
|
|
68878
|
+
var import_node_fs20 = require("node:fs");
|
|
68879
|
+
var import_promises9 = require("node:fs/promises");
|
|
70214
68880
|
var import_node_path26 = require("node:path");
|
|
70215
68881
|
var import_node_string_decoder = require("node:string_decoder");
|
|
70216
68882
|
init_win_spawn();
|
|
@@ -70304,7 +68970,7 @@ async function followFile(filePath, onData, options = {}) {
|
|
|
70304
68970
|
let handle;
|
|
70305
68971
|
try {
|
|
70306
68972
|
try {
|
|
70307
|
-
handle = await (0,
|
|
68973
|
+
handle = await (0, import_promises9.open)(filePath, "r");
|
|
70308
68974
|
} catch (error) {
|
|
70309
68975
|
if (error.code === "ENOENT") {
|
|
70310
68976
|
markMissing();
|
|
@@ -70369,7 +69035,7 @@ async function followFile(filePath, onData, options = {}) {
|
|
|
70369
69035
|
}, pollIntervalMs);
|
|
70370
69036
|
const targetName = (0, import_node_path26.basename)(filePath);
|
|
70371
69037
|
try {
|
|
70372
|
-
watcher = (0,
|
|
69038
|
+
watcher = (0, import_node_fs20.watch)((0, import_node_path26.dirname)(filePath), (_eventType, filename) => {
|
|
70373
69039
|
if (filename === null || filename.toString() === targetName) {
|
|
70374
69040
|
void check();
|
|
70375
69041
|
}
|
|
@@ -70410,7 +69076,7 @@ async function readTailSnapshot(filePath, maxLines) {
|
|
|
70410
69076
|
async function readTailSnapshotOnce(filePath, maxLines) {
|
|
70411
69077
|
let handle;
|
|
70412
69078
|
try {
|
|
70413
|
-
handle = await (0,
|
|
69079
|
+
handle = await (0, import_promises9.open)(filePath, "r");
|
|
70414
69080
|
} catch (error) {
|
|
70415
69081
|
if (error.code === "ENOENT") {
|
|
70416
69082
|
return { text: "", offset: 0, fileIdentity: null };
|
|
@@ -70467,7 +69133,7 @@ async function readTailSnapshotOnce(filePath, maxLines) {
|
|
|
70467
69133
|
}
|
|
70468
69134
|
async function currentPositionOrMissing(filePath) {
|
|
70469
69135
|
try {
|
|
70470
|
-
const stats = await (0,
|
|
69136
|
+
const stats = await (0, import_promises9.stat)(filePath);
|
|
70471
69137
|
return { offset: stats.size, fileIdentity: identityForStats(stats) };
|
|
70472
69138
|
} catch (error) {
|
|
70473
69139
|
if (error.code === "ENOENT") {
|
|
@@ -70564,7 +69230,7 @@ async function startXmtpTest(args, releaseInfo) {
|
|
|
70564
69230
|
const runId = requestedRunId ? validateRunId(requestedRunId) : createRunId(requestedName);
|
|
70565
69231
|
const files = resolveRunFiles(testsDir, runId);
|
|
70566
69232
|
try {
|
|
70567
|
-
await (0,
|
|
69233
|
+
await (0, import_promises10.stat)(files.runDir);
|
|
70568
69234
|
throw new Error(`XMTP test run already exists: ${runId}`);
|
|
70569
69235
|
} catch (error) {
|
|
70570
69236
|
if (error.code !== "ENOENT") {
|
|
@@ -70572,7 +69238,7 @@ async function startXmtpTest(args, releaseInfo) {
|
|
|
70572
69238
|
}
|
|
70573
69239
|
}
|
|
70574
69240
|
await ensurePrivateDir(files.runDir);
|
|
70575
|
-
await (0,
|
|
69241
|
+
await (0, import_promises10.writeFile)(files.eventsPath, "", { encoding: "utf8", mode: 384 });
|
|
70576
69242
|
const manifest = {
|
|
70577
69243
|
runId,
|
|
70578
69244
|
name: requestedName,
|
|
@@ -70616,7 +69282,7 @@ async function stopXmtpTest(args) {
|
|
|
70616
69282
|
}
|
|
70617
69283
|
const runId = validateRunId(active.runId);
|
|
70618
69284
|
const files = resolveRunFiles(testsDir, runId);
|
|
70619
|
-
await (0,
|
|
69285
|
+
await (0, import_promises10.unlink)(activePath);
|
|
70620
69286
|
const manifest = await readRequiredJson(files.manifestPath);
|
|
70621
69287
|
const completed = {
|
|
70622
69288
|
...manifest,
|
|
@@ -70934,7 +69600,7 @@ async function resolveRequestedRunId(testsDir, args, preferActive = false) {
|
|
|
70934
69600
|
async function findLatestRunId(testsDir) {
|
|
70935
69601
|
let entries;
|
|
70936
69602
|
try {
|
|
70937
|
-
entries = await (0,
|
|
69603
|
+
entries = await (0, import_promises10.readdir)(testsDir, { withFileTypes: true });
|
|
70938
69604
|
} catch (error) {
|
|
70939
69605
|
if (error.code === "ENOENT") {
|
|
70940
69606
|
return null;
|
|
@@ -70959,7 +69625,7 @@ async function findLatestRunId(testsDir) {
|
|
|
70959
69625
|
async function readMetricEvents(path2) {
|
|
70960
69626
|
let text;
|
|
70961
69627
|
try {
|
|
70962
|
-
text = await (0,
|
|
69628
|
+
text = await (0, import_promises10.readFile)(path2, "utf8");
|
|
70963
69629
|
} catch (error) {
|
|
70964
69630
|
if (error.code === "ENOENT") {
|
|
70965
69631
|
return [];
|
|
@@ -70983,9 +69649,9 @@ function parseMetricEvent(line) {
|
|
|
70983
69649
|
}
|
|
70984
69650
|
}
|
|
70985
69651
|
async function ensurePrivateDir(path2) {
|
|
70986
|
-
await (0,
|
|
69652
|
+
await (0, import_promises10.mkdir)(path2, { recursive: true, mode: 448 });
|
|
70987
69653
|
try {
|
|
70988
|
-
await (0,
|
|
69654
|
+
await (0, import_promises10.chmod)(path2, 448);
|
|
70989
69655
|
} catch (error) {
|
|
70990
69656
|
const code = error.code;
|
|
70991
69657
|
if (code !== "EPERM" && code !== "EACCES") {
|
|
@@ -70995,12 +69661,12 @@ async function ensurePrivateDir(path2) {
|
|
|
70995
69661
|
}
|
|
70996
69662
|
async function writeJson(path2, value) {
|
|
70997
69663
|
const temporary = `${path2}.${process.pid}.tmp`;
|
|
70998
|
-
await (0,
|
|
69664
|
+
await (0, import_promises10.writeFile)(temporary, `${JSON.stringify(value, null, 2)}
|
|
70999
69665
|
`, {
|
|
71000
69666
|
encoding: "utf8",
|
|
71001
69667
|
mode: 384
|
|
71002
69668
|
});
|
|
71003
|
-
await (0,
|
|
69669
|
+
await (0, import_promises10.rename)(temporary, path2);
|
|
71004
69670
|
}
|
|
71005
69671
|
async function readRequiredJson(path2) {
|
|
71006
69672
|
const value = await readJsonIfExists(path2);
|
|
@@ -71011,7 +69677,7 @@ async function readRequiredJson(path2) {
|
|
|
71011
69677
|
}
|
|
71012
69678
|
async function readJsonIfExists(path2) {
|
|
71013
69679
|
try {
|
|
71014
|
-
return JSON.parse(await (0,
|
|
69680
|
+
return JSON.parse(await (0, import_promises10.readFile)(path2, "utf8"));
|
|
71015
69681
|
} catch (error) {
|
|
71016
69682
|
if (error.code === "ENOENT") {
|
|
71017
69683
|
return null;
|
|
@@ -71303,21 +69969,21 @@ function parseLogsTailArgs(args, subcommand) {
|
|
|
71303
69969
|
|
|
71304
69970
|
// src/logs-export.ts
|
|
71305
69971
|
var import_node_child_process10 = require("node:child_process");
|
|
71306
|
-
var
|
|
71307
|
-
var
|
|
69972
|
+
var import_node_fs27 = require("node:fs");
|
|
69973
|
+
var import_promises15 = require("node:fs/promises");
|
|
71308
69974
|
var import_node_os12 = require("node:os");
|
|
71309
69975
|
var import_node_path34 = require("node:path");
|
|
71310
69976
|
var import_jszip = __toESM(require_lib3());
|
|
71311
69977
|
|
|
71312
69978
|
// src/logs-export-archive.ts
|
|
71313
|
-
var
|
|
71314
|
-
var
|
|
71315
|
-
var
|
|
69979
|
+
var import_node_crypto14 = require("node:crypto");
|
|
69980
|
+
var import_node_fs24 = require("node:fs");
|
|
69981
|
+
var import_promises13 = require("node:fs/promises");
|
|
71316
69982
|
var import_node_path31 = require("node:path");
|
|
71317
69983
|
|
|
71318
69984
|
// src/logs-export-filter.ts
|
|
71319
|
-
var
|
|
71320
|
-
var
|
|
69985
|
+
var import_node_fs23 = require("node:fs");
|
|
69986
|
+
var import_promises12 = require("node:fs/promises");
|
|
71321
69987
|
var import_node_path30 = require("node:path");
|
|
71322
69988
|
var import_node_readline2 = require("node:readline");
|
|
71323
69989
|
var MAX_SINGLE_RECORD_BYTES = 2 * 1024 * 1024;
|
|
@@ -71427,7 +70093,7 @@ async function readFilteredLog(path2, options, correlationIds, requireCorrelatio
|
|
|
71427
70093
|
};
|
|
71428
70094
|
}
|
|
71429
70095
|
async function* streamLogRecords(path2, mode) {
|
|
71430
|
-
const input = (0,
|
|
70096
|
+
const input = (0, import_node_fs23.createReadStream)(path2, { encoding: "utf8" });
|
|
71431
70097
|
const lines = (0, import_node_readline2.createInterface)({ input, crlfDelay: Infinity });
|
|
71432
70098
|
let current = null;
|
|
71433
70099
|
try {
|
|
@@ -71844,7 +70510,7 @@ function escapeRegExp2(value) {
|
|
|
71844
70510
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
71845
70511
|
}
|
|
71846
70512
|
async function assertRegularFile(path2) {
|
|
71847
|
-
const file = await (0,
|
|
70513
|
+
const file = await (0, import_promises12.lstat)(path2);
|
|
71848
70514
|
if (file.isSymbolicLink() || !file.isFile()) {
|
|
71849
70515
|
throw Object.assign(
|
|
71850
70516
|
new Error(`Refusing non-regular diagnostic source: ${(0, import_node_path30.basename)(path2)}`),
|
|
@@ -71929,7 +70595,7 @@ function recordCollector(state, result) {
|
|
|
71929
70595
|
async function resolveOutputPath(requested, input) {
|
|
71930
70596
|
if (requested) {
|
|
71931
70597
|
const output2 = (0, import_node_path31.isAbsolute)(requested) ? requested : (0, import_node_path31.resolve)(input.cwd, requested);
|
|
71932
|
-
if ((0,
|
|
70598
|
+
if ((0, import_node_fs24.existsSync)(output2) && !input.overwrite) {
|
|
71933
70599
|
throw new Error(`Output already exists: ${output2}. Pass --overwrite to replace it.`);
|
|
71934
70600
|
}
|
|
71935
70601
|
return output2;
|
|
@@ -71937,42 +70603,42 @@ async function resolveOutputPath(requested, input) {
|
|
|
71937
70603
|
const stamp = input.now.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
|
|
71938
70604
|
const base = `okx-a2a-diagnostics-${stamp}.zip`;
|
|
71939
70605
|
let output = (0, import_node_path31.join)(input.cwd, base);
|
|
71940
|
-
for (let suffix = 2; (0,
|
|
70606
|
+
for (let suffix = 2; (0, import_node_fs24.existsSync)(output); suffix += 1) {
|
|
71941
70607
|
output = (0, import_node_path31.join)(input.cwd, `okx-a2a-diagnostics-${stamp}-${suffix}.zip`);
|
|
71942
70608
|
}
|
|
71943
70609
|
return output;
|
|
71944
70610
|
}
|
|
71945
70611
|
async function writeArchiveAtomically(outputPath, archive, overwrite) {
|
|
71946
|
-
await (0,
|
|
70612
|
+
await (0, import_promises13.mkdir)((0, import_node_path31.dirname)(outputPath), { recursive: true });
|
|
71947
70613
|
const temporaryPath = (0, import_node_path31.join)(
|
|
71948
70614
|
(0, import_node_path31.dirname)(outputPath),
|
|
71949
|
-
`.${(0, import_node_path31.basename)(outputPath)}.${(0,
|
|
70615
|
+
`.${(0, import_node_path31.basename)(outputPath)}.${(0, import_node_crypto14.randomUUID)()}.tmp`
|
|
71950
70616
|
);
|
|
71951
70617
|
try {
|
|
71952
|
-
await (0,
|
|
70618
|
+
await (0, import_promises13.writeFile)(temporaryPath, archive, { flag: "wx", mode: 384 });
|
|
71953
70619
|
if (overwrite) {
|
|
71954
|
-
if ((0,
|
|
71955
|
-
await (0,
|
|
70620
|
+
if ((0, import_node_fs24.existsSync)(outputPath)) {
|
|
70621
|
+
await (0, import_promises13.rm)(outputPath, { force: true });
|
|
71956
70622
|
}
|
|
71957
|
-
await (0,
|
|
70623
|
+
await (0, import_promises13.rename)(temporaryPath, outputPath);
|
|
71958
70624
|
} else {
|
|
71959
|
-
await (0,
|
|
71960
|
-
await (0,
|
|
70625
|
+
await (0, import_promises13.link)(temporaryPath, outputPath);
|
|
70626
|
+
await (0, import_promises13.rm)(temporaryPath, { force: true });
|
|
71961
70627
|
}
|
|
71962
70628
|
} catch (err) {
|
|
71963
|
-
await (0,
|
|
70629
|
+
await (0, import_promises13.rm)(temporaryPath, { force: true }).catch(() => void 0);
|
|
71964
70630
|
throw err;
|
|
71965
70631
|
}
|
|
71966
70632
|
}
|
|
71967
70633
|
function hashDiagnosticFileContent(content) {
|
|
71968
|
-
return (0,
|
|
70634
|
+
return (0, import_node_crypto14.createHash)("sha256").update(content).digest("hex");
|
|
71969
70635
|
}
|
|
71970
70636
|
function isUnavailableError(err) {
|
|
71971
70637
|
return !!err && typeof err === "object" && "diagnosticUnavailable" in err;
|
|
71972
70638
|
}
|
|
71973
70639
|
|
|
71974
70640
|
// src/logs-export-database.ts
|
|
71975
|
-
var
|
|
70641
|
+
var import_node_fs25 = require("node:fs");
|
|
71976
70642
|
var PROVIDERS = ["codex", "claude", "openclaw", "hermes"];
|
|
71977
70643
|
function readSessionSqliteSnapshot(dbPath, options, selectedJobIds) {
|
|
71978
70644
|
const hasTimeWindow2 = options.fromMs !== void 0 && options.toMs !== void 0;
|
|
@@ -72070,11 +70736,11 @@ function readSessionSqliteSnapshot(dbPath, options, selectedJobIds) {
|
|
|
72070
70736
|
};
|
|
72071
70737
|
}
|
|
72072
70738
|
function readSqliteRows(dbPath, sql, params = []) {
|
|
72073
|
-
if (!(0,
|
|
70739
|
+
if (!(0, import_node_fs25.existsSync)(dbPath)) {
|
|
72074
70740
|
throw unavailable(`SQLite database not found: ${dbPath}`);
|
|
72075
70741
|
}
|
|
72076
|
-
const { DatabaseSync:
|
|
72077
|
-
const db = new
|
|
70742
|
+
const { DatabaseSync: DatabaseSync4 } = loadSqlite4();
|
|
70743
|
+
const db = new DatabaseSync4(dbPath, { readOnly: true });
|
|
72078
70744
|
try {
|
|
72079
70745
|
return db.prepare(sql).all(...params);
|
|
72080
70746
|
} finally {
|
|
@@ -72092,7 +70758,7 @@ function emptySqliteSnapshot() {
|
|
|
72092
70758
|
storedProviderCommands: {}
|
|
72093
70759
|
};
|
|
72094
70760
|
}
|
|
72095
|
-
function
|
|
70761
|
+
function loadSqlite4() {
|
|
72096
70762
|
const originalEmitWarning = process.emitWarning;
|
|
72097
70763
|
process.emitWarning = ((warning, ...args) => {
|
|
72098
70764
|
const message = typeof warning === "string" ? warning : warning.message;
|
|
@@ -72225,9 +70891,9 @@ function isProvider2(value) {
|
|
|
72225
70891
|
}
|
|
72226
70892
|
|
|
72227
70893
|
// src/logs-export-utils.ts
|
|
72228
|
-
var
|
|
72229
|
-
var
|
|
72230
|
-
var
|
|
70894
|
+
var import_node_crypto15 = require("node:crypto");
|
|
70895
|
+
var import_node_fs26 = require("node:fs");
|
|
70896
|
+
var import_promises14 = require("node:fs/promises");
|
|
72231
70897
|
var import_node_path33 = require("node:path");
|
|
72232
70898
|
var MAX_JSON_FILE_BYTES = 20 * 1024 * 1024;
|
|
72233
70899
|
var STRONG_CORRELATION_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -72343,7 +71009,7 @@ function collectCorrelationIds(value, output, key = "", depth = 0) {
|
|
|
72343
71009
|
}
|
|
72344
71010
|
async function safeReadDir(path2) {
|
|
72345
71011
|
try {
|
|
72346
|
-
return await (0,
|
|
71012
|
+
return await (0, import_promises14.readdir)(path2);
|
|
72347
71013
|
} catch (err) {
|
|
72348
71014
|
if (err.code === "ENOENT") {
|
|
72349
71015
|
return [];
|
|
@@ -72356,11 +71022,11 @@ async function readJsonObject(path2) {
|
|
|
72356
71022
|
if (file.size > MAX_JSON_FILE_BYTES) {
|
|
72357
71023
|
throw unavailable2(`JSON source exceeds ${MAX_JSON_FILE_BYTES} bytes`);
|
|
72358
71024
|
}
|
|
72359
|
-
const value = parseJsonValue3(await (0,
|
|
71025
|
+
const value = parseJsonValue3(await (0, import_promises14.readFile)(path2, "utf8"));
|
|
72360
71026
|
return isRecord7(value) ? value : null;
|
|
72361
71027
|
}
|
|
72362
71028
|
async function assertRegularFile2(path2) {
|
|
72363
|
-
const file = await (0,
|
|
71029
|
+
const file = await (0, import_promises14.lstat)(path2);
|
|
72364
71030
|
if (file.isSymbolicLink() || !file.isFile()) {
|
|
72365
71031
|
throw unavailable2(`Refusing non-regular diagnostic source: ${(0, import_node_path33.basename)(path2)}`);
|
|
72366
71032
|
}
|
|
@@ -72368,8 +71034,8 @@ async function assertRegularFile2(path2) {
|
|
|
72368
71034
|
}
|
|
72369
71035
|
async function inspectRegularFile(path2) {
|
|
72370
71036
|
const file = await assertRegularFile2(path2);
|
|
72371
|
-
const hash2 = (0,
|
|
72372
|
-
for await (const chunk of (0,
|
|
71037
|
+
const hash2 = (0, import_node_crypto15.createHash)("sha256");
|
|
71038
|
+
for await (const chunk of (0, import_node_fs26.createReadStream)(path2)) {
|
|
72373
71039
|
hash2.update(chunk);
|
|
72374
71040
|
}
|
|
72375
71041
|
return {
|
|
@@ -72621,7 +71287,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
72621
71287
|
node: process.version,
|
|
72622
71288
|
platform: process.platform,
|
|
72623
71289
|
arch: process.arch,
|
|
72624
|
-
packageVersion: true ? "0.2.19
|
|
71290
|
+
packageVersion: true ? "0.2.19" : "unknown",
|
|
72625
71291
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
72626
71292
|
listenerAndLlmContentIncluded: true,
|
|
72627
71293
|
credentialsAlwaysRedacted: true,
|
|
@@ -73038,7 +71704,7 @@ async function collectProviderDiagnostics(state, provider, storedCommand, option
|
|
|
73038
71704
|
const configCandidates = providerConfigCandidates(provider, paths.taskHome);
|
|
73039
71705
|
const configNotes = [];
|
|
73040
71706
|
for (const candidate of configCandidates) {
|
|
73041
|
-
if (!(0,
|
|
71707
|
+
if (!(0, import_node_fs27.existsSync)(candidate.path)) {
|
|
73042
71708
|
continue;
|
|
73043
71709
|
}
|
|
73044
71710
|
let info;
|
|
@@ -73089,7 +71755,7 @@ async function collectOpenClawSessionStore(state, options) {
|
|
|
73089
71755
|
for (const agentId of allAgentNames.slice(0, MAX_OPENCLAW_AGENTS)) {
|
|
73090
71756
|
const sessionsDir = (0, import_node_path34.join)(agentsDir, agentId, "sessions");
|
|
73091
71757
|
try {
|
|
73092
|
-
const info = await (0,
|
|
71758
|
+
const info = await (0, import_promises15.lstat)(sessionsDir);
|
|
73093
71759
|
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
73094
71760
|
skippedSources += 1;
|
|
73095
71761
|
continue;
|
|
@@ -73266,7 +71932,7 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
|
|
|
73266
71932
|
async function collectDoctorSnapshot(state, options) {
|
|
73267
71933
|
await runCollector(state, "doctor", async () => {
|
|
73268
71934
|
const cliPath = process.argv[1];
|
|
73269
|
-
if (!cliPath || !(0,
|
|
71935
|
+
if (!cliPath || !(0, import_node_fs27.existsSync)(cliPath)) {
|
|
73270
71936
|
throw unavailable2("Unable to resolve the running okx-a2a CLI path");
|
|
73271
71937
|
}
|
|
73272
71938
|
const result = (0, import_node_child_process10.spawnSync)(process.execPath, [
|
|
@@ -74533,7 +73199,7 @@ async function runDoctor(options = {}) {
|
|
|
74533
73199
|
platform: options.platform ?? process.platform,
|
|
74534
73200
|
env: options.env ?? process.env,
|
|
74535
73201
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
74536
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.19
|
|
73202
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.19" : "0.0.0"),
|
|
74537
73203
|
fixMode: options.fix === true,
|
|
74538
73204
|
nonInteractive: options.nonInteractive === true,
|
|
74539
73205
|
packageChanged: false,
|
|
@@ -74774,23 +73440,7 @@ init_autostart_windows();
|
|
|
74774
73440
|
DEFAULT_LOG_TAIL_LIMIT,
|
|
74775
73441
|
DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC,
|
|
74776
73442
|
DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC,
|
|
74777
|
-
DEVKIT_DROP_REASON,
|
|
74778
|
-
DEVKIT_MAX_CONCURRENCY,
|
|
74779
|
-
DEVKIT_MAX_MESSAGE_BYTES,
|
|
74780
|
-
DEVKIT_MAX_PENDING,
|
|
74781
|
-
DEVKIT_MAX_PENDING_BYTES,
|
|
74782
|
-
DEVKIT_OUTCOME,
|
|
74783
|
-
DEVKIT_REQUEST_BUDGET_MS,
|
|
74784
|
-
DEVKIT_RESPONSE_DIAGNOSTIC_MAX_BYTES,
|
|
74785
|
-
DEVKIT_RESPONSE_SUMMARY_MAX_CHARS,
|
|
74786
|
-
DEVKIT_SERVER_APPLICATION_ID,
|
|
74787
|
-
DEVKIT_SERVER_DB_NAME,
|
|
74788
|
-
DEVKIT_SERVER_SCHEMA_VERSION,
|
|
74789
73443
|
DOCTOR_MIN_NODE_VERSION,
|
|
74790
|
-
DevkitDeliveryDispatcher,
|
|
74791
|
-
DevkitServerStore,
|
|
74792
|
-
DevkitServerStoreError,
|
|
74793
|
-
DevkitTargetError,
|
|
74794
73444
|
GatewayOutboundBehavior,
|
|
74795
73445
|
HEARTBEAT_GATEWAY_CHECK_TIMEOUT_MS,
|
|
74796
73446
|
InboundReplayGate,
|
|
@@ -74848,7 +73498,6 @@ init_autostart_windows();
|
|
|
74848
73498
|
buildExternalCommandInvocation,
|
|
74849
73499
|
buildGatewayOutboundExtra,
|
|
74850
73500
|
buildInboundTerminalExtras,
|
|
74851
|
-
buildJobEnvelope,
|
|
74852
73501
|
buildLaunchdPlist,
|
|
74853
73502
|
buildLauncherEntryJs,
|
|
74854
73503
|
buildMessageEligibleArgs,
|
|
@@ -74859,7 +73508,6 @@ init_autostart_windows();
|
|
|
74859
73508
|
buildSchtasksRunArgs,
|
|
74860
73509
|
buildSeaConfig,
|
|
74861
73510
|
buildServicePath,
|
|
74862
|
-
buildSessionEnvelope,
|
|
74863
73511
|
buildSessionKey,
|
|
74864
73512
|
buildSystemMessageNotice,
|
|
74865
73513
|
buildSystemStoredMessage,
|
|
@@ -74877,8 +73525,6 @@ init_autostart_windows();
|
|
|
74877
73525
|
checkCodexCliAuthStatus,
|
|
74878
73526
|
checkCodexReadiness,
|
|
74879
73527
|
claimActiveDaemon,
|
|
74880
|
-
classifyFetchFailure,
|
|
74881
|
-
classifyHttpOutcome,
|
|
74882
73528
|
classifyJobBindingSource,
|
|
74883
73529
|
clearCodexReadinessCache,
|
|
74884
73530
|
codexCommandResolvesWithoutOverride,
|
|
@@ -74887,7 +73533,6 @@ init_autostart_windows();
|
|
|
74887
73533
|
collectCodexCommandCandidates,
|
|
74888
73534
|
commandExists,
|
|
74889
73535
|
createAiToolFailureTracker,
|
|
74890
|
-
createDevkitAutoRouter,
|
|
74891
73536
|
createFileMessageHandler,
|
|
74892
73537
|
createOutboundBehavior,
|
|
74893
73538
|
createUserAttentionWatchParentMonitor,
|
|
@@ -74898,7 +73543,6 @@ init_autostart_windows();
|
|
|
74898
73543
|
detectGatewayInvocation,
|
|
74899
73544
|
detectMessageEligibleOfflineReplaySupport,
|
|
74900
73545
|
detectRuntime,
|
|
74901
|
-
devkitServerDbExists,
|
|
74902
73546
|
ensureDaemonReady,
|
|
74903
73547
|
ensureDefaultAiProvider,
|
|
74904
73548
|
ensureOpenClawOkxA2aPluginConfig,
|
|
@@ -74921,7 +73565,6 @@ init_autostart_windows();
|
|
|
74921
73565
|
getSessionBusyTracker,
|
|
74922
73566
|
getXmtpCreationCooldown,
|
|
74923
73567
|
handleCapabilitiesCommand,
|
|
74924
|
-
handleDevkitCommand,
|
|
74925
73568
|
handleDoctorCommand,
|
|
74926
73569
|
handleXmtpDebugCommand,
|
|
74927
73570
|
handleXmtpSendCommand,
|
|
@@ -74963,7 +73606,6 @@ init_autostart_windows();
|
|
|
74963
73606
|
nodeVersionSatisfies,
|
|
74964
73607
|
normalizeAiProvider,
|
|
74965
73608
|
normalizeAiRuntimeProvider,
|
|
74966
|
-
normalizeDevkitTarget,
|
|
74967
73609
|
normalizeHermesOkxA2aPluginConfig,
|
|
74968
73610
|
notifyAgentMessageToUserAttention,
|
|
74969
73611
|
notifyDirectToUserAttention,
|
|
@@ -74980,7 +73622,6 @@ init_autostart_windows();
|
|
|
74980
73622
|
persistCurrentRuntimeSelectionForNewJob,
|
|
74981
73623
|
pickOnchainosWin32Candidate,
|
|
74982
73624
|
prepareAndBindCurrentRuntimeForNewJob,
|
|
74983
|
-
printDevkitUsage,
|
|
74984
73625
|
printLogsExportUsage,
|
|
74985
73626
|
printXmtpTestUsage,
|
|
74986
73627
|
probeCodexAuthStatus,
|
|
@@ -74992,7 +73633,6 @@ init_autostart_windows();
|
|
|
74992
73633
|
readLastLines,
|
|
74993
73634
|
readParentProcessCommandForPlatform,
|
|
74994
73635
|
readUserAttentionWatcherEvent,
|
|
74995
|
-
redactSummary,
|
|
74996
73636
|
refreshAgentsAndWait,
|
|
74997
73637
|
refreshOnchainosVersionMetadata,
|
|
74998
73638
|
registerUserAttentionWatcher,
|
|
@@ -75015,7 +73655,6 @@ init_autostart_windows();
|
|
|
75015
73655
|
resolveCodexCommandSource,
|
|
75016
73656
|
resolveConfiguredAiProvider,
|
|
75017
73657
|
resolveConfiguredAiProviderForJob,
|
|
75018
|
-
resolveDevkitServerDbPath,
|
|
75019
73658
|
resolveDirectCommunicationSessionTarget,
|
|
75020
73659
|
resolveDoctorTarget,
|
|
75021
73660
|
resolveEnvelopePayload,
|