@remnic/core 9.50.1 → 9.50.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.js +3 -3
- package/dist/access-authorization-probe.js +4 -4
- package/dist/access-boundary.js +3 -3
- package/dist/access-cli.js +13 -13
- package/dist/access-extraction-force-flush.js +3 -3
- package/dist/access-http-query.js +3 -3
- package/dist/access-http.js +9 -9
- package/dist/access-identity-continuity-surface.js +3 -3
- package/dist/access-lcm-surface.js +3 -3
- package/dist/access-mcp.js +7 -7
- package/dist/access-namespace-preflight.js +3 -3
- package/dist/access-observe-write-surface.js +3 -3
- package/dist/access-operations-batch.js +4 -4
- package/dist/access-operations.js +6 -6
- package/dist/access-recall-concurrency.js +3 -3
- package/dist/access-recall-response.js +3 -3
- package/dist/access-recall-surface.js +3 -3
- package/dist/access-service.js +3 -3
- package/dist/{chunk-UWIDGVQM.js → chunk-5C2HNJMO.js} +3 -3
- package/dist/{chunk-X4IDNPOS.js → chunk-HAEU3ZW7.js} +2 -2
- package/dist/{chunk-NZ6UDRUA.js → chunk-IK6X5QPO.js} +5 -5
- package/dist/{chunk-P7ADRREJ.js → chunk-KDG2KTWW.js} +3 -3
- package/dist/{chunk-IB25FBMX.js → chunk-LEJPSMKM.js} +2 -2
- package/dist/{chunk-ZDAYWJV6.js → chunk-NO37MR45.js} +3 -3
- package/dist/{chunk-ZCO5F5FW.js → chunk-PLKFO2HJ.js} +2 -2
- package/dist/{chunk-LOW66JRO.js → chunk-PYKKWQZ2.js} +2 -2
- package/dist/{chunk-T6RATUV2.js → chunk-QW3WFHKU.js} +2 -2
- package/dist/{chunk-PNRA7FAD.js → chunk-RZRUV6N2.js} +104 -62
- package/dist/chunk-RZRUV6N2.js.map +1 -0
- package/dist/{chunk-D73B6HMN.js → chunk-S3AYIQCU.js} +2 -2
- package/dist/{chunk-HS4M6BZM.js → chunk-TQFHQPWD.js} +5 -5
- package/dist/{chunk-JFNRA7YJ.js → chunk-V7X767RT.js} +4 -4
- package/dist/cli.js +10 -10
- package/dist/connectors/index.d.ts +1 -0
- package/dist/connectors/index.js +1 -1
- package/dist/external-wiki-access.js +4 -4
- package/dist/extraction.js +4 -4
- package/dist/index.js +13 -13
- package/dist/orchestrator.js +13 -13
- package/dist/source-agent-qualifier.js +3 -3
- package/package.json +2 -2
- package/src/connectors/index.ts +40 -112
- package/src/runtime/daemon-health.ts +53 -0
- package/src/runtime/http-transport.ts +25 -0
- package/dist/chunk-PNRA7FAD.js.map +0 -1
- /package/dist/{chunk-UWIDGVQM.js.map → chunk-5C2HNJMO.js.map} +0 -0
- /package/dist/{chunk-X4IDNPOS.js.map → chunk-HAEU3ZW7.js.map} +0 -0
- /package/dist/{chunk-NZ6UDRUA.js.map → chunk-IK6X5QPO.js.map} +0 -0
- /package/dist/{chunk-P7ADRREJ.js.map → chunk-KDG2KTWW.js.map} +0 -0
- /package/dist/{chunk-IB25FBMX.js.map → chunk-LEJPSMKM.js.map} +0 -0
- /package/dist/{chunk-ZDAYWJV6.js.map → chunk-NO37MR45.js.map} +0 -0
- /package/dist/{chunk-ZCO5F5FW.js.map → chunk-PLKFO2HJ.js.map} +0 -0
- /package/dist/{chunk-LOW66JRO.js.map → chunk-PYKKWQZ2.js.map} +0 -0
- /package/dist/{chunk-T6RATUV2.js.map → chunk-QW3WFHKU.js.map} +0 -0
- /package/dist/{chunk-D73B6HMN.js.map → chunk-S3AYIQCU.js.map} +0 -0
- /package/dist/{chunk-HS4M6BZM.js.map → chunk-TQFHQPWD.js.map} +0 -0
- /package/dist/{chunk-JFNRA7YJ.js.map → chunk-V7X767RT.js.map} +0 -0
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
defineOperation,
|
|
29
29
|
parseNamespacePreflightWriteOp,
|
|
30
30
|
resolveAuthorizedNamespaceWritablePreflight
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5C2HNJMO.js";
|
|
32
32
|
import {
|
|
33
33
|
validateBriefingFormat
|
|
34
34
|
} from "./chunk-VJXY5ZCT.js";
|
|
@@ -494,4 +494,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
|
|
|
494
494
|
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
495
495
|
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
496
496
|
defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
497
|
-
//# sourceMappingURL=chunk-
|
|
497
|
+
//# sourceMappingURL=chunk-PYKKWQZ2.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
OPERATION_NAMES,
|
|
3
3
|
getOperation,
|
|
4
4
|
operationRequiresAuthorizedNamespace
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5C2HNJMO.js";
|
|
6
6
|
import {
|
|
7
7
|
assertOperationAuthorizationAllowed
|
|
8
8
|
} from "./chunk-MZWSOLMT.js";
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
probeOperationAuthorization,
|
|
50
50
|
authorizationProbeNamespaces
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-QW3WFHKU.js.map
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getRegistryPath
|
|
12
12
|
} from "./chunk-K6MV3TRQ.js";
|
|
13
13
|
import {
|
|
14
|
+
coerceBool,
|
|
14
15
|
coerceInstallExtension
|
|
15
16
|
} from "./chunk-PQVCH2AE.js";
|
|
16
17
|
import {
|
|
@@ -38,6 +39,70 @@ import os from "os";
|
|
|
38
39
|
import { createRequire } from "module";
|
|
39
40
|
import { fileURLToPath } from "url";
|
|
40
41
|
|
|
42
|
+
// src/runtime/http-transport.ts
|
|
43
|
+
import { isIP } from "net";
|
|
44
|
+
function normalizedIp(host) {
|
|
45
|
+
const value = host.trim().replace(/^\[/, "").replace(/\]\.?$/, "").replace(/\.$/, "");
|
|
46
|
+
if (isIP(value) === 4) return value;
|
|
47
|
+
if (isIP(value) !== 6) return "";
|
|
48
|
+
return new URL(`http://[${value}]/`).hostname.slice(1, -1);
|
|
49
|
+
}
|
|
50
|
+
function isLoopbackHost(host) {
|
|
51
|
+
const normalized = host.trim().replace(/^\[/, "").replace(/\]\.?$/, "").replace(/\.$/, "").toLowerCase();
|
|
52
|
+
if (normalized === "localhost" || normalized.endsWith(".localhost")) return true;
|
|
53
|
+
const ip = normalizedIp(normalized);
|
|
54
|
+
if (ip === "::1") return true;
|
|
55
|
+
if (isIP(ip) === 4) return ip.startsWith("127.");
|
|
56
|
+
if (!ip.startsWith("::ffff:")) return false;
|
|
57
|
+
const [high, low] = ip.slice("::ffff:".length).split(":");
|
|
58
|
+
return Number.parseInt(high, 16) >>> 8 === 127 || high === "0" && Number.parseInt(low, 16) >>> 8 === 127;
|
|
59
|
+
}
|
|
60
|
+
function httpProtocolForHost(host, allowInsecureHttp = false) {
|
|
61
|
+
return isLoopbackHost(host) || allowInsecureHttp ? "http" : "https";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/runtime/daemon-health.ts
|
|
65
|
+
var HEALTH_EXIT_OK = 0;
|
|
66
|
+
var HEALTH_EXIT_UNAUTHORIZED = 2;
|
|
67
|
+
function checkDaemonHealth(host, port, authToken, allowInsecureHttp = false) {
|
|
68
|
+
try {
|
|
69
|
+
const safePort = Math.trunc(Number(port));
|
|
70
|
+
if (!Number.isFinite(safePort) || safePort < 1 || safePort > 65535) return false;
|
|
71
|
+
const bareHost = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
72
|
+
const script = [
|
|
73
|
+
"const env = process['env'];",
|
|
74
|
+
"const protocol = env.REMNIC_HEALTH_PROTOCOL;",
|
|
75
|
+
"if (protocol !== 'http' && protocol !== 'https') process.exit(1);",
|
|
76
|
+
"const transport = require(protocol);",
|
|
77
|
+
"const headers = {};",
|
|
78
|
+
"if (env.REMNIC_HEALTH_TOKEN) headers['authorization'] = 'Bearer ' + env.REMNIC_HEALTH_TOKEN;",
|
|
79
|
+
"const req = transport.get({",
|
|
80
|
+
" host: env.REMNIC_HEALTH_HOST,",
|
|
81
|
+
" port: parseInt(env.REMNIC_HEALTH_PORT, 10),",
|
|
82
|
+
" path: '/engram/v1/health', headers, timeout: 3000,",
|
|
83
|
+
"}, (res) => { process.exit(res.statusCode === 200 ? 0 : res.statusCode === 401 ? 2 : 1); });",
|
|
84
|
+
"req.on('error', () => process.exit(1));",
|
|
85
|
+
"req.on('timeout', () => { req.destroy(); process.exit(1); });"
|
|
86
|
+
].join("\n");
|
|
87
|
+
const env = mergeEnv({
|
|
88
|
+
REMNIC_HEALTH_HOST: bareHost,
|
|
89
|
+
REMNIC_HEALTH_PORT: String(safePort),
|
|
90
|
+
REMNIC_HEALTH_PROTOCOL: httpProtocolForHost(host, allowInsecureHttp)
|
|
91
|
+
});
|
|
92
|
+
if (authToken) env.REMNIC_HEALTH_TOKEN = authToken;
|
|
93
|
+
const launchOptions = { timeout: 4e3, env };
|
|
94
|
+
const result = launchProcessSync(process.execPath, ["-e", script], launchOptions);
|
|
95
|
+
if (result.status === HEALTH_EXIT_OK) return true;
|
|
96
|
+
if (result.status !== HEALTH_EXIT_UNAUTHORIZED) return false;
|
|
97
|
+
console.error("[remnic/connectors] health probe got 401 \u2014 retrying after token cache TTL...");
|
|
98
|
+
launchProcessSync(process.execPath, ["-e", "setTimeout(() => {}, 6000)"], { timeout: 7e3, env: {} });
|
|
99
|
+
const retry = launchProcessSync(process.execPath, ["-e", script], launchOptions);
|
|
100
|
+
return retry.status === HEALTH_EXIT_OK;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
41
106
|
// src/connectors/hermes-shim.ts
|
|
42
107
|
import fs from "fs";
|
|
43
108
|
import path from "path";
|
|
@@ -1208,9 +1273,11 @@ function installConnector(options) {
|
|
|
1208
1273
|
let hermesSavedProfile;
|
|
1209
1274
|
let hermesSavedHost;
|
|
1210
1275
|
let hermesSavedPort;
|
|
1276
|
+
let hermesSavedAllowInsecureHttp;
|
|
1211
1277
|
let hermesResolvedProfile;
|
|
1212
1278
|
let hermesResolvedHost;
|
|
1213
1279
|
let hermesResolvedPort;
|
|
1280
|
+
let hermesResolvedAllowInsecureHttp = false;
|
|
1214
1281
|
if (options.connectorId === "hermes") {
|
|
1215
1282
|
if (fs3.existsSync(configPath)) {
|
|
1216
1283
|
try {
|
|
@@ -1234,11 +1301,15 @@ function installConnector(options) {
|
|
|
1234
1301
|
} catch {
|
|
1235
1302
|
}
|
|
1236
1303
|
}
|
|
1304
|
+
if (prev?.allow_insecure_http != null) {
|
|
1305
|
+
hermesSavedAllowInsecureHttp = coerceBool(prev.allow_insecure_http, "allow_insecure_http");
|
|
1306
|
+
}
|
|
1237
1307
|
} catch {
|
|
1238
1308
|
}
|
|
1239
1309
|
}
|
|
1240
1310
|
hermesResolvedProfile = hermesSavedProfile ?? "default";
|
|
1241
1311
|
hermesResolvedHost = hermesSavedHost ?? "127.0.0.1";
|
|
1312
|
+
hermesResolvedAllowInsecureHttp = hermesSavedAllowInsecureHttp ?? false;
|
|
1242
1313
|
if (options.config?.port !== void 0) {
|
|
1243
1314
|
try {
|
|
1244
1315
|
hermesResolvedPort = sanitizeHermesPort(Number(String(options.config.port)));
|
|
@@ -1275,6 +1346,17 @@ function installConnector(options) {
|
|
|
1275
1346
|
};
|
|
1276
1347
|
}
|
|
1277
1348
|
}
|
|
1349
|
+
if (options.config?.allow_insecure_http !== void 0) {
|
|
1350
|
+
const allowInsecureHttp = coerceBool(options.config.allow_insecure_http, "allow_insecure_http");
|
|
1351
|
+
if (allowInsecureHttp === void 0) {
|
|
1352
|
+
return {
|
|
1353
|
+
connectorId: options.connectorId,
|
|
1354
|
+
status: "error",
|
|
1355
|
+
message: "Invalid Hermes config: allow_insecure_http must be true or false"
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
hermesResolvedAllowInsecureHttp = allowInsecureHttp;
|
|
1359
|
+
}
|
|
1278
1360
|
}
|
|
1279
1361
|
const nonHermesPriorTokenStore = options.connectorId !== "hermes" && manifest.requiresToken ? loadTokenStore() : null;
|
|
1280
1362
|
let tokenEntry = null;
|
|
@@ -1317,7 +1399,8 @@ function installConnector(options) {
|
|
|
1317
1399
|
...hermesResolvedProfile !== void 0 ? {
|
|
1318
1400
|
profile: hermesResolvedProfile,
|
|
1319
1401
|
host: hermesResolvedHost,
|
|
1320
|
-
port: hermesResolvedPort
|
|
1402
|
+
port: hermesResolvedPort,
|
|
1403
|
+
allow_insecure_http: hermesResolvedAllowInsecureHttp
|
|
1321
1404
|
} : {}
|
|
1322
1405
|
};
|
|
1323
1406
|
if (options.connectorId === "hermes") {
|
|
@@ -1356,7 +1439,8 @@ function installConnector(options) {
|
|
|
1356
1439
|
profile: hermesProfile,
|
|
1357
1440
|
host: hermesHost,
|
|
1358
1441
|
port: hermesPort,
|
|
1359
|
-
token: tokenEntry.token
|
|
1442
|
+
token: tokenEntry.token,
|
|
1443
|
+
allowInsecureHttp: hermesResolvedAllowInsecureHttp
|
|
1360
1444
|
});
|
|
1361
1445
|
} catch (err) {
|
|
1362
1446
|
return {
|
|
@@ -1469,7 +1553,8 @@ function installConnector(options) {
|
|
|
1469
1553
|
const refresh = upsertHermesConfigAt(priorConfigPath, {
|
|
1470
1554
|
host: hermesHost,
|
|
1471
1555
|
port: hermesPort,
|
|
1472
|
-
token: tokenEntry.token
|
|
1556
|
+
token: tokenEntry.token,
|
|
1557
|
+
allowInsecureHttp: hermesResolvedAllowInsecureHttp
|
|
1473
1558
|
});
|
|
1474
1559
|
if (refresh.updated) {
|
|
1475
1560
|
hermesPriorConfigMutations.push({ mutatedPath: priorConfigPath, priorContent: beforeRefresh });
|
|
@@ -1680,7 +1765,12 @@ function installConnector(options) {
|
|
|
1680
1765
|
}
|
|
1681
1766
|
}
|
|
1682
1767
|
if (committed && tokenEntry) {
|
|
1683
|
-
const daemonOk = checkDaemonHealth(
|
|
1768
|
+
const daemonOk = checkDaemonHealth(
|
|
1769
|
+
hermesHost,
|
|
1770
|
+
hermesPort,
|
|
1771
|
+
tokenEntry.token,
|
|
1772
|
+
hermesResolvedAllowInsecureHttp
|
|
1773
|
+
);
|
|
1684
1774
|
if (daemonOk) {
|
|
1685
1775
|
notes.push("Daemon health check: OK");
|
|
1686
1776
|
} else {
|
|
@@ -2331,6 +2421,7 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2331
2421
|
const profileDir = path3.dirname(cfgPath);
|
|
2332
2422
|
const safeHost = sanitizeHermesHost(opts.host);
|
|
2333
2423
|
const safePort = sanitizeHermesPort(opts.port);
|
|
2424
|
+
const allowInsecureHttp = opts.allowInsecureHttp ?? false;
|
|
2334
2425
|
if (!/^[A-Za-z0-9_]+$/.test(opts.token)) {
|
|
2335
2426
|
throw new Error("Invalid Hermes token: contains non-alphanumeric characters");
|
|
2336
2427
|
}
|
|
@@ -2346,7 +2437,8 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2346
2437
|
"remnic:",
|
|
2347
2438
|
` host: "${safeHost}"`,
|
|
2348
2439
|
` port: ${safePort}`,
|
|
2349
|
-
` token: "${opts.token}"
|
|
2440
|
+
` token: "${opts.token}"`,
|
|
2441
|
+
` allow_insecure_http: ${allowInsecureHttp}`
|
|
2350
2442
|
].join("\n");
|
|
2351
2443
|
if (!fs3.existsSync(cfgPath)) {
|
|
2352
2444
|
writeSecretFileSync(cfgPath, block + "\n");
|
|
@@ -2367,7 +2459,7 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2367
2459
|
const newLines = [];
|
|
2368
2460
|
let inRemnicBlock = false;
|
|
2369
2461
|
let blockWritten = false;
|
|
2370
|
-
const written = { host: false, port: false, token: false };
|
|
2462
|
+
const written = { host: false, port: false, token: false, allowInsecureHttp: false };
|
|
2371
2463
|
for (let i = 0; i < lines.length; i++) {
|
|
2372
2464
|
const line = lines[i];
|
|
2373
2465
|
if (/^remnic:/.test(line)) {
|
|
@@ -2380,6 +2472,7 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2380
2472
|
if (!written.host) newLines.push(` host: "${safeHost}"`);
|
|
2381
2473
|
if (!written.port) newLines.push(` port: ${safePort}`);
|
|
2382
2474
|
if (!written.token) newLines.push(` token: "${opts.token}"`);
|
|
2475
|
+
if (!written.allowInsecureHttp) newLines.push(` allow_insecure_http: ${allowInsecureHttp}`);
|
|
2383
2476
|
blockWritten = true;
|
|
2384
2477
|
inRemnicBlock = false;
|
|
2385
2478
|
newLines.push(line);
|
|
@@ -2394,6 +2487,9 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2394
2487
|
} else if (/^\s+token:/.test(line)) {
|
|
2395
2488
|
newLines.push(` token: "${opts.token}"`);
|
|
2396
2489
|
written.token = true;
|
|
2490
|
+
} else if (/^\s+allow_insecure_http:/.test(line)) {
|
|
2491
|
+
newLines.push(` allow_insecure_http: ${allowInsecureHttp}`);
|
|
2492
|
+
written.allowInsecureHttp = true;
|
|
2397
2493
|
} else {
|
|
2398
2494
|
newLines.push(line);
|
|
2399
2495
|
}
|
|
@@ -2405,6 +2501,7 @@ function upsertHermesConfigAt(cfgPath, opts) {
|
|
|
2405
2501
|
if (!written.host) newLines.push(` host: "${safeHost}"`);
|
|
2406
2502
|
if (!written.port) newLines.push(` port: ${safePort}`);
|
|
2407
2503
|
if (!written.token) newLines.push(` token: "${opts.token}"`);
|
|
2504
|
+
if (!written.allowInsecureHttp) newLines.push(` allow_insecure_http: ${allowInsecureHttp}`);
|
|
2408
2505
|
}
|
|
2409
2506
|
writeSecretFileSync(cfgPath, newLines.join("\n") + "\n");
|
|
2410
2507
|
return { updated: true, skipped: false, configPath: cfgPath, priorContent: raw };
|
|
@@ -2535,61 +2632,6 @@ function removeHermesConfigFile(cfgPath) {
|
|
|
2535
2632
|
writeSecretFileSync(cfgPath, newLines.length > 0 ? newLines.join("\n") + "\n" : "");
|
|
2536
2633
|
return { updated: true, skipped: false, configPath: cfgPath };
|
|
2537
2634
|
}
|
|
2538
|
-
var HEALTH_EXIT_OK = 0;
|
|
2539
|
-
var HEALTH_EXIT_UNAUTHORIZED = 2;
|
|
2540
|
-
function checkDaemonHealth(host, port, authToken) {
|
|
2541
|
-
try {
|
|
2542
|
-
const safePort = Math.trunc(Number(port));
|
|
2543
|
-
if (!Number.isFinite(safePort) || safePort < 1 || safePort > 65535) {
|
|
2544
|
-
return false;
|
|
2545
|
-
}
|
|
2546
|
-
const bareHost = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
2547
|
-
const script = [
|
|
2548
|
-
"const http = require('http');",
|
|
2549
|
-
"const env = process['env'];",
|
|
2550
|
-
"const headers = {};",
|
|
2551
|
-
"if (env.REMNIC_HEALTH_TOKEN) {",
|
|
2552
|
-
" headers['authorization'] = 'Bearer ' + env.REMNIC_HEALTH_TOKEN;",
|
|
2553
|
-
"}",
|
|
2554
|
-
"const req = http.get({",
|
|
2555
|
-
" host: env.REMNIC_HEALTH_HOST,",
|
|
2556
|
-
" port: parseInt(env.REMNIC_HEALTH_PORT, 10),",
|
|
2557
|
-
" path: '/engram/v1/health',",
|
|
2558
|
-
" headers,",
|
|
2559
|
-
" timeout: 3000,",
|
|
2560
|
-
"}, (res) => { process.exit(res.statusCode === 200 ? 0 : res.statusCode === 401 ? 2 : 1); });",
|
|
2561
|
-
"req.on('error', () => process.exit(1));",
|
|
2562
|
-
"req.on('timeout', () => { req.destroy(); process.exit(1); });"
|
|
2563
|
-
].join("\n");
|
|
2564
|
-
const env = mergeEnv({
|
|
2565
|
-
REMNIC_HEALTH_HOST: bareHost,
|
|
2566
|
-
REMNIC_HEALTH_PORT: String(safePort)
|
|
2567
|
-
});
|
|
2568
|
-
if (authToken) {
|
|
2569
|
-
env.REMNIC_HEALTH_TOKEN = authToken;
|
|
2570
|
-
}
|
|
2571
|
-
const processPath = process.execPath;
|
|
2572
|
-
const launchOptions = { timeout: 4e3, env };
|
|
2573
|
-
const result = launchProcessSync(processPath, ["-e", script], launchOptions);
|
|
2574
|
-
if (result.status === HEALTH_EXIT_OK) {
|
|
2575
|
-
return true;
|
|
2576
|
-
}
|
|
2577
|
-
if (result.status === HEALTH_EXIT_UNAUTHORIZED) {
|
|
2578
|
-
console.error(
|
|
2579
|
-
"[remnic/connectors] health probe got 401 \u2014 retrying after token cache TTL..."
|
|
2580
|
-
);
|
|
2581
|
-
launchProcessSync(processPath, ["-e", "setTimeout(() => {}, 6000)"], {
|
|
2582
|
-
timeout: 7e3,
|
|
2583
|
-
env: {}
|
|
2584
|
-
});
|
|
2585
|
-
const retry = launchProcessSync(processPath, ["-e", script], launchOptions);
|
|
2586
|
-
return retry.status === HEALTH_EXIT_OK;
|
|
2587
|
-
}
|
|
2588
|
-
return false;
|
|
2589
|
-
} catch {
|
|
2590
|
-
return false;
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
2635
|
async function doctorConnector(connectorId) {
|
|
2594
2636
|
const installed = listConnectors().installed;
|
|
2595
2637
|
const instance = installed.find((c) => c.connectorId === connectorId);
|
|
@@ -3032,4 +3074,4 @@ export {
|
|
|
3032
3074
|
resolveWeCloneProxyConfigPath,
|
|
3033
3075
|
buildWeCloneProxyConfig
|
|
3034
3076
|
};
|
|
3035
|
-
//# sourceMappingURL=chunk-
|
|
3077
|
+
//# sourceMappingURL=chunk-RZRUV6N2.js.map
|