@remnic/core 10.0.187 → 10.0.189
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 +39 -39
- package/dist/access-cli.js +39 -39
- package/dist/access-extraction-force-flush-preempt.js +39 -39
- package/dist/access-extraction-force-flush.d.ts.map +1 -1
- package/dist/access-extraction-force-flush.js +39 -39
- package/dist/access-http-briefing.js +39 -39
- package/dist/access-http-query.js +39 -39
- package/dist/access-http.js +39 -39
- package/dist/access-identity-continuity-surface.js +39 -39
- package/dist/access-lcm-surface.js +39 -39
- package/dist/access-mcp.js +39 -39
- package/dist/access-observe-helpers.d.ts +1 -4
- package/dist/access-observe-helpers.d.ts.map +1 -1
- package/dist/access-observe-helpers.js +1 -1
- package/dist/access-observe-write-surface.d.ts +0 -4
- package/dist/access-observe-write-surface.d.ts.map +1 -1
- package/dist/access-observe-write-surface.js +39 -39
- package/dist/access-operations-batch.js +39 -39
- package/dist/access-operations.js +39 -39
- package/dist/access-recall-concurrency.js +39 -39
- package/dist/access-recall-response.js +39 -39
- package/dist/access-recall-surface.js +39 -39
- package/dist/access-service.d.ts +0 -2
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +39 -39
- package/dist/active-recall.js +1 -1
- package/dist/briefing.js +2 -2
- package/dist/buffer-add-turns-bounded.js +2 -2
- package/dist/buffer-admission-idempotency.d.ts.map +1 -1
- package/dist/buffer-admission-idempotency.js +1 -1
- package/dist/buffer-persistence.d.ts +14 -0
- package/dist/buffer-persistence.d.ts.map +1 -1
- package/dist/buffer-persistence.js +3 -1
- package/dist/buffer.js +4 -4
- package/dist/calibration.js +3 -3
- package/dist/causal-consolidation.js +3 -3
- package/dist/{chunk-2ZS7CB5H.js → chunk-2I3ETW3G.js} +2 -2
- package/dist/{chunk-PSUSA5SM.js → chunk-2VNMSEZR.js} +2 -2
- package/dist/{chunk-LANV6I63.js → chunk-56BNHKZM.js} +7 -7
- package/dist/{chunk-3FEQNKMB.js → chunk-5WDUY2ZZ.js} +2 -2
- package/dist/{chunk-BANMPRSC.js → chunk-65DWWJKI.js} +2 -2
- package/dist/{chunk-O5ZCDK32.js → chunk-6AMFGXG2.js} +39 -11
- package/dist/chunk-6AMFGXG2.js.map +1 -0
- package/dist/{chunk-VZBKCRU7.js → chunk-6MDHK6NO.js} +2 -2
- package/dist/{chunk-2RAVHJCD.js → chunk-6OHCNTKU.js} +2 -2
- package/dist/{chunk-P5FF44G3.js → chunk-7X6EZ2QB.js} +4 -4
- package/dist/{chunk-K5RGHUX7.js → chunk-A32EBVCZ.js} +2 -2
- package/dist/{chunk-L2DYRQQH.js → chunk-ABPOW3SX.js} +73 -103
- package/dist/chunk-ABPOW3SX.js.map +1 -0
- package/dist/{chunk-KVM3BS5K.js → chunk-ATPY63F5.js} +2 -2
- package/dist/chunk-B256MMS7.js +205 -0
- package/dist/chunk-B256MMS7.js.map +1 -0
- package/dist/{chunk-MOWLANEJ.js → chunk-C6Y2YHJL.js} +2 -2
- package/dist/{chunk-IMT7NTFV.js → chunk-CIAQK2OU.js} +6 -1
- package/dist/{chunk-IMT7NTFV.js.map → chunk-CIAQK2OU.js.map} +1 -1
- package/dist/{chunk-AJVCM2E3.js → chunk-CYX7JI4O.js} +2 -2
- package/dist/{chunk-76KL37ON.js → chunk-D3FP4JQI.js} +2 -2
- package/dist/{chunk-TQXKUQFX.js → chunk-FZU62GIV.js} +7 -6
- package/dist/chunk-FZU62GIV.js.map +1 -0
- package/dist/{chunk-YDGQYG4L.js → chunk-H442UKDV.js} +8 -8
- package/dist/{chunk-FXDQO7VX.js → chunk-HL53XYHC.js} +3 -3
- package/dist/{chunk-4VFEN3WT.js → chunk-IMSLPQJB.js} +2 -2
- package/dist/{chunk-FKLSIQBF.js → chunk-K3JGILZC.js} +3 -3
- package/dist/{chunk-JRHOL6B5.js → chunk-K6BS5RB4.js} +2 -2
- package/dist/{chunk-HHCLV572.js → chunk-KVTUUU7H.js} +2 -2
- package/dist/{chunk-TRFSTCQK.js → chunk-LL6WEMTC.js} +34 -6
- package/dist/chunk-LL6WEMTC.js.map +1 -0
- package/dist/{chunk-2WITFW6F.js → chunk-NKHRIDYP.js} +2 -2
- package/dist/{chunk-KYZMCH4I.js → chunk-NN3LMWKA.js} +12 -4
- package/dist/chunk-NN3LMWKA.js.map +1 -0
- package/dist/{chunk-CYTTY4M2.js → chunk-OPXK5IQU.js} +47 -47
- package/dist/chunk-OPXK5IQU.js.map +1 -0
- package/dist/{chunk-CTWWMEGR.js → chunk-PCGBESAN.js} +2 -2
- package/dist/{chunk-MDXZIU5X.js → chunk-QGT5KNQT.js} +2 -2
- package/dist/{chunk-YJZDRM33.js → chunk-QXHWOUS6.js} +3 -3
- package/dist/{chunk-OVJAQWHO.js → chunk-RPOG6HLI.js} +2 -2
- package/dist/{chunk-2QQCCUXF.js → chunk-RVODERA5.js} +2 -2
- package/dist/{chunk-FQE5QN5Q.js → chunk-TAPF7T26.js} +2 -2
- package/dist/{chunk-7UTCETGK.js → chunk-TQODBIMW.js} +2 -2
- package/dist/{chunk-KZJEKKK6.js → chunk-VQQZJ6KJ.js} +3 -3
- package/dist/{chunk-I233SAGS.js → chunk-X3ERYOLO.js} +2 -2
- package/dist/{chunk-UCCXPMTP.js → chunk-XQF2KLV5.js} +2 -2
- package/dist/{chunk-LPYGM6RE.js → chunk-XWPYK5T4.js} +2 -2
- package/dist/{chunk-7EPEZYX3.js → chunk-YVXR7CPS.js} +2 -2
- package/dist/cli.js +39 -39
- package/dist/coding/export-okf-codegraph.js +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.js +2 -2
- package/dist/connectors/index.js +2 -2
- package/dist/convergence-refresh.js +4 -4
- package/dist/corpus-watermark.js +4 -4
- package/dist/entity-retrieval.js +2 -2
- package/dist/explicit-capture.js +39 -39
- package/dist/extraction.js +6 -6
- package/dist/harmonic-retrieval.js +2 -2
- package/dist/index.js +39 -39
- package/dist/local-llm-helpers.d.ts.map +1 -1
- package/dist/local-llm-helpers.js +2 -2
- package/dist/local-llm-transport.d.ts +82 -9
- package/dist/local-llm-transport.d.ts.map +1 -1
- package/dist/local-llm-transport.js +11 -3
- package/dist/local-llm.d.ts.map +1 -1
- package/dist/local-llm.js +3 -3
- package/dist/location/index.js +3 -3
- package/dist/maintenance/memory-governance.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
- package/dist/maintenance/rebuild-memory-projection-runner.js +4 -4
- package/dist/maintenance/rebuild-memory-projection.js +3 -3
- package/dist/namespaces/migrate.js +3 -3
- package/dist/namespaces/storage.js +2 -2
- package/dist/operator-doctor-corpus.js +5 -5
- package/dist/operator-toolkit.js +8 -8
- package/dist/orchestration/backlog-scheduler.js +40 -40
- package/dist/orchestration/buffer-drain-runner.js +40 -40
- package/dist/orchestration/extraction-queue-coordinator.d.ts +14 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +13 -13
- package/dist/orchestrator.js +39 -39
- package/dist/recall-navigation.js +39 -39
- package/dist/resume-bundles.js +1 -1
- package/dist/semantic-consolidation.js +3 -3
- package/dist/semantic-rule-promotion.js +2 -2
- package/dist/semantic-rule-verifier.js +2 -2
- package/dist/source-agent-qualifier.js +2 -2
- package/dist/standup/build.js +2 -2
- package/dist/storage/entity-canonical-id-migration-runner.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/summarizer.js +4 -4
- package/dist/support-passport/index.js +4 -4
- package/dist/transfer/export-okf.js +2 -2
- package/dist/verified-recall.js +2 -2
- package/dist/who-knows-cli.js +3 -3
- package/dist/who-knows.js +2 -2
- package/package.json +2 -2
- package/src/access-extraction-force-flush-preempt-coordinator.test.ts +71 -0
- package/src/access-extraction-force-flush.ts +20 -56
- package/src/access-observe-helpers.test.ts +71 -88
- package/src/access-observe-helpers.ts +60 -73
- package/src/access-observe-write-surface.ts +1 -22
- package/src/access-service-observe-lcm-parity.test.ts +176 -89
- package/src/access-service-observe-scope.test.ts +18 -86
- package/src/access-service.ts +0 -13
- package/src/buffer-admission-idempotency.test.ts +115 -0
- package/src/buffer-admission-idempotency.ts +67 -11
- package/src/buffer-persistence.ts +46 -5
- package/src/local-llm-headers-timeout.test.ts +246 -16
- package/src/local-llm-helpers.ts +14 -4
- package/src/local-llm-transport.ts +253 -16
- package/src/local-llm.ts +7 -8
- package/src/orchestration/extraction-queue-coordinator.ts +34 -3
- package/src/storage/entity-canonical-id-migration-runner.test.ts +90 -0
- package/src/storage/entity-canonical-id-migration-runner.ts +10 -0
- package/dist/chunk-5YQXWVCP.js +0 -74
- package/dist/chunk-5YQXWVCP.js.map +0 -1
- package/dist/chunk-CYTTY4M2.js.map +0 -1
- package/dist/chunk-KYZMCH4I.js.map +0 -1
- package/dist/chunk-L2DYRQQH.js.map +0 -1
- package/dist/chunk-O5ZCDK32.js.map +0 -1
- package/dist/chunk-TQXKUQFX.js.map +0 -1
- package/dist/chunk-TRFSTCQK.js.map +0 -1
- /package/dist/{chunk-2ZS7CB5H.js.map → chunk-2I3ETW3G.js.map} +0 -0
- /package/dist/{chunk-PSUSA5SM.js.map → chunk-2VNMSEZR.js.map} +0 -0
- /package/dist/{chunk-LANV6I63.js.map → chunk-56BNHKZM.js.map} +0 -0
- /package/dist/{chunk-3FEQNKMB.js.map → chunk-5WDUY2ZZ.js.map} +0 -0
- /package/dist/{chunk-BANMPRSC.js.map → chunk-65DWWJKI.js.map} +0 -0
- /package/dist/{chunk-VZBKCRU7.js.map → chunk-6MDHK6NO.js.map} +0 -0
- /package/dist/{chunk-2RAVHJCD.js.map → chunk-6OHCNTKU.js.map} +0 -0
- /package/dist/{chunk-P5FF44G3.js.map → chunk-7X6EZ2QB.js.map} +0 -0
- /package/dist/{chunk-K5RGHUX7.js.map → chunk-A32EBVCZ.js.map} +0 -0
- /package/dist/{chunk-KVM3BS5K.js.map → chunk-ATPY63F5.js.map} +0 -0
- /package/dist/{chunk-MOWLANEJ.js.map → chunk-C6Y2YHJL.js.map} +0 -0
- /package/dist/{chunk-AJVCM2E3.js.map → chunk-CYX7JI4O.js.map} +0 -0
- /package/dist/{chunk-76KL37ON.js.map → chunk-D3FP4JQI.js.map} +0 -0
- /package/dist/{chunk-YDGQYG4L.js.map → chunk-H442UKDV.js.map} +0 -0
- /package/dist/{chunk-FXDQO7VX.js.map → chunk-HL53XYHC.js.map} +0 -0
- /package/dist/{chunk-4VFEN3WT.js.map → chunk-IMSLPQJB.js.map} +0 -0
- /package/dist/{chunk-FKLSIQBF.js.map → chunk-K3JGILZC.js.map} +0 -0
- /package/dist/{chunk-JRHOL6B5.js.map → chunk-K6BS5RB4.js.map} +0 -0
- /package/dist/{chunk-HHCLV572.js.map → chunk-KVTUUU7H.js.map} +0 -0
- /package/dist/{chunk-2WITFW6F.js.map → chunk-NKHRIDYP.js.map} +0 -0
- /package/dist/{chunk-CTWWMEGR.js.map → chunk-PCGBESAN.js.map} +0 -0
- /package/dist/{chunk-MDXZIU5X.js.map → chunk-QGT5KNQT.js.map} +0 -0
- /package/dist/{chunk-YJZDRM33.js.map → chunk-QXHWOUS6.js.map} +0 -0
- /package/dist/{chunk-OVJAQWHO.js.map → chunk-RPOG6HLI.js.map} +0 -0
- /package/dist/{chunk-2QQCCUXF.js.map → chunk-RVODERA5.js.map} +0 -0
- /package/dist/{chunk-FQE5QN5Q.js.map → chunk-TAPF7T26.js.map} +0 -0
- /package/dist/{chunk-7UTCETGK.js.map → chunk-TQODBIMW.js.map} +0 -0
- /package/dist/{chunk-KZJEKKK6.js.map → chunk-VQQZJ6KJ.js.map} +0 -0
- /package/dist/{chunk-I233SAGS.js.map → chunk-X3ERYOLO.js.map} +0 -0
- /package/dist/{chunk-UCCXPMTP.js.map → chunk-XQF2KLV5.js.map} +0 -0
- /package/dist/{chunk-LPYGM6RE.js.map → chunk-XWPYK5T4.js.map} +0 -0
- /package/dist/{chunk-7EPEZYX3.js.map → chunk-YVXR7CPS.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CIAQK2OU.js";
|
|
4
4
|
import {
|
|
5
5
|
keyring_exports,
|
|
6
6
|
secureStoreDir
|
|
@@ -417,4 +417,4 @@ export {
|
|
|
417
417
|
resolveNamespaceStorageRoot,
|
|
418
418
|
NamespaceStorageRouter
|
|
419
419
|
};
|
|
420
|
-
//# sourceMappingURL=chunk-
|
|
420
|
+
//# sourceMappingURL=chunk-ATPY63F5.js.map
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log
|
|
3
|
+
} from "./chunk-3WCASNQZ.js";
|
|
4
|
+
|
|
5
|
+
// src/local-llm-transport.ts
|
|
6
|
+
import {
|
|
7
|
+
Agent,
|
|
8
|
+
EnvHttpProxyAgent,
|
|
9
|
+
MockAgent,
|
|
10
|
+
fetch as undiciFetch,
|
|
11
|
+
getGlobalDispatcher
|
|
12
|
+
} from "undici";
|
|
13
|
+
var EXTRACTION_MIN_TRANSPORT_BUDGET_MS = 9e5;
|
|
14
|
+
function routeBudgets(operation, ceilingMs, operatorMs) {
|
|
15
|
+
const routeFloorMs = operation === "extraction" ? EXTRACTION_MIN_TRANSPORT_BUDGET_MS : 0;
|
|
16
|
+
const operatorBudgetMs = operatorMs ?? ceilingMs;
|
|
17
|
+
const effectiveTimeoutMs = Math.min(ceilingMs, operatorBudgetMs);
|
|
18
|
+
const transportBudgetMs = routeFloorMs ? Math.max(ceilingMs, routeFloorMs) : ceilingMs;
|
|
19
|
+
return { effectiveTimeoutMs, transportBudgetMs };
|
|
20
|
+
}
|
|
21
|
+
var HTTP_PROXY_KEYS = ["http_proxy", "HTTP_PROXY"];
|
|
22
|
+
var HTTPS_PROXY_KEYS = ["https_proxy", "HTTPS_PROXY"];
|
|
23
|
+
var NO_PROXY_KEYS = ["no_proxy", "NO_PROXY"];
|
|
24
|
+
var PROXY_ENV_KEYS = [...HTTP_PROXY_KEYS, ...HTTPS_PROXY_KEYS];
|
|
25
|
+
function envValue(keys) {
|
|
26
|
+
for (const key of keys) {
|
|
27
|
+
const value = process.env[key]?.trim();
|
|
28
|
+
if (value) return value;
|
|
29
|
+
}
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
function resolveProxyEnv() {
|
|
33
|
+
return {
|
|
34
|
+
httpProxy: envValue(HTTP_PROXY_KEYS),
|
|
35
|
+
httpsProxy: envValue(HTTPS_PROXY_KEYS),
|
|
36
|
+
noProxy: envValue(NO_PROXY_KEYS)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function defaultPortFor(protocol) {
|
|
40
|
+
return protocol === "http:" ? 80 : protocol === "https:" ? 443 : 0;
|
|
41
|
+
}
|
|
42
|
+
function noProxyBypasses(url, noProxy) {
|
|
43
|
+
if (!noProxy) return false;
|
|
44
|
+
if (noProxy === "*") return true;
|
|
45
|
+
let hostname;
|
|
46
|
+
let port;
|
|
47
|
+
try {
|
|
48
|
+
const parsed = new URL(url);
|
|
49
|
+
hostname = parsed.host.replace(/:\d*$/, "").toLowerCase();
|
|
50
|
+
port = Number.parseInt(parsed.port, 10) || defaultPortFor(parsed.protocol);
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
for (const entry of noProxy.split(/[,\s]/)) {
|
|
55
|
+
if (!entry) continue;
|
|
56
|
+
const hostPort = entry.match(/^(.+):(\d+)$/);
|
|
57
|
+
const entryHost = (hostPort ? hostPort[1] : entry).toLowerCase();
|
|
58
|
+
const entryPort = hostPort ? Number.parseInt(hostPort[2], 10) : 0;
|
|
59
|
+
if (entryPort && entryPort !== port) continue;
|
|
60
|
+
if (!/^[.*]/.test(entryHost)) {
|
|
61
|
+
if (hostname === entryHost) return true;
|
|
62
|
+
} else if (hostname.endsWith(entryHost.replace(/^\*/, ""))) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
function isInvalidDispatcherArg(err) {
|
|
69
|
+
let current = err;
|
|
70
|
+
for (let depth = 0; current instanceof Error && depth < 5; depth += 1) {
|
|
71
|
+
const errno = current;
|
|
72
|
+
if (errno.code === "UND_ERR_INVALID_ARG") return true;
|
|
73
|
+
current = errno.cause;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
function isPlainPoolingAgent(dispatcher) {
|
|
78
|
+
if (dispatcher instanceof Agent) return true;
|
|
79
|
+
if (!dispatcher || typeof dispatcher !== "object") return false;
|
|
80
|
+
const ctor = dispatcher.constructor;
|
|
81
|
+
if (!ctor || typeof ctor !== "function") return false;
|
|
82
|
+
return ctor.name === "Agent";
|
|
83
|
+
}
|
|
84
|
+
var directProbeAgent = null;
|
|
85
|
+
function directProbeDispatcher() {
|
|
86
|
+
if (process.env.REMNIC_LOCAL_LLM_DIRECT !== "1") return void 0;
|
|
87
|
+
directProbeAgent ??= new Agent();
|
|
88
|
+
return directProbeAgent;
|
|
89
|
+
}
|
|
90
|
+
var ChatTransport = class {
|
|
91
|
+
agent = null;
|
|
92
|
+
agentBudgetMs = null;
|
|
93
|
+
warnedAboutCustomDispatcher = false;
|
|
94
|
+
/** Chained proxy pool: the proxyline stays in the path with widened budgets. */
|
|
95
|
+
proxyAgent = null;
|
|
96
|
+
proxyKey = null;
|
|
97
|
+
/**
|
|
98
|
+
* The widened pool, or `undefined` when the process installed its own
|
|
99
|
+
* transport that we must not displace.
|
|
100
|
+
*
|
|
101
|
+
* A deployment can route the local endpoint through a process-wide
|
|
102
|
+
* dispatcher — an agent runtime's managed proxy ("proxyline") or a custom
|
|
103
|
+
* connect/TLS/DNS transport.
|
|
104
|
+
*
|
|
105
|
+
* - When the standard egress-proxy environment variables name the proxy,
|
|
106
|
+
* the transport chains its own `ProxyAgent` over that URI with the
|
|
107
|
+
* widened budgets: the proxyline stays in the path and the budgets take
|
|
108
|
+
* effect. This is the issue-#2148 root cause fix — the managed proxyline
|
|
109
|
+
* dispatcher kept undici's 300s `headersTimeout`, so extraction
|
|
110
|
+
* completions slower than five minutes died.
|
|
111
|
+
* - A NO_PROXY/no_proxy exemption on the request host routes it direct,
|
|
112
|
+
* but a plain direct pool cannot reproduce a custom dispatcher's
|
|
113
|
+
* DNS/connect/TLS logic — the installed transport stays in place.
|
|
114
|
+
* - With no proxy environment to mirror, the installed dispatcher is left
|
|
115
|
+
* alone and the 300s cap stands — only its owner knows how to rebuild
|
|
116
|
+
* it. The trade-off is logged once.
|
|
117
|
+
* - `REMNIC_LOCAL_LLM_DIRECT=1` declares the local endpoint is reached
|
|
118
|
+
* directly even though a global dispatcher exists; the widened direct
|
|
119
|
+
* pool is used, bypassing the proxy.
|
|
120
|
+
*
|
|
121
|
+
* A `MockAgent` is excluded by the same check, so test transports keep
|
|
122
|
+
* working.
|
|
123
|
+
*/
|
|
124
|
+
dispatcherFor(budgetMs, url) {
|
|
125
|
+
const normalized = Number.isFinite(budgetMs) ? Math.max(0, budgetMs) : 0;
|
|
126
|
+
const installed = getGlobalDispatcher();
|
|
127
|
+
const custom = !isPlainPoolingAgent(installed);
|
|
128
|
+
const installedIsMock = custom && (installed instanceof MockAgent || installed.constructor.name === "MockAgent");
|
|
129
|
+
if (custom && process.env.REMNIC_LOCAL_LLM_DIRECT !== "1") {
|
|
130
|
+
const proxyEnv = installedIsMock ? void 0 : resolveProxyEnv();
|
|
131
|
+
const proxyUri = proxyEnv ? proxyEnv.httpsProxy ?? proxyEnv.httpProxy : void 0;
|
|
132
|
+
if (proxyUri) {
|
|
133
|
+
if (url && noProxyBypasses(url, proxyEnv?.noProxy)) {
|
|
134
|
+
if (!this.warnedAboutCustomDispatcher) {
|
|
135
|
+
this.warnedAboutCustomDispatcher = true;
|
|
136
|
+
log.debug(
|
|
137
|
+
"local LLM: NO_PROXY exempts the local endpoint from the proxy environment; leaving the installed custom dispatcher in place. localLlmTimeoutMs above that dispatcher's headersTimeout will not take effect."
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
const key = [
|
|
143
|
+
proxyUri,
|
|
144
|
+
...PROXY_ENV_KEYS.map((k) => process.env[k] ?? ""),
|
|
145
|
+
...NO_PROXY_KEYS.map((k) => process.env[k] ?? ""),
|
|
146
|
+
normalized
|
|
147
|
+
].join("|");
|
|
148
|
+
if (this.proxyAgent && this.proxyKey === key) return this.proxyAgent;
|
|
149
|
+
void this.proxyAgent?.close().catch(() => {
|
|
150
|
+
});
|
|
151
|
+
this.proxyAgent = new EnvHttpProxyAgent({
|
|
152
|
+
httpProxy: proxyEnv?.httpProxy,
|
|
153
|
+
httpsProxy: proxyEnv?.httpsProxy,
|
|
154
|
+
noProxy: proxyEnv?.noProxy,
|
|
155
|
+
headersTimeout: normalized,
|
|
156
|
+
bodyTimeout: normalized
|
|
157
|
+
});
|
|
158
|
+
this.proxyKey = key;
|
|
159
|
+
return this.proxyAgent;
|
|
160
|
+
}
|
|
161
|
+
if (!this.warnedAboutCustomDispatcher) {
|
|
162
|
+
this.warnedAboutCustomDispatcher = true;
|
|
163
|
+
log.debug(
|
|
164
|
+
"local LLM: a custom global dispatcher is installed and no proxy environment names it; leaving it in place. localLlmTimeoutMs above that dispatcher's headersTimeout will not take effect."
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
if (this.agent && this.agentBudgetMs === normalized) return this.agent;
|
|
170
|
+
void this.agent?.close().catch(() => {
|
|
171
|
+
});
|
|
172
|
+
this.agent = new Agent({
|
|
173
|
+
headersTimeout: normalized,
|
|
174
|
+
bodyTimeout: normalized
|
|
175
|
+
});
|
|
176
|
+
this.agentBudgetMs = normalized;
|
|
177
|
+
return this.agent;
|
|
178
|
+
}
|
|
179
|
+
async post(request) {
|
|
180
|
+
const init = {
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: request.headers,
|
|
183
|
+
body: request.body,
|
|
184
|
+
signal: request.signal
|
|
185
|
+
};
|
|
186
|
+
const dispatcher = this.dispatcherFor(request.budgetMs, request.url);
|
|
187
|
+
if (dispatcher) init.dispatcher = dispatcher;
|
|
188
|
+
try {
|
|
189
|
+
return await fetch(request.url, init);
|
|
190
|
+
} catch (err) {
|
|
191
|
+
if (!(err instanceof Error) || !isInvalidDispatcherArg(err)) throw err;
|
|
192
|
+
return await undiciFetch(request.url, init);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
EXTRACTION_MIN_TRANSPORT_BUDGET_MS,
|
|
199
|
+
routeBudgets,
|
|
200
|
+
resolveProxyEnv,
|
|
201
|
+
isInvalidDispatcherArg,
|
|
202
|
+
directProbeDispatcher,
|
|
203
|
+
ChatTransport
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=chunk-B256MMS7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/local-llm-transport.ts"],"sourcesContent":["import {\n Agent,\n EnvHttpProxyAgent,\n MockAgent,\n fetch as undiciFetch,\n getGlobalDispatcher,\n type Dispatcher,\n type Response as UndiciResponse,\n} from \"undici\";\n\nimport { log } from \"./logger.js\";\n\n/**\n * Transport floor for the extraction route (issue #2148 root cause):\n * extraction completions routinely run past undici's default 300s header\n * budget, and the generic `localLlmTimeoutMs` ceiling is sized for chat. The\n * extraction operation's dispatcher inactivity budgets are floored at this\n * value; the call's abort budget still follows the ceiling/operator bound and\n * the caller's own cancellation signal still ends the request early.\n */\nexport const EXTRACTION_MIN_TRANSPORT_BUDGET_MS = 900_000;\n\n/**\n * Route-sized budgets: the generic ceiling is `min(ceiling, operator)`,\n * except the extraction route, whose dispatcher inactivity budgets are\n * floored at EXTRACTION_MIN_TRANSPORT_BUDGET_MS (extraction completions\n * routinely outlast chat-sized budgets; issue #2148 root cause). The abort\n * budget (effectiveTimeoutMs) is not floored.\n */\nexport interface RouteBudgets {\n effectiveTimeoutMs: number;\n transportBudgetMs: number;\n}\n\nexport function routeBudgets(\n operation: string,\n ceilingMs: number,\n operatorMs?: number,\n): RouteBudgets {\n const routeFloorMs =\n operation === \"extraction\" ? EXTRACTION_MIN_TRANSPORT_BUDGET_MS : 0;\n const operatorBudgetMs = operatorMs ?? ceilingMs;\n // The operator's budget (the signal's ceiling) bounds the call; the floor\n // widens only the transport's inactivity budgets, so a proxyline host's\n // 300s dispatcher cap cannot dead-letter a longer configured budget.\n const effectiveTimeoutMs = Math.min(ceilingMs, operatorBudgetMs);\n const transportBudgetMs = routeFloorMs\n ? Math.max(ceilingMs, routeFloorMs)\n : ceilingMs;\n return { effectiveTimeoutMs, transportBudgetMs };\n}\n\n/** The standard egress-proxy environment variables, undici's lowercase-first\n * read order (the `lower ?? upper` read inside EnvHttpProxyAgent). */\nconst HTTP_PROXY_KEYS = [\"http_proxy\", \"HTTP_PROXY\"] as const;\nconst HTTPS_PROXY_KEYS = [\"https_proxy\", \"HTTPS_PROXY\"] as const;\nconst NO_PROXY_KEYS = [\"no_proxy\", \"NO_PROXY\"] as const;\nconst PROXY_ENV_KEYS = [...HTTP_PROXY_KEYS, ...HTTPS_PROXY_KEYS] as const;\n\nfunction envValue(keys: readonly string[]): string | undefined {\n // An empty variable must not hide a later one: HTTPS_PROXY=\"\" means \"unset\",\n // not \"the proxy is the empty string\".\n for (const key of keys) {\n const value = process.env[key]?.trim();\n if (value) return value;\n }\n return undefined;\n}\n\n/**\n * The egress-proxy environment after resolution: lowercase-first read order\n * with empty values treated as unset. The same resolved values are handed\n * to EnvHttpProxyAgent's overrides, so the gate and the pool can never\n * disagree about which proxy applies (undici's own read skips only unset\n * variables — an empty lowercase value would hide a set uppercase one).\n */\nexport interface ResolvedProxyEnv {\n httpProxy?: string;\n httpsProxy?: string;\n noProxy?: string;\n}\n\nexport function resolveProxyEnv(): ResolvedProxyEnv {\n return {\n httpProxy: envValue(HTTP_PROXY_KEYS),\n httpsProxy: envValue(HTTPS_PROXY_KEYS),\n noProxy: envValue(NO_PROXY_KEYS),\n };\n}\n\nfunction proxyUriFromEnv(): string | undefined {\n const { httpsProxy, httpProxy } = resolveProxyEnv();\n return httpsProxy ?? httpProxy;\n}\n\n/** undici's DEFAULT_PORTS for the schemes the local endpoint uses. */\nfunction defaultPortFor(protocol: string): number {\n return protocol === \"http:\" ? 80 : protocol === \"https:\" ? 443 : 0;\n}\n\n/**\n * EnvHttpProxyAgent's `#shouldProxy` semantics, mirrored: true when `url`'s\n * host and port are exempt from the proxy environment via NO_PROXY/no_proxy.\n */\nfunction noProxyBypasses(url: string, noProxy: string | undefined): boolean {\n if (!noProxy) return false;\n if (noProxy === \"*\") return true;\n let hostname: string;\n let port: number;\n try {\n const parsed = new URL(url);\n hostname = parsed.host.replace(/:\\d*$/, \"\").toLowerCase();\n port = Number.parseInt(parsed.port, 10) || defaultPortFor(parsed.protocol);\n } catch {\n return false;\n }\n for (const entry of noProxy.split(/[,\\s]/)) {\n if (!entry) continue;\n const hostPort = entry.match(/^(.+):(\\d+)$/);\n const entryHost = (hostPort ? hostPort[1] : entry).toLowerCase();\n const entryPort = hostPort ? Number.parseInt(hostPort[2], 10) : 0;\n if (entryPort && entryPort !== port) continue;\n if (!/^[.*]/.test(entryHost)) {\n if (hostname === entryHost) return true;\n } else if (hostname.endsWith(entryHost.replace(/^\\*/, \"\"))) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The per-request init shape the transport hands fetch: undici's RequestInit\n * (minus the body union this client never uses — chat bodies are strings)\n * plus the dispatcher the #2148 fix passes per request.\n */\nexport type TransportRequestInit = Omit<RequestInit, \"body\" | \"dispatcher\"> & {\n body?: string;\n dispatcher?: Dispatcher;\n};\n\n/**\n * True when `err` or its cause chain (node 26 wraps dispatch failures in\n * TypeError(\"fetch failed\")) carries undici's UND_ERR_INVALID_ARG — the\n * runtime's rejection of a per-request dispatcher.\n */\nexport function isInvalidDispatcherArg(err: Error): boolean {\n let current: unknown = err;\n for (let depth = 0; current instanceof Error && depth < 5; depth += 1) {\n // SAFETY: undici codes ride NodeJS.ErrnoException-style `code` and `cause` members.\n const errno = current as NodeJS.ErrnoException;\n if (errno.code === \"UND_ERR_INVALID_ARG\") return true;\n current = errno.cause;\n }\n return false;\n}\n\n/**\n * Either wire response: the runtime's (global fetch) or undici's (the\n * dispatcher-carrying fallback for runtimes that reject per-request\n * dispatchers). Every consumer only reads ok/status/headers/text/json.\n */\nexport type ChatWireResponse = Response | UndiciResponse;\n\n/**\n * Wire transport for local LLM chat completions.\n *\n * Split out of `local-llm.ts` so the client module keeps prompt and\n * response semantics while connection budgets live in one place.\n */\n\nexport interface ChatCompletionRequest {\n url: string;\n headers: Record<string, string>;\n body: string;\n signal: AbortSignal;\n /**\n * Ceiling for this endpoint, i.e. `localLlmTimeoutMs`. Sizes the\n * connection's inactivity budgets. Per-request budgets below the ceiling\n * stay enforced by `signal`.\n */\n budgetMs: number;\n}\n\n/**\n * Is this undici's stock pooling `Agent` — the transport we may widen?\n *\n * `instanceof` alone is not enough: Node's global fetch is backed by its\n * OWN bundled copy of undici, so the dispatcher parked on the well-known\n * global symbol is an `Agent` from a different copy than the one we import,\n * and cross-copy `instanceof` is false. Fall back to the constructor name,\n * which is stable across copies and still distinguishes `ProxyAgent` and\n * `MockAgent` from the stock pool.\n */\nfunction isPlainPoolingAgent(dispatcher: unknown): boolean {\n if (dispatcher instanceof Agent) return true;\n if (!dispatcher || typeof dispatcher !== \"object\") return false;\n const ctor = (dispatcher as { constructor?: unknown }).constructor;\n if (!ctor || typeof ctor !== \"function\") return false;\n return ctor.name === \"Agent\";\n}\n\n/**\n * REMNIC_LOCAL_LLM_DIRECT=1 declares that the local endpoint is reached\n * directly. Availability probes use this shared plain pool in that mode so they\n * take the same route as chat requests; `undefined` keeps the global dispatcher.\n */\nlet directProbeAgent: Agent | null = null;\nexport function directProbeDispatcher(): Agent | undefined {\n if (process.env.REMNIC_LOCAL_LLM_DIRECT !== \"1\") return undefined;\n directProbeAgent ??= new Agent();\n return directProbeAgent;\n}\n\n/**\n * Connection pool whose header/body inactivity budgets track the configured\n * request budget.\n *\n * Node's global fetch runs on undici, which applies a default\n * `headersTimeout` and `bodyTimeout` of 300s. A non-streaming completion\n * sends its response headers only once generation finishes, so any\n * completion slower than 300s died with a bare `fetch failed` no matter how\n * high `localLlmTimeoutMs` was set — the configured budget was dead letter\n * past five minutes (issue #2148).\n *\n * One pool per client is enough: it is keyed on the ceiling and rebuilt when\n * that changes.\n */\nexport class ChatTransport {\n private agent: Agent | null = null;\n private agentBudgetMs: number | null = null;\n private warnedAboutCustomDispatcher = false;\n /** Chained proxy pool: the proxyline stays in the path with widened budgets. */\n private proxyAgent: EnvHttpProxyAgent | null = null;\n private proxyKey: string | null = null;\n\n /**\n * The widened pool, or `undefined` when the process installed its own\n * transport that we must not displace.\n *\n * A deployment can route the local endpoint through a process-wide\n * dispatcher — an agent runtime's managed proxy (\"proxyline\") or a custom\n * connect/TLS/DNS transport.\n *\n * - When the standard egress-proxy environment variables name the proxy,\n * the transport chains its own `ProxyAgent` over that URI with the\n * widened budgets: the proxyline stays in the path and the budgets take\n * effect. This is the issue-#2148 root cause fix — the managed proxyline\n * dispatcher kept undici's 300s `headersTimeout`, so extraction\n * completions slower than five minutes died.\n * - A NO_PROXY/no_proxy exemption on the request host routes it direct,\n * but a plain direct pool cannot reproduce a custom dispatcher's\n * DNS/connect/TLS logic — the installed transport stays in place.\n * - With no proxy environment to mirror, the installed dispatcher is left\n * alone and the 300s cap stands — only its owner knows how to rebuild\n * it. The trade-off is logged once.\n * - `REMNIC_LOCAL_LLM_DIRECT=1` declares the local endpoint is reached\n * directly even though a global dispatcher exists; the widened direct\n * pool is used, bypassing the proxy.\n *\n * A `MockAgent` is excluded by the same check, so test transports keep\n * working.\n */\n dispatcherFor(budgetMs: number, url?: string): Agent | EnvHttpProxyAgent | undefined {\n const normalized = Number.isFinite(budgetMs) ? Math.max(0, budgetMs) : 0;\n const installed = getGlobalDispatcher();\n const custom = !isPlainPoolingAgent(installed);\n // A MockAgent is a test transport: it is left in place like any other\n // dispatcher the transport cannot mirror. The constructor-name check\n // covers a MockAgent from a different undici copy than the one we import\n // (same reason isPlainPoolingAgent checks ctor.name).\n const installedIsMock =\n custom && (installed instanceof MockAgent || installed.constructor.name === \"MockAgent\");\n if (custom && process.env.REMNIC_LOCAL_LLM_DIRECT !== \"1\") {\n const proxyEnv = installedIsMock ? undefined : resolveProxyEnv();\n const proxyUri = proxyEnv ? proxyEnv.httpsProxy ?? proxyEnv.httpProxy : undefined;\n if (proxyUri) {\n if (url && noProxyBypasses(url, proxyEnv?.noProxy)) {\n // The environment routes this host direct — but a fresh direct pool\n // cannot reproduce the installed transport's custom DNS/connect\n // logic, so it stays. The 300s trade-off is logged once.\n if (!this.warnedAboutCustomDispatcher) {\n this.warnedAboutCustomDispatcher = true;\n log.debug(\n \"local LLM: NO_PROXY exempts the local endpoint from the proxy environment; \" +\n \"leaving the installed custom dispatcher in place. \" +\n \"localLlmTimeoutMs above that dispatcher's headersTimeout will not take effect.\",\n );\n }\n return undefined;\n }\n // The chained agent's behavior tracks the whole proxy environment, so\n // the cache key must too: a changed HTTP_PROXY or NO_PROXY with a\n // steady HTTPS_PROXY must not hand back the stale pool.\n const key = [\n proxyUri,\n ...PROXY_ENV_KEYS.map((k) => process.env[k] ?? \"\"),\n ...NO_PROXY_KEYS.map((k) => process.env[k] ?? \"\"),\n normalized,\n ].join(\"|\");\n if (this.proxyAgent && this.proxyKey === key) return this.proxyAgent;\n void this.proxyAgent?.close().catch(() => {\n /* pool teardown is best-effort */\n });\n // EnvHttpProxyAgent keeps NO_PROXY and per-protocol proxy selection;\n // the resolved values are passed as overrides so its raw env read can\n // never disagree with the gate's resolution (empty-lowercase skew).\n this.proxyAgent = new EnvHttpProxyAgent({\n httpProxy: proxyEnv?.httpProxy,\n httpsProxy: proxyEnv?.httpsProxy,\n noProxy: proxyEnv?.noProxy,\n headersTimeout: normalized,\n bodyTimeout: normalized,\n });\n this.proxyKey = key;\n return this.proxyAgent;\n }\n if (!this.warnedAboutCustomDispatcher) {\n this.warnedAboutCustomDispatcher = true;\n log.debug(\n \"local LLM: a custom global dispatcher is installed and no proxy environment names it; leaving it in place. \" +\n \"localLlmTimeoutMs above that dispatcher's headersTimeout will not take effect.\",\n );\n }\n return undefined;\n }\n if (this.agent && this.agentBudgetMs === normalized) return this.agent;\n void this.agent?.close().catch(() => {\n /* pool teardown is best-effort */\n });\n this.agent = new Agent({\n headersTimeout: normalized,\n bodyTimeout: normalized,\n });\n this.agentBudgetMs = normalized;\n return this.agent;\n }\n\n async post(request: ChatCompletionRequest): Promise<Response | UndiciResponse> {\n const init: TransportRequestInit = {\n method: \"POST\",\n headers: request.headers,\n body: request.body,\n signal: request.signal,\n };\n const dispatcher = this.dispatcherFor(request.budgetMs, request.url);\n if (dispatcher) init.dispatcher = dispatcher;\n try {\n return await fetch(request.url, init);\n } catch (err) {\n // node >= 26 wraps dispatch failures in TypeError(\"fetch failed\"),\n // so UND_ERR_INVALID_ARG can ride `err` or its cause chain; the\n // bundled undici's fetch accepts the same init on every supported\n // Node, so the widened budget still rides.\n if (!(err instanceof Error) || !isInvalidDispatcherArg(err)) throw err;\n return await undiciFetch(request.url, init);\n }\n }\n}\n"],"mappings":";;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OAGK;AAYA,IAAM,qCAAqC;AAc3C,SAAS,aACd,WACA,WACA,YACc;AACd,QAAM,eACJ,cAAc,eAAe,qCAAqC;AACpE,QAAM,mBAAmB,cAAc;AAIvC,QAAM,qBAAqB,KAAK,IAAI,WAAW,gBAAgB;AAC/D,QAAM,oBAAoB,eACtB,KAAK,IAAI,WAAW,YAAY,IAChC;AACJ,SAAO,EAAE,oBAAoB,kBAAkB;AACjD;AAIA,IAAM,kBAAkB,CAAC,cAAc,YAAY;AACnD,IAAM,mBAAmB,CAAC,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AQ;AAAA,MACjB,MAAM,QAAQ;AAAA,MACd,QAAQ,QAAQ;AAAA,IAClB;AACA,UAAM,aAAa,KAAK,cAAc,QAAQ,UAAU,QAAQ,GAAG;AACnE,QAAI,WAAY,MAAK,aAAa;AAClC,QAAI;AACF,aAAO,MAAM,MAAM,QAAQ,KAAK,IAAI;AAAA,IACtC,SAAS,KAAK;AAKZ,UAAI,EAAE,eAAe,UAAU,CAAC,uBAAuB,GAAG,EAAG,OAAM;AACnE,aAAO,MAAM,YAAY,QAAQ,KAAK,IAAI;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CIAQK2OU.js";
|
|
4
4
|
import {
|
|
5
5
|
composeMemoryEnvelope
|
|
6
6
|
} from "./chunk-X26YOFGS.js";
|
|
@@ -546,4 +546,4 @@ export {
|
|
|
546
546
|
setSemanticRulePromotionTestHooks,
|
|
547
547
|
promoteSemanticRuleFromMemory
|
|
548
548
|
};
|
|
549
|
-
//# sourceMappingURL=chunk-
|
|
549
|
+
//# sourceMappingURL=chunk-C6Y2YHJL.js.map
|
|
@@ -4220,6 +4220,11 @@ var EntityCanonicalIdMigrationRunner = class {
|
|
|
4220
4220
|
async runOrReuse() {
|
|
4221
4221
|
let fingerprintAtStart = await this.readFingerprint();
|
|
4222
4222
|
if (this.migrationComplete && fingerprintAtStart === this.completedFingerprint) return;
|
|
4223
|
+
if (this.migrationComplete) {
|
|
4224
|
+
const stabilityRead = await this.readFingerprint();
|
|
4225
|
+
if (stabilityRead !== fingerprintAtStart) return;
|
|
4226
|
+
fingerprintAtStart = stabilityRead;
|
|
4227
|
+
}
|
|
4223
4228
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
4224
4229
|
const completionFingerprint = await this.runMigration();
|
|
4225
4230
|
const fingerprintAfterMigration = await this.readFingerprint();
|
|
@@ -13356,4 +13361,4 @@ export {
|
|
|
13356
13361
|
isValidBufferSurpriseEvent,
|
|
13357
13362
|
StorageManager3 as StorageManager
|
|
13358
13363
|
};
|
|
13359
|
-
//# sourceMappingURL=chunk-
|
|
13364
|
+
//# sourceMappingURL=chunk-CIAQK2OU.js.map
|