@okxweb3/a2a-node 0.0.16 → 0.0.17-beta-db5dca184d-260624144716
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/README.md +40 -6
- package/dist/cli.js +584 -292
- package/dist/index.js +29 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -343,6 +343,9 @@ function mapPendingGatewayDeliveryRow(row) {
|
|
|
343
343
|
...row.job_id ? { jobId: row.job_id } : {},
|
|
344
344
|
...row.llm_content ? { llmContent: row.llm_content } : {},
|
|
345
345
|
...row.message_id ? { messageId: row.message_id } : {},
|
|
346
|
+
...row.attention_id ? { attentionId: row.attention_id } : {},
|
|
347
|
+
...row.delivery_state_json ? { deliveryStateJson: row.delivery_state_json } : {},
|
|
348
|
+
...row.payload_json ? { payloadJson: row.payload_json } : {},
|
|
346
349
|
...row.last_error ? { lastError: row.last_error } : {},
|
|
347
350
|
...row.last_attempt_at ? { lastAttemptAt: row.last_attempt_at } : {}
|
|
348
351
|
};
|
|
@@ -579,7 +582,7 @@ var init_session_store = __esm({
|
|
|
579
582
|
`);
|
|
580
583
|
}
|
|
581
584
|
ensurePendingGatewayDeliveriesSchema() {
|
|
582
|
-
const expectedKindCheck =
|
|
585
|
+
const expectedKindCheck = this.pendingGatewayDeliveryKindCheck();
|
|
583
586
|
this.db.exec(`
|
|
584
587
|
CREATE TABLE IF NOT EXISTS pending_gateway_deliveries (
|
|
585
588
|
id TEXT PRIMARY KEY,
|
|
@@ -590,6 +593,9 @@ var init_session_store = __esm({
|
|
|
590
593
|
content TEXT NOT NULL,
|
|
591
594
|
llm_content TEXT,
|
|
592
595
|
message_id TEXT UNIQUE,
|
|
596
|
+
attention_id TEXT,
|
|
597
|
+
delivery_state_json TEXT,
|
|
598
|
+
payload_json TEXT,
|
|
593
599
|
attempts INTEGER NOT NULL DEFAULT 0,
|
|
594
600
|
last_error TEXT,
|
|
595
601
|
created_at TEXT NOT NULL,
|
|
@@ -597,7 +603,7 @@ var init_session_store = __esm({
|
|
|
597
603
|
)
|
|
598
604
|
`);
|
|
599
605
|
const row = this.db.prepare("SELECT sql FROM sqlite_master WHERE type='table' AND name='pending_gateway_deliveries'").get();
|
|
600
|
-
if (row?.sql?.includes("
|
|
606
|
+
if (row?.sql?.includes("attention_id") && row.sql.includes("delivery_state_json") && row.sql.includes("payload_json")) {
|
|
601
607
|
return;
|
|
602
608
|
}
|
|
603
609
|
this.db.exec("ALTER TABLE pending_gateway_deliveries RENAME TO pending_gateway_deliveries_old");
|
|
@@ -611,6 +617,9 @@ var init_session_store = __esm({
|
|
|
611
617
|
content TEXT NOT NULL,
|
|
612
618
|
llm_content TEXT,
|
|
613
619
|
message_id TEXT UNIQUE,
|
|
620
|
+
attention_id TEXT,
|
|
621
|
+
delivery_state_json TEXT,
|
|
622
|
+
payload_json TEXT,
|
|
614
623
|
attempts INTEGER NOT NULL DEFAULT 0,
|
|
615
624
|
last_error TEXT,
|
|
616
625
|
created_at TEXT NOT NULL,
|
|
@@ -620,15 +629,19 @@ var init_session_store = __esm({
|
|
|
620
629
|
this.db.exec(`
|
|
621
630
|
INSERT INTO pending_gateway_deliveries (
|
|
622
631
|
id, kind, provider, session_key, job_id, content, llm_content,
|
|
623
|
-
message_id,
|
|
632
|
+
message_id, attention_id, delivery_state_json, payload_json,
|
|
633
|
+
attempts, last_error, created_at, last_attempt_at
|
|
624
634
|
)
|
|
625
635
|
SELECT
|
|
626
636
|
id, kind, provider, session_key, job_id, content, llm_content,
|
|
627
|
-
message_id, attempts, last_error, created_at, last_attempt_at
|
|
637
|
+
message_id, NULL, NULL, NULL, attempts, last_error, created_at, last_attempt_at
|
|
628
638
|
FROM pending_gateway_deliveries_old
|
|
629
639
|
`);
|
|
630
640
|
this.db.exec("DROP TABLE pending_gateway_deliveries_old");
|
|
631
641
|
}
|
|
642
|
+
pendingGatewayDeliveryKindCheck() {
|
|
643
|
+
return "kind IN ('session_send', 'chat_inject', 'dispatch_user_latest', 'prompt_user_latest')";
|
|
644
|
+
}
|
|
632
645
|
close() {
|
|
633
646
|
this.db.close();
|
|
634
647
|
}
|
|
@@ -1358,9 +1371,10 @@ var init_session_store = __esm({
|
|
|
1358
1371
|
this.db.prepare(`
|
|
1359
1372
|
INSERT INTO pending_gateway_deliveries (
|
|
1360
1373
|
id, kind, provider, session_key, job_id, content, llm_content,
|
|
1361
|
-
message_id,
|
|
1374
|
+
message_id, attention_id, delivery_state_json, payload_json,
|
|
1375
|
+
attempts, last_error, created_at, last_attempt_at
|
|
1362
1376
|
)
|
|
1363
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, NULL, ?, NULL)
|
|
1377
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, NULL, ?, NULL)
|
|
1364
1378
|
`).run(
|
|
1365
1379
|
id,
|
|
1366
1380
|
input.kind,
|
|
@@ -1370,6 +1384,9 @@ var init_session_store = __esm({
|
|
|
1370
1384
|
input.content,
|
|
1371
1385
|
input.llmContent ?? null,
|
|
1372
1386
|
messageId,
|
|
1387
|
+
input.attentionId ?? null,
|
|
1388
|
+
input.deliveryStateJson ?? null,
|
|
1389
|
+
input.payloadJson ?? null,
|
|
1373
1390
|
createdAt
|
|
1374
1391
|
);
|
|
1375
1392
|
const row = this.getPendingGatewayDelivery(id);
|
|
@@ -1630,15 +1647,15 @@ async function ensureAiWorkspace(paths) {
|
|
|
1630
1647
|
return aiWorkingDir;
|
|
1631
1648
|
}
|
|
1632
1649
|
async function waitForImmediateExit(child, timeoutMs) {
|
|
1633
|
-
return await new Promise((
|
|
1650
|
+
return await new Promise((resolve8) => {
|
|
1634
1651
|
let timer;
|
|
1635
1652
|
const onExit = () => {
|
|
1636
1653
|
clearTimeout(timer);
|
|
1637
|
-
|
|
1654
|
+
resolve8(true);
|
|
1638
1655
|
};
|
|
1639
1656
|
timer = setTimeout(() => {
|
|
1640
1657
|
child.off("exit", onExit);
|
|
1641
|
-
|
|
1658
|
+
resolve8(false);
|
|
1642
1659
|
}, timeoutMs);
|
|
1643
1660
|
child.once("exit", onExit);
|
|
1644
1661
|
});
|
|
@@ -1757,7 +1774,7 @@ async function waitForExit(pid, timeoutMs) {
|
|
|
1757
1774
|
if (!isProcessAlive(pid)) {
|
|
1758
1775
|
return true;
|
|
1759
1776
|
}
|
|
1760
|
-
await new Promise((
|
|
1777
|
+
await new Promise((resolve8) => setTimeout(resolve8, 100));
|
|
1761
1778
|
}
|
|
1762
1779
|
return !isProcessAlive(pid);
|
|
1763
1780
|
}
|
|
@@ -2077,7 +2094,7 @@ var init_command_store = __esm({
|
|
|
2077
2094
|
if (result) {
|
|
2078
2095
|
return result;
|
|
2079
2096
|
}
|
|
2080
|
-
await new Promise((
|
|
2097
|
+
await new Promise((resolve8) => setTimeout(resolve8, 500));
|
|
2081
2098
|
}
|
|
2082
2099
|
return null;
|
|
2083
2100
|
}
|
|
@@ -3175,7 +3192,7 @@ async function promptForAiProviderWithArrows(options) {
|
|
|
3175
3192
|
options.stdin.resume();
|
|
3176
3193
|
options.stdout.write("\x1B[?25l");
|
|
3177
3194
|
render();
|
|
3178
|
-
return await new Promise((
|
|
3195
|
+
return await new Promise((resolve8, reject) => {
|
|
3179
3196
|
const cleanup = () => {
|
|
3180
3197
|
options.stdin.off("keypress", onKeypress);
|
|
3181
3198
|
options.stdin.setRawMode(false);
|
|
@@ -3194,7 +3211,7 @@ async function promptForAiProviderWithArrows(options) {
|
|
|
3194
3211
|
clearRendered();
|
|
3195
3212
|
options.stdout.write(`Selected AI provider: ${provider}
|
|
3196
3213
|
`);
|
|
3197
|
-
|
|
3214
|
+
resolve8(provider);
|
|
3198
3215
|
};
|
|
3199
3216
|
const onKeypress = (_str, key) => {
|
|
3200
3217
|
if (key.ctrl && key.name === "c") {
|
|
@@ -3311,14 +3328,14 @@ async function startUserAttentionEventServer(options = {}) {
|
|
|
3311
3328
|
}
|
|
3312
3329
|
}
|
|
3313
3330
|
}
|
|
3314
|
-
await new Promise((
|
|
3331
|
+
await new Promise((resolve8, reject) => {
|
|
3315
3332
|
const onError = (err2) => {
|
|
3316
3333
|
server.off("listening", onListening);
|
|
3317
3334
|
reject(err2);
|
|
3318
3335
|
};
|
|
3319
3336
|
const onListening = () => {
|
|
3320
3337
|
server.off("error", onError);
|
|
3321
|
-
|
|
3338
|
+
resolve8();
|
|
3322
3339
|
};
|
|
3323
3340
|
server.once("error", onError);
|
|
3324
3341
|
server.once("listening", onListening);
|
|
@@ -3333,7 +3350,7 @@ async function startUserAttentionEventServer(options = {}) {
|
|
|
3333
3350
|
for (const socket of sockets) {
|
|
3334
3351
|
socket.destroy();
|
|
3335
3352
|
}
|
|
3336
|
-
return new Promise((
|
|
3353
|
+
return new Promise((resolve8, reject) => {
|
|
3337
3354
|
server.close((err2) => {
|
|
3338
3355
|
if (process.platform !== "win32") {
|
|
3339
3356
|
try {
|
|
@@ -3344,7 +3361,7 @@ async function startUserAttentionEventServer(options = {}) {
|
|
|
3344
3361
|
if (err2) {
|
|
3345
3362
|
reject(err2);
|
|
3346
3363
|
} else {
|
|
3347
|
-
|
|
3364
|
+
resolve8();
|
|
3348
3365
|
}
|
|
3349
3366
|
});
|
|
3350
3367
|
});
|
|
@@ -3353,7 +3370,7 @@ async function startUserAttentionEventServer(options = {}) {
|
|
|
3353
3370
|
}
|
|
3354
3371
|
async function subscribeUserAttentionEvents(options) {
|
|
3355
3372
|
const path = resolveUserAttentionIpcPath(options.homeDir);
|
|
3356
|
-
return new Promise((
|
|
3373
|
+
return new Promise((resolve8) => {
|
|
3357
3374
|
const socket = (0, import_node_net.createConnection)(path);
|
|
3358
3375
|
let settled = false;
|
|
3359
3376
|
let buffer2 = "";
|
|
@@ -3362,7 +3379,7 @@ async function subscribeUserAttentionEvents(options) {
|
|
|
3362
3379
|
return;
|
|
3363
3380
|
}
|
|
3364
3381
|
settled = true;
|
|
3365
|
-
|
|
3382
|
+
resolve8({
|
|
3366
3383
|
path,
|
|
3367
3384
|
connected,
|
|
3368
3385
|
close() {
|
|
@@ -3394,7 +3411,7 @@ async function subscribeUserAttentionEvents(options) {
|
|
|
3394
3411
|
}
|
|
3395
3412
|
async function notifyUserAttentionChanged(homeDir) {
|
|
3396
3413
|
const path = resolveUserAttentionIpcPath(homeDir);
|
|
3397
|
-
return new Promise((
|
|
3414
|
+
return new Promise((resolve8) => {
|
|
3398
3415
|
const socket = (0, import_node_net.createConnection)(path);
|
|
3399
3416
|
let done = false;
|
|
3400
3417
|
const finish = (ok) => {
|
|
@@ -3403,7 +3420,7 @@ async function notifyUserAttentionChanged(homeDir) {
|
|
|
3403
3420
|
}
|
|
3404
3421
|
done = true;
|
|
3405
3422
|
socket.destroy();
|
|
3406
|
-
|
|
3423
|
+
resolve8(ok);
|
|
3407
3424
|
};
|
|
3408
3425
|
socket.setTimeout(1e3, () => finish(false));
|
|
3409
3426
|
socket.once("connect", () => {
|
|
@@ -7348,7 +7365,7 @@ function isGatewayStartingError(err2) {
|
|
|
7348
7365
|
return String(e?.details?.reason ?? "") === "startup-sidecars" || String(e?.message ?? "").toLowerCase().includes("gateway starting");
|
|
7349
7366
|
}
|
|
7350
7367
|
async function sleep(ms) {
|
|
7351
|
-
await new Promise((
|
|
7368
|
+
await new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
7352
7369
|
}
|
|
7353
7370
|
function readSyncedGatewayConfig(env) {
|
|
7354
7371
|
try {
|
|
@@ -7373,7 +7390,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7373
7390
|
client: {
|
|
7374
7391
|
id: "gateway-client",
|
|
7375
7392
|
displayName: "okx-a2a-node",
|
|
7376
|
-
version: "0.0.
|
|
7393
|
+
version: "0.0.17-beta-db5dca184d-260624144716",
|
|
7377
7394
|
platform: "node",
|
|
7378
7395
|
mode: "backend",
|
|
7379
7396
|
instanceId
|
|
@@ -7384,7 +7401,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
7384
7401
|
commands: [],
|
|
7385
7402
|
permissions: {},
|
|
7386
7403
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
7387
|
-
userAgent: `okx-a2a-node/${"0.0.
|
|
7404
|
+
userAgent: `okx-a2a-node/${"0.0.17-beta-db5dca184d-260624144716"}`,
|
|
7388
7405
|
auth: {
|
|
7389
7406
|
...config.token ? { token: config.token } : {},
|
|
7390
7407
|
...config.password ? { password: config.password } : {}
|
|
@@ -7489,7 +7506,7 @@ var init_openclaw_gateway = __esm({
|
|
|
7489
7506
|
);
|
|
7490
7507
|
const ws = wsFactory(this.config.url);
|
|
7491
7508
|
this.ws = ws;
|
|
7492
|
-
await new Promise((
|
|
7509
|
+
await new Promise((resolve8, reject) => {
|
|
7493
7510
|
let settled = false;
|
|
7494
7511
|
const timer = setTimeout(() => {
|
|
7495
7512
|
if (settled) {
|
|
@@ -7508,7 +7525,7 @@ var init_openclaw_gateway = __esm({
|
|
|
7508
7525
|
}
|
|
7509
7526
|
settled = true;
|
|
7510
7527
|
clearTimeout(timer);
|
|
7511
|
-
|
|
7528
|
+
resolve8();
|
|
7512
7529
|
},
|
|
7513
7530
|
(err2) => {
|
|
7514
7531
|
if (settled) {
|
|
@@ -7560,7 +7577,7 @@ var init_openclaw_gateway = __esm({
|
|
|
7560
7577
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
7561
7578
|
const id = `okx-a2a-${++this.requestSeq}-${(0, import_node_crypto3.randomUUID)()}`;
|
|
7562
7579
|
const frame = { type: "req", id, method, params };
|
|
7563
|
-
return new Promise((
|
|
7580
|
+
return new Promise((resolve8, reject) => {
|
|
7564
7581
|
const timer = setTimeout(() => {
|
|
7565
7582
|
this.pending.delete(id);
|
|
7566
7583
|
reject(Object.assign(new Error(`OpenClaw gateway request timed out method=${method}`), {
|
|
@@ -7569,7 +7586,7 @@ var init_openclaw_gateway = __esm({
|
|
|
7569
7586
|
}));
|
|
7570
7587
|
}, timeoutMs);
|
|
7571
7588
|
timer.unref?.();
|
|
7572
|
-
this.pending.set(id, { method, resolve:
|
|
7589
|
+
this.pending.set(id, { method, resolve: resolve8, reject, timer });
|
|
7573
7590
|
try {
|
|
7574
7591
|
this.ws.send(JSON.stringify(frame));
|
|
7575
7592
|
} catch (err2) {
|
|
@@ -9864,7 +9881,7 @@ var require_path = __commonJS({
|
|
|
9864
9881
|
const parts = splitPathRe.exec(truncated);
|
|
9865
9882
|
return parts ? parts.slice(1) : [];
|
|
9866
9883
|
}
|
|
9867
|
-
function
|
|
9884
|
+
function resolve8(...args) {
|
|
9868
9885
|
let resolvedPath = "";
|
|
9869
9886
|
let resolvedAbsolute = false;
|
|
9870
9887
|
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
@@ -9900,8 +9917,8 @@ var require_path = __commonJS({
|
|
|
9900
9917
|
return arr.slice(start, end - start + 1);
|
|
9901
9918
|
}
|
|
9902
9919
|
function relative(from3, to) {
|
|
9903
|
-
from3 =
|
|
9904
|
-
to =
|
|
9920
|
+
from3 = resolve8(from3).slice(1);
|
|
9921
|
+
to = resolve8(to).slice(1);
|
|
9905
9922
|
const fromParts = trim2(from3.split("/"));
|
|
9906
9923
|
const toParts = trim2(to.split("/"));
|
|
9907
9924
|
const length2 = Math.min(fromParts.length, toParts.length);
|
|
@@ -9937,7 +9954,7 @@ var require_path = __commonJS({
|
|
|
9937
9954
|
function isAbsolute2(path) {
|
|
9938
9955
|
return path.charAt(0) === "/";
|
|
9939
9956
|
}
|
|
9940
|
-
function
|
|
9957
|
+
function join22(...args) {
|
|
9941
9958
|
return normalizePath(args.join("/"));
|
|
9942
9959
|
}
|
|
9943
9960
|
function dirname6(path) {
|
|
@@ -9962,10 +9979,10 @@ var require_path = __commonJS({
|
|
|
9962
9979
|
exports2.basename = basename5;
|
|
9963
9980
|
exports2.dirname = dirname6;
|
|
9964
9981
|
exports2.isAbsolute = isAbsolute2;
|
|
9965
|
-
exports2.join =
|
|
9982
|
+
exports2.join = join22;
|
|
9966
9983
|
exports2.normalizePath = normalizePath;
|
|
9967
9984
|
exports2.relative = relative;
|
|
9968
|
-
exports2.resolve =
|
|
9985
|
+
exports2.resolve = resolve8;
|
|
9969
9986
|
}
|
|
9970
9987
|
});
|
|
9971
9988
|
|
|
@@ -9984,8 +10001,8 @@ var require_syncpromise = __commonJS({
|
|
|
9984
10001
|
States2[States2["REJECTED"] = REJECTED] = "REJECTED";
|
|
9985
10002
|
})(States || (States = {}));
|
|
9986
10003
|
function resolvedSyncPromise(value) {
|
|
9987
|
-
return new SyncPromise((
|
|
9988
|
-
|
|
10004
|
+
return new SyncPromise((resolve8) => {
|
|
10005
|
+
resolve8(value);
|
|
9989
10006
|
});
|
|
9990
10007
|
}
|
|
9991
10008
|
function rejectedSyncPromise(reason) {
|
|
@@ -10009,15 +10026,15 @@ var require_syncpromise = __commonJS({
|
|
|
10009
10026
|
}
|
|
10010
10027
|
/** JSDoc */
|
|
10011
10028
|
then(onfulfilled, onrejected) {
|
|
10012
|
-
return new _SyncPromise((
|
|
10029
|
+
return new _SyncPromise((resolve8, reject) => {
|
|
10013
10030
|
this._handlers.push([
|
|
10014
10031
|
false,
|
|
10015
10032
|
(result) => {
|
|
10016
10033
|
if (!onfulfilled) {
|
|
10017
|
-
|
|
10034
|
+
resolve8(result);
|
|
10018
10035
|
} else {
|
|
10019
10036
|
try {
|
|
10020
|
-
|
|
10037
|
+
resolve8(onfulfilled(result));
|
|
10021
10038
|
} catch (e) {
|
|
10022
10039
|
reject(e);
|
|
10023
10040
|
}
|
|
@@ -10028,7 +10045,7 @@ var require_syncpromise = __commonJS({
|
|
|
10028
10045
|
reject(reason);
|
|
10029
10046
|
} else {
|
|
10030
10047
|
try {
|
|
10031
|
-
|
|
10048
|
+
resolve8(onrejected(reason));
|
|
10032
10049
|
} catch (e) {
|
|
10033
10050
|
reject(e);
|
|
10034
10051
|
}
|
|
@@ -10044,7 +10061,7 @@ var require_syncpromise = __commonJS({
|
|
|
10044
10061
|
}
|
|
10045
10062
|
/** JSDoc */
|
|
10046
10063
|
finally(onfinally) {
|
|
10047
|
-
return new _SyncPromise((
|
|
10064
|
+
return new _SyncPromise((resolve8, reject) => {
|
|
10048
10065
|
let val;
|
|
10049
10066
|
let isRejected;
|
|
10050
10067
|
return this.then(
|
|
@@ -10067,7 +10084,7 @@ var require_syncpromise = __commonJS({
|
|
|
10067
10084
|
reject(val);
|
|
10068
10085
|
return;
|
|
10069
10086
|
}
|
|
10070
|
-
|
|
10087
|
+
resolve8(val);
|
|
10071
10088
|
});
|
|
10072
10089
|
});
|
|
10073
10090
|
}
|
|
@@ -10157,21 +10174,21 @@ var require_promisebuffer = __commonJS({
|
|
|
10157
10174
|
return task;
|
|
10158
10175
|
}
|
|
10159
10176
|
function drain(timeout) {
|
|
10160
|
-
return new syncpromise.SyncPromise((
|
|
10177
|
+
return new syncpromise.SyncPromise((resolve8, reject) => {
|
|
10161
10178
|
let counter = buffer2.length;
|
|
10162
10179
|
if (!counter) {
|
|
10163
|
-
return
|
|
10180
|
+
return resolve8(true);
|
|
10164
10181
|
}
|
|
10165
10182
|
const capturedSetTimeout = setTimeout(() => {
|
|
10166
10183
|
if (timeout && timeout > 0) {
|
|
10167
|
-
|
|
10184
|
+
resolve8(false);
|
|
10168
10185
|
}
|
|
10169
10186
|
}, timeout);
|
|
10170
10187
|
buffer2.forEach((item) => {
|
|
10171
10188
|
void syncpromise.resolvedSyncPromise(item).then(() => {
|
|
10172
10189
|
if (!--counter) {
|
|
10173
10190
|
clearTimeout(capturedSetTimeout);
|
|
10174
|
-
|
|
10191
|
+
resolve8(true);
|
|
10175
10192
|
}
|
|
10176
10193
|
}, reject);
|
|
10177
10194
|
});
|
|
@@ -11373,17 +11390,17 @@ var require_eventProcessors = __commonJS({
|
|
|
11373
11390
|
getGlobalEventProcessors().push(callback);
|
|
11374
11391
|
}
|
|
11375
11392
|
function notifyEventProcessors(processors, event, hint, index2 = 0) {
|
|
11376
|
-
return new utils.SyncPromise((
|
|
11393
|
+
return new utils.SyncPromise((resolve8, reject) => {
|
|
11377
11394
|
const processor = processors[index2];
|
|
11378
11395
|
if (event === null || typeof processor !== "function") {
|
|
11379
|
-
|
|
11396
|
+
resolve8(event);
|
|
11380
11397
|
} else {
|
|
11381
11398
|
const result = processor({ ...event }, hint);
|
|
11382
11399
|
(typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__) && processor.id && result === null && utils.logger.log(`Event processor "${processor.id}" dropped event`);
|
|
11383
11400
|
if (utils.isThenable(result)) {
|
|
11384
|
-
void result.then((final) => notifyEventProcessors(processors, final, hint, index2 + 1).then(
|
|
11401
|
+
void result.then((final) => notifyEventProcessors(processors, final, hint, index2 + 1).then(resolve8)).then(null, reject);
|
|
11385
11402
|
} else {
|
|
11386
|
-
void notifyEventProcessors(processors, result, hint, index2 + 1).then(
|
|
11403
|
+
void notifyEventProcessors(processors, result, hint, index2 + 1).then(resolve8).then(null, reject);
|
|
11387
11404
|
}
|
|
11388
11405
|
}
|
|
11389
11406
|
});
|
|
@@ -14537,18 +14554,18 @@ var require_baseclient = __commonJS({
|
|
|
14537
14554
|
* `false` otherwise
|
|
14538
14555
|
*/
|
|
14539
14556
|
_isClientDoneProcessing(timeout) {
|
|
14540
|
-
return new utils.SyncPromise((
|
|
14557
|
+
return new utils.SyncPromise((resolve8) => {
|
|
14541
14558
|
let ticked = 0;
|
|
14542
14559
|
const tick = 1;
|
|
14543
14560
|
const interval = setInterval(() => {
|
|
14544
14561
|
if (this._numProcessing == 0) {
|
|
14545
14562
|
clearInterval(interval);
|
|
14546
|
-
|
|
14563
|
+
resolve8(true);
|
|
14547
14564
|
} else {
|
|
14548
14565
|
ticked += tick;
|
|
14549
14566
|
if (timeout && ticked >= timeout) {
|
|
14550
14567
|
clearInterval(interval);
|
|
14551
|
-
|
|
14568
|
+
resolve8(false);
|
|
14552
14569
|
}
|
|
14553
14570
|
}
|
|
14554
14571
|
}, tick);
|
|
@@ -19196,20 +19213,20 @@ var require_promisify = __commonJS({
|
|
|
19196
19213
|
"../../node_modules/agent-base/dist/src/promisify.js"(exports2) {
|
|
19197
19214
|
"use strict";
|
|
19198
19215
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19199
|
-
function
|
|
19216
|
+
function promisify3(fn) {
|
|
19200
19217
|
return function(req, opts) {
|
|
19201
|
-
return new Promise((
|
|
19218
|
+
return new Promise((resolve8, reject) => {
|
|
19202
19219
|
fn.call(this, req, opts, (err2, rtn) => {
|
|
19203
19220
|
if (err2) {
|
|
19204
19221
|
reject(err2);
|
|
19205
19222
|
} else {
|
|
19206
|
-
|
|
19223
|
+
resolve8(rtn);
|
|
19207
19224
|
}
|
|
19208
19225
|
});
|
|
19209
19226
|
});
|
|
19210
19227
|
};
|
|
19211
19228
|
}
|
|
19212
|
-
exports2.default =
|
|
19229
|
+
exports2.default = promisify3;
|
|
19213
19230
|
}
|
|
19214
19231
|
});
|
|
19215
19232
|
|
|
@@ -19407,7 +19424,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
19407
19424
|
var debug_1 = __importDefault(require_src());
|
|
19408
19425
|
var debug = debug_1.default("https-proxy-agent:parse-proxy-response");
|
|
19409
19426
|
function parseProxyResponse(socket) {
|
|
19410
|
-
return new Promise((
|
|
19427
|
+
return new Promise((resolve8, reject) => {
|
|
19411
19428
|
let buffersLength = 0;
|
|
19412
19429
|
const buffers = [];
|
|
19413
19430
|
function read2() {
|
|
@@ -19447,7 +19464,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
19447
19464
|
const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
|
|
19448
19465
|
const statusCode = +firstLine.split(" ")[1];
|
|
19449
19466
|
debug("got proxy server response: %o", firstLine);
|
|
19450
|
-
|
|
19467
|
+
resolve8({
|
|
19451
19468
|
statusCode,
|
|
19452
19469
|
buffered
|
|
19453
19470
|
});
|
|
@@ -19468,11 +19485,11 @@ var require_agent = __commonJS({
|
|
|
19468
19485
|
"use strict";
|
|
19469
19486
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
19470
19487
|
function adopt(value) {
|
|
19471
|
-
return value instanceof P2 ? value : new P2(function(
|
|
19472
|
-
|
|
19488
|
+
return value instanceof P2 ? value : new P2(function(resolve8) {
|
|
19489
|
+
resolve8(value);
|
|
19473
19490
|
});
|
|
19474
19491
|
}
|
|
19475
|
-
return new (P2 || (P2 = Promise))(function(
|
|
19492
|
+
return new (P2 || (P2 = Promise))(function(resolve8, reject) {
|
|
19476
19493
|
function fulfilled(value) {
|
|
19477
19494
|
try {
|
|
19478
19495
|
step(generator.next(value));
|
|
@@ -19488,7 +19505,7 @@ var require_agent = __commonJS({
|
|
|
19488
19505
|
}
|
|
19489
19506
|
}
|
|
19490
19507
|
function step(result) {
|
|
19491
|
-
result.done ?
|
|
19508
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
19492
19509
|
}
|
|
19493
19510
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19494
19511
|
});
|
|
@@ -19699,7 +19716,7 @@ var require_http = __commonJS({
|
|
|
19699
19716
|
function createRequestExecutor(options, httpModule, agent) {
|
|
19700
19717
|
const { hostname, pathname, port, protocol, search } = new url.URL(options.url);
|
|
19701
19718
|
return function makeRequest(request) {
|
|
19702
|
-
return new Promise((
|
|
19719
|
+
return new Promise((resolve8, reject) => {
|
|
19703
19720
|
let body = streamFromBody(request.body);
|
|
19704
19721
|
const headers = { ...options.headers };
|
|
19705
19722
|
if (request.body.length > GZIP_THRESHOLD) {
|
|
@@ -19725,7 +19742,7 @@ var require_http = __commonJS({
|
|
|
19725
19742
|
res.setEncoding("utf8");
|
|
19726
19743
|
const retryAfterHeader = _nullishCoalesce(res.headers["retry-after"], () => null);
|
|
19727
19744
|
const rateLimitsHeader = _nullishCoalesce(res.headers["x-sentry-rate-limits"], () => null);
|
|
19728
|
-
|
|
19745
|
+
resolve8({
|
|
19729
19746
|
statusCode: res.statusCode,
|
|
19730
19747
|
headers: {
|
|
19731
19748
|
"retry-after": retryAfterHeader,
|
|
@@ -19993,7 +20010,7 @@ var require_websocket2 = __commonJS({
|
|
|
19993
20010
|
};
|
|
19994
20011
|
async function createWebSocketClient(rawUrl) {
|
|
19995
20012
|
const parts = url.parse(rawUrl);
|
|
19996
|
-
return new Promise((
|
|
20013
|
+
return new Promise((resolve8, reject) => {
|
|
19997
20014
|
const key = crypto3.randomBytes(16).toString("base64");
|
|
19998
20015
|
const digest2 = createKey(key);
|
|
19999
20016
|
const req = http2.request({
|
|
@@ -20024,7 +20041,7 @@ var require_websocket2 = __commonJS({
|
|
|
20024
20041
|
return;
|
|
20025
20042
|
}
|
|
20026
20043
|
const client = new WebSocketInterface(socket);
|
|
20027
|
-
|
|
20044
|
+
resolve8(client);
|
|
20028
20045
|
});
|
|
20029
20046
|
req.on("error", (err2) => {
|
|
20030
20047
|
reject(err2);
|
|
@@ -21353,10 +21370,10 @@ var require_contextlines = __commonJS({
|
|
|
21353
21370
|
var FILE_CONTENT_CACHE = new lru_map.LRUMap(100);
|
|
21354
21371
|
var DEFAULT_LINES_OF_CONTEXT = 7;
|
|
21355
21372
|
function readTextFileAsync(path) {
|
|
21356
|
-
return new Promise((
|
|
21373
|
+
return new Promise((resolve8, reject) => {
|
|
21357
21374
|
fs.readFile(path, "utf8", (err2, data) => {
|
|
21358
21375
|
if (err2) reject(err2);
|
|
21359
|
-
else
|
|
21376
|
+
else resolve8(data);
|
|
21360
21377
|
});
|
|
21361
21378
|
});
|
|
21362
21379
|
}
|
|
@@ -21666,13 +21683,13 @@ var require_context = __commonJS({
|
|
|
21666
21683
|
version: `10.${Number(os.release().split(".")[0]) - 4}`
|
|
21667
21684
|
};
|
|
21668
21685
|
try {
|
|
21669
|
-
const output4 = await new Promise((
|
|
21686
|
+
const output4 = await new Promise((resolve8, reject) => {
|
|
21670
21687
|
child_process.execFile("/usr/bin/sw_vers", (error, stdout) => {
|
|
21671
21688
|
if (error) {
|
|
21672
21689
|
reject(error);
|
|
21673
21690
|
return;
|
|
21674
21691
|
}
|
|
21675
|
-
|
|
21692
|
+
resolve8(stdout);
|
|
21676
21693
|
});
|
|
21677
21694
|
});
|
|
21678
21695
|
darwinInfo.name = matchFirst(/^ProductName:\s+(.*)$/m, output4);
|
|
@@ -24529,14 +24546,242 @@ var init_sentry_config = __esm({
|
|
|
24529
24546
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
24530
24547
|
SENTRY_CONFIG = {
|
|
24531
24548
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
24532
|
-
release: "0.0.
|
|
24549
|
+
release: "0.0.17-beta-db5dca184d-260624144716",
|
|
24533
24550
|
environment
|
|
24534
24551
|
};
|
|
24535
24552
|
}
|
|
24536
24553
|
});
|
|
24537
24554
|
|
|
24555
|
+
// src/autostart.ts
|
|
24556
|
+
var autostart_exports = {};
|
|
24557
|
+
__export(autostart_exports, {
|
|
24558
|
+
autostartStatus: () => autostartStatus,
|
|
24559
|
+
buildLaunchdPlist: () => buildLaunchdPlist,
|
|
24560
|
+
buildSystemdUserService: () => buildSystemdUserService,
|
|
24561
|
+
installAutostart: () => installAutostart,
|
|
24562
|
+
installLaunchdAutostart: () => installLaunchdAutostart,
|
|
24563
|
+
installSystemdAutostart: () => installSystemdAutostart,
|
|
24564
|
+
printLaunchdPlist: () => printLaunchdPlist,
|
|
24565
|
+
printSystemdAutostartUnit: () => printSystemdAutostartUnit,
|
|
24566
|
+
resolveLaunchdAutostartPaths: () => resolveLaunchdAutostartPaths,
|
|
24567
|
+
resolveSystemdAutostartPaths: () => resolveSystemdAutostartPaths,
|
|
24568
|
+
uninstallAutostart: () => uninstallAutostart,
|
|
24569
|
+
uninstallLaunchdAutostart: () => uninstallLaunchdAutostart,
|
|
24570
|
+
uninstallSystemdAutostart: () => uninstallSystemdAutostart
|
|
24571
|
+
});
|
|
24572
|
+
function resolveSystemdAutostartPaths(home = (0, import_node_os4.homedir)()) {
|
|
24573
|
+
const serviceDir = (0, import_node_path13.join)(home, ".config", "systemd", "user");
|
|
24574
|
+
return {
|
|
24575
|
+
serviceDir,
|
|
24576
|
+
servicePath: (0, import_node_path13.join)(serviceDir, SERVICE_NAME)
|
|
24577
|
+
};
|
|
24578
|
+
}
|
|
24579
|
+
function resolveLaunchdAutostartPaths(home = (0, import_node_os4.homedir)()) {
|
|
24580
|
+
const agentDir = (0, import_node_path13.join)(home, "Library", "LaunchAgents");
|
|
24581
|
+
return {
|
|
24582
|
+
agentDir,
|
|
24583
|
+
plistPath: (0, import_node_path13.join)(agentDir, LAUNCHD_PLIST_NAME)
|
|
24584
|
+
};
|
|
24585
|
+
}
|
|
24586
|
+
function quoteSystemdArg(value) {
|
|
24587
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
24588
|
+
}
|
|
24589
|
+
function escapeXml(value) {
|
|
24590
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
24591
|
+
}
|
|
24592
|
+
function resolveCliPath() {
|
|
24593
|
+
const entry = process.argv[1];
|
|
24594
|
+
if (!entry) {
|
|
24595
|
+
throw new Error("Unable to resolve current okx-a2a CLI path");
|
|
24596
|
+
}
|
|
24597
|
+
return (0, import_node_path13.resolve)(entry);
|
|
24598
|
+
}
|
|
24599
|
+
function buildSystemdUserService() {
|
|
24600
|
+
const taskHome2 = resolveTaskHome();
|
|
24601
|
+
const pathValue = process.env.PATH?.trim() || "/usr/local/bin:/usr/bin:/bin";
|
|
24602
|
+
const execStart = [
|
|
24603
|
+
quoteSystemdArg(process.execPath),
|
|
24604
|
+
quoteSystemdArg(resolveCliPath()),
|
|
24605
|
+
"run"
|
|
24606
|
+
].join(" ");
|
|
24607
|
+
return `[Unit]
|
|
24608
|
+
Description=OKX A2A daemon
|
|
24609
|
+
After=default.target
|
|
24610
|
+
|
|
24611
|
+
[Service]
|
|
24612
|
+
Type=simple
|
|
24613
|
+
ExecStart=${execStart}
|
|
24614
|
+
Restart=always
|
|
24615
|
+
RestartSec=5
|
|
24616
|
+
Environment=${quoteSystemdArg(`PATH=${pathValue}`)}
|
|
24617
|
+
Environment=${quoteSystemdArg(`OKX_AGENT_TASK_HOME=${taskHome2}`)}
|
|
24618
|
+
|
|
24619
|
+
[Install]
|
|
24620
|
+
WantedBy=default.target
|
|
24621
|
+
`;
|
|
24622
|
+
}
|
|
24623
|
+
function buildLaunchdPlist() {
|
|
24624
|
+
const paths = resolveTaskPaths();
|
|
24625
|
+
const pathValue = process.env.PATH?.trim() || "/usr/local/bin:/usr/bin:/bin";
|
|
24626
|
+
const args = [process.execPath, resolveCliPath(), "run"];
|
|
24627
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
24628
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
24629
|
+
<plist version="1.0">
|
|
24630
|
+
<dict>
|
|
24631
|
+
<key>Label</key>
|
|
24632
|
+
<string>${LAUNCHD_LABEL}</string>
|
|
24633
|
+
<key>ProgramArguments</key>
|
|
24634
|
+
<array>
|
|
24635
|
+
${args.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n")}
|
|
24636
|
+
</array>
|
|
24637
|
+
<key>EnvironmentVariables</key>
|
|
24638
|
+
<dict>
|
|
24639
|
+
<key>PATH</key>
|
|
24640
|
+
<string>${escapeXml(pathValue)}</string>
|
|
24641
|
+
<key>OKX_AGENT_TASK_HOME</key>
|
|
24642
|
+
<string>${escapeXml(paths.homeDir)}</string>
|
|
24643
|
+
</dict>
|
|
24644
|
+
<key>RunAtLoad</key>
|
|
24645
|
+
<true/>
|
|
24646
|
+
<key>KeepAlive</key>
|
|
24647
|
+
<true/>
|
|
24648
|
+
<key>StandardOutPath</key>
|
|
24649
|
+
<string>${escapeXml(paths.listenerLogPath)}</string>
|
|
24650
|
+
<key>StandardErrorPath</key>
|
|
24651
|
+
<string>${escapeXml(paths.listenerLogPath)}</string>
|
|
24652
|
+
</dict>
|
|
24653
|
+
</plist>
|
|
24654
|
+
`;
|
|
24655
|
+
}
|
|
24656
|
+
async function runSystemctl(args) {
|
|
24657
|
+
try {
|
|
24658
|
+
return await execFileAsync("systemctl", ["--user", ...args], {
|
|
24659
|
+
timeout: 3e4,
|
|
24660
|
+
env: process.env
|
|
24661
|
+
});
|
|
24662
|
+
} catch (err2) {
|
|
24663
|
+
const e = err2;
|
|
24664
|
+
const stdout = String(e.stdout ?? "");
|
|
24665
|
+
const stderr = String(e.stderr ?? e.message ?? err2);
|
|
24666
|
+
throw new Error(`systemctl --user ${args.join(" ")} failed: ${(stderr || stdout).trim()}`);
|
|
24667
|
+
}
|
|
24668
|
+
}
|
|
24669
|
+
async function runLaunchctl(args, options = {}) {
|
|
24670
|
+
try {
|
|
24671
|
+
return await execFileAsync("launchctl", args, {
|
|
24672
|
+
timeout: 3e4,
|
|
24673
|
+
env: process.env
|
|
24674
|
+
});
|
|
24675
|
+
} catch (err2) {
|
|
24676
|
+
const e = err2;
|
|
24677
|
+
const stdout = String(e.stdout ?? "");
|
|
24678
|
+
const stderr = String(e.stderr ?? e.message ?? err2);
|
|
24679
|
+
if (options.tolerateFailure) {
|
|
24680
|
+
return { stdout, stderr };
|
|
24681
|
+
}
|
|
24682
|
+
throw new Error(`launchctl ${args.join(" ")} failed: ${(stderr || stdout).trim()}`);
|
|
24683
|
+
}
|
|
24684
|
+
}
|
|
24685
|
+
function launchdDomain() {
|
|
24686
|
+
const uid2 = typeof process.getuid === "function" ? process.getuid() : null;
|
|
24687
|
+
if (uid2 === null) {
|
|
24688
|
+
throw new Error("Unable to resolve current uid for launchd autostart");
|
|
24689
|
+
}
|
|
24690
|
+
return `gui/${uid2}`;
|
|
24691
|
+
}
|
|
24692
|
+
async function installSystemdAutostart() {
|
|
24693
|
+
const paths = resolveSystemdAutostartPaths();
|
|
24694
|
+
await (0, import_promises5.mkdir)(paths.serviceDir, { recursive: true });
|
|
24695
|
+
await (0, import_promises5.writeFile)(paths.servicePath, buildSystemdUserService(), "utf8");
|
|
24696
|
+
await runSystemctl(["daemon-reload"]);
|
|
24697
|
+
await runSystemctl(["enable", "--now", SERVICE_NAME]);
|
|
24698
|
+
return { platform: "linux-systemd", path: paths.servicePath };
|
|
24699
|
+
}
|
|
24700
|
+
async function uninstallSystemdAutostart() {
|
|
24701
|
+
const paths = resolveSystemdAutostartPaths();
|
|
24702
|
+
try {
|
|
24703
|
+
await runSystemctl(["disable", "--now", SERVICE_NAME]);
|
|
24704
|
+
} catch (err2) {
|
|
24705
|
+
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
24706
|
+
if (!message.includes("does not exist") && !message.includes("not loaded")) {
|
|
24707
|
+
throw err2;
|
|
24708
|
+
}
|
|
24709
|
+
}
|
|
24710
|
+
await (0, import_promises5.rm)(paths.servicePath, { force: true });
|
|
24711
|
+
await runSystemctl(["daemon-reload"]);
|
|
24712
|
+
return { platform: "linux-systemd", path: paths.servicePath };
|
|
24713
|
+
}
|
|
24714
|
+
function printSystemdAutostartUnit() {
|
|
24715
|
+
return buildSystemdUserService();
|
|
24716
|
+
}
|
|
24717
|
+
async function installLaunchdAutostart() {
|
|
24718
|
+
const paths = resolveLaunchdAutostartPaths();
|
|
24719
|
+
const taskPaths = resolveTaskPaths();
|
|
24720
|
+
await (0, import_promises5.mkdir)(paths.agentDir, { recursive: true });
|
|
24721
|
+
await (0, import_promises5.mkdir)(taskPaths.logsDir, { recursive: true });
|
|
24722
|
+
await (0, import_promises5.writeFile)(paths.plistPath, buildLaunchdPlist(), "utf8");
|
|
24723
|
+
const domain = launchdDomain();
|
|
24724
|
+
await runLaunchctl(["bootout", domain, paths.plistPath], { tolerateFailure: true });
|
|
24725
|
+
await runLaunchctl(["bootstrap", domain, paths.plistPath]);
|
|
24726
|
+
await runLaunchctl(["enable", `${domain}/${LAUNCHD_LABEL}`]);
|
|
24727
|
+
await runLaunchctl(["kickstart", "-k", `${domain}/${LAUNCHD_LABEL}`]);
|
|
24728
|
+
return { platform: "macos-launchd", path: paths.plistPath };
|
|
24729
|
+
}
|
|
24730
|
+
async function uninstallLaunchdAutostart() {
|
|
24731
|
+
const paths = resolveLaunchdAutostartPaths();
|
|
24732
|
+
await runLaunchctl(["bootout", launchdDomain(), paths.plistPath], { tolerateFailure: true });
|
|
24733
|
+
await (0, import_promises5.rm)(paths.plistPath, { force: true });
|
|
24734
|
+
return { platform: "macos-launchd", path: paths.plistPath };
|
|
24735
|
+
}
|
|
24736
|
+
function printLaunchdPlist() {
|
|
24737
|
+
return buildLaunchdPlist();
|
|
24738
|
+
}
|
|
24739
|
+
async function installAutostart() {
|
|
24740
|
+
if (process.platform === "linux") {
|
|
24741
|
+
return installSystemdAutostart();
|
|
24742
|
+
}
|
|
24743
|
+
if (process.platform === "darwin") {
|
|
24744
|
+
return installLaunchdAutostart();
|
|
24745
|
+
}
|
|
24746
|
+
throw new Error(`autostart is not supported on ${process.platform}`);
|
|
24747
|
+
}
|
|
24748
|
+
async function uninstallAutostart() {
|
|
24749
|
+
if (process.platform === "linux") {
|
|
24750
|
+
return uninstallSystemdAutostart();
|
|
24751
|
+
}
|
|
24752
|
+
if (process.platform === "darwin") {
|
|
24753
|
+
return uninstallLaunchdAutostart();
|
|
24754
|
+
}
|
|
24755
|
+
throw new Error(`autostart is not supported on ${process.platform}`);
|
|
24756
|
+
}
|
|
24757
|
+
function autostartStatus() {
|
|
24758
|
+
if (process.platform === "linux") {
|
|
24759
|
+
return printSystemdAutostartUnit();
|
|
24760
|
+
}
|
|
24761
|
+
if (process.platform === "darwin") {
|
|
24762
|
+
return printLaunchdPlist();
|
|
24763
|
+
}
|
|
24764
|
+
throw new Error(`autostart is not supported on ${process.platform}`);
|
|
24765
|
+
}
|
|
24766
|
+
var import_node_child_process3, import_promises5, import_node_os4, import_node_path13, import_node_util, execFileAsync, SERVICE_NAME, LAUNCHD_LABEL, LAUNCHD_PLIST_NAME;
|
|
24767
|
+
var init_autostart = __esm({
|
|
24768
|
+
"src/autostart.ts"() {
|
|
24769
|
+
"use strict";
|
|
24770
|
+
import_node_child_process3 = require("node:child_process");
|
|
24771
|
+
import_promises5 = require("node:fs/promises");
|
|
24772
|
+
import_node_os4 = require("node:os");
|
|
24773
|
+
import_node_path13 = require("node:path");
|
|
24774
|
+
import_node_util = require("node:util");
|
|
24775
|
+
init_paths();
|
|
24776
|
+
execFileAsync = (0, import_node_util.promisify)(import_node_child_process3.execFile);
|
|
24777
|
+
SERVICE_NAME = "okx-a2a.service";
|
|
24778
|
+
LAUNCHD_LABEL = "com.okx.a2a";
|
|
24779
|
+
LAUNCHD_PLIST_NAME = `${LAUNCHD_LABEL}.plist`;
|
|
24780
|
+
}
|
|
24781
|
+
});
|
|
24782
|
+
|
|
24538
24783
|
// ../core/src/xmtp-sdk/onchainos/bin.ts
|
|
24539
|
-
async function
|
|
24784
|
+
async function resolve3() {
|
|
24540
24785
|
if (resolvedBin) {
|
|
24541
24786
|
return resolvedBin;
|
|
24542
24787
|
}
|
|
@@ -24548,7 +24793,7 @@ async function resolve2() {
|
|
|
24548
24793
|
}
|
|
24549
24794
|
try {
|
|
24550
24795
|
const shell = process.env.SHELL || "/bin/bash";
|
|
24551
|
-
const { stdout } = await
|
|
24796
|
+
const { stdout } = await execFileAsync2(shell, ["-lc", "command -v onchainos"]);
|
|
24552
24797
|
const bin = extractExecutablePath(stdout);
|
|
24553
24798
|
if (bin) {
|
|
24554
24799
|
logWithTimestamp(`[onchainos] resolved binary via shell: ${bin}`);
|
|
@@ -24609,12 +24854,12 @@ function commandForLog(bin, args) {
|
|
|
24609
24854
|
return `${bin} ${redactArgsForLog(args).join(" ")}`;
|
|
24610
24855
|
}
|
|
24611
24856
|
async function exec(args) {
|
|
24612
|
-
const bin = await
|
|
24857
|
+
const bin = await resolve3();
|
|
24613
24858
|
const cmd = commandForLog(bin, args);
|
|
24614
24859
|
logWithTimestamp(`[onchainos] exec: ${cmd}`);
|
|
24615
24860
|
const t0 = Date.now();
|
|
24616
24861
|
try {
|
|
24617
|
-
const result = await
|
|
24862
|
+
const result = await execFileAsync2(bin, args);
|
|
24618
24863
|
logWithTimestamp(
|
|
24619
24864
|
`[onchainos] exec done: ${cmd} (${Date.now() - t0}ms, stdout=${result.stdout.length}B, stderr=${result.stderr.length}B)`
|
|
24620
24865
|
);
|
|
@@ -24647,16 +24892,16 @@ async function exec(args) {
|
|
|
24647
24892
|
throw err2;
|
|
24648
24893
|
}
|
|
24649
24894
|
}
|
|
24650
|
-
var import_node_fs10,
|
|
24895
|
+
var import_node_fs10, import_node_child_process4, import_node_util2, execFileAsync2, resolvedBin, REDACTED_VALUE_FLAGS;
|
|
24651
24896
|
var init_bin = __esm({
|
|
24652
24897
|
"../core/src/xmtp-sdk/onchainos/bin.ts"() {
|
|
24653
24898
|
"use strict";
|
|
24654
24899
|
init_log();
|
|
24655
24900
|
import_node_fs10 = require("node:fs");
|
|
24656
|
-
|
|
24657
|
-
|
|
24901
|
+
import_node_child_process4 = require("node:child_process");
|
|
24902
|
+
import_node_util2 = require("node:util");
|
|
24658
24903
|
init_sentry_logger();
|
|
24659
|
-
|
|
24904
|
+
execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process4.execFile);
|
|
24660
24905
|
resolvedBin = null;
|
|
24661
24906
|
REDACTED_VALUE_FLAGS = /* @__PURE__ */ new Set(["--message"]);
|
|
24662
24907
|
}
|
|
@@ -28189,8 +28434,8 @@ var require_util2 = __commonJS({
|
|
|
28189
28434
|
function createDeferredPromise() {
|
|
28190
28435
|
let res;
|
|
28191
28436
|
let rej;
|
|
28192
|
-
const promise = new Promise((
|
|
28193
|
-
res =
|
|
28437
|
+
const promise = new Promise((resolve8, reject) => {
|
|
28438
|
+
res = resolve8;
|
|
28194
28439
|
rej = reject;
|
|
28195
28440
|
});
|
|
28196
28441
|
return { promise, resolve: res, reject: rej };
|
|
@@ -29694,8 +29939,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
29694
29939
|
});
|
|
29695
29940
|
}
|
|
29696
29941
|
});
|
|
29697
|
-
const busboyResolve = new Promise((
|
|
29698
|
-
busboy.on("finish",
|
|
29942
|
+
const busboyResolve = new Promise((resolve8, reject) => {
|
|
29943
|
+
busboy.on("finish", resolve8);
|
|
29699
29944
|
busboy.on("error", (err2) => reject(new TypeError(err2)));
|
|
29700
29945
|
});
|
|
29701
29946
|
if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk);
|
|
@@ -30229,9 +30474,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
30229
30474
|
}
|
|
30230
30475
|
close(callback) {
|
|
30231
30476
|
if (callback === void 0) {
|
|
30232
|
-
return new Promise((
|
|
30477
|
+
return new Promise((resolve8, reject) => {
|
|
30233
30478
|
this.close((err2, data) => {
|
|
30234
|
-
return err2 ? reject(err2) :
|
|
30479
|
+
return err2 ? reject(err2) : resolve8(data);
|
|
30235
30480
|
});
|
|
30236
30481
|
});
|
|
30237
30482
|
}
|
|
@@ -30269,12 +30514,12 @@ var require_dispatcher_base = __commonJS({
|
|
|
30269
30514
|
err2 = null;
|
|
30270
30515
|
}
|
|
30271
30516
|
if (callback === void 0) {
|
|
30272
|
-
return new Promise((
|
|
30517
|
+
return new Promise((resolve8, reject) => {
|
|
30273
30518
|
this.destroy(err2, (err3, data) => {
|
|
30274
30519
|
return err3 ? (
|
|
30275
30520
|
/* istanbul ignore next: should never error */
|
|
30276
30521
|
reject(err3)
|
|
30277
|
-
) :
|
|
30522
|
+
) : resolve8(data);
|
|
30278
30523
|
});
|
|
30279
30524
|
});
|
|
30280
30525
|
}
|
|
@@ -31334,16 +31579,16 @@ var require_client2 = __commonJS({
|
|
|
31334
31579
|
return this[kNeedDrain] < 2;
|
|
31335
31580
|
}
|
|
31336
31581
|
async [kClose]() {
|
|
31337
|
-
return new Promise((
|
|
31582
|
+
return new Promise((resolve8) => {
|
|
31338
31583
|
if (!this[kSize]) {
|
|
31339
|
-
|
|
31584
|
+
resolve8(null);
|
|
31340
31585
|
} else {
|
|
31341
|
-
this[kClosedResolve] =
|
|
31586
|
+
this[kClosedResolve] = resolve8;
|
|
31342
31587
|
}
|
|
31343
31588
|
});
|
|
31344
31589
|
}
|
|
31345
31590
|
async [kDestroy](err2) {
|
|
31346
|
-
return new Promise((
|
|
31591
|
+
return new Promise((resolve8) => {
|
|
31347
31592
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
31348
31593
|
for (let i = 0; i < requests.length; i++) {
|
|
31349
31594
|
const request = requests[i];
|
|
@@ -31354,7 +31599,7 @@ var require_client2 = __commonJS({
|
|
|
31354
31599
|
this[kClosedResolve]();
|
|
31355
31600
|
this[kClosedResolve] = null;
|
|
31356
31601
|
}
|
|
31357
|
-
|
|
31602
|
+
resolve8();
|
|
31358
31603
|
};
|
|
31359
31604
|
if (this[kHTTP2Session] != null) {
|
|
31360
31605
|
util.destroy(this[kHTTP2Session], err2);
|
|
@@ -31934,7 +32179,7 @@ var require_client2 = __commonJS({
|
|
|
31934
32179
|
});
|
|
31935
32180
|
}
|
|
31936
32181
|
try {
|
|
31937
|
-
const socket = await new Promise((
|
|
32182
|
+
const socket = await new Promise((resolve8, reject) => {
|
|
31938
32183
|
client[kConnector]({
|
|
31939
32184
|
host,
|
|
31940
32185
|
hostname,
|
|
@@ -31946,7 +32191,7 @@ var require_client2 = __commonJS({
|
|
|
31946
32191
|
if (err2) {
|
|
31947
32192
|
reject(err2);
|
|
31948
32193
|
} else {
|
|
31949
|
-
|
|
32194
|
+
resolve8(socket2);
|
|
31950
32195
|
}
|
|
31951
32196
|
});
|
|
31952
32197
|
});
|
|
@@ -32570,12 +32815,12 @@ upgrade: ${upgrade}\r
|
|
|
32570
32815
|
cb();
|
|
32571
32816
|
}
|
|
32572
32817
|
}
|
|
32573
|
-
const waitForDrain = () => new Promise((
|
|
32818
|
+
const waitForDrain = () => new Promise((resolve8, reject) => {
|
|
32574
32819
|
assert(callback === null);
|
|
32575
32820
|
if (socket[kError]) {
|
|
32576
32821
|
reject(socket[kError]);
|
|
32577
32822
|
} else {
|
|
32578
|
-
callback =
|
|
32823
|
+
callback = resolve8;
|
|
32579
32824
|
}
|
|
32580
32825
|
});
|
|
32581
32826
|
if (client[kHTTPConnVersion] === "h2") {
|
|
@@ -32920,8 +33165,8 @@ var require_pool_base = __commonJS({
|
|
|
32920
33165
|
if (this[kQueue].isEmpty()) {
|
|
32921
33166
|
return Promise.all(this[kClients].map((c) => c.close()));
|
|
32922
33167
|
} else {
|
|
32923
|
-
return new Promise((
|
|
32924
|
-
this[kClosedResolve] =
|
|
33168
|
+
return new Promise((resolve8) => {
|
|
33169
|
+
this[kClosedResolve] = resolve8;
|
|
32925
33170
|
});
|
|
32926
33171
|
}
|
|
32927
33172
|
}
|
|
@@ -33499,7 +33744,7 @@ var require_readable = __commonJS({
|
|
|
33499
33744
|
if (this.closed) {
|
|
33500
33745
|
return Promise.resolve(null);
|
|
33501
33746
|
}
|
|
33502
|
-
return new Promise((
|
|
33747
|
+
return new Promise((resolve8, reject) => {
|
|
33503
33748
|
const signalListenerCleanup = signal ? util.addAbortListener(signal, () => {
|
|
33504
33749
|
this.destroy();
|
|
33505
33750
|
}) : noop;
|
|
@@ -33508,7 +33753,7 @@ var require_readable = __commonJS({
|
|
|
33508
33753
|
if (signal && signal.aborted) {
|
|
33509
33754
|
reject(signal.reason || Object.assign(new Error("The operation was aborted"), { name: "AbortError" }));
|
|
33510
33755
|
} else {
|
|
33511
|
-
|
|
33756
|
+
resolve8(null);
|
|
33512
33757
|
}
|
|
33513
33758
|
}).on("error", noop).on("data", function(chunk) {
|
|
33514
33759
|
limit -= chunk.length;
|
|
@@ -33530,11 +33775,11 @@ var require_readable = __commonJS({
|
|
|
33530
33775
|
throw new TypeError("unusable");
|
|
33531
33776
|
}
|
|
33532
33777
|
assert(!stream[kConsume]);
|
|
33533
|
-
return new Promise((
|
|
33778
|
+
return new Promise((resolve8, reject) => {
|
|
33534
33779
|
stream[kConsume] = {
|
|
33535
33780
|
type,
|
|
33536
33781
|
stream,
|
|
33537
|
-
resolve:
|
|
33782
|
+
resolve: resolve8,
|
|
33538
33783
|
reject,
|
|
33539
33784
|
length: 0,
|
|
33540
33785
|
body: []
|
|
@@ -33569,12 +33814,12 @@ var require_readable = __commonJS({
|
|
|
33569
33814
|
}
|
|
33570
33815
|
}
|
|
33571
33816
|
function consumeEnd(consume2) {
|
|
33572
|
-
const { type, body, resolve:
|
|
33817
|
+
const { type, body, resolve: resolve8, stream, length: length2 } = consume2;
|
|
33573
33818
|
try {
|
|
33574
33819
|
if (type === "text") {
|
|
33575
|
-
|
|
33820
|
+
resolve8(toUSVString(Buffer.concat(body)));
|
|
33576
33821
|
} else if (type === "json") {
|
|
33577
|
-
|
|
33822
|
+
resolve8(JSON.parse(Buffer.concat(body)));
|
|
33578
33823
|
} else if (type === "arrayBuffer") {
|
|
33579
33824
|
const dst = new Uint8Array(length2);
|
|
33580
33825
|
let pos = 0;
|
|
@@ -33582,12 +33827,12 @@ var require_readable = __commonJS({
|
|
|
33582
33827
|
dst.set(buf, pos);
|
|
33583
33828
|
pos += buf.byteLength;
|
|
33584
33829
|
}
|
|
33585
|
-
|
|
33830
|
+
resolve8(dst.buffer);
|
|
33586
33831
|
} else if (type === "blob") {
|
|
33587
33832
|
if (!Blob2) {
|
|
33588
33833
|
Blob2 = require("buffer").Blob;
|
|
33589
33834
|
}
|
|
33590
|
-
|
|
33835
|
+
resolve8(new Blob2(body, { type: stream[kContentType] }));
|
|
33591
33836
|
}
|
|
33592
33837
|
consumeFinish(consume2);
|
|
33593
33838
|
} catch (err2) {
|
|
@@ -33842,9 +34087,9 @@ var require_api_request = __commonJS({
|
|
|
33842
34087
|
};
|
|
33843
34088
|
function request(opts, callback) {
|
|
33844
34089
|
if (callback === void 0) {
|
|
33845
|
-
return new Promise((
|
|
34090
|
+
return new Promise((resolve8, reject) => {
|
|
33846
34091
|
request.call(this, opts, (err2, data) => {
|
|
33847
|
-
return err2 ? reject(err2) :
|
|
34092
|
+
return err2 ? reject(err2) : resolve8(data);
|
|
33848
34093
|
});
|
|
33849
34094
|
});
|
|
33850
34095
|
}
|
|
@@ -34017,9 +34262,9 @@ var require_api_stream = __commonJS({
|
|
|
34017
34262
|
};
|
|
34018
34263
|
function stream(opts, factory, callback) {
|
|
34019
34264
|
if (callback === void 0) {
|
|
34020
|
-
return new Promise((
|
|
34265
|
+
return new Promise((resolve8, reject) => {
|
|
34021
34266
|
stream.call(this, opts, factory, (err2, data) => {
|
|
34022
|
-
return err2 ? reject(err2) :
|
|
34267
|
+
return err2 ? reject(err2) : resolve8(data);
|
|
34023
34268
|
});
|
|
34024
34269
|
});
|
|
34025
34270
|
}
|
|
@@ -34300,9 +34545,9 @@ var require_api_upgrade = __commonJS({
|
|
|
34300
34545
|
};
|
|
34301
34546
|
function upgrade(opts, callback) {
|
|
34302
34547
|
if (callback === void 0) {
|
|
34303
|
-
return new Promise((
|
|
34548
|
+
return new Promise((resolve8, reject) => {
|
|
34304
34549
|
upgrade.call(this, opts, (err2, data) => {
|
|
34305
|
-
return err2 ? reject(err2) :
|
|
34550
|
+
return err2 ? reject(err2) : resolve8(data);
|
|
34306
34551
|
});
|
|
34307
34552
|
});
|
|
34308
34553
|
}
|
|
@@ -34391,9 +34636,9 @@ var require_api_connect = __commonJS({
|
|
|
34391
34636
|
};
|
|
34392
34637
|
function connect(opts, callback) {
|
|
34393
34638
|
if (callback === void 0) {
|
|
34394
|
-
return new Promise((
|
|
34639
|
+
return new Promise((resolve8, reject) => {
|
|
34395
34640
|
connect.call(this, opts, (err2, data) => {
|
|
34396
|
-
return err2 ? reject(err2) :
|
|
34641
|
+
return err2 ? reject(err2) : resolve8(data);
|
|
34397
34642
|
});
|
|
34398
34643
|
});
|
|
34399
34644
|
}
|
|
@@ -34917,7 +35162,7 @@ var require_mock_interceptor = __commonJS({
|
|
|
34917
35162
|
var require_mock_client = __commonJS({
|
|
34918
35163
|
"../../node_modules/undici/lib/mock/mock-client.js"(exports2, module2) {
|
|
34919
35164
|
"use strict";
|
|
34920
|
-
var { promisify:
|
|
35165
|
+
var { promisify: promisify3 } = require("util");
|
|
34921
35166
|
var Client2 = require_client2();
|
|
34922
35167
|
var { buildMockDispatch } = require_mock_utils();
|
|
34923
35168
|
var {
|
|
@@ -34957,7 +35202,7 @@ var require_mock_client = __commonJS({
|
|
|
34957
35202
|
return new MockInterceptor(opts, this[kDispatches]);
|
|
34958
35203
|
}
|
|
34959
35204
|
async [kClose]() {
|
|
34960
|
-
await
|
|
35205
|
+
await promisify3(this[kOriginalClose])();
|
|
34961
35206
|
this[kConnected] = 0;
|
|
34962
35207
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
34963
35208
|
}
|
|
@@ -34970,7 +35215,7 @@ var require_mock_client = __commonJS({
|
|
|
34970
35215
|
var require_mock_pool = __commonJS({
|
|
34971
35216
|
"../../node_modules/undici/lib/mock/mock-pool.js"(exports2, module2) {
|
|
34972
35217
|
"use strict";
|
|
34973
|
-
var { promisify:
|
|
35218
|
+
var { promisify: promisify3 } = require("util");
|
|
34974
35219
|
var Pool = require_pool();
|
|
34975
35220
|
var { buildMockDispatch } = require_mock_utils();
|
|
34976
35221
|
var {
|
|
@@ -35010,7 +35255,7 @@ var require_mock_pool = __commonJS({
|
|
|
35010
35255
|
return new MockInterceptor(opts, this[kDispatches]);
|
|
35011
35256
|
}
|
|
35012
35257
|
async [kClose]() {
|
|
35013
|
-
await
|
|
35258
|
+
await promisify3(this[kOriginalClose])();
|
|
35014
35259
|
this[kConnected] = 0;
|
|
35015
35260
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
35016
35261
|
}
|
|
@@ -38015,7 +38260,7 @@ var require_fetch = __commonJS({
|
|
|
38015
38260
|
async function dispatch({ body }) {
|
|
38016
38261
|
const url = requestCurrentURL(request);
|
|
38017
38262
|
const agent = fetchParams.controller.dispatcher;
|
|
38018
|
-
return new Promise((
|
|
38263
|
+
return new Promise((resolve8, reject) => agent.dispatch(
|
|
38019
38264
|
{
|
|
38020
38265
|
path: url.pathname + url.search,
|
|
38021
38266
|
origin: url.origin,
|
|
@@ -38091,7 +38336,7 @@ var require_fetch = __commonJS({
|
|
|
38091
38336
|
}
|
|
38092
38337
|
}
|
|
38093
38338
|
}
|
|
38094
|
-
|
|
38339
|
+
resolve8({
|
|
38095
38340
|
status,
|
|
38096
38341
|
statusText,
|
|
38097
38342
|
headersList: headers[kHeadersList],
|
|
@@ -38134,7 +38379,7 @@ var require_fetch = __commonJS({
|
|
|
38134
38379
|
const val = headersList[n + 1].toString("latin1");
|
|
38135
38380
|
headers[kHeadersList].append(key, val);
|
|
38136
38381
|
}
|
|
38137
|
-
|
|
38382
|
+
resolve8({
|
|
38138
38383
|
status,
|
|
38139
38384
|
statusText: STATUS_CODES[status],
|
|
38140
38385
|
headersList: headers[kHeadersList],
|
|
@@ -41461,11 +41706,11 @@ var require_fetch_pb = __commonJS({
|
|
|
41461
41706
|
"use strict";
|
|
41462
41707
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
41463
41708
|
function adopt(value) {
|
|
41464
|
-
return value instanceof P2 ? value : new P2(function(
|
|
41465
|
-
|
|
41709
|
+
return value instanceof P2 ? value : new P2(function(resolve8) {
|
|
41710
|
+
resolve8(value);
|
|
41466
41711
|
});
|
|
41467
41712
|
}
|
|
41468
|
-
return new (P2 || (P2 = Promise))(function(
|
|
41713
|
+
return new (P2 || (P2 = Promise))(function(resolve8, reject) {
|
|
41469
41714
|
function fulfilled(value) {
|
|
41470
41715
|
try {
|
|
41471
41716
|
step(generator.next(value));
|
|
@@ -41481,7 +41726,7 @@ var require_fetch_pb = __commonJS({
|
|
|
41481
41726
|
}
|
|
41482
41727
|
}
|
|
41483
41728
|
function step(result) {
|
|
41484
|
-
result.done ?
|
|
41729
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
41485
41730
|
}
|
|
41486
41731
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41487
41732
|
});
|
|
@@ -42751,7 +42996,7 @@ var require_aspromise = __commonJS({
|
|
|
42751
42996
|
var params = new Array(arguments.length - 1), offset = 0, index2 = 2, pending = true;
|
|
42752
42997
|
while (index2 < arguments.length)
|
|
42753
42998
|
params[offset++] = arguments[index2++];
|
|
42754
|
-
return new Promise(function executor(
|
|
42999
|
+
return new Promise(function executor(resolve8, reject) {
|
|
42755
43000
|
params[offset] = function callback(err2) {
|
|
42756
43001
|
if (pending) {
|
|
42757
43002
|
pending = false;
|
|
@@ -42761,7 +43006,7 @@ var require_aspromise = __commonJS({
|
|
|
42761
43006
|
var params2 = new Array(arguments.length - 1), offset2 = 0;
|
|
42762
43007
|
while (offset2 < params2.length)
|
|
42763
43008
|
params2[offset2++] = arguments[offset2];
|
|
42764
|
-
|
|
43009
|
+
resolve8.apply(null, params2);
|
|
42765
43010
|
}
|
|
42766
43011
|
}
|
|
42767
43012
|
};
|
|
@@ -52217,7 +52462,7 @@ var require_Observable = __commonJS({
|
|
|
52217
52462
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
52218
52463
|
var _this = this;
|
|
52219
52464
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
52220
|
-
return new promiseCtor(function(
|
|
52465
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
52221
52466
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
52222
52467
|
next: function(value) {
|
|
52223
52468
|
try {
|
|
@@ -52228,7 +52473,7 @@ var require_Observable = __commonJS({
|
|
|
52228
52473
|
}
|
|
52229
52474
|
},
|
|
52230
52475
|
error: reject,
|
|
52231
|
-
complete:
|
|
52476
|
+
complete: resolve8
|
|
52232
52477
|
});
|
|
52233
52478
|
_this.subscribe(subscriber);
|
|
52234
52479
|
});
|
|
@@ -52250,14 +52495,14 @@ var require_Observable = __commonJS({
|
|
|
52250
52495
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
52251
52496
|
var _this = this;
|
|
52252
52497
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
52253
|
-
return new promiseCtor(function(
|
|
52498
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
52254
52499
|
var value;
|
|
52255
52500
|
_this.subscribe(function(x) {
|
|
52256
52501
|
return value = x;
|
|
52257
52502
|
}, function(err2) {
|
|
52258
52503
|
return reject(err2);
|
|
52259
52504
|
}, function() {
|
|
52260
|
-
return
|
|
52505
|
+
return resolve8(value);
|
|
52261
52506
|
});
|
|
52262
52507
|
});
|
|
52263
52508
|
};
|
|
@@ -52518,11 +52763,11 @@ var require_innerFrom = __commonJS({
|
|
|
52518
52763
|
"use strict";
|
|
52519
52764
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
52520
52765
|
function adopt(value) {
|
|
52521
|
-
return value instanceof P2 ? value : new P2(function(
|
|
52522
|
-
|
|
52766
|
+
return value instanceof P2 ? value : new P2(function(resolve8) {
|
|
52767
|
+
resolve8(value);
|
|
52523
52768
|
});
|
|
52524
52769
|
}
|
|
52525
|
-
return new (P2 || (P2 = Promise))(function(
|
|
52770
|
+
return new (P2 || (P2 = Promise))(function(resolve8, reject) {
|
|
52526
52771
|
function fulfilled(value) {
|
|
52527
52772
|
try {
|
|
52528
52773
|
step(generator.next(value));
|
|
@@ -52538,7 +52783,7 @@ var require_innerFrom = __commonJS({
|
|
|
52538
52783
|
}
|
|
52539
52784
|
}
|
|
52540
52785
|
function step(result) {
|
|
52541
|
-
result.done ?
|
|
52786
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
52542
52787
|
}
|
|
52543
52788
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52544
52789
|
});
|
|
@@ -52620,14 +52865,14 @@ var require_innerFrom = __commonJS({
|
|
|
52620
52865
|
}, i);
|
|
52621
52866
|
function verb(n) {
|
|
52622
52867
|
i[n] = o[n] && function(v) {
|
|
52623
|
-
return new Promise(function(
|
|
52624
|
-
v = o[n](v), settle(
|
|
52868
|
+
return new Promise(function(resolve8, reject) {
|
|
52869
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
52625
52870
|
});
|
|
52626
52871
|
};
|
|
52627
52872
|
}
|
|
52628
|
-
function settle(
|
|
52873
|
+
function settle(resolve8, reject, d, v) {
|
|
52629
52874
|
Promise.resolve(v).then(function(v2) {
|
|
52630
|
-
|
|
52875
|
+
resolve8({ value: v2, done: d });
|
|
52631
52876
|
}, reject);
|
|
52632
52877
|
}
|
|
52633
52878
|
};
|
|
@@ -67360,7 +67605,7 @@ function createAsyncStreamProxy(stream) {
|
|
|
67360
67605
|
function isHexString(value) {
|
|
67361
67606
|
return typeof value === "string" && /^0x(?:[0-9a-fA-F]{2})+$/.test(value);
|
|
67362
67607
|
}
|
|
67363
|
-
var import_node_bindings, import_node_bindings2, import_types,
|
|
67608
|
+
var import_node_bindings, import_node_bindings2, import_types, import_node_path14, import_node_process, ApiUrls, HistorySyncUrls, DecodedMessage, CodecNotFoundError, InboxReassignError, AccountAlreadyAssociatedError, InvalidGroupMembershipChangeError, MissingContentTypeError, SignerUnavailableError, ClientNotInitializedError, StreamFailedError, StreamInvalidRetryAttemptsError, AsyncStream, usableProperties, isUsableProperty, wait, DEFAULT_RETRY_DELAY, DEFAULT_RETRY_ATTEMPTS, createStream, Conversation, Dm, Group, Conversations, DebugInformation, Preferences, generateInboxId, getInboxIdForIdentifier, createClient, Client;
|
|
67364
67609
|
var init_dist4 = __esm({
|
|
67365
67610
|
"../../node_modules/@xmtp/node-sdk/dist/index.js"() {
|
|
67366
67611
|
init_dist2();
|
|
@@ -67369,7 +67614,7 @@ var init_dist4 = __esm({
|
|
|
67369
67614
|
import_node_bindings2 = require("@xmtp/node-bindings");
|
|
67370
67615
|
init_dist();
|
|
67371
67616
|
import_types = require("node:util/types");
|
|
67372
|
-
|
|
67617
|
+
import_node_path14 = require("node:path");
|
|
67373
67618
|
import_node_process = __toESM(require("node:process"), 1);
|
|
67374
67619
|
ApiUrls = {
|
|
67375
67620
|
local: "http://localhost:5556",
|
|
@@ -67530,8 +67775,8 @@ var init_dist4 = __esm({
|
|
|
67530
67775
|
value: this.#queue.shift()
|
|
67531
67776
|
});
|
|
67532
67777
|
}
|
|
67533
|
-
return new Promise((
|
|
67534
|
-
this.#pendingResolves.push(
|
|
67778
|
+
return new Promise((resolve8) => {
|
|
67779
|
+
this.#pendingResolves.push(resolve8);
|
|
67535
67780
|
});
|
|
67536
67781
|
};
|
|
67537
67782
|
return = () => {
|
|
@@ -67557,7 +67802,7 @@ var init_dist4 = __esm({
|
|
|
67557
67802
|
isUsableProperty = (prop) => {
|
|
67558
67803
|
return usableProperties.includes(prop);
|
|
67559
67804
|
};
|
|
67560
|
-
wait = (ms) => new Promise((
|
|
67805
|
+
wait = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
67561
67806
|
DEFAULT_RETRY_DELAY = 6e4;
|
|
67562
67807
|
DEFAULT_RETRY_ATTEMPTS = 10;
|
|
67563
67808
|
createStream = async (streamFunction, streamValueMutator, options) => {
|
|
@@ -68615,7 +68860,7 @@ var init_dist4 = __esm({
|
|
|
68615
68860
|
const inboxId = await getInboxIdForIdentifier(identifier, env, gatewayHost) || generateInboxId(identifier, options?.nonce);
|
|
68616
68861
|
let dbPath;
|
|
68617
68862
|
if (options?.dbPath === void 0) {
|
|
68618
|
-
dbPath = (0,
|
|
68863
|
+
dbPath = (0, import_node_path14.join)(import_node_process.default.cwd(), `xmtp-${env}-${inboxId}.db3`);
|
|
68619
68864
|
} else if (typeof options.dbPath === "function") {
|
|
68620
68865
|
dbPath = options.dbPath(inboxId);
|
|
68621
68866
|
} else {
|
|
@@ -77124,7 +77369,7 @@ var init_wait = __esm({
|
|
|
77124
77369
|
|
|
77125
77370
|
// ../../node_modules/viem/_esm/utils/promise/withRetry.js
|
|
77126
77371
|
function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shouldRetry2 = () => true } = {}) {
|
|
77127
|
-
return new Promise((
|
|
77372
|
+
return new Promise((resolve8, reject) => {
|
|
77128
77373
|
const attemptRetry = async ({ count = 0 } = {}) => {
|
|
77129
77374
|
const retry = async ({ error }) => {
|
|
77130
77375
|
const delay = typeof delay_ === "function" ? delay_({ count, error }) : delay_;
|
|
@@ -77134,7 +77379,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
|
|
|
77134
77379
|
};
|
|
77135
77380
|
try {
|
|
77136
77381
|
const data = await fn();
|
|
77137
|
-
|
|
77382
|
+
resolve8(data);
|
|
77138
77383
|
} catch (err2) {
|
|
77139
77384
|
if (count < retryCount && await shouldRetry2({ count, error: err2 }))
|
|
77140
77385
|
return retry({ error: err2 });
|
|
@@ -77708,13 +77953,13 @@ var init_transactionRequest = __esm({
|
|
|
77708
77953
|
|
|
77709
77954
|
// ../../node_modules/viem/_esm/utils/promise/withResolvers.js
|
|
77710
77955
|
function withResolvers() {
|
|
77711
|
-
let
|
|
77956
|
+
let resolve8 = () => void 0;
|
|
77712
77957
|
let reject = () => void 0;
|
|
77713
77958
|
const promise = new Promise((resolve_, reject_) => {
|
|
77714
|
-
|
|
77959
|
+
resolve8 = resolve_;
|
|
77715
77960
|
reject = reject_;
|
|
77716
77961
|
});
|
|
77717
|
-
return { promise, resolve:
|
|
77962
|
+
return { promise, resolve: resolve8, reject };
|
|
77718
77963
|
}
|
|
77719
77964
|
var init_withResolvers = __esm({
|
|
77720
77965
|
"../../node_modules/viem/_esm/utils/promise/withResolvers.js"() {
|
|
@@ -77733,8 +77978,8 @@ function createBatchScheduler({ fn, id, shouldSplitBatch, wait: wait3 = 0, sort
|
|
|
77733
77978
|
if (sort && Array.isArray(data))
|
|
77734
77979
|
data.sort(sort);
|
|
77735
77980
|
for (let i = 0; i < scheduler.length; i++) {
|
|
77736
|
-
const { resolve:
|
|
77737
|
-
|
|
77981
|
+
const { resolve: resolve8 } = scheduler[i];
|
|
77982
|
+
resolve8?.([data[i], data]);
|
|
77738
77983
|
}
|
|
77739
77984
|
}).catch((err2) => {
|
|
77740
77985
|
for (let i = 0; i < scheduler.length; i++) {
|
|
@@ -77750,16 +77995,16 @@ function createBatchScheduler({ fn, id, shouldSplitBatch, wait: wait3 = 0, sort
|
|
|
77750
77995
|
return {
|
|
77751
77996
|
flush: flush2,
|
|
77752
77997
|
async schedule(args) {
|
|
77753
|
-
const { promise, resolve:
|
|
77998
|
+
const { promise, resolve: resolve8, reject } = withResolvers();
|
|
77754
77999
|
const split2 = shouldSplitBatch?.([...getBatchedArgs(), args]);
|
|
77755
78000
|
if (split2)
|
|
77756
78001
|
exec2();
|
|
77757
78002
|
const hasActiveScheduler = getScheduler().length > 0;
|
|
77758
78003
|
if (hasActiveScheduler) {
|
|
77759
|
-
setScheduler({ args, resolve:
|
|
78004
|
+
setScheduler({ args, resolve: resolve8, reject });
|
|
77760
78005
|
return promise;
|
|
77761
78006
|
}
|
|
77762
|
-
setScheduler({ args, resolve:
|
|
78007
|
+
setScheduler({ args, resolve: resolve8, reject });
|
|
77763
78008
|
setTimeout(exec2, wait3);
|
|
77764
78009
|
return promise;
|
|
77765
78010
|
}
|
|
@@ -78196,7 +78441,7 @@ var init_getTransactionCount = __esm({
|
|
|
78196
78441
|
|
|
78197
78442
|
// ../../node_modules/viem/_esm/utils/promise/withTimeout.js
|
|
78198
78443
|
function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, signal }) {
|
|
78199
|
-
return new Promise((
|
|
78444
|
+
return new Promise((resolve8, reject) => {
|
|
78200
78445
|
;
|
|
78201
78446
|
(async () => {
|
|
78202
78447
|
let timeoutId;
|
|
@@ -78211,7 +78456,7 @@ function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, sign
|
|
|
78211
78456
|
}
|
|
78212
78457
|
}, timeout);
|
|
78213
78458
|
}
|
|
78214
|
-
|
|
78459
|
+
resolve8(await fn({ signal: controller?.signal || null }));
|
|
78215
78460
|
} catch (err2) {
|
|
78216
78461
|
if (err2?.name === "AbortError")
|
|
78217
78462
|
reject(errorInstance);
|
|
@@ -81288,7 +81533,7 @@ async function sendCalls(client, parameters) {
|
|
|
81288
81533
|
});
|
|
81289
81534
|
promises.push(promise);
|
|
81290
81535
|
if (experimental_fallbackDelay > 0)
|
|
81291
|
-
await new Promise((
|
|
81536
|
+
await new Promise((resolve8) => setTimeout(resolve8, experimental_fallbackDelay));
|
|
81292
81537
|
}
|
|
81293
81538
|
const results = await Promise.allSettled(promises);
|
|
81294
81539
|
if (results.every((r) => r.status === "rejected"))
|
|
@@ -81419,9 +81664,9 @@ async function waitForCallsStatus(client, parameters) {
|
|
|
81419
81664
|
throwOnFailure = false
|
|
81420
81665
|
} = parameters;
|
|
81421
81666
|
const observerId = stringify(["waitForCallsStatus", client.uid, id]);
|
|
81422
|
-
const { promise, resolve:
|
|
81667
|
+
const { promise, resolve: resolve8, reject } = withResolvers();
|
|
81423
81668
|
let timer;
|
|
81424
|
-
const unobserve = observe(observerId, { resolve:
|
|
81669
|
+
const unobserve = observe(observerId, { resolve: resolve8, reject }, (emit) => {
|
|
81425
81670
|
const unpoll = poll(async () => {
|
|
81426
81671
|
const done = (fn) => {
|
|
81427
81672
|
clearTimeout(timer);
|
|
@@ -81759,13 +82004,13 @@ async function waitForTransactionReceipt(client, parameters) {
|
|
|
81759
82004
|
let retrying = false;
|
|
81760
82005
|
let _unobserve;
|
|
81761
82006
|
let _unwatch;
|
|
81762
|
-
const { promise, resolve:
|
|
82007
|
+
const { promise, resolve: resolve8, reject } = withResolvers();
|
|
81763
82008
|
const timer = timeout ? setTimeout(() => {
|
|
81764
82009
|
_unwatch?.();
|
|
81765
82010
|
_unobserve?.();
|
|
81766
82011
|
reject(new WaitForTransactionReceiptTimeoutError({ hash: hash2 }));
|
|
81767
82012
|
}, timeout) : void 0;
|
|
81768
|
-
_unobserve = observe(observerId, { onReplaced, resolve:
|
|
82013
|
+
_unobserve = observe(observerId, { onReplaced, resolve: resolve8, reject }, async (emit) => {
|
|
81769
82014
|
receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash2 }).catch(() => void 0);
|
|
81770
82015
|
if (receipt && confirmations <= 1) {
|
|
81771
82016
|
clearTimeout(timer);
|
|
@@ -83401,7 +83646,7 @@ var init_agent_status = __esm({
|
|
|
83401
83646
|
|
|
83402
83647
|
// ../core/src/xmtp-sdk/index.ts
|
|
83403
83648
|
function cachePath(dataDir, fileName) {
|
|
83404
|
-
return (0,
|
|
83649
|
+
return (0, import_node_path15.join)(dataDir, fileName);
|
|
83405
83650
|
}
|
|
83406
83651
|
function ensureCacheDir(dataDir) {
|
|
83407
83652
|
ensureA2aTaskDir(dataDir);
|
|
@@ -83761,13 +84006,13 @@ function createOfflineReplayAddressSummary(address) {
|
|
|
83761
84006
|
durationMs: 0
|
|
83762
84007
|
};
|
|
83763
84008
|
}
|
|
83764
|
-
var import_node_fs11,
|
|
84009
|
+
var import_node_fs11, import_node_path15, DEFAULT_DATA_DIR, SENSITIVE_WORDS_LAZY_RETRY_COOLDOWN_MS, SESSION_EXPIRED_RE, SYSTEM_CONFIG_DEFAULTS, SEMVER_RE, SENDER_BLACKLISTED_MESSAGE, RECIPIENT_BLACKLISTED_MESSAGE, XmtpService;
|
|
83765
84010
|
var init_xmtp_sdk = __esm({
|
|
83766
84011
|
"../core/src/xmtp-sdk/index.ts"() {
|
|
83767
84012
|
"use strict";
|
|
83768
84013
|
init_log();
|
|
83769
84014
|
import_node_fs11 = require("node:fs");
|
|
83770
|
-
|
|
84015
|
+
import_node_path15 = require("node:path");
|
|
83771
84016
|
init_dist4();
|
|
83772
84017
|
init_sentry_logger();
|
|
83773
84018
|
init_extract_job_id();
|
|
@@ -85879,12 +86124,12 @@ function loadSqlite3() {
|
|
|
85879
86124
|
process.emitWarning = originalEmitWarning;
|
|
85880
86125
|
}
|
|
85881
86126
|
}
|
|
85882
|
-
var import_node_fs12,
|
|
86127
|
+
var import_node_fs12, import_node_path16, DatabaseSync3, InvalidXmtpMessageStore;
|
|
85883
86128
|
var init_invalid_message_store = __esm({
|
|
85884
86129
|
"src/invalid-message-store.ts"() {
|
|
85885
86130
|
"use strict";
|
|
85886
86131
|
import_node_fs12 = require("node:fs");
|
|
85887
|
-
|
|
86132
|
+
import_node_path16 = require("node:path");
|
|
85888
86133
|
init_paths();
|
|
85889
86134
|
({ DatabaseSync: DatabaseSync3 } = loadSqlite3());
|
|
85890
86135
|
InvalidXmtpMessageStore = class {
|
|
@@ -85892,8 +86137,8 @@ var init_invalid_message_store = __esm({
|
|
|
85892
86137
|
db;
|
|
85893
86138
|
constructor(homeDir) {
|
|
85894
86139
|
const paths = resolveTaskPaths(homeDir);
|
|
85895
|
-
this.dbPath = (0,
|
|
85896
|
-
(0, import_node_fs12.mkdirSync)((0,
|
|
86140
|
+
this.dbPath = (0, import_node_path16.join)(paths.sqliteDir, "invalid-xmtp-messages.sqlite");
|
|
86141
|
+
(0, import_node_fs12.mkdirSync)((0, import_node_path16.dirname)(this.dbPath), { recursive: true });
|
|
85897
86142
|
this.db = new DatabaseSync3(this.dbPath);
|
|
85898
86143
|
this.ensureReady();
|
|
85899
86144
|
}
|
|
@@ -87261,7 +87506,7 @@ function buildAiAdapterCommand(options) {
|
|
|
87261
87506
|
function readCodexAddDirs(env = process.env) {
|
|
87262
87507
|
const raw = env.OKX_A2A_AI_CODEX_ADD_DIRS ?? env.OKX_AGENT_TASK_CODEX_ADD_DIRS ?? "";
|
|
87263
87508
|
const seen = /* @__PURE__ */ new Set();
|
|
87264
|
-
return raw.split(
|
|
87509
|
+
return raw.split(import_node_path17.delimiter).map((value) => expandHomePath(value.trim())).filter(Boolean).filter((dir) => {
|
|
87265
87510
|
if (seen.has(dir)) {
|
|
87266
87511
|
return false;
|
|
87267
87512
|
}
|
|
@@ -87271,10 +87516,10 @@ function readCodexAddDirs(env = process.env) {
|
|
|
87271
87516
|
}
|
|
87272
87517
|
function expandHomePath(value) {
|
|
87273
87518
|
if (value === "~") {
|
|
87274
|
-
return (0,
|
|
87519
|
+
return (0, import_node_os5.homedir)();
|
|
87275
87520
|
}
|
|
87276
87521
|
if (value.startsWith("~/")) {
|
|
87277
|
-
return (0,
|
|
87522
|
+
return (0, import_node_path17.join)((0, import_node_os5.homedir)(), value.slice(2));
|
|
87278
87523
|
}
|
|
87279
87524
|
return value;
|
|
87280
87525
|
}
|
|
@@ -87286,7 +87531,7 @@ async function runAiAdapter(options) {
|
|
|
87286
87531
|
errorWithTimestamp(
|
|
87287
87532
|
`[okx-agent-task] AI adapter start provider=${options.provider} command=${built.command} mode=${options.sessionId ? "resume" : "new"} cwd=${options.cwd ?? process.cwd()}`
|
|
87288
87533
|
);
|
|
87289
|
-
const child = (0,
|
|
87534
|
+
const child = (0, import_node_child_process5.spawn)(built.command, built.args, {
|
|
87290
87535
|
cwd: options.cwd,
|
|
87291
87536
|
env: buildAiProviderEnv(built.command, { ...process.env, ...options.env ?? {}, OKX_A2A_IS_CLI: "1" }),
|
|
87292
87537
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -87344,9 +87589,9 @@ async function runAiAdapter(options) {
|
|
|
87344
87589
|
}, 5e3).unref();
|
|
87345
87590
|
}, timeoutMs);
|
|
87346
87591
|
timeout?.unref();
|
|
87347
|
-
const exitCode = await new Promise((
|
|
87592
|
+
const exitCode = await new Promise((resolve8, reject) => {
|
|
87348
87593
|
child.once("error", reject);
|
|
87349
|
-
child.once("close", (code2) =>
|
|
87594
|
+
child.once("close", (code2) => resolve8(code2));
|
|
87350
87595
|
});
|
|
87351
87596
|
if (timeout) {
|
|
87352
87597
|
clearTimeout(timeout);
|
|
@@ -87480,9 +87725,9 @@ function formatOpenClawSessionKey(sessionKey, agentId) {
|
|
|
87480
87725
|
function buildClaudeAddDirArgs(homeDir, env) {
|
|
87481
87726
|
const dirs = [
|
|
87482
87727
|
homeDir,
|
|
87483
|
-
(0,
|
|
87484
|
-
(0,
|
|
87485
|
-
...env.OKX_A2A_AI_CLAUDE_ADD_DIRS ? env.OKX_A2A_AI_CLAUDE_ADD_DIRS.split(
|
|
87728
|
+
(0, import_node_path17.join)((0, import_node_os5.homedir)(), ".agents"),
|
|
87729
|
+
(0, import_node_path17.join)(__dirname, ".."),
|
|
87730
|
+
...env.OKX_A2A_AI_CLAUDE_ADD_DIRS ? env.OKX_A2A_AI_CLAUDE_ADD_DIRS.split(import_node_path17.delimiter).filter(Boolean) : []
|
|
87486
87731
|
];
|
|
87487
87732
|
return ["--add-dir", ...[...new Set(dirs)]];
|
|
87488
87733
|
}
|
|
@@ -87534,17 +87779,17 @@ function applyArgTemplate(template, options) {
|
|
|
87534
87779
|
const homeDir = options.homeDir ?? resolveTaskPaths().homeDir;
|
|
87535
87780
|
const cwd = options.cwd ?? process.cwd();
|
|
87536
87781
|
return template.map((arg) => {
|
|
87537
|
-
return arg.replaceAll("{prompt}", options.prompt).replaceAll("{sessionId}", options.sessionId ?? "").replaceAll("{homeDir}", homeDir).replaceAll("{cwd}", cwd).replaceAll("{repoCli}", (0,
|
|
87782
|
+
return arg.replaceAll("{prompt}", options.prompt).replaceAll("{sessionId}", options.sessionId ?? "").replaceAll("{homeDir}", homeDir).replaceAll("{cwd}", cwd).replaceAll("{repoCli}", (0, import_node_path17.join)(__dirname, "cli.js"));
|
|
87538
87783
|
});
|
|
87539
87784
|
}
|
|
87540
|
-
var
|
|
87785
|
+
var import_node_child_process5, import_node_os5, import_node_path17, CLAUDE_ALLOWED_TOOLS, CLAUDE_PERMISSION_MODES, CODEX_SANDBOX_MODES, CODEX_APPROVAL_POLICIES;
|
|
87541
87786
|
var init_ai_adapter = __esm({
|
|
87542
87787
|
"src/ai-adapter.ts"() {
|
|
87543
87788
|
"use strict";
|
|
87544
87789
|
init_log();
|
|
87545
|
-
|
|
87546
|
-
|
|
87547
|
-
|
|
87790
|
+
import_node_child_process5 = require("node:child_process");
|
|
87791
|
+
import_node_os5 = require("node:os");
|
|
87792
|
+
import_node_path17 = require("node:path");
|
|
87548
87793
|
init_ai_command();
|
|
87549
87794
|
init_paths();
|
|
87550
87795
|
init_session_store();
|
|
@@ -87585,7 +87830,7 @@ function aiRunSentryExtra(input) {
|
|
|
87585
87830
|
closeSignal: input.closeSignal ?? "",
|
|
87586
87831
|
timedOut: input.timedOut === void 0 ? "" : String(input.timedOut),
|
|
87587
87832
|
aiSessionId: input.aiSessionId ?? "",
|
|
87588
|
-
aiLogFile: input.logPath ? (0,
|
|
87833
|
+
aiLogFile: input.logPath ? (0, import_node_path18.basename)(input.logPath) : "",
|
|
87589
87834
|
commandPendingMs: input.commandPendingMs ?? "",
|
|
87590
87835
|
queueWaitMs: input.queueWaitMs ?? "",
|
|
87591
87836
|
cliMs: input.cliMs ?? "",
|
|
@@ -87617,7 +87862,7 @@ function aiRunToolFailureSentryExtra(failure, context) {
|
|
|
87617
87862
|
closeSignal: context.closeSignal ?? "",
|
|
87618
87863
|
timedOut: String(context.timedOut),
|
|
87619
87864
|
aiSessionId: context.aiSessionId ?? "",
|
|
87620
|
-
aiLogFile: (0,
|
|
87865
|
+
aiLogFile: (0, import_node_path18.basename)(context.logPath)
|
|
87621
87866
|
}).filter(([, value]) => value !== "");
|
|
87622
87867
|
return entries.reduce((out, [key, value]) => {
|
|
87623
87868
|
out[key] = String(value);
|
|
@@ -87929,11 +88174,11 @@ function extractDeniedFilesystemPath(text) {
|
|
|
87929
88174
|
}
|
|
87930
88175
|
function getPreferredCodexWritableRoot(target) {
|
|
87931
88176
|
const expanded = expandHomePath2(target);
|
|
87932
|
-
const home = (0,
|
|
88177
|
+
const home = (0, import_node_os6.homedir)();
|
|
87933
88178
|
const appRoots = [
|
|
87934
|
-
(0,
|
|
87935
|
-
(0,
|
|
87936
|
-
(0,
|
|
88179
|
+
(0, import_node_path18.join)(home, ".onchainos", "task"),
|
|
88180
|
+
(0, import_node_path18.join)(home, ".onchainos", "deliverables"),
|
|
88181
|
+
(0, import_node_path18.join)(home, ".okx-agent-task")
|
|
87937
88182
|
];
|
|
87938
88183
|
for (const root of appRoots) {
|
|
87939
88184
|
if (expanded === root || expanded.startsWith(`${root}/`)) {
|
|
@@ -87948,16 +88193,16 @@ function inferAppOwnedCodexWritableRoot(failure) {
|
|
|
87948
88193
|
return void 0;
|
|
87949
88194
|
}
|
|
87950
88195
|
if (containsOnchainosCommand(command) && /\b0x[0-9a-fA-F]{16,}\b/.test(command)) {
|
|
87951
|
-
return (0,
|
|
88196
|
+
return (0, import_node_path18.join)((0, import_node_os6.homedir)(), ".onchainos", "task");
|
|
87952
88197
|
}
|
|
87953
88198
|
return void 0;
|
|
87954
88199
|
}
|
|
87955
88200
|
function expandHomePath2(value) {
|
|
87956
88201
|
if (value === "~") {
|
|
87957
|
-
return (0,
|
|
88202
|
+
return (0, import_node_os6.homedir)();
|
|
87958
88203
|
}
|
|
87959
88204
|
if (value.startsWith("~/")) {
|
|
87960
|
-
return (0,
|
|
88205
|
+
return (0, import_node_path18.join)((0, import_node_os6.homedir)(), value.slice(2));
|
|
87961
88206
|
}
|
|
87962
88207
|
return value;
|
|
87963
88208
|
}
|
|
@@ -88885,17 +89130,17 @@ function shortenJobId2(jobId) {
|
|
|
88885
89130
|
}
|
|
88886
89131
|
return `${jobId.slice(0, 6)}\u2026${jobId.slice(-4)}`;
|
|
88887
89132
|
}
|
|
88888
|
-
var import_node_crypto8, import_node_fs13,
|
|
89133
|
+
var import_node_crypto8, import_node_fs13, import_promises6, import_node_child_process6, import_node_os6, import_node_path18, AiRunner, CODEX_TOOL_FAILURE_MARKER;
|
|
88889
89134
|
var init_ai_runner = __esm({
|
|
88890
89135
|
"src/ai-runner.ts"() {
|
|
88891
89136
|
"use strict";
|
|
88892
89137
|
init_log();
|
|
88893
89138
|
import_node_crypto8 = require("node:crypto");
|
|
88894
89139
|
import_node_fs13 = require("node:fs");
|
|
88895
|
-
|
|
88896
|
-
|
|
88897
|
-
|
|
88898
|
-
|
|
89140
|
+
import_promises6 = require("node:fs/promises");
|
|
89141
|
+
import_node_child_process6 = require("node:child_process");
|
|
89142
|
+
import_node_os6 = require("node:os");
|
|
89143
|
+
import_node_path18 = require("node:path");
|
|
88899
89144
|
init_ai_command();
|
|
88900
89145
|
init_paths();
|
|
88901
89146
|
init_file_store();
|
|
@@ -89112,7 +89357,7 @@ var init_ai_runner = __esm({
|
|
|
89112
89357
|
let timedOut = false;
|
|
89113
89358
|
const timeoutMs = readAiProviderTimeoutMs();
|
|
89114
89359
|
const spawnStartedAt = Date.now();
|
|
89115
|
-
const child = (0,
|
|
89360
|
+
const child = (0, import_node_child_process6.spawn)(command, args, {
|
|
89116
89361
|
cwd: aiCwd,
|
|
89117
89362
|
stdio: ["ignore", "pipe", "pipe"],
|
|
89118
89363
|
env: buildAiProviderEnv(command, {
|
|
@@ -89174,9 +89419,9 @@ var init_ai_runner = __esm({
|
|
|
89174
89419
|
}, 5e3).unref();
|
|
89175
89420
|
}, timeoutMs);
|
|
89176
89421
|
timeout?.unref();
|
|
89177
|
-
const closeResult = await new Promise((
|
|
89422
|
+
const closeResult = await new Promise((resolve8, reject) => {
|
|
89178
89423
|
child.once("error", reject);
|
|
89179
|
-
child.once("close", (code2, signal) =>
|
|
89424
|
+
child.once("close", (code2, signal) => resolve8({ code: code2, signal }));
|
|
89180
89425
|
});
|
|
89181
89426
|
if (timeout) {
|
|
89182
89427
|
clearTimeout(timeout);
|
|
@@ -89198,8 +89443,8 @@ var init_ai_runner = __esm({
|
|
|
89198
89443
|
const sessionWriteMs = sessionWriteEndedAt - sessionWriteStartedAt;
|
|
89199
89444
|
const logFileCloseStartedAt = Date.now();
|
|
89200
89445
|
if (log) {
|
|
89201
|
-
await new Promise((
|
|
89202
|
-
log.end(
|
|
89446
|
+
await new Promise((resolve8) => {
|
|
89447
|
+
log.end(resolve8);
|
|
89203
89448
|
});
|
|
89204
89449
|
}
|
|
89205
89450
|
const logFileCloseEndedAt = Date.now();
|
|
@@ -89404,10 +89649,10 @@ var init_ai_runner = __esm({
|
|
|
89404
89649
|
const safeMessageId = encodeURIComponent(request.messageId);
|
|
89405
89650
|
if (request.source === "job-dispatch") {
|
|
89406
89651
|
const safeJobId = encodeURIComponent(request.jobId ?? "unknown");
|
|
89407
|
-
return (0,
|
|
89652
|
+
return (0, import_node_path18.join)(this.logsDir, `ai-${safeJobId}-${safeMessageId}.log`);
|
|
89408
89653
|
}
|
|
89409
89654
|
const safeSessionKey = encodeURIComponent(request.sessionKey);
|
|
89410
|
-
return (0,
|
|
89655
|
+
return (0, import_node_path18.join)(this.logsDir, `ai-session-${safeSessionKey}-${safeMessageId}.log`);
|
|
89411
89656
|
}
|
|
89412
89657
|
readRunAiSessionId(provider, request, file, sessionMeta) {
|
|
89413
89658
|
if (request.source === "job-dispatch" && request.jobId) {
|
|
@@ -89561,7 +89806,7 @@ var init_ai_runner = __esm({
|
|
|
89561
89806
|
process.env.OKX_AGENT_TASK_AI_CWD,
|
|
89562
89807
|
this.sessionStore.getSetting("ai_working_dir"),
|
|
89563
89808
|
safeProcessCwd(),
|
|
89564
|
-
(0,
|
|
89809
|
+
(0, import_node_os6.homedir)(),
|
|
89565
89810
|
this.homeDir
|
|
89566
89811
|
];
|
|
89567
89812
|
return candidates.find((candidate) => !!candidate && isDirectory(candidate)) ?? this.homeDir;
|
|
@@ -89718,7 +89963,7 @@ var init_ai_runner = __esm({
|
|
|
89718
89963
|
async appendLlmLog(entry) {
|
|
89719
89964
|
try {
|
|
89720
89965
|
ensureTaskDir(this.logsDir);
|
|
89721
|
-
await (0,
|
|
89966
|
+
await (0, import_promises6.appendFile)((0, import_node_path18.join)(this.logsDir, "llm.log"), formatLlmLogEntry(entry), "utf8");
|
|
89722
89967
|
} catch (err2) {
|
|
89723
89968
|
errorWithTimestamp("[okx-agent-task] failed to append llm.log:", err2);
|
|
89724
89969
|
}
|
|
@@ -91863,12 +92108,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
91863
92108
|
}));
|
|
91864
92109
|
}
|
|
91865
92110
|
});
|
|
91866
|
-
service.setPluginVersion("0.0.
|
|
92111
|
+
service.setPluginVersion("0.0.17-beta-db5dca184d-260624144716");
|
|
91867
92112
|
await service.init();
|
|
91868
92113
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
91869
92114
|
if (pluginVersionStatus.unavailable) {
|
|
91870
92115
|
throw new Error(
|
|
91871
|
-
`@okxweb3/a2a-node v${"0.0.
|
|
92116
|
+
`@okxweb3/a2a-node v${"0.0.17-beta-db5dca184d-260624144716"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
91872
92117
|
);
|
|
91873
92118
|
}
|
|
91874
92119
|
const systemConfig = service.getSystemConfig();
|
|
@@ -91886,7 +92131,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
91886
92131
|
onchainosAgentId: "*",
|
|
91887
92132
|
reason: "system-config missing sentryDsn",
|
|
91888
92133
|
pluginId: "@okxweb3/a2a-node",
|
|
91889
|
-
pluginVersion: "0.0.
|
|
92134
|
+
pluginVersion: "0.0.17-beta-db5dca184d-260624144716"
|
|
91890
92135
|
});
|
|
91891
92136
|
}
|
|
91892
92137
|
logWithTimestamp(
|
|
@@ -92147,7 +92392,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
92147
92392
|
sessionStore,
|
|
92148
92393
|
homeDir: options.homeDir
|
|
92149
92394
|
});
|
|
92150
|
-
await new Promise((
|
|
92395
|
+
await new Promise((resolve8) => {
|
|
92151
92396
|
const shutdown2 = (signal) => {
|
|
92152
92397
|
if (stopping) {
|
|
92153
92398
|
return;
|
|
@@ -92156,7 +92401,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
92156
92401
|
logWithTimestamp(`[okx-agent-task] received ${signal}, stopping listener`);
|
|
92157
92402
|
const forceResolve = setTimeout(() => {
|
|
92158
92403
|
logWithTimestamp("[okx-agent-task] listener shutdown timed out; forcing process exit");
|
|
92159
|
-
|
|
92404
|
+
resolve8();
|
|
92160
92405
|
}, SHUTDOWN_FORCE_RESOLVE_MS);
|
|
92161
92406
|
void (async () => {
|
|
92162
92407
|
if (timer) {
|
|
@@ -92184,7 +92429,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
92184
92429
|
stopClients(service);
|
|
92185
92430
|
sessionStore.close();
|
|
92186
92431
|
clearTimeout(forceResolve);
|
|
92187
|
-
|
|
92432
|
+
resolve8();
|
|
92188
92433
|
})();
|
|
92189
92434
|
};
|
|
92190
92435
|
process.once("SIGTERM", shutdown2);
|
|
@@ -92230,9 +92475,9 @@ var init_listener = __esm({
|
|
|
92230
92475
|
|
|
92231
92476
|
// ../core/src/file-upload-safety.ts
|
|
92232
92477
|
function getUnsafeFileUploadReason(filePath, sensitiveUploadReg = []) {
|
|
92233
|
-
const expanded = (0,
|
|
92478
|
+
const expanded = (0, import_node_path19.resolve)(expandHome(filePath));
|
|
92234
92479
|
const target = (0, import_node_fs14.realpathSync)(expanded);
|
|
92235
|
-
const targetName = (0,
|
|
92480
|
+
const targetName = (0, import_node_path19.basename)(target);
|
|
92236
92481
|
if (targetName === ".env" || targetName.startsWith(".env.")) {
|
|
92237
92482
|
return ".env";
|
|
92238
92483
|
}
|
|
@@ -92240,18 +92485,18 @@ function getUnsafeFileUploadReason(filePath, sensitiveUploadReg = []) {
|
|
|
92240
92485
|
if (configuredRule) {
|
|
92241
92486
|
return `SENSITIVE_UPLOAD_REG:${configuredRule}`;
|
|
92242
92487
|
}
|
|
92243
|
-
const home = safeRealpath((0,
|
|
92488
|
+
const home = safeRealpath((0, import_node_os7.homedir)());
|
|
92244
92489
|
if (!home) {
|
|
92245
92490
|
return null;
|
|
92246
92491
|
}
|
|
92247
92492
|
for (const dir of SENSITIVE_HOME_DIRS) {
|
|
92248
|
-
const sensitiveDir = safeRealpath((0,
|
|
92493
|
+
const sensitiveDir = safeRealpath((0, import_node_path19.join)(home, dir));
|
|
92249
92494
|
if (sensitiveDir && isPathInside(target, sensitiveDir)) {
|
|
92250
92495
|
return `~/${dir}`;
|
|
92251
92496
|
}
|
|
92252
92497
|
}
|
|
92253
92498
|
for (const file of SENSITIVE_HOME_FILES) {
|
|
92254
|
-
const sensitiveFile = safeRealpath((0,
|
|
92499
|
+
const sensitiveFile = safeRealpath((0, import_node_path19.join)(home, file));
|
|
92255
92500
|
if (sensitiveFile && target === sensitiveFile) {
|
|
92256
92501
|
return `~/${file}`;
|
|
92257
92502
|
}
|
|
@@ -92277,10 +92522,10 @@ function matchSensitiveUploadReg(paths, patterns) {
|
|
|
92277
92522
|
}
|
|
92278
92523
|
function expandHome(filePath) {
|
|
92279
92524
|
if (filePath === "~") {
|
|
92280
|
-
return (0,
|
|
92525
|
+
return (0, import_node_os7.homedir)();
|
|
92281
92526
|
}
|
|
92282
|
-
if (filePath.startsWith(`~${
|
|
92283
|
-
return (0,
|
|
92527
|
+
if (filePath.startsWith(`~${import_node_path19.sep}`)) {
|
|
92528
|
+
return (0, import_node_path19.join)((0, import_node_os7.homedir)(), filePath.slice(2));
|
|
92284
92529
|
}
|
|
92285
92530
|
return filePath;
|
|
92286
92531
|
}
|
|
@@ -92291,15 +92536,15 @@ function safeRealpath(path) {
|
|
|
92291
92536
|
return (0, import_node_fs14.realpathSync)(path);
|
|
92292
92537
|
}
|
|
92293
92538
|
function isPathInside(target, dir) {
|
|
92294
|
-
return target === dir || target.startsWith(`${dir}${
|
|
92539
|
+
return target === dir || target.startsWith(`${dir}${import_node_path19.sep}`);
|
|
92295
92540
|
}
|
|
92296
|
-
var import_node_fs14,
|
|
92541
|
+
var import_node_fs14, import_node_os7, import_node_path19, SENSITIVE_HOME_DIRS, SENSITIVE_HOME_FILES, UNSAFE_FILE_UPLOAD_MESSAGE;
|
|
92297
92542
|
var init_file_upload_safety = __esm({
|
|
92298
92543
|
"../core/src/file-upload-safety.ts"() {
|
|
92299
92544
|
"use strict";
|
|
92300
92545
|
import_node_fs14 = require("node:fs");
|
|
92301
|
-
|
|
92302
|
-
|
|
92546
|
+
import_node_os7 = require("node:os");
|
|
92547
|
+
import_node_path19 = require("node:path");
|
|
92303
92548
|
SENSITIVE_HOME_DIRS = [
|
|
92304
92549
|
".ssh",
|
|
92305
92550
|
".gnupg",
|
|
@@ -92307,7 +92552,7 @@ var init_file_upload_safety = __esm({
|
|
|
92307
92552
|
".azure",
|
|
92308
92553
|
".kube",
|
|
92309
92554
|
".docker",
|
|
92310
|
-
(0,
|
|
92555
|
+
(0, import_node_path19.join)(".config", "gcloud")
|
|
92311
92556
|
];
|
|
92312
92557
|
SENSITIVE_HOME_FILES = [
|
|
92313
92558
|
".npmrc",
|
|
@@ -92369,7 +92614,7 @@ function hasHelpFlag(args) {
|
|
|
92369
92614
|
return args.some((arg) => arg === "-h" || arg === "--help" || arg === "help");
|
|
92370
92615
|
}
|
|
92371
92616
|
async function uploadFile(params) {
|
|
92372
|
-
const filename = params.filename || (0,
|
|
92617
|
+
const filename = params.filename || (0, import_node_path20.basename)(params.filePath);
|
|
92373
92618
|
const mimeType = params.mimeType || "application/octet-stream";
|
|
92374
92619
|
const uploadConfig = readUploadSystemConfig();
|
|
92375
92620
|
const unsafeReason = getUnsafeFileUploadReason(params.filePath, uploadConfig.sensitiveUploadReg);
|
|
@@ -92393,7 +92638,7 @@ async function uploadFile(params) {
|
|
|
92393
92638
|
const attachment = { filename, mimeType, data: new Uint8Array(data) };
|
|
92394
92639
|
const encrypted = await RemoteAttachmentCodec.encodeEncrypted(attachment, new AttachmentCodec());
|
|
92395
92640
|
ensureFileDirs();
|
|
92396
|
-
const encryptedPath = (0,
|
|
92641
|
+
const encryptedPath = (0, import_node_path20.resolve)(FILE_WORK_DIR, `${(0, import_node_crypto11.randomUUID)()}.enc`);
|
|
92397
92642
|
(0, import_node_fs15.writeFileSync)(encryptedPath, encrypted.payload);
|
|
92398
92643
|
try {
|
|
92399
92644
|
const stdout = runOnchainos([
|
|
@@ -92437,7 +92682,7 @@ async function uploadFile(params) {
|
|
|
92437
92682
|
}
|
|
92438
92683
|
async function downloadFile(params) {
|
|
92439
92684
|
ensureFileDirs();
|
|
92440
|
-
const encryptedPath = (0,
|
|
92685
|
+
const encryptedPath = (0, import_node_path20.resolve)(FILE_WORK_DIR, `${(0, import_node_crypto11.randomUUID)()}.enc`);
|
|
92441
92686
|
try {
|
|
92442
92687
|
const stdout = runOnchainos([
|
|
92443
92688
|
"agent",
|
|
@@ -92473,7 +92718,7 @@ async function downloadFile(params) {
|
|
|
92473
92718
|
const outputFilename = params.filename || attachment.filename || `${(0, import_node_crypto11.randomUUID)()}.bin`;
|
|
92474
92719
|
const outputDir = DOWNLOADS_DIR;
|
|
92475
92720
|
ensureA2aTaskDir(outputDir);
|
|
92476
|
-
const outputPath = (0,
|
|
92721
|
+
const outputPath = (0, import_node_path20.resolve)(outputDir, (0, import_node_path20.basename)(outputFilename));
|
|
92477
92722
|
(0, import_node_fs15.writeFileSync)(outputPath, attachment.data);
|
|
92478
92723
|
console.log(outputPath);
|
|
92479
92724
|
} finally {
|
|
@@ -92503,7 +92748,7 @@ function toArrayBuffer(bytes) {
|
|
|
92503
92748
|
function runOnchainos(args, operation, extra = {}) {
|
|
92504
92749
|
const command = readCommand("ONCHAINOS_BIN", "onchainos");
|
|
92505
92750
|
const [bin, ...prefix] = command;
|
|
92506
|
-
const result = (0,
|
|
92751
|
+
const result = (0, import_node_child_process7.spawnSync)(bin, [...prefix, ...args], {
|
|
92507
92752
|
encoding: "utf8",
|
|
92508
92753
|
env: process.env
|
|
92509
92754
|
});
|
|
@@ -92634,14 +92879,14 @@ function readRequiredOption(args, name2) {
|
|
|
92634
92879
|
}
|
|
92635
92880
|
return value;
|
|
92636
92881
|
}
|
|
92637
|
-
var
|
|
92882
|
+
var import_node_child_process7, import_node_crypto11, import_node_fs15, import_node_path20, import_proto4, OKX_A2A_PATHS, OKX_A2A_HOME_DIR, FILE_WORK_DIR, DOWNLOADS_DIR, SYSTEM_CONFIG_PATH;
|
|
92638
92883
|
var init_file_cli = __esm({
|
|
92639
92884
|
"src/file-cli.ts"() {
|
|
92640
92885
|
"use strict";
|
|
92641
|
-
|
|
92886
|
+
import_node_child_process7 = require("node:child_process");
|
|
92642
92887
|
import_node_crypto11 = require("node:crypto");
|
|
92643
92888
|
import_node_fs15 = require("node:fs");
|
|
92644
|
-
|
|
92889
|
+
import_node_path20 = require("node:path");
|
|
92645
92890
|
init_dist6();
|
|
92646
92891
|
import_proto4 = __toESM(require_node3());
|
|
92647
92892
|
init_a2a_paths();
|
|
@@ -92652,7 +92897,7 @@ var init_file_cli = __esm({
|
|
|
92652
92897
|
OKX_A2A_HOME_DIR = OKX_A2A_PATHS.homeDir;
|
|
92653
92898
|
FILE_WORK_DIR = process.env.OKX_A2A_FILE_WORK_DIR || OKX_A2A_PATHS.filesDir;
|
|
92654
92899
|
DOWNLOADS_DIR = process.env.OKX_A2A_DOWNLOADS_DIR || OKX_A2A_PATHS.downloadsDir;
|
|
92655
|
-
SYSTEM_CONFIG_PATH = (0,
|
|
92900
|
+
SYSTEM_CONFIG_PATH = (0, import_node_path20.resolve)(OKX_A2A_PATHS.xmtpDir, "system-config.json");
|
|
92656
92901
|
}
|
|
92657
92902
|
});
|
|
92658
92903
|
|
|
@@ -93042,16 +93287,16 @@ function createWakeSignal() {
|
|
|
93042
93287
|
wake = null;
|
|
93043
93288
|
},
|
|
93044
93289
|
wait(ms) {
|
|
93045
|
-
return new Promise((
|
|
93290
|
+
return new Promise((resolve8) => {
|
|
93046
93291
|
const timer = setTimeout(() => {
|
|
93047
93292
|
if (wake === finish) {
|
|
93048
93293
|
wake = null;
|
|
93049
93294
|
}
|
|
93050
|
-
|
|
93295
|
+
resolve8();
|
|
93051
93296
|
}, ms);
|
|
93052
93297
|
const finish = () => {
|
|
93053
93298
|
clearTimeout(timer);
|
|
93054
|
-
|
|
93299
|
+
resolve8();
|
|
93055
93300
|
};
|
|
93056
93301
|
wake = finish;
|
|
93057
93302
|
});
|
|
@@ -93059,7 +93304,7 @@ function createWakeSignal() {
|
|
|
93059
93304
|
};
|
|
93060
93305
|
}
|
|
93061
93306
|
function sleep2(ms) {
|
|
93062
|
-
return new Promise((
|
|
93307
|
+
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
93063
93308
|
}
|
|
93064
93309
|
function output(json, payload, human) {
|
|
93065
93310
|
if (json) {
|
|
@@ -94808,7 +95053,7 @@ function detectSetupTarget() {
|
|
|
94808
95053
|
}
|
|
94809
95054
|
const gatewayProviders = [
|
|
94810
95055
|
...commandExists("openclaw") ? ["openclaw"] : [],
|
|
94811
|
-
...commandExists("hermes") || (0, import_node_fs16.existsSync)((0,
|
|
95056
|
+
...commandExists("hermes") || (0, import_node_fs16.existsSync)((0, import_node_path21.join)(process.env.HERMES_HOME ?? (0, import_node_path21.join)((0, import_node_os8.homedir)(), ".hermes"))) ? ["hermes"] : []
|
|
94812
95057
|
];
|
|
94813
95058
|
if (gatewayProviders.length === 1) {
|
|
94814
95059
|
return gatewayProviders[0];
|
|
@@ -94865,7 +95110,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
94865
95110
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
94866
95111
|
}
|
|
94867
95112
|
function getBundledNodeCliVersion() {
|
|
94868
|
-
return true ? "0.0.
|
|
95113
|
+
return true ? "0.0.17-beta-db5dca184d-260624144716" : null;
|
|
94869
95114
|
}
|
|
94870
95115
|
function readConfiguredAiProvider() {
|
|
94871
95116
|
const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
|
|
@@ -94935,17 +95180,17 @@ async function updateHermes(release, options) {
|
|
|
94935
95180
|
const label = options.label ?? "update";
|
|
94936
95181
|
assertNotRunningInsideGateway("hermes");
|
|
94937
95182
|
const spec = buildNpmPackageSpec("hermes", release);
|
|
94938
|
-
const workDir = await (0,
|
|
95183
|
+
const workDir = await (0, import_promises7.mkdtemp)((0, import_node_path21.join)((0, import_node_os8.tmpdir)(), `okx-a2a-${label}-hermes-`));
|
|
94939
95184
|
try {
|
|
94940
95185
|
console.log(`[${label}] downloading ${spec}`);
|
|
94941
95186
|
const npmTarball = await npmPack(spec, workDir);
|
|
94942
|
-
const npmPackageDir = (0,
|
|
95187
|
+
const npmPackageDir = (0, import_node_path21.join)(workDir, "npm-package");
|
|
94943
95188
|
await runCommand("tar", ["-xzf", npmTarball, "-C", npmPackageDir], { ensureDir: npmPackageDir });
|
|
94944
|
-
const pluginTarball = await findHermesPluginTarball((0,
|
|
94945
|
-
const pluginDir = (0,
|
|
95189
|
+
const pluginTarball = await findHermesPluginTarball((0, import_node_path21.join)(npmPackageDir, "package", "dist"));
|
|
95190
|
+
const pluginDir = (0, import_node_path21.join)(workDir, "plugin");
|
|
94946
95191
|
await runCommand("tar", ["-xzf", pluginTarball, "-C", pluginDir], { ensureDir: pluginDir });
|
|
94947
95192
|
const unpackedPluginDir = await findFirstDirectory(pluginDir);
|
|
94948
|
-
const installer = (0,
|
|
95193
|
+
const installer = (0, import_node_path21.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
|
|
94949
95194
|
console.log(`[${label}] running ${installer}`);
|
|
94950
95195
|
await runCommand("bash", [installer, ...options.restart ? ["--restart"] : []], { cwd: unpackedPluginDir });
|
|
94951
95196
|
await normalizeHermesOkxA2aPluginConfig();
|
|
@@ -94954,13 +95199,13 @@ async function updateHermes(release, options) {
|
|
|
94954
95199
|
}
|
|
94955
95200
|
console.log(`[${label}] hermes ${label} done`);
|
|
94956
95201
|
} finally {
|
|
94957
|
-
await (0,
|
|
95202
|
+
await (0, import_promises7.rm)(workDir, { recursive: true, force: true });
|
|
94958
95203
|
}
|
|
94959
95204
|
}
|
|
94960
95205
|
async function normalizeHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPath()) {
|
|
94961
95206
|
let content3;
|
|
94962
95207
|
try {
|
|
94963
|
-
content3 = await (0,
|
|
95208
|
+
content3 = await (0, import_promises7.readFile)(configFile, "utf8");
|
|
94964
95209
|
} catch (error) {
|
|
94965
95210
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
94966
95211
|
return false;
|
|
@@ -94971,18 +95216,18 @@ async function normalizeHermesOkxA2aPluginConfig(configFile = resolveHermesConfi
|
|
|
94971
95216
|
if (!normalized.changed) {
|
|
94972
95217
|
return false;
|
|
94973
95218
|
}
|
|
94974
|
-
await (0,
|
|
95219
|
+
await (0, import_promises7.writeFile)(configFile, normalized.content);
|
|
94975
95220
|
console.log(`[update] normalized Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
94976
95221
|
return true;
|
|
94977
95222
|
}
|
|
94978
95223
|
async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPath()) {
|
|
94979
95224
|
let content3;
|
|
94980
95225
|
try {
|
|
94981
|
-
content3 = await (0,
|
|
95226
|
+
content3 = await (0, import_promises7.readFile)(configFile, "utf8");
|
|
94982
95227
|
} catch (error) {
|
|
94983
95228
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
94984
|
-
await (0,
|
|
94985
|
-
await (0,
|
|
95229
|
+
await (0, import_promises7.mkdir)((0, import_node_path21.resolve)(configFile, ".."), { recursive: true });
|
|
95230
|
+
await (0, import_promises7.writeFile)(configFile, "plugins:\n enabled:\n - okx-a2a\n");
|
|
94986
95231
|
console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
94987
95232
|
return true;
|
|
94988
95233
|
}
|
|
@@ -94990,7 +95235,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
|
|
|
94990
95235
|
}
|
|
94991
95236
|
const normalized = normalizeHermesPluginConfigContent(content3);
|
|
94992
95237
|
if (normalized.changed) {
|
|
94993
|
-
await (0,
|
|
95238
|
+
await (0, import_promises7.writeFile)(configFile, normalized.content);
|
|
94994
95239
|
console.log(`[update] normalized Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
94995
95240
|
return true;
|
|
94996
95241
|
}
|
|
@@ -94998,7 +95243,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
|
|
|
94998
95243
|
return false;
|
|
94999
95244
|
}
|
|
95000
95245
|
const updated = addHermesOkxA2aEnabled(content3);
|
|
95001
|
-
await (0,
|
|
95246
|
+
await (0, import_promises7.writeFile)(configFile, updated);
|
|
95002
95247
|
console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
|
|
95003
95248
|
return true;
|
|
95004
95249
|
}
|
|
@@ -95141,7 +95386,7 @@ function addHermesOkxA2aEnabled(content3) {
|
|
|
95141
95386
|
return `${lines.join("\n")}${trailingNewline ? "\n" : ""}`;
|
|
95142
95387
|
}
|
|
95143
95388
|
function resolveHermesConfigPath() {
|
|
95144
|
-
return (0,
|
|
95389
|
+
return (0, import_node_path21.join)(process.env.HERMES_HOME ?? (0, import_node_path21.join)((0, import_node_os8.homedir)(), ".hermes"), "config.yaml");
|
|
95145
95390
|
}
|
|
95146
95391
|
function lineIndent(line) {
|
|
95147
95392
|
const match = line.match(/^\s*/);
|
|
@@ -95222,7 +95467,7 @@ async function isGatewayPluginInstalled(target) {
|
|
|
95222
95467
|
if (target === "openclaw") {
|
|
95223
95468
|
return (await getInstalledOpenClawPluginInfo()).installed;
|
|
95224
95469
|
}
|
|
95225
|
-
if ((0, import_node_fs16.existsSync)((0,
|
|
95470
|
+
if ((0, import_node_fs16.existsSync)((0, import_node_path21.join)(process.env.HERMES_HOME ?? (0, import_node_path21.join)((0, import_node_os8.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml"))) {
|
|
95226
95471
|
return true;
|
|
95227
95472
|
}
|
|
95228
95473
|
return await isGlobalNpmPackageInstalled(UPDATE_PACKAGES.hermes);
|
|
@@ -95316,9 +95561,9 @@ function parsePackageVersionFromText(output4) {
|
|
|
95316
95561
|
return output4.match(/@okxweb3\/a2a-openclaw@([0-9A-Za-z.+-]+)/)?.[1] ?? null;
|
|
95317
95562
|
}
|
|
95318
95563
|
async function getInstalledHermesPluginVersion() {
|
|
95319
|
-
const pluginYaml = (0,
|
|
95564
|
+
const pluginYaml = (0, import_node_path21.join)(process.env.HERMES_HOME ?? (0, import_node_path21.join)((0, import_node_os8.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
|
|
95320
95565
|
try {
|
|
95321
|
-
const content3 = await (0,
|
|
95566
|
+
const content3 = await (0, import_promises7.readFile)(pluginYaml, "utf8");
|
|
95322
95567
|
return parsePluginYamlVersion(content3);
|
|
95323
95568
|
} catch (error) {
|
|
95324
95569
|
if (isNodeError(error) && error.code === "ENOENT") {
|
|
@@ -95369,23 +95614,23 @@ async function npmPack(spec, destination) {
|
|
|
95369
95614
|
if (!tarballName) {
|
|
95370
95615
|
throw new Error(`Unable to detect npm pack tarball from output: ${output4.trim()}`);
|
|
95371
95616
|
}
|
|
95372
|
-
return (0,
|
|
95617
|
+
return (0, import_node_path21.resolve)(destination, (0, import_node_path21.basename)(tarballName));
|
|
95373
95618
|
}
|
|
95374
95619
|
async function findHermesPluginTarball(distDir) {
|
|
95375
|
-
const entries = await (0,
|
|
95620
|
+
const entries = await (0, import_promises7.readdir)(distDir);
|
|
95376
95621
|
const tarball = entries.find((entry) => /^okx-a2a-hermes-plugin-.+\.tar\.gz$/.test(entry));
|
|
95377
95622
|
if (!tarball) {
|
|
95378
95623
|
throw new Error(`Hermes npm package did not contain dist/okx-a2a-hermes-plugin-*.tar.gz`);
|
|
95379
95624
|
}
|
|
95380
|
-
return (0,
|
|
95625
|
+
return (0, import_node_path21.join)(distDir, tarball);
|
|
95381
95626
|
}
|
|
95382
95627
|
async function findFirstDirectory(parent) {
|
|
95383
|
-
const entries = await (0,
|
|
95628
|
+
const entries = await (0, import_promises7.readdir)(parent, { withFileTypes: true });
|
|
95384
95629
|
const dir = entries.find((entry) => entry.isDirectory());
|
|
95385
95630
|
if (!dir) {
|
|
95386
95631
|
throw new Error(`No unpacked plugin directory found under ${parent}`);
|
|
95387
95632
|
}
|
|
95388
|
-
return (0,
|
|
95633
|
+
return (0, import_node_path21.join)(parent, dir.name);
|
|
95389
95634
|
}
|
|
95390
95635
|
function readOption2(args, name2) {
|
|
95391
95636
|
const index2 = args.indexOf(name2);
|
|
@@ -95427,11 +95672,11 @@ function assertOnlyKnownUpdateOptions(args, command = "update") {
|
|
|
95427
95672
|
}
|
|
95428
95673
|
async function runCommand(command, args, options = {}) {
|
|
95429
95674
|
if (options.ensureDir) {
|
|
95430
|
-
const { mkdir:
|
|
95431
|
-
await
|
|
95675
|
+
const { mkdir: mkdir5 } = await import("node:fs/promises");
|
|
95676
|
+
await mkdir5(options.ensureDir, { recursive: true });
|
|
95432
95677
|
}
|
|
95433
95678
|
await new Promise((resolvePromise, reject) => {
|
|
95434
|
-
const child = (0,
|
|
95679
|
+
const child = (0, import_node_child_process8.spawn)(command, args, {
|
|
95435
95680
|
cwd: options.cwd,
|
|
95436
95681
|
stdio: redirectCommandStdoutToStderr ? ["ignore", "pipe", "pipe"] : "inherit"
|
|
95437
95682
|
});
|
|
@@ -95451,7 +95696,7 @@ async function runCommand(command, args, options = {}) {
|
|
|
95451
95696
|
}
|
|
95452
95697
|
async function runCommandCapture(command, args) {
|
|
95453
95698
|
return await new Promise((resolvePromise, reject) => {
|
|
95454
|
-
const child = (0,
|
|
95699
|
+
const child = (0, import_node_child_process8.spawn)(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
95455
95700
|
let stdout = "";
|
|
95456
95701
|
let stderr = "";
|
|
95457
95702
|
child.stdout.setEncoding("utf8");
|
|
@@ -95478,7 +95723,7 @@ ${stderr}`));
|
|
|
95478
95723
|
}
|
|
95479
95724
|
async function runCommandCaptureOptional(command, args) {
|
|
95480
95725
|
return await new Promise((resolvePromise) => {
|
|
95481
|
-
const child = (0,
|
|
95726
|
+
const child = (0, import_node_child_process8.spawn)(command, args, { stdio: ["ignore", "pipe", "ignore"] });
|
|
95482
95727
|
let stdout = "";
|
|
95483
95728
|
child.stdout.setEncoding("utf8");
|
|
95484
95729
|
child.stdout.on("data", (chunk) => {
|
|
@@ -95492,15 +95737,15 @@ async function runCommandCaptureOptional(command, args) {
|
|
|
95492
95737
|
});
|
|
95493
95738
|
});
|
|
95494
95739
|
}
|
|
95495
|
-
var
|
|
95740
|
+
var import_node_child_process8, import_node_fs16, import_promises7, import_node_os8, import_node_path21, UPDATE_PACKAGES, OPENCLAW_UNSAFE_INSTALL_FLAG, redirectCommandStdoutToStderr;
|
|
95496
95741
|
var init_update_cli = __esm({
|
|
95497
95742
|
"src/update-cli.ts"() {
|
|
95498
95743
|
"use strict";
|
|
95499
|
-
|
|
95744
|
+
import_node_child_process8 = require("node:child_process");
|
|
95500
95745
|
import_node_fs16 = require("node:fs");
|
|
95501
|
-
|
|
95502
|
-
|
|
95503
|
-
|
|
95746
|
+
import_promises7 = require("node:fs/promises");
|
|
95747
|
+
import_node_os8 = require("node:os");
|
|
95748
|
+
import_node_path21 = require("node:path");
|
|
95504
95749
|
init_ai_provider();
|
|
95505
95750
|
init_ai_command();
|
|
95506
95751
|
init_session_store();
|
|
@@ -95515,10 +95760,10 @@ var init_update_cli = __esm({
|
|
|
95515
95760
|
});
|
|
95516
95761
|
|
|
95517
95762
|
// src/cli.ts
|
|
95518
|
-
var
|
|
95763
|
+
var import_node_child_process9 = require("node:child_process");
|
|
95519
95764
|
var import_node_fs17 = require("node:fs");
|
|
95520
|
-
var
|
|
95521
|
-
var
|
|
95765
|
+
var import_node_os9 = require("node:os");
|
|
95766
|
+
var import_node_path22 = require("node:path");
|
|
95522
95767
|
init_daemon();
|
|
95523
95768
|
init_command_store();
|
|
95524
95769
|
init_file_store();
|
|
@@ -95532,7 +95777,7 @@ init_sentry_logger();
|
|
|
95532
95777
|
init_sentry_config();
|
|
95533
95778
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV2 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
95534
95779
|
function printUsage2() {
|
|
95535
|
-
console.log(`okx-a2a ${"0.0.
|
|
95780
|
+
console.log(`okx-a2a ${"0.0.17-beta-db5dca184d-260624144716"}
|
|
95536
95781
|
|
|
95537
95782
|
Usage:
|
|
95538
95783
|
okx-a2a <command> [options]
|
|
@@ -95569,20 +95814,22 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
95569
95814
|
`);
|
|
95570
95815
|
}
|
|
95571
95816
|
function printVersion() {
|
|
95572
|
-
console.log("0.0.
|
|
95817
|
+
console.log("0.0.17-beta-db5dca184d-260624144716");
|
|
95573
95818
|
}
|
|
95574
95819
|
function printDaemonUsage() {
|
|
95575
|
-
console.log(`Usage: okx-a2a daemon <start|restart|stop|status> [options]
|
|
95820
|
+
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
95576
95821
|
|
|
95577
95822
|
Commands:
|
|
95578
|
-
daemon start [--provider codex|claude|hermes|openclaw] [--ai-provider codex|claude|hermes|openclaw]
|
|
95579
|
-
Start the background XMTP-to-JSON writer
|
|
95823
|
+
daemon start [--provider codex|claude|hermes|openclaw] [--ai-provider codex|claude|hermes|openclaw] [--no-autostart]
|
|
95824
|
+
Start the background XMTP-to-JSON writer and install OS autostart by default
|
|
95580
95825
|
daemon restart [--provider codex|claude|hermes|openclaw] [--ai-provider codex|claude|hermes|openclaw]
|
|
95581
95826
|
Restart the background writer
|
|
95582
95827
|
daemon stop
|
|
95583
95828
|
Stop the background writer
|
|
95584
95829
|
daemon status
|
|
95585
95830
|
Print writer process status
|
|
95831
|
+
daemon autostart <install|uninstall|status>
|
|
95832
|
+
Manage OS autostart for okx-a2a run
|
|
95586
95833
|
`);
|
|
95587
95834
|
}
|
|
95588
95835
|
function printLogsUsage() {
|
|
@@ -95801,6 +96048,9 @@ function hasFlag2(args, name2) {
|
|
|
95801
96048
|
function readLifecycleProviderOption(args) {
|
|
95802
96049
|
return readOption3(args, "--provider") ?? readOption3(args, "--ai-provider");
|
|
95803
96050
|
}
|
|
96051
|
+
function shouldInstallAutostart(args) {
|
|
96052
|
+
return !hasFlag2(args, "--no-autostart");
|
|
96053
|
+
}
|
|
95804
96054
|
function printStopDaemonResult(result) {
|
|
95805
96055
|
if (result.stopped) {
|
|
95806
96056
|
console.log(`stopped pid=${result.pid}${result.forced ? " (forced)" : ""}`);
|
|
@@ -95823,12 +96073,12 @@ async function printDaemonStatus() {
|
|
|
95823
96073
|
}
|
|
95824
96074
|
}
|
|
95825
96075
|
async function tailLogFile(logPath) {
|
|
95826
|
-
await new Promise((
|
|
95827
|
-
const child = (0,
|
|
96076
|
+
await new Promise((resolve8, reject) => {
|
|
96077
|
+
const child = (0, import_node_child_process9.spawn)("tail", ["-600", "-f", logPath], { stdio: "inherit" });
|
|
95828
96078
|
child.on("error", reject);
|
|
95829
96079
|
child.on("close", (code2, signal) => {
|
|
95830
96080
|
if (signal || code2 === 0) {
|
|
95831
|
-
|
|
96081
|
+
resolve8();
|
|
95832
96082
|
return;
|
|
95833
96083
|
}
|
|
95834
96084
|
reject(new Error(`tail exited with code=${code2}`));
|
|
@@ -95847,7 +96097,7 @@ async function handleLogs(args) {
|
|
|
95847
96097
|
return;
|
|
95848
96098
|
}
|
|
95849
96099
|
if (subcommand === "llm") {
|
|
95850
|
-
await tailLogFile((0,
|
|
96100
|
+
await tailLogFile((0, import_node_path22.join)(paths.logsDir, "llm.log"));
|
|
95851
96101
|
return;
|
|
95852
96102
|
}
|
|
95853
96103
|
throw new Error("logs requires <server|llm>");
|
|
@@ -96177,6 +96427,21 @@ async function configureDefaultAiProviderForLifecycle(args) {
|
|
|
96177
96427
|
}
|
|
96178
96428
|
async function handleStart(args) {
|
|
96179
96429
|
await configureDefaultAiProviderForLifecycle(args);
|
|
96430
|
+
if (shouldInstallAutostart(args)) {
|
|
96431
|
+
try {
|
|
96432
|
+
const { installAutostart: installAutostart2 } = await Promise.resolve().then(() => (init_autostart(), autostart_exports));
|
|
96433
|
+
const result2 = await installAutostart2();
|
|
96434
|
+
console.log(`installed ${result2.platform} autostart ${result2.path}`);
|
|
96435
|
+
const status = await getDaemonStatus();
|
|
96436
|
+
if (status.running) {
|
|
96437
|
+
console.log(`running pid=${status.pid}`);
|
|
96438
|
+
}
|
|
96439
|
+
return;
|
|
96440
|
+
} catch (err2) {
|
|
96441
|
+
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
96442
|
+
console.warn(`autostart install failed; starting without autostart: ${message}`);
|
|
96443
|
+
}
|
|
96444
|
+
}
|
|
96180
96445
|
const result = await startDaemon();
|
|
96181
96446
|
if (result.started) {
|
|
96182
96447
|
console.log(`started pid=${result.pid} log=${result.logPath}`);
|
|
@@ -96198,6 +96463,29 @@ async function handleRestart(args) {
|
|
|
96198
96463
|
console.log(`already running pid=${startResult.pid} log=${startResult.logPath}`);
|
|
96199
96464
|
}
|
|
96200
96465
|
}
|
|
96466
|
+
async function handleDaemonAutostart(args) {
|
|
96467
|
+
const subcommand = args[0] ?? "status";
|
|
96468
|
+
const {
|
|
96469
|
+
autostartStatus: autostartStatus2,
|
|
96470
|
+
installAutostart: installAutostart2,
|
|
96471
|
+
uninstallAutostart: uninstallAutostart2
|
|
96472
|
+
} = await Promise.resolve().then(() => (init_autostart(), autostart_exports));
|
|
96473
|
+
if (subcommand === "install") {
|
|
96474
|
+
const result = await installAutostart2();
|
|
96475
|
+
console.log(`installed ${result.platform} autostart ${result.path}`);
|
|
96476
|
+
return;
|
|
96477
|
+
}
|
|
96478
|
+
if (subcommand === "uninstall") {
|
|
96479
|
+
const result = await uninstallAutostart2();
|
|
96480
|
+
console.log(`removed ${result.platform} autostart ${result.path}`);
|
|
96481
|
+
return;
|
|
96482
|
+
}
|
|
96483
|
+
if (subcommand === "status") {
|
|
96484
|
+
console.log(autostartStatus2());
|
|
96485
|
+
return;
|
|
96486
|
+
}
|
|
96487
|
+
throw new Error("daemon autostart requires <install|uninstall|status>");
|
|
96488
|
+
}
|
|
96201
96489
|
async function handleAiProvider(args) {
|
|
96202
96490
|
if (hasHelpFlag5(args)) {
|
|
96203
96491
|
printAiProviderUsage();
|
|
@@ -96524,7 +96812,7 @@ function initDirectCliSentry() {
|
|
|
96524
96812
|
}
|
|
96525
96813
|
cliSentryInitAttempted = true;
|
|
96526
96814
|
try {
|
|
96527
|
-
const configPath = (0,
|
|
96815
|
+
const configPath = (0, import_node_path22.join)(resolveTaskHomeForSentryConfig(), "xmtp", "system-config.json");
|
|
96528
96816
|
if (!(0, import_node_fs17.existsSync)(configPath)) {
|
|
96529
96817
|
return;
|
|
96530
96818
|
}
|
|
@@ -96546,13 +96834,13 @@ function resolveTaskHomeForSentryConfig() {
|
|
|
96546
96834
|
return process.env.OKX_AGENT_TASK_HOME;
|
|
96547
96835
|
}
|
|
96548
96836
|
try {
|
|
96549
|
-
const home = (0,
|
|
96837
|
+
const home = (0, import_node_os9.homedir)();
|
|
96550
96838
|
if (home) {
|
|
96551
|
-
return (0,
|
|
96839
|
+
return (0, import_node_path22.join)(home, ".okx-agent-task");
|
|
96552
96840
|
}
|
|
96553
96841
|
} catch {
|
|
96554
96842
|
}
|
|
96555
|
-
return (0,
|
|
96843
|
+
return (0, import_node_path22.resolve)(process.cwd(), ".okx-agent-task");
|
|
96556
96844
|
}
|
|
96557
96845
|
function directCliSentryExtra(operation, extra = {}) {
|
|
96558
96846
|
return {
|
|
@@ -96568,8 +96856,8 @@ async function flushDirectCliSentry() {
|
|
|
96568
96856
|
return;
|
|
96569
96857
|
}
|
|
96570
96858
|
try {
|
|
96571
|
-
const timeout = new Promise((
|
|
96572
|
-
const timer = setTimeout(() =>
|
|
96859
|
+
const timeout = new Promise((resolve8) => {
|
|
96860
|
+
const timer = setTimeout(() => resolve8("timeout"), 750);
|
|
96573
96861
|
timer.unref?.();
|
|
96574
96862
|
});
|
|
96575
96863
|
const result = await Promise.race([shutdown().then(() => "flushed"), timeout]);
|
|
@@ -96618,6 +96906,10 @@ async function main() {
|
|
|
96618
96906
|
await printDaemonStatus();
|
|
96619
96907
|
return;
|
|
96620
96908
|
}
|
|
96909
|
+
if (daemonCommand === "autostart") {
|
|
96910
|
+
await handleDaemonAutostart(daemonArgs);
|
|
96911
|
+
return;
|
|
96912
|
+
}
|
|
96621
96913
|
throw new Error(`Unknown daemon command: ${daemonCommand}`);
|
|
96622
96914
|
}
|
|
96623
96915
|
if (command === "start") {
|