omnicell-router 0.7.0 → 0.8.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/backend/dist/cli/clients/activity.d.ts +35 -0
- package/backend/dist/cli/clients/activity.js +67 -0
- package/backend/dist/cli/clients/base.d.ts +13 -2
- package/backend/dist/cli/clients/claude.d.ts +2 -2
- package/backend/dist/cli/clients/codex.d.ts +2 -2
- package/backend/dist/cli/clients/core-adapters.d.ts +3 -4
- package/backend/dist/cli/clients/core-adapters.js +3 -4
- package/backend/dist/cli/clients/cursor-proxy.d.ts +88 -0
- package/backend/dist/cli/clients/cursor-proxy.js +421 -0
- package/backend/dist/cli/clients/dsh.d.ts +2 -2
- package/backend/dist/cli/clients/grok.d.ts +2 -2
- package/backend/dist/cli/clients/index.d.ts +8 -1
- package/backend/dist/cli/clients/index.js +55 -21
- package/backend/dist/cli/clients/kimi.d.ts +2 -2
- package/backend/dist/cli/clients/launcher.d.ts +8 -0
- package/backend/dist/cli/clients/model-meta.js +1 -1
- package/backend/dist/cli/clients/omp.d.ts +2 -2
- package/backend/dist/cli/clients/openclaw.d.ts +2 -2
- package/backend/dist/cli/clients/opencode-proxy.d.ts +11 -0
- package/backend/dist/cli/clients/opencode-proxy.js +351 -0
- package/backend/dist/cli/clients/opencode.d.ts +2 -2
- package/backend/dist/cli/clients/pi.d.ts +2 -2
- package/backend/dist/cli/clients/plugin-adapters.d.ts +3 -1
- package/backend/dist/cli/clients/plugin-adapters.js +6 -29
- package/backend/dist/cli/clients/qoder-proxy.d.ts +84 -0
- package/backend/dist/cli/clients/qoder-proxy.js +497 -0
- package/backend/dist/cli/clients/reserved.d.ts +2 -6
- package/backend/dist/cli/clients/reserved.js +2 -0
- package/backend/dist/cli/clients/workbuddy.d.ts +2 -2
- package/backend/dist/cli/index.js +60 -9
- package/backend/dist/cli/types.d.ts +29 -8
- package/backend/dist/compression/caveman-prompts.d.ts +1 -1
- package/backend/dist/config/comments-en.js +6 -12
- package/backend/dist/config/comments-zh.js +6 -12
- package/backend/dist/config/defaults.d.ts +56 -1
- package/backend/dist/config/defaults.js +68 -0
- package/backend/dist/config/index.d.ts +9 -2
- package/backend/dist/config/index.js +26 -3
- package/backend/dist/config/types.d.ts +55 -43
- package/backend/dist/forward-proxy/egress.d.ts +10 -2
- package/backend/dist/forward-proxy/egress.js +42 -4
- package/backend/dist/forward-proxy/ordered-relay.d.ts +29 -0
- package/backend/dist/forward-proxy/ordered-relay.js +46 -0
- package/backend/dist/forward-proxy/rules.d.ts +66 -19
- package/backend/dist/forward-proxy/rules.js +61 -14
- package/backend/dist/forward-proxy/server.js +226 -77
- package/backend/dist/forward-proxy/system-proxy.d.ts +42 -2
- package/backend/dist/forward-proxy/system-proxy.js +199 -22
- package/backend/dist/harness/common/market.d.ts +3 -3
- package/backend/dist/harness/host/adapters/amp.d.ts +1 -1
- package/backend/dist/harness/host/adapters/antigravity.d.ts +1 -1
- package/backend/dist/harness/host/adapters/claude.d.ts +1 -1
- package/backend/dist/harness/host/adapters/cline.d.ts +1 -1
- package/backend/dist/harness/host/adapters/codex.d.ts +1 -1
- package/backend/dist/harness/host/adapters/cursor.d.ts +1 -1
- package/backend/dist/harness/host/adapters/dsh.d.ts +2 -2
- package/backend/dist/harness/host/adapters/factory.d.ts +1 -1
- package/backend/dist/harness/host/adapters/gemini-cli.d.ts +1 -1
- package/backend/dist/harness/host/adapters/grok.d.ts +1 -1
- package/backend/dist/harness/host/adapters/kimi.d.ts +1 -1
- package/backend/dist/harness/host/adapters/omp.d.ts +1 -1
- package/backend/dist/harness/host/adapters/openclaw.d.ts +1 -1
- package/backend/dist/harness/host/adapters/opencode.d.ts +1 -1
- package/backend/dist/harness/host/adapters/pi.d.ts +1 -1
- package/backend/dist/harness/host/adapters/universal.d.ts +1 -1
- package/backend/dist/harness/host/adapters/windsurf.d.ts +1 -1
- package/backend/dist/harness/host/adapters/zed.d.ts +1 -1
- package/backend/dist/harness/skill/skills-sh.d.ts +1 -1
- package/backend/dist/harness/translation.js +64 -21
- package/backend/dist/harness/types.d.ts +1 -1
- package/backend/dist/harness/types.js +1 -1
- package/backend/dist/index.js +31 -18
- package/backend/dist/ir/adapters/anthropic-stream.d.ts +18 -0
- package/backend/dist/ir/adapters/anthropic-stream.js +247 -0
- package/backend/dist/ir/adapters/anthropic.d.ts +29 -0
- package/backend/dist/ir/adapters/anthropic.js +788 -0
- package/backend/dist/ir/adapters/chat.d.ts +15 -0
- package/backend/dist/ir/adapters/chat.js +602 -0
- package/backend/dist/ir/adapters/google-stream.d.ts +22 -0
- package/backend/dist/ir/adapters/google-stream.js +242 -0
- package/backend/dist/ir/adapters/google.d.ts +9 -0
- package/backend/dist/ir/adapters/google.js +317 -0
- package/backend/dist/ir/adapters/openai-responses-output.js +8 -5
- package/backend/dist/ir/adapters/openai-responses.d.ts +15 -0
- package/backend/dist/ir/adapters/openai-responses.js +26 -1
- package/backend/dist/ir/adapters/responses-output.d.ts +50 -0
- package/backend/dist/ir/adapters/responses-output.js +348 -0
- package/backend/dist/ir/adapters/responses-stream.d.ts +12 -0
- package/backend/dist/ir/adapters/responses-stream.js +178 -0
- package/backend/dist/ir/adapters/responses.d.ts +14 -0
- package/backend/dist/ir/adapters/responses.js +646 -0
- package/backend/dist/ir/errors.d.ts +2 -2
- package/backend/dist/ir/types.d.ts +2 -1
- package/backend/dist/metrics/request-cost.d.ts +11 -2
- package/backend/dist/metrics/request-cost.js +12 -3
- package/backend/dist/observability/request-identity.d.ts +1 -1
- package/backend/dist/observability/trace-id.d.ts +40 -0
- package/backend/dist/observability/trace-id.js +134 -0
- package/backend/dist/observability/upstream-events.d.ts +82 -60
- package/backend/dist/observability/upstream-events.js +142 -67
- package/backend/dist/opencode/catalog/types.d.ts +9 -0
- package/backend/dist/opencode/credentials/types.d.ts +2 -2
- package/backend/dist/opencode/probe.d.ts +24 -1
- package/backend/dist/opencode/probe.js +28 -4
- package/backend/dist/opencode/user-config.d.ts +5 -0
- package/backend/dist/pipeline/directives.d.ts +6 -2
- package/backend/dist/pipeline/directives.js +7 -3
- package/backend/dist/pipeline/orchestrator.d.ts +28 -27
- package/backend/dist/pipeline/orchestrator.js +220 -194
- package/backend/dist/pipeline/unresolved-model.d.ts +33 -0
- package/backend/dist/pipeline/unresolved-model.js +43 -0
- package/backend/dist/plugins/catalog-def.d.ts +143 -0
- package/backend/dist/plugins/catalog-def.js +177 -0
- package/backend/dist/plugins/gateways.d.ts +62 -3
- package/backend/dist/plugins/gateways.js +139 -2
- package/backend/dist/plugins/host.d.ts +42 -5
- package/backend/dist/plugins/host.js +454 -38
- package/backend/dist/plugins/manifest.d.ts +119 -10
- package/backend/dist/plugins/manifest.js +265 -14
- package/backend/dist/plugins/pack.js +26 -0
- package/backend/dist/plugins/types.d.ts +187 -21
- package/backend/dist/protocols/systemone/convert.d.ts +1 -0
- package/backend/dist/protocols/systemone/convert.js +6 -1
- package/backend/dist/protocols/systemone/decide.js +18 -8
- package/backend/dist/providers/anthropic-messages.d.ts +12 -0
- package/backend/dist/providers/anthropic-messages.js +53 -0
- package/backend/dist/providers/anthropic.d.ts +7 -8
- package/backend/dist/providers/anthropic.js +36 -324
- package/backend/dist/providers/base.d.ts +14 -2
- package/backend/dist/providers/boot-direct.js +68 -38
- package/backend/dist/providers/dispatch.d.ts +5 -19
- package/backend/dist/providers/dispatch.js +46 -58
- package/backend/dist/providers/executors/anthropic-messages.d.ts +1 -0
- package/backend/dist/providers/executors/anthropic-messages.js +3 -0
- package/backend/dist/providers/executors/dispatch.d.ts +16 -2
- package/backend/dist/providers/executors/dispatch.js +39 -9
- package/backend/dist/providers/executors/google-gemini.d.ts +1 -0
- package/backend/dist/providers/executors/google-gemini.js +3 -0
- package/backend/dist/providers/executors/http-stream.js +16 -3
- package/backend/dist/providers/executors/openai-chat.d.ts +1 -0
- package/backend/dist/providers/executors/openai-chat.js +3 -0
- package/backend/dist/providers/executors/openai-responses.d.ts +1 -0
- package/backend/dist/providers/executors/openai-responses.js +3 -0
- package/backend/dist/providers/executors/plugin-adapter.js +4 -4
- package/backend/dist/providers/google-gemini.d.ts +12 -0
- package/backend/dist/providers/google-gemini.js +50 -0
- package/backend/dist/providers/google.d.ts +7 -8
- package/backend/dist/providers/google.js +35 -308
- package/backend/dist/providers/http-json.d.ts +19 -0
- package/backend/dist/providers/http-json.js +104 -0
- package/backend/dist/providers/http-stream.d.ts +52 -0
- package/backend/dist/providers/http-stream.js +423 -0
- package/backend/dist/providers/member-match.d.ts +4 -5
- package/backend/dist/providers/member-match.js +4 -5
- package/backend/dist/providers/openai-chat.d.ts +13 -0
- package/backend/dist/providers/openai-chat.js +99 -0
- package/backend/dist/providers/openai-compatible.d.ts +7 -4
- package/backend/dist/providers/openai-compatible.js +71 -368
- package/backend/dist/providers/openai-responses.d.ts +12 -0
- package/backend/dist/providers/openai-responses.js +68 -0
- package/backend/dist/providers/opencode-proxy.d.ts +5 -5
- package/backend/dist/providers/opencode-proxy.js +49 -125
- package/backend/dist/providers/plugin-adapter.d.ts +9 -0
- package/backend/dist/providers/plugin-adapter.js +31 -0
- package/backend/dist/providers/registry.d.ts +49 -24
- package/backend/dist/providers/registry.js +97 -55
- package/backend/dist/providers/responses.d.ts +7 -28
- package/backend/dist/providers/responses.js +45 -253
- package/backend/dist/providers/tool-markup-leak.d.ts +41 -0
- package/backend/dist/providers/tool-markup-leak.js +57 -0
- package/backend/dist/providers/tool-markup-recovery.d.ts +27 -0
- package/backend/dist/providers/tool-markup-recovery.js +786 -0
- package/backend/dist/providers/virtual-meta.d.ts +21 -2
- package/backend/dist/providers/virtual-meta.js +49 -9
- package/backend/dist/proxy/asset-download.d.ts +54 -0
- package/backend/dist/proxy/asset-download.js +420 -0
- package/backend/dist/proxy/manual-node-spec.d.ts +16 -16
- package/backend/dist/proxy/mihomo-binary.d.ts +17 -2
- package/backend/dist/proxy/mihomo-binary.js +62 -51
- package/backend/dist/proxy/mihomo-client.js +15 -1
- package/backend/dist/proxy/mihomo-config.js +11 -2
- package/backend/dist/proxy/mihomo-geo.d.ts +87 -0
- package/backend/dist/proxy/mihomo-geo.js +213 -0
- package/backend/dist/proxy/mihomo-logs.d.ts +27 -0
- package/backend/dist/proxy/mihomo-logs.js +70 -0
- package/backend/dist/proxy/mihomo-pac.d.ts +11 -0
- package/backend/dist/proxy/mihomo-pac.js +15 -0
- package/backend/dist/proxy/mihomo-rules-import.d.ts +1 -1
- package/backend/dist/proxy/mihomo-rules-import.js +7 -7
- package/backend/dist/proxy/mihomo-sidecar.d.ts +17 -1
- package/backend/dist/proxy/mihomo-sidecar.js +148 -26
- package/backend/dist/quota/adapters/minimax.js +36 -13
- package/backend/dist/quota/cli-login.d.ts +8 -0
- package/backend/dist/quota/cli-login.js +18 -0
- package/backend/dist/quota/declarations.js +10 -0
- package/backend/dist/quota/dsl.js +18 -5
- package/backend/dist/quota/engine.d.ts +22 -1
- package/backend/dist/quota/engine.js +170 -29
- package/backend/dist/quota/prober.d.ts +5 -0
- package/backend/dist/quota/prober.js +11 -2
- package/backend/dist/quota/types.d.ts +87 -8
- package/backend/dist/quota/verdict.d.ts +35 -0
- package/backend/dist/quota/verdict.js +135 -0
- package/backend/dist/ratelimit/admission.d.ts +131 -0
- package/backend/dist/ratelimit/admission.js +233 -0
- package/backend/dist/ratelimit/rate-limiter.js +6 -0
- package/backend/dist/resilience/types.d.ts +2 -2
- package/backend/dist/router/layer2-decision.d.ts +1 -1
- package/backend/dist/router/layer2-decision.js +5 -8
- package/backend/dist/routes/console.js +248 -52
- package/backend/dist/routes/mihomo.d.ts +2 -0
- package/backend/dist/routes/mihomo.js +334 -29
- package/backend/dist/routes/responses.d.ts +87 -8
- package/backend/dist/routes/responses.js +314 -33
- package/backend/dist/server.js +34 -6
- package/backend/dist/session/session-manager.d.ts +6 -0
- package/backend/dist/session/session-manager.js +20 -9
- package/backend/dist/surfaces/chat-pipeline.d.ts +2 -2
- package/backend/dist/surfaces/chat-pipeline.js +17 -7
- package/backend/dist/surfaces/chat.js +15 -0
- package/backend/dist/surfaces/decision-pipeline.js +7 -10
- package/backend/dist/surfaces/direct-forward.d.ts +3 -0
- package/backend/dist/surfaces/direct-forward.js +206 -0
- package/backend/dist/surfaces/rate-limit-response.d.ts +17 -0
- package/backend/dist/surfaces/rate-limit-response.js +57 -0
- package/backend/dist/surfaces/types.d.ts +11 -0
- package/backend/dist/trace/tracker.d.ts +32 -1
- package/backend/dist/trace/tracker.js +29 -4
- package/backend/dist/types/router.d.ts +34 -12
- package/backend/dist/types/router.js +35 -6
- package/backend/dist/utils/chat-stream.d.ts +21 -8
- package/backend/dist/utils/chat-stream.js +46 -9
- package/backend/dist/utils/event-ring.d.ts +4 -0
- package/backend/dist/utils/event-ring.js +4 -0
- package/backend/dist/utils/popularity.js +29 -4
- package/backend/dist/utils/proxy.d.ts +7 -0
- package/backend/dist/utils/proxy.js +35 -10
- package/backend/dist/utils/retry-after.d.ts +21 -0
- package/backend/dist/utils/retry-after.js +36 -0
- package/bin/ocr.js +2 -2
- package/frontend/dist/assets/index-55VVwfFQ.js +1521 -0
- package/frontend/dist/assets/{index-CQSLGFTV.css → index-DxZ9MHKB.css} +1 -1
- package/frontend/dist/assets/workbuddy.color-DOMpQkxJ.svg +29 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-CLvxJjp_.js +0 -1476
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
* baseURLs / wrong model ids before the first genuine request fails.
|
|
14
14
|
*
|
|
15
15
|
* Outbound traffic honors the gateway proxy policy (proxiedFetch), so probing
|
|
16
|
-
* a geo-restricted upstream works identically to routed inference
|
|
16
|
+
* a geo-restricted upstream works identically to routed inference — and the
|
|
17
|
+
* result REPORTS which egress it took (`egress` / `egressProxy`), because the
|
|
18
|
+
* include/exclude page cannot otherwise tell the operator whether their split
|
|
19
|
+
* reached this provider at all.
|
|
17
20
|
*/
|
|
18
21
|
import { type WireKind } from '../providers/wire.js';
|
|
19
22
|
/** The probe speaks the same wire vocabulary as dispatch — no second enum, so
|
|
@@ -40,6 +43,13 @@ export interface ProbeOptions {
|
|
|
40
43
|
kind?: ProbeKind;
|
|
41
44
|
/** Provider-configured extra headers (defs-file options.headers). */
|
|
42
45
|
headers?: Record<string, string>;
|
|
46
|
+
/** Model capabilities the caller already knows (from its def/catalog). A
|
|
47
|
+
* vendor plugin probe builds a REAL request, so a flag it must guess is a
|
|
48
|
+
* model it can mis-test — forwarded verbatim to `PluginProbeOptions`. */
|
|
49
|
+
capabilities?: {
|
|
50
|
+
reasoning?: boolean;
|
|
51
|
+
vision?: boolean;
|
|
52
|
+
};
|
|
43
53
|
timeoutMs?: number;
|
|
44
54
|
}
|
|
45
55
|
export interface ProbeResult {
|
|
@@ -73,6 +83,19 @@ export interface ProbeResult {
|
|
|
73
83
|
* Security P3-5: redaction happens BEFORE truncation (upstreams echo the
|
|
74
84
|
* submitted key; slicing first could re-expose chars at the boundary). */
|
|
75
85
|
upstreamBody?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Where the probe's bytes actually left (ADR-0018 / ADR-0022 vocabulary).
|
|
88
|
+
* `direct` = straight out of the machine, `proxy` = through the operator's
|
|
89
|
+
* outbound proxy at `egressProxy` (redacted origin). A plugin wire that owns
|
|
90
|
+
* its own transport leaves BOTH unset: the core cannot observe that hop, so
|
|
91
|
+
* UNKNOWN is the only honest answer — never read it as direct.
|
|
92
|
+
*
|
|
93
|
+
* This is the console's answer to "did my proxy split actually apply", which
|
|
94
|
+
* the include/exclude page cannot answer on its own.
|
|
95
|
+
*/
|
|
96
|
+
egress?: 'direct' | 'proxy';
|
|
97
|
+
/** Redacted `scheme://host:port` of the outbound proxy; only with `egress: 'proxy'`. */
|
|
98
|
+
egressProxy?: string;
|
|
76
99
|
}
|
|
77
100
|
/**
|
|
78
101
|
* Wire decision for probes — DELEGATES to the shared `wireFor()` —
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
* baseURLs / wrong model ids before the first genuine request fails.
|
|
14
14
|
*
|
|
15
15
|
* Outbound traffic honors the gateway proxy policy (proxiedFetch), so probing
|
|
16
|
-
* a geo-restricted upstream works identically to routed inference
|
|
16
|
+
* a geo-restricted upstream works identically to routed inference — and the
|
|
17
|
+
* result REPORTS which egress it took (`egress` / `egressProxy`), because the
|
|
18
|
+
* include/exclude page cannot otherwise tell the operator whether their split
|
|
19
|
+
* reached this provider at all.
|
|
17
20
|
*/
|
|
18
|
-
import { proxiedFetch } from '../utils/proxy.js';
|
|
21
|
+
import { proxiedFetch, redactProxyUrl, resolveProxyUrl } from '../utils/proxy.js';
|
|
19
22
|
import { wireFor, unroutableInfo, anthropicMessagesUrl } from '../providers/wire.js';
|
|
20
23
|
import { redactBodySecrets } from './credentials/opencode-v2-store.js';
|
|
21
24
|
import { redactUpstreamBody } from '../observability/upstream-body-redaction.js';
|
|
@@ -70,7 +73,10 @@ export function structuredApiError(body) {
|
|
|
70
73
|
return { code: code !== undefined ? String(code) : undefined };
|
|
71
74
|
}
|
|
72
75
|
function hintForStatus(status, body = '') {
|
|
73
|
-
|
|
76
|
+
// Google spells an egress-region refusal as a 400 FAILED_PRECONDITION
|
|
77
|
+
// ("User location is not supported for the API use."), a wording the
|
|
78
|
+
// OpenAI/Anthropic-style region markers below never match.
|
|
79
|
+
if (/unsupported_country_region|Country, region, or territory|User location is not supported|location is not supported for the API/i.test(body))
|
|
74
80
|
return { hintCode: 'regionBlocked' };
|
|
75
81
|
if (status === 401 || status === 403)
|
|
76
82
|
return { authHint: true, hintCode: 'authFailed' };
|
|
@@ -103,6 +109,9 @@ export async function probeProvider(opts) {
|
|
|
103
109
|
// implemented by the model-service plugin. Built-in wires have no plugin
|
|
104
110
|
// and fall through to the wire-specific HTTP logic.
|
|
105
111
|
const plugin = getModelServicePlugin(kind);
|
|
112
|
+
// A plugin probe runs ITS OWN transport: the core never touches the socket, so
|
|
113
|
+
// `egress` stays unset (UNKNOWN) — reporting `direct` would be a lie whenever
|
|
114
|
+
// the vendor client honors its own proxy settings.
|
|
106
115
|
if (plugin?.probe)
|
|
107
116
|
return { ...(await plugin.probe(opts)), kind };
|
|
108
117
|
if (!BUILTIN_PROBE_KINDS[kind]) {
|
|
@@ -162,7 +171,16 @@ export async function probeProvider(opts) {
|
|
|
162
171
|
? { model: opts.model, state: 'ping', questions: { probe: { type: 'noul', instructions: 'ping' } } }
|
|
163
172
|
: { model: opts.model, max_tokens: 16, stream: false, messages: [{ role: 'user', content: 'ping' }] };
|
|
164
173
|
const started = Date.now();
|
|
174
|
+
// Resolve the egress ONCE and reuse it for the dial: the operator's question is
|
|
175
|
+
// "did my include/exclude split apply to THIS provider/model", and the probe is
|
|
176
|
+
// the only place that can answer before a real request burns a turn. Same
|
|
177
|
+
// resolver the executors call at dial time, so the answer cannot drift.
|
|
178
|
+
const proxyUrl = resolveProxyUrl(url, { provider: opts.provider, model: opts.model });
|
|
179
|
+
const egress = proxyUrl ? 'proxy' : 'direct';
|
|
180
|
+
const egressProxy = proxyUrl ? redactProxyUrl(proxyUrl) : undefined;
|
|
165
181
|
try {
|
|
182
|
+
// proxiedFetch resolves the proxy itself from these same arguments — the
|
|
183
|
+
// pre-resolved `proxyUrl` above is only for the REPORT, never a second gate.
|
|
166
184
|
const res = await proxiedFetch(url, {
|
|
167
185
|
method: 'POST',
|
|
168
186
|
headers,
|
|
@@ -181,6 +199,8 @@ export async function probeProvider(opts) {
|
|
|
181
199
|
upstreamBody: `Upstream redirected (${res.status}); credentialed probes do not follow redirects.`,
|
|
182
200
|
transportCode: 'unreachable',
|
|
183
201
|
transportUrl: url,
|
|
202
|
+
egress,
|
|
203
|
+
...(egressProxy ? { egressProxy } : {}),
|
|
184
204
|
};
|
|
185
205
|
}
|
|
186
206
|
const latencyMs = Date.now() - started;
|
|
@@ -209,9 +229,11 @@ export async function probeProvider(opts) {
|
|
|
209
229
|
httpStatus: res.status,
|
|
210
230
|
hintCode,
|
|
211
231
|
upstreamBody: text || undefined,
|
|
232
|
+
egress,
|
|
233
|
+
...(egressProxy ? { egressProxy } : {}),
|
|
212
234
|
};
|
|
213
235
|
}
|
|
214
|
-
return { ok: true, kind, model: opts.model, latencyMs };
|
|
236
|
+
return { ok: true, kind, model: opts.model, latencyMs, egress, ...(egressProxy ? { egressProxy } : {}) };
|
|
215
237
|
}
|
|
216
238
|
catch (err) {
|
|
217
239
|
const latencyMs = Date.now() - started;
|
|
@@ -226,6 +248,8 @@ export async function probeProvider(opts) {
|
|
|
226
248
|
transportUrl: url,
|
|
227
249
|
transportCause: cause ? String(cause) : undefined,
|
|
228
250
|
timeoutMs: opts.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
251
|
+
egress,
|
|
252
|
+
...(egressProxy ? { egressProxy } : {}),
|
|
229
253
|
};
|
|
230
254
|
}
|
|
231
255
|
}
|
|
@@ -84,6 +84,11 @@ export interface OpenCodeProviderView {
|
|
|
84
84
|
keyMasked?: string;
|
|
85
85
|
inline?: boolean;
|
|
86
86
|
};
|
|
87
|
+
/** Plugin-declared credential methods. An empty array means the plugin owns
|
|
88
|
+
* login and the console must not collect a credential. */
|
|
89
|
+
authTypes?: Array<'none' | 'webLogin' | 'key'>;
|
|
90
|
+
/** Already-localized how-to line from the owning preset. */
|
|
91
|
+
keyHint?: string;
|
|
87
92
|
}
|
|
88
93
|
/**
|
|
89
94
|
* Valid custom-provider id - lowercase slug only (`[a-z0-9._-]`, leading
|
|
@@ -21,7 +21,7 @@ import { ReasoningEffort, TierLevel } from '../types/router.js';
|
|
|
21
21
|
* so both forms flow through the same array and every consumer stays total.
|
|
22
22
|
*/
|
|
23
23
|
export type DirectiveAction = 'tier_up' | 'tier_down' | 'effort_up' | 'effort_down' | 'continue' | `tier_set:${TierLevel}` | `effort_set:${ReasoningEffort}`;
|
|
24
|
-
export declare const DIRECTIVE_STEP_SUFFIXES: readonly [
|
|
24
|
+
export declare const DIRECTIVE_STEP_SUFFIXES: readonly ["tier-up", "tier-down", "effort-up", "effort-down"];
|
|
25
25
|
/** Every suffix the namespace reserves: 4 steps + continue + 4 tier pins + 6 effort pins. */
|
|
26
26
|
export declare function directiveSuffixes(): string[];
|
|
27
27
|
/**
|
|
@@ -135,4 +135,8 @@ export interface EffortDirectiveResult {
|
|
|
135
135
|
* still gets the raised ask, which the executor then honestly degrades
|
|
136
136
|
* (`reasoningDegraded`).
|
|
137
137
|
*/
|
|
138
|
-
export declare function applyEffortDirectives(actions: readonly DirectiveAction[], baseEffort: ReasoningEffort | undefined, supportedEfforts?: readonly ReasoningEffort[]
|
|
138
|
+
export declare function applyEffortDirectives(actions: readonly DirectiveAction[], baseEffort: ReasoningEffort | undefined, supportedEfforts?: readonly ReasoningEffort[],
|
|
139
|
+
/** The model's vendor forbids thinking-off (ADR-0035). A step or pin that
|
|
140
|
+
* cannot land at-or-above a declared rung serves the LOWEST declared rung
|
|
141
|
+
* rather than the `none` this model cannot answer. */
|
|
142
|
+
alwaysThink?: boolean): EffortDirectiveResult;
|
|
@@ -400,7 +400,11 @@ export function applyTierDirectives(actions, baseTier) {
|
|
|
400
400
|
* still gets the raised ask, which the executor then honestly degrades
|
|
401
401
|
* (`reasoningDegraded`).
|
|
402
402
|
*/
|
|
403
|
-
export function applyEffortDirectives(actions, baseEffort, supportedEfforts
|
|
403
|
+
export function applyEffortDirectives(actions, baseEffort, supportedEfforts,
|
|
404
|
+
/** The model's vendor forbids thinking-off (ADR-0035). A step or pin that
|
|
405
|
+
* cannot land at-or-above a declared rung serves the LOWEST declared rung
|
|
406
|
+
* rather than the `none` this model cannot answer. */
|
|
407
|
+
alwaysThink = false) {
|
|
404
408
|
const supportedEmpty = !!supportedEfforts && supportedEfforts.length === 0;
|
|
405
409
|
const noop = (delta, pinned, suffix) => ({
|
|
406
410
|
effort: baseEffort,
|
|
@@ -419,7 +423,7 @@ export function applyEffortDirectives(actions, baseEffort, supportedEfforts) {
|
|
|
419
423
|
const suffix = `effort-${target}`;
|
|
420
424
|
if (supportedEmpty)
|
|
421
425
|
return noop(0, true, suffix);
|
|
422
|
-
const served = downgradeReasoning(target, supportedEfforts);
|
|
426
|
+
const served = downgradeReasoning(target, supportedEfforts, alwaysThink);
|
|
423
427
|
const baseRank = baseEffort === undefined ? -1 : EFFORT_LADDER.indexOf(baseEffort);
|
|
424
428
|
const servedRank = EFFORT_LADDER.indexOf(served);
|
|
425
429
|
return {
|
|
@@ -482,7 +486,7 @@ export function applyEffortDirectives(actions, baseEffort, supportedEfforts) {
|
|
|
482
486
|
ignoredSteps: 0,
|
|
483
487
|
};
|
|
484
488
|
}
|
|
485
|
-
const served = downgradeReasoning(candidate, supportedEfforts);
|
|
489
|
+
const served = downgradeReasoning(candidate, supportedEfforts, alwaysThink);
|
|
486
490
|
return {
|
|
487
491
|
effort: served,
|
|
488
492
|
delta,
|
|
@@ -82,6 +82,15 @@ export declare class PipelineOrchestrator {
|
|
|
82
82
|
getCaptureRecorder(): CaptureRecorder;
|
|
83
83
|
getRegistry(): ProviderRegistry;
|
|
84
84
|
getCircuitBreakerManager(): CircuitBreakerManager;
|
|
85
|
+
/**
|
|
86
|
+
* The pool a model serves from, derived from its HOME tier — the single-tier
|
|
87
|
+
* question "is this pinned model still config-intended?". A model with no
|
|
88
|
+
* home tier serves from NO pool (empty list): every pool filters it out, so
|
|
89
|
+
* a pin on it is config-evicted and falls through to the ordinary
|
|
90
|
+
* replacement path. Callers must not treat the empty list as "tier down";
|
|
91
|
+
* that judgement belongs to `getModelForTier`.
|
|
92
|
+
*/
|
|
93
|
+
private poolOfHomedModel;
|
|
85
94
|
/**
|
|
86
95
|
* Auto-request routing with the experience table in front of the decision layer
|
|
87
96
|
* (ADR-0011): an entry hit short-circuits L2 entirely — the table IS a
|
|
@@ -95,27 +104,16 @@ export declare class PipelineOrchestrator {
|
|
|
95
104
|
stopProber(): void;
|
|
96
105
|
/** The health prober's CLAMPED sweep interval (0 when probing is off). */
|
|
97
106
|
getProberIntervalMs(): number;
|
|
98
|
-
/**
|
|
99
|
-
* Public entry point — thin capture wrapper around processInternal.
|
|
100
|
-
*
|
|
101
|
-
* Records the full request/response into the opt-in CaptureRecorder audit
|
|
102
|
-
* log on BOTH the success and the failure path (debugging failed requests
|
|
103
|
-
* is the primary use case). Implemented as a wrapper instead of an inline
|
|
104
|
-
* hook so processInternal stays untouched: the session-id resolution and
|
|
105
|
-
* the PRE-compression message snapshot are rebuilt here with the same pure
|
|
106
|
-
* functions (PromptOptimizer.normalizeMessages / scanDirectives /
|
|
107
|
-
* resolveSessionId) — all deterministic and run in the same synchronous
|
|
108
|
-
* segment, so the wrapper snapshot is byte-identical to the scrubbed chain
|
|
109
|
-
* processInternal routes on before applyCompression mutates the request
|
|
110
|
-
* (ADR-0011 §4: the scrubbed chain feeds hashing, snippets, traces AND
|
|
111
|
-
* capture — reserved tokens never reach the archive, and session /
|
|
112
|
-
* conversation anchor resolution sees the same bytes the router sees).
|
|
113
|
-
* Request headers are captured in
|
|
114
|
-
* SANITIZED form (credential values masked per the deny-list in
|
|
115
|
-
* observability/http-exchange.ts), never raw.
|
|
116
|
-
*/
|
|
117
107
|
/** One-shot allocation of the write-time turn identity (ADR-0024). */
|
|
118
108
|
private allocateTurn;
|
|
109
|
+
/**
|
|
110
|
+
* Public entry point. The admission gate scrubs the chain once, resolves
|
|
111
|
+
* the conversation and allocates its turn, before anything else. The rest
|
|
112
|
+
* of the pipeline uses that scrubbed request and that session. Capture,
|
|
113
|
+
* when on, copies the id into the audit log. When it is off, no context
|
|
114
|
+
* is built and no event is written. Captured headers are sanitized
|
|
115
|
+
* (credential values masked in observability/http-exchange.ts).
|
|
116
|
+
*/
|
|
119
117
|
process(request: CanonicalRequest, context?: ProcessContext,
|
|
120
118
|
/**
|
|
121
119
|
* Progressive-output relay (see utils/stream-relay). Offered by a transport
|
|
@@ -134,14 +132,17 @@ export declare class PipelineOrchestrator {
|
|
|
134
132
|
*/
|
|
135
133
|
private resolveUpstreamRelay;
|
|
136
134
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
135
|
+
* Names the model the client addressed. Throws 404 for an unknown variant
|
|
136
|
+
* or an unusable combo, and 403 when the key's model policy denies an
|
|
137
|
+
* explicit model. A bare name that matches nothing falls through to the
|
|
138
|
+
* classifier. Mutates `request` with the tier and effort that name implies.
|
|
139
|
+
* Does not resolve a session.
|
|
140
|
+
*/
|
|
141
|
+
private resolveAddressedModel;
|
|
142
|
+
/**
|
|
143
|
+
* Routing and execution after admission. The request is already scrubbed,
|
|
144
|
+
* the addressed model is already accepted, and the session and turn
|
|
145
|
+
* already exist. A rejected request never reaches this function.
|
|
145
146
|
*/
|
|
146
147
|
private processInternal;
|
|
147
148
|
/**
|