mslxdff 0.1.159 → 0.1.160
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/bin/mslxdff.js +4 -4
- package/package.json +1 -1
- package/src/auto.js +254 -254
- package/src/bench/cline-bench.js +42 -42
- package/src/bench/probe.js +70 -70
- package/src/bench/report.js +162 -162
- package/src/bench/runner.js +77 -77
- package/src/bench/via-probe.js +124 -124
- package/src/bench/via-routes.js +87 -87
- package/src/bench/workbuddy-bench.js +54 -54
- package/src/chat/engine.js +160 -160
- package/src/chat/gateway.js +163 -163
- package/src/chat/orchestrator.js +234 -234
- package/src/chat/prompt.js +70 -70
- package/src/chat/repl.js +88 -88
- package/src/chat/terminal.js +135 -135
- package/src/chat/tools.js +306 -306
- package/src/chat-pipeline/auto-race.js +1 -1
- package/src/chat-pipeline/index.js +123 -123
- package/src/chat-pipeline/policy.js +76 -76
- package/src/chat-pipeline/serial-trial.js +210 -210
- package/src/cli/commands/group.js +249 -249
- package/src/cli/commands/model/picks.js +50 -50
- package/src/cli/commands/provider/bench-via.js +247 -247
- package/src/cli/commands/provider/bench.js +141 -141
- package/src/cli/commands/provider/index.js +124 -124
- package/src/cli/commands/provider/models.js +139 -139
- package/src/cli/commands/provider/qwenwork-login.js +119 -119
- package/src/cli/commands/stats.js +20 -5
- package/src/cli/commands/sync.js +232 -232
- package/src/cli/provider-row.js +2 -2
- package/src/cli/status.js +279 -279
- package/src/daemon.js +96 -96
- package/src/model-capabilities/enrich.js +86 -86
- package/src/model-capabilities/index.js +183 -183
- package/src/model-capabilities/parse.js +70 -70
- package/src/models.js +225 -225
- package/src/providers/cline/auth.js +228 -228
- package/src/providers/cline/chat.js +307 -307
- package/src/providers/cline.js +2 -2
- package/src/providers/keyring.js +60 -60
- package/src/providers/qoder/chat.js +183 -183
- package/src/providers/qoder/index.js +230 -230
- package/src/providers/qoder/sse.js +103 -103
- package/src/providers/qwenwork/account-store.js +133 -133
- package/src/providers/qwenwork/constants.js +67 -67
- package/src/providers/qwenwork/cosy.js +120 -120
- package/src/providers/qwenwork/crypto.js +218 -218
- package/src/providers/qwenwork/http.js +20 -20
- package/src/providers/qwenwork/index.js +327 -327
- package/src/providers/qwenwork/payload.js +142 -142
- package/src/providers/qwenwork/rsa.js +54 -54
- package/src/providers/qwenwork/sse.js +268 -268
- package/src/providers/qwenwork/stream.js +130 -130
- package/src/providers/qwenwork/upstream.js +120 -120
- package/src/providers/qwenwork.js +1 -1
- package/src/providers/registry.js +66 -66
- package/src/providers/workbuddy/chat.js +248 -248
- package/src/providers/workbuddy/reshape.js +152 -152
- package/src/providers/workbuddy.js +2 -2
- package/src/providers/zcode/chat.js +11 -10
- package/src/providers/zcode/const.js +1 -1
- package/src/providers/zcode/context-shape.js +162 -0
- package/src/providers/zcode/headers.js +38 -0
- package/src/reasoning.js +32 -32
- package/src/routes/chat/broadband-handler.js +3 -2
- package/src/routes/chat/gateway.js +46 -46
- package/src/routes/chat/hedge-handler.js +3 -0
- package/src/routes/chat/local-handler.js +2 -0
- package/src/routes/chat/peer-handler.js +2 -0
- package/src/routes/chat/relay-pipeline.js +264 -250
- package/src/routes/chat/via-route-handler.js +146 -144
- package/src/routes/hedge.js +255 -255
- package/src/routes/models-route.js +167 -167
- package/src/routes/peers.js +273 -273
- package/src/routes/stream-scan.js +86 -0
- package/src/routes/stream.js +393 -438
- package/src/runtime/bootstrap.js +45 -45
- package/src/runtime/provider-gate.js +33 -33
- package/src/runtime/providers-setup.js +165 -165
- package/src/server.js +64 -64
- package/src/state/schemas/allowlist.js +92 -92
- package/src/sync-opencode.js +280 -280
- package/src/transport/index.js +244 -244
- package/src/transport/pool.js +56 -56
- package/src/transport/retry.js +24 -24
- package/src/transport/sse.js +93 -93
- package/src/upstream-probe/display.js +52 -52
- package/src/upstream-probe/probe.js +49 -49
- package/src/upstream-probe/rotate.js +110 -110
- package/src/upstream-probe/start.js +45 -45
- package/src/upstream.js +289 -289
- package/src/usage/record.js +8 -1
- package/src/usage/report.js +39 -2
- package/docs/cli_help_mini.md +0 -133
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
// ADR-0015 daemon 装配:60s 节拍轮转探针;0=完全关闭
|
|
2
|
-
import { probeTargetsFromState, rotateTick, nextCursor } from "./rotate.js";
|
|
3
|
-
import { loadProviderConfigs, loadProviderKeys, loadProviderBaseUrl } from "../state.js";
|
|
4
|
-
import { loadPeers } from "../state.js";
|
|
5
|
-
|
|
6
|
-
export function upstreamProbeIntervalMs() {
|
|
7
|
-
const n = Number(process.env.MSLXDFF_UPSTREAM_PROBE_MS);
|
|
8
|
-
return Number.isInteger(n) && n >= 0 ? n : 60_000;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function startUpstreamProbe({ evt = () => {}, peers, file, delayMs } = {}) {
|
|
12
|
-
const interval = upstreamProbeIntervalMs();
|
|
13
|
-
if (interval === 0) return null;
|
|
14
|
-
let cursor = 0;
|
|
15
|
-
let busy = false;
|
|
16
|
-
const loadTargets = () => {
|
|
17
|
-
try {
|
|
18
|
-
return probeTargetsFromState({
|
|
19
|
-
loadProviderConfigs: () => loadProviderConfigs({}),
|
|
20
|
-
loadProviderKeys: (id) => loadProviderKeys(id, {}),
|
|
21
|
-
loadProviderBaseUrl: (id) => loadProviderBaseUrl(id, {}),
|
|
22
|
-
});
|
|
23
|
-
} catch {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const tick = async () => {
|
|
28
|
-
if (busy) return;
|
|
29
|
-
busy = true;
|
|
30
|
-
try {
|
|
31
|
-
const targets = loadTargets();
|
|
32
|
-
if (!targets.length) return;
|
|
33
|
-
const out = await rotateTick({ targets, cursor, peers, evt, file, delayMs });
|
|
34
|
-
if (out.probed != null) cursor = nextCursor(cursor, targets.length);
|
|
35
|
-
} catch {
|
|
36
|
-
// 探针永不影响主链路
|
|
37
|
-
} finally {
|
|
38
|
-
busy = false;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
void tick();
|
|
42
|
-
const timer = setInterval(tick, interval);
|
|
43
|
-
timer.unref?.();
|
|
44
|
-
return { stop: () => clearInterval(timer), interval, tick };
|
|
45
|
-
}
|
|
1
|
+
// ADR-0015 daemon 装配:60s 节拍轮转探针;0=完全关闭
|
|
2
|
+
import { probeTargetsFromState, rotateTick, nextCursor } from "./rotate.js";
|
|
3
|
+
import { loadProviderConfigs, loadProviderKeys, loadProviderBaseUrl } from "../state.js";
|
|
4
|
+
import { loadPeers } from "../state.js";
|
|
5
|
+
|
|
6
|
+
export function upstreamProbeIntervalMs() {
|
|
7
|
+
const n = Number(process.env.MSLXDFF_UPSTREAM_PROBE_MS);
|
|
8
|
+
return Number.isInteger(n) && n >= 0 ? n : 60_000;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function startUpstreamProbe({ evt = () => {}, peers, file, delayMs } = {}) {
|
|
12
|
+
const interval = upstreamProbeIntervalMs();
|
|
13
|
+
if (interval === 0) return null;
|
|
14
|
+
let cursor = 0;
|
|
15
|
+
let busy = false;
|
|
16
|
+
const loadTargets = () => {
|
|
17
|
+
try {
|
|
18
|
+
return probeTargetsFromState({
|
|
19
|
+
loadProviderConfigs: () => loadProviderConfigs({}),
|
|
20
|
+
loadProviderKeys: (id) => loadProviderKeys(id, {}),
|
|
21
|
+
loadProviderBaseUrl: (id) => loadProviderBaseUrl(id, {}),
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const tick = async () => {
|
|
28
|
+
if (busy) return;
|
|
29
|
+
busy = true;
|
|
30
|
+
try {
|
|
31
|
+
const targets = loadTargets();
|
|
32
|
+
if (!targets.length) return;
|
|
33
|
+
const out = await rotateTick({ targets, cursor, peers, evt, file, delayMs });
|
|
34
|
+
if (out.probed != null) cursor = nextCursor(cursor, targets.length);
|
|
35
|
+
} catch {
|
|
36
|
+
// 探针永不影响主链路
|
|
37
|
+
} finally {
|
|
38
|
+
busy = false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
void tick();
|
|
42
|
+
const timer = setInterval(tick, interval);
|
|
43
|
+
timer.unref?.();
|
|
44
|
+
return { stop: () => clearInterval(timer), interval, tick };
|
|
45
|
+
}
|