@skrr-ai/cli 0.1.171 → 0.1.173
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/commands/harnesses/models.d.ts +12 -0
- package/dist/commands/harnesses/models.js +14 -2
- package/dist/commands/harnesses/rollouts/grant.d.ts +21 -0
- package/dist/commands/harnesses/rollouts/grant.js +56 -0
- package/dist/commands/harnesses/rollouts/list.d.ts +24 -0
- package/dist/commands/harnesses/rollouts/list.js +87 -0
- package/dist/commands/harnesses/rollouts/revoke.d.ts +22 -0
- package/dist/commands/harnesses/rollouts/revoke.js +56 -0
- package/dist/commands/machines/hosted/exec.d.ts +19 -0
- package/dist/commands/machines/hosted/exec.js +59 -5
- package/dist/commands/machines/hosted/list.js +8 -1
- package/dist/commands/machines/hosted/start.js +10 -1
- package/dist/lib/first-party-harness-broker.js +6 -0
- package/dist/lib/harness-tiers.d.ts +6 -4
- package/dist/lib/harness-tiers.js +12 -10
- package/dist/lib/hosted-machines.d.ts +13 -0
- package/dist/lib/hosted-machines.js +34 -1
- package/dist/lib/provider-rollouts.d.ts +58 -0
- package/dist/lib/provider-rollouts.js +23 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.cjs +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.d.cts +23 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +2381 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +1 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.d.ts +165 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.js +132 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +1 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.d.ts +165 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.js +203 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +14 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11598 -11591
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +4 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +58 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +170 -70
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +58 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +226 -102
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +297 -4
- package/package.json +5 -2
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* ESM and CJS are both emitted because the daemon is ESM and the CLI is CJS, and
|
|
52
52
|
* this package exists precisely so both can host the broker.
|
|
53
53
|
*/
|
|
54
|
-
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, type ManagedSessionStatus, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, type GatewayCredential, type ManagedCapabilityRefresh, type ManagedCapabilityRefreshResult, type ManagedInferenceBrokerOptions, type ManagedInferenceBrokerSession, type ManagedInferenceInputTokenAccounting, type ManagedInferenceModelScope, type ManagedInferenceRequestEnvelope, type ManagedReasoningPolicy, } from './managed-inference-broker.js';
|
|
54
|
+
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, LOOPBACK_BROKER_NO_PROXY_HOSTS, noProxyEnvWithHosts, type ManagedSessionStatus, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, type GatewayCredential, type ManagedCapabilityRefresh, type ManagedCapabilityRefreshResult, type ManagedInferenceBrokerOptions, type ManagedInferenceBrokerSession, type ManagedInferenceBrokerTransport, type ManagedInferenceEndpoint, type ManagedInferenceLoopbackSession, type ManagedInferenceInputTokenAccounting, type ManagedInferenceModelScope, type ManagedInferenceRequestEnvelope, type ManagedReasoningPolicy, } from './managed-inference-broker.js';
|
|
55
55
|
export { minimumCapabilityWindowMs, scheduleRenewalDelay, startRenewalLoop, type CapabilityRefreshOutcome, type RenewalLoop, type RenewalLoopOptions, type RenewalOutcome, type RenewalStopReason, } from './managed-inference-renewal.js';
|
|
56
56
|
export { ModelProxyLoopbackServer, type ModelProxyForwarder } from './loopback-server.js';
|
|
57
57
|
export * from './contract.js';
|
|
@@ -22,6 +22,7 @@ __export(index_exports, {
|
|
|
22
22
|
INFERENCE_BROKER_HOST: () => import_managed_inference_broker.INFERENCE_BROKER_HOST,
|
|
23
23
|
INFERENCE_BROKER_ORIGIN: () => import_managed_inference_broker.INFERENCE_BROKER_ORIGIN,
|
|
24
24
|
INFERENCE_BROKER_SOCKET_ENV: () => import_managed_inference_broker.INFERENCE_BROKER_SOCKET_ENV,
|
|
25
|
+
LOOPBACK_BROKER_NO_PROXY_HOSTS: () => import_managed_inference_broker.LOOPBACK_BROKER_NO_PROXY_HOSTS,
|
|
25
26
|
MANAGED_PROMPT_CACHING_ENV: () => import_managed_inference_broker.MANAGED_PROMPT_CACHING_ENV,
|
|
26
27
|
MANAGED_SESSION_ENV: () => import_managed_inference_broker.MANAGED_SESSION_ENV,
|
|
27
28
|
MANAGED_STATUS_PATH: () => import_managed_inference_broker.MANAGED_STATUS_PATH,
|
|
@@ -30,6 +31,7 @@ __export(index_exports, {
|
|
|
30
31
|
inferenceBrokerNoProxyEnv: () => import_managed_inference_broker.inferenceBrokerNoProxyEnv,
|
|
31
32
|
isManagedInferenceModelScope: () => import_managed_inference_broker.isManagedInferenceModelScope,
|
|
32
33
|
minimumCapabilityWindowMs: () => import_managed_inference_renewal.minimumCapabilityWindowMs,
|
|
34
|
+
noProxyEnvWithHosts: () => import_managed_inference_broker.noProxyEnvWithHosts,
|
|
33
35
|
scheduleRenewalDelay: () => import_managed_inference_renewal.scheduleRenewalDelay,
|
|
34
36
|
startManagedInferenceBroker: () => import_managed_inference_broker.startManagedInferenceBroker,
|
|
35
37
|
startRenewalLoop: () => import_managed_inference_renewal.startRenewalLoop
|
|
@@ -44,6 +46,7 @@ __reExport(index_exports, require("./contract.js"), module.exports);
|
|
|
44
46
|
INFERENCE_BROKER_HOST,
|
|
45
47
|
INFERENCE_BROKER_ORIGIN,
|
|
46
48
|
INFERENCE_BROKER_SOCKET_ENV,
|
|
49
|
+
LOOPBACK_BROKER_NO_PROXY_HOSTS,
|
|
47
50
|
MANAGED_PROMPT_CACHING_ENV,
|
|
48
51
|
MANAGED_SESSION_ENV,
|
|
49
52
|
MANAGED_STATUS_PATH,
|
|
@@ -52,6 +55,7 @@ __reExport(index_exports, require("./contract.js"), module.exports);
|
|
|
52
55
|
inferenceBrokerNoProxyEnv,
|
|
53
56
|
isManagedInferenceModelScope,
|
|
54
57
|
minimumCapabilityWindowMs,
|
|
58
|
+
noProxyEnvWithHosts,
|
|
55
59
|
scheduleRenewalDelay,
|
|
56
60
|
startManagedInferenceBroker,
|
|
57
61
|
startRenewalLoop,
|
|
@@ -117,6 +117,40 @@ export interface ManagedInferenceBrokerOptions {
|
|
|
117
117
|
fetchImpl?: FetchLike;
|
|
118
118
|
/** Trusted cross-uid group for a Dedicated Runtime harness child. */
|
|
119
119
|
socketGroupId?: number;
|
|
120
|
+
/**
|
|
121
|
+
* How the harness reaches the broker. `unix-socket` (the default) is a 0600
|
|
122
|
+
* socket the harness addresses through {@link INFERENCE_BROKER_SOCKET_ENV}.
|
|
123
|
+
* `loopback-tcp` is a 127.0.0.1 ephemeral port for a closed runtime that can
|
|
124
|
+
* only speak HTTP over TCP (the GitHub Copilot runtime); the bearer is then
|
|
125
|
+
* handed out only through {@link ManagedInferenceEndpoint.bearerToken} and is
|
|
126
|
+
* never written into `env`.
|
|
127
|
+
*/
|
|
128
|
+
transport?: ManagedInferenceBrokerTransport;
|
|
129
|
+
/**
|
|
130
|
+
* What a managed lease that does NOT allow prompt caching does with an
|
|
131
|
+
* Anthropic-dialect `cache_control` marker. `refuse` (the default) fails the
|
|
132
|
+
* request. `strip` removes the markers and forwards the request uncached,
|
|
133
|
+
* for a harness that always sends them and cannot be told not to (Claude
|
|
134
|
+
* Code, OSK-24457). Stripping can only lower what a request costs: a cache
|
|
135
|
+
* write is billed above an ordinary input token, an uncached read is not.
|
|
136
|
+
* Every other prompt-cache field is still refused, and a lease that ALLOWS
|
|
137
|
+
* caching for a Claude-family model is still refused (there is no policy for
|
|
138
|
+
* it yet), whichever value is set.
|
|
139
|
+
*/
|
|
140
|
+
promptCacheControl?: 'refuse' | 'strip';
|
|
141
|
+
}
|
|
142
|
+
export type ManagedInferenceBrokerTransport = 'unix-socket' | 'loopback-tcp';
|
|
143
|
+
/**
|
|
144
|
+
* A `loopback-tcp` broker's address. The bearer is a function rather than a
|
|
145
|
+
* value so it can be read per request (an SDK `bearerTokenProvider`) and stops
|
|
146
|
+
* authenticating anything once `stop()` has run.
|
|
147
|
+
*/
|
|
148
|
+
export interface ManagedInferenceEndpoint {
|
|
149
|
+
/** `http://127.0.0.1:<port>`, no path. */
|
|
150
|
+
readonly origin: string;
|
|
151
|
+
/** The lease's upstream dialect family, so a caller can pick the client wire. */
|
|
152
|
+
readonly upstreamProvider: ManagedInferenceModelScope['upstreamProvider'] | null;
|
|
153
|
+
bearerToken(): string;
|
|
120
154
|
}
|
|
121
155
|
export interface ManagedInferenceBrokerSession {
|
|
122
156
|
/** Safe-to-deliver child environment. It intentionally never includes the gateway key. */
|
|
@@ -133,6 +167,10 @@ export interface ManagedInferenceBrokerSession {
|
|
|
133
167
|
reasoningPolicy?: ManagedReasoningPolicy;
|
|
134
168
|
stop(): Promise<void>;
|
|
135
169
|
}
|
|
170
|
+
/** A `loopback-tcp` broker: no socket, and no bearer in `env`. */
|
|
171
|
+
export interface ManagedInferenceLoopbackSession extends Omit<ManagedInferenceBrokerSession, 'socketPath'> {
|
|
172
|
+
endpoint: ManagedInferenceEndpoint;
|
|
173
|
+
}
|
|
136
174
|
/**
|
|
137
175
|
* OSK-3893 — reserved local path the engine reads for its managed-session readout.
|
|
138
176
|
*
|
|
@@ -210,6 +248,20 @@ export declare function inferenceBrokerNoProxyEnv(env: Readonly<Record<string, s
|
|
|
210
248
|
NO_PROXY: string;
|
|
211
249
|
no_proxy: string;
|
|
212
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* The loopback hosts a `loopback-tcp` broker is reached on. A harness that
|
|
253
|
+
* honours HTTP(S)_PROXY would otherwise send its model traffic, relay token
|
|
254
|
+
* included, to the proxy instead of to this machine (OSK-24457).
|
|
255
|
+
*/
|
|
256
|
+
export declare const LOOPBACK_BROKER_NO_PROXY_HOSTS: readonly string[];
|
|
257
|
+
/**
|
|
258
|
+
* {@link inferenceBrokerNoProxyEnv} for any set of hosts: both spellings, each
|
|
259
|
+
* keeping its existing entries in order and gaining every missing host once.
|
|
260
|
+
*/
|
|
261
|
+
export declare function noProxyEnvWithHosts(env: Readonly<Record<string, string | undefined>>, hosts: readonly string[]): {
|
|
262
|
+
NO_PROXY: string;
|
|
263
|
+
no_proxy: string;
|
|
264
|
+
};
|
|
213
265
|
export declare const MANAGED_SESSION_ENV = "OVERSKY_MANAGED_SESSION";
|
|
214
266
|
export declare const MANAGED_PROMPT_CACHING_ENV = "OVERSKY_MANAGED_PROMPT_CACHING";
|
|
215
267
|
export declare function managedClientModelId(scope: ManagedInferenceModelScope): string;
|
|
@@ -238,7 +290,12 @@ export declare function buildManagedInferenceRelayCredential(credential: Gateway
|
|
|
238
290
|
* execution; a failure to do so becomes an auth failure rather than a
|
|
239
291
|
* direct-provider fallback.
|
|
240
292
|
*/
|
|
241
|
-
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions
|
|
293
|
+
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions & {
|
|
294
|
+
transport: 'loopback-tcp';
|
|
295
|
+
}): Promise<ManagedInferenceLoopbackSession>;
|
|
296
|
+
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions & {
|
|
297
|
+
transport?: 'unix-socket';
|
|
298
|
+
}): Promise<ManagedInferenceBrokerSession>;
|
|
242
299
|
/**
|
|
243
300
|
* Classify a NON-OK lease renewal response.
|
|
244
301
|
*
|
|
@@ -21,6 +21,7 @@ __export(managed_inference_broker_exports, {
|
|
|
21
21
|
INFERENCE_BROKER_HOST: () => INFERENCE_BROKER_HOST,
|
|
22
22
|
INFERENCE_BROKER_ORIGIN: () => INFERENCE_BROKER_ORIGIN,
|
|
23
23
|
INFERENCE_BROKER_SOCKET_ENV: () => INFERENCE_BROKER_SOCKET_ENV,
|
|
24
|
+
LOOPBACK_BROKER_NO_PROXY_HOSTS: () => LOOPBACK_BROKER_NO_PROXY_HOSTS,
|
|
24
25
|
MANAGED_PROMPT_CACHING_ENV: () => MANAGED_PROMPT_CACHING_ENV,
|
|
25
26
|
MANAGED_SESSION_ENV: () => MANAGED_SESSION_ENV,
|
|
26
27
|
MANAGED_STATUS_PATH: () => MANAGED_STATUS_PATH,
|
|
@@ -30,6 +31,7 @@ __export(managed_inference_broker_exports, {
|
|
|
30
31
|
isGatewayCredential: () => isGatewayCredential,
|
|
31
32
|
isManagedInferenceModelScope: () => isManagedInferenceModelScope,
|
|
32
33
|
managedClientModelId: () => managedClientModelId,
|
|
34
|
+
noProxyEnvWithHosts: () => noProxyEnvWithHosts,
|
|
33
35
|
startManagedInferenceBroker: () => startManagedInferenceBroker
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(managed_inference_broker_exports);
|
|
@@ -48,19 +50,27 @@ const INFERENCE_BROKER_ORIGIN = "http://oversky-inference-broker.invalid";
|
|
|
48
50
|
const INFERENCE_BROKER_HOST = new URL(INFERENCE_BROKER_ORIGIN).hostname;
|
|
49
51
|
const INFERENCE_BROKER_SOCKET_ENV = "OVERSKY_INFERENCE_BROKER_SOCKET";
|
|
50
52
|
function inferenceBrokerNoProxyEnv(env) {
|
|
53
|
+
return noProxyEnvWithHosts(env, [INFERENCE_BROKER_HOST]);
|
|
54
|
+
}
|
|
55
|
+
const LOOPBACK_BROKER_NO_PROXY_HOSTS = ["127.0.0.1", "localhost"];
|
|
56
|
+
function noProxyEnvWithHosts(env, hosts) {
|
|
51
57
|
const upper = nonEmpty(env.NO_PROXY);
|
|
52
58
|
const lower = nonEmpty(env.no_proxy);
|
|
53
59
|
return {
|
|
54
|
-
NO_PROXY:
|
|
55
|
-
no_proxy:
|
|
60
|
+
NO_PROXY: withNoProxyHosts(upper ?? lower ?? "", hosts),
|
|
61
|
+
no_proxy: withNoProxyHosts(lower ?? upper ?? "", hosts)
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
function withNoProxyHosts(list, hosts) {
|
|
65
|
+
let out = list;
|
|
66
|
+
for (const host of hosts) {
|
|
67
|
+
const entries = out.split(",").map((entry) => entry.trim().toLowerCase());
|
|
68
|
+
if (entries.includes("*") || entries.includes(host))
|
|
69
|
+
continue;
|
|
70
|
+
const kept = out.replace(WITH_INFERENCE_BROKER_HOST_RE, "");
|
|
71
|
+
out = kept ? `${kept},${host}` : host;
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
64
74
|
}
|
|
65
75
|
const MANAGED_SESSION_ENV = "OVERSKY_MANAGED_SESSION";
|
|
66
76
|
const MANAGED_PROMPT_CACHING_ENV = "OVERSKY_MANAGED_PROMPT_CACHING";
|
|
@@ -72,13 +82,42 @@ const ALLOWED_PATHS = /* @__PURE__ */ new Set([
|
|
|
72
82
|
"/v1/responses",
|
|
73
83
|
"/responses"
|
|
74
84
|
]);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
"/messages",
|
|
78
|
-
"/
|
|
79
|
-
"/chat/completions"
|
|
85
|
+
const ANTHROPIC_MESSAGES_PATHS = /* @__PURE__ */ new Set(["/v1/messages", "/messages"]);
|
|
86
|
+
const ANTHROPIC_COUNT_TOKENS_PATHS = /* @__PURE__ */ new Set([
|
|
87
|
+
"/v1/messages/count_tokens",
|
|
88
|
+
"/messages/count_tokens"
|
|
80
89
|
]);
|
|
81
|
-
const
|
|
90
|
+
const ACCEPTED_ANTHROPIC_QUERY = "beta=true";
|
|
91
|
+
function brokerRequestTarget(target) {
|
|
92
|
+
const queryAt = target.indexOf("?");
|
|
93
|
+
if (queryAt === -1)
|
|
94
|
+
return { path: target, query: "" };
|
|
95
|
+
return { path: target.slice(0, queryAt), query: target.slice(queryAt + 1) };
|
|
96
|
+
}
|
|
97
|
+
function approvedRequestPath(target) {
|
|
98
|
+
if (target.query === "")
|
|
99
|
+
return target.path;
|
|
100
|
+
if (target.query === ACCEPTED_ANTHROPIC_QUERY && (ANTHROPIC_MESSAGES_PATHS.has(target.path) || ANTHROPIC_COUNT_TOKENS_PATHS.has(target.path))) {
|
|
101
|
+
return target.path;
|
|
102
|
+
}
|
|
103
|
+
rejectManagedRequest("managed inference broker denied a request query it does not accept");
|
|
104
|
+
}
|
|
105
|
+
function countTokensUnavailableResponse() {
|
|
106
|
+
const encoded = new TextEncoder().encode(JSON.stringify({
|
|
107
|
+
type: "error",
|
|
108
|
+
error: {
|
|
109
|
+
type: "not_found_error",
|
|
110
|
+
message: "The managed inference broker does not serve token counting; estimate locally."
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
return {
|
|
114
|
+
status: 404,
|
|
115
|
+
headers: { "content-type": "application/json", "cache-control": "no-store" },
|
|
116
|
+
body: (async function* () {
|
|
117
|
+
yield encoded;
|
|
118
|
+
})()
|
|
119
|
+
};
|
|
120
|
+
}
|
|
82
121
|
const FORWARDED_HEADERS = /* @__PURE__ */ new Set([
|
|
83
122
|
"accept",
|
|
84
123
|
"content-type",
|
|
@@ -140,10 +179,15 @@ function buildManagedInferenceRelayCredential(credential, options) {
|
|
|
140
179
|
};
|
|
141
180
|
}
|
|
142
181
|
async function startManagedInferenceBroker(options) {
|
|
182
|
+
const transport = options.transport ?? "unix-socket";
|
|
183
|
+
if (transport !== "unix-socket" && transport !== "loopback-tcp") {
|
|
184
|
+
throw new Error("managed inference broker received an unknown transport");
|
|
185
|
+
}
|
|
143
186
|
const gatewayBase = nonEmpty(options.credential.baseUrl);
|
|
144
187
|
const gatewayKey = nonEmpty(options.credential.authToken);
|
|
145
188
|
const modelScope = isManagedInferenceModelScope(options.modelScope) ? options.modelScope : null;
|
|
146
189
|
const legacyModel = nonEmpty(options.model);
|
|
190
|
+
const promptCacheControl = options.promptCacheControl === "strip" ? "strip" : "refuse";
|
|
147
191
|
if (!gatewayBase || !gatewayKey || !modelScope && !legacyModel) {
|
|
148
192
|
throw new Error("managed inference broker requires gateway base URL, virtual key, and resolved model");
|
|
149
193
|
}
|
|
@@ -231,10 +275,14 @@ async function startManagedInferenceBroker(options) {
|
|
|
231
275
|
if (request.path === MANAGED_STATUS_PATH) {
|
|
232
276
|
return statusResponse();
|
|
233
277
|
}
|
|
278
|
+
const target = brokerRequestTarget(request.path);
|
|
279
|
+
const path = approvedRequestPath(target);
|
|
280
|
+
if (ANTHROPIC_COUNT_TOKENS_PATHS.has(path))
|
|
281
|
+
return countTokensUnavailableResponse();
|
|
234
282
|
const releaseSlot = acquireRequestSlot();
|
|
235
|
-
const url = resolveGatewayUrl(gatewayBase, origin,
|
|
283
|
+
const url = resolveGatewayUrl(gatewayBase, origin, path);
|
|
236
284
|
try {
|
|
237
|
-
const body = assertApprovedEnvelope(request.method,
|
|
285
|
+
const body = assertApprovedEnvelope(request.method, path, request.body, modelScope, legacyModel, promptCacheControl);
|
|
238
286
|
const headers = new Headers();
|
|
239
287
|
for (const [name, value] of Object.entries(request.headers)) {
|
|
240
288
|
if (FORWARDED_HEADERS.has(name.toLowerCase()))
|
|
@@ -261,30 +309,44 @@ async function startManagedInferenceBroker(options) {
|
|
|
261
309
|
}
|
|
262
310
|
}
|
|
263
311
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
312
|
+
const startListener = async () => {
|
|
313
|
+
if (transport === "loopback-tcp") {
|
|
314
|
+
const tcp = new import_loopback_server.ModelProxyLoopbackServer({
|
|
315
|
+
relayToken,
|
|
316
|
+
forwarder,
|
|
317
|
+
host: "127.0.0.1",
|
|
318
|
+
port: 0,
|
|
319
|
+
...envelope ? { maxBodyBytes: envelope.maxInputBytes } : {}
|
|
320
|
+
});
|
|
321
|
+
return { kind: "tcp", server: tcp, origin: (await tcp.start()).baseUrl };
|
|
322
|
+
}
|
|
323
|
+
if (process.platform === "win32") {
|
|
324
|
+
throw new Error("managed inference broker requires a verified local IPC transport on Windows");
|
|
325
|
+
}
|
|
326
|
+
const directory = (0, import_node_fs.mkdtempSync)("/tmp/oversky-inference-");
|
|
327
|
+
const sharedSocketGroup = Number.isSafeInteger(options.socketGroupId);
|
|
328
|
+
if (sharedSocketGroup) {
|
|
329
|
+
(0, import_node_fs.chownSync)(directory, typeof process.getuid === "function" ? process.getuid() : -1, options.socketGroupId);
|
|
330
|
+
}
|
|
331
|
+
(0, import_node_fs.chmodSync)(directory, sharedSocketGroup ? 488 : 448);
|
|
332
|
+
const path = (0, import_node_path.join)(directory, "broker.sock");
|
|
333
|
+
const socket = new import_loopback_server.ModelProxyLoopbackServer({
|
|
334
|
+
relayToken,
|
|
335
|
+
forwarder,
|
|
336
|
+
socketPath: path,
|
|
337
|
+
...sharedSocketGroup ? { socketGroupId: options.socketGroupId } : {},
|
|
338
|
+
advertisedBaseUrl: INFERENCE_BROKER_ORIGIN,
|
|
339
|
+
...envelope ? { maxBodyBytes: envelope.maxInputBytes } : {}
|
|
340
|
+
});
|
|
341
|
+
try {
|
|
342
|
+
await socket.start();
|
|
343
|
+
} catch (error) {
|
|
344
|
+
(0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
return { kind: "socket", server: socket, directory, path };
|
|
348
|
+
};
|
|
349
|
+
const listener = await startListener();
|
|
288
350
|
let stopped = false;
|
|
289
351
|
if (options.leaseExpiresInMs && options.leaseExpiresInMs > 0) {
|
|
290
352
|
const renewUrl = `${gatewayBase.replace(START_MANAGED_INFERENCE_BROKER_RE, "")}/renew`;
|
|
@@ -341,6 +403,47 @@ async function startManagedInferenceBroker(options) {
|
|
|
341
403
|
}
|
|
342
404
|
});
|
|
343
405
|
}
|
|
406
|
+
const promptCachingEnv = modelScope?.requestEnvelope.allowPromptCaching && supportsManagedPromptCaching(modelScope) ? { [MANAGED_PROMPT_CACHING_ENV]: "1" } : {};
|
|
407
|
+
const leaseFields = {
|
|
408
|
+
...modelScope ? { clientModelId: managedClientModelId(modelScope) } : {},
|
|
409
|
+
...envelope ? {
|
|
410
|
+
reasoningPolicy: {
|
|
411
|
+
allowedEfforts: [...envelope.allowedReasoningEfforts],
|
|
412
|
+
defaultEffort: envelope.defaultReasoningEffort ?? envelope.allowedReasoningEfforts[0],
|
|
413
|
+
...envelope.selectedReasoningEffort ? { requestedEffort: envelope.selectedReasoningEffort } : {},
|
|
414
|
+
...envelope.reasoningSelectionSource ? { selectionSource: envelope.reasoningSelectionSource } : {}
|
|
415
|
+
}
|
|
416
|
+
} : {}
|
|
417
|
+
};
|
|
418
|
+
const stop = async () => {
|
|
419
|
+
if (stopped)
|
|
420
|
+
return;
|
|
421
|
+
stopped = true;
|
|
422
|
+
renewal?.stop();
|
|
423
|
+
await listener.server.stop();
|
|
424
|
+
if (listener.kind === "socket")
|
|
425
|
+
(0, import_node_fs.rmSync)(listener.directory, { recursive: true, force: true });
|
|
426
|
+
relayToken = "";
|
|
427
|
+
upstreamKey = "";
|
|
428
|
+
};
|
|
429
|
+
if (listener.kind === "tcp") {
|
|
430
|
+
return {
|
|
431
|
+
// No bearer and no base URL in the environment: a TCP harness is given the
|
|
432
|
+
// endpoint through its SDK, so nothing it starts inherits the token.
|
|
433
|
+
env: { [MANAGED_SESSION_ENV]: "1", ...promptCachingEnv },
|
|
434
|
+
endpoint: {
|
|
435
|
+
origin: listener.origin,
|
|
436
|
+
upstreamProvider: modelScope?.upstreamProvider ?? null,
|
|
437
|
+
bearerToken: () => {
|
|
438
|
+
if (stopped || !relayToken)
|
|
439
|
+
throw new Error("managed inference broker is stopped");
|
|
440
|
+
return relayToken;
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
...leaseFields,
|
|
444
|
+
stop
|
|
445
|
+
};
|
|
446
|
+
}
|
|
344
447
|
return {
|
|
345
448
|
env: {
|
|
346
449
|
OPENAI_BASE_URL: INFERENCE_BROKER_ORIGIN,
|
|
@@ -359,30 +462,13 @@ async function startManagedInferenceBroker(options) {
|
|
|
359
462
|
// Bearer capability that ModelProxyLoopbackServer validates.
|
|
360
463
|
ANTHROPIC_BASE_URL: INFERENCE_BROKER_ORIGIN,
|
|
361
464
|
ANTHROPIC_AUTH_TOKEN: relayToken,
|
|
362
|
-
[INFERENCE_BROKER_SOCKET_ENV]:
|
|
465
|
+
[INFERENCE_BROKER_SOCKET_ENV]: listener.path,
|
|
363
466
|
[MANAGED_SESSION_ENV]: "1",
|
|
364
|
-
...
|
|
467
|
+
...promptCachingEnv
|
|
365
468
|
},
|
|
366
|
-
socketPath,
|
|
367
|
-
...
|
|
368
|
-
|
|
369
|
-
reasoningPolicy: {
|
|
370
|
-
allowedEfforts: [...envelope.allowedReasoningEfforts],
|
|
371
|
-
defaultEffort: envelope.defaultReasoningEffort ?? envelope.allowedReasoningEfforts[0],
|
|
372
|
-
...envelope.selectedReasoningEffort ? { requestedEffort: envelope.selectedReasoningEffort } : {},
|
|
373
|
-
...envelope.reasoningSelectionSource ? { selectionSource: envelope.reasoningSelectionSource } : {}
|
|
374
|
-
}
|
|
375
|
-
} : {},
|
|
376
|
-
async stop() {
|
|
377
|
-
if (stopped)
|
|
378
|
-
return;
|
|
379
|
-
stopped = true;
|
|
380
|
-
renewal?.stop();
|
|
381
|
-
await server.stop();
|
|
382
|
-
(0, import_node_fs.rmSync)(socketDirectory, { recursive: true, force: true });
|
|
383
|
-
relayToken = "";
|
|
384
|
-
upstreamKey = "";
|
|
385
|
-
}
|
|
469
|
+
socketPath: listener.path,
|
|
470
|
+
...leaseFields,
|
|
471
|
+
stop
|
|
386
472
|
};
|
|
387
473
|
}
|
|
388
474
|
const LEASE_CEILING_CODE = "lease-ceiling-reached";
|
|
@@ -452,7 +538,7 @@ function resolveGatewayUrl(base, allowedOrigin, path) {
|
|
|
452
538
|
}
|
|
453
539
|
return url;
|
|
454
540
|
}
|
|
455
|
-
function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
|
|
541
|
+
function assertApprovedEnvelope(method, path, body, modelScope, legacyModel, promptCacheControl = "refuse") {
|
|
456
542
|
if (method.toUpperCase() !== "POST" || !ALLOWED_PATHS.has(path)) {
|
|
457
543
|
rejectManagedRequest("managed inference broker denied an unapproved request method or route");
|
|
458
544
|
}
|
|
@@ -472,16 +558,13 @@ function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
|
|
|
472
558
|
}
|
|
473
559
|
const requestedModel = payload.model;
|
|
474
560
|
if (modelScope) {
|
|
475
|
-
if (modelScope.upstreamProvider === "anthropic" && !ANTHROPIC_ALLOWED_PATHS.has(path) || modelScope.upstreamProvider === "bedrock" && !OPENAI_COMPATIBLE_CHAT_PATHS.has(path) || !["anthropic", "bedrock"].includes(modelScope.upstreamProvider) && path.endsWith("/messages")) {
|
|
476
|
-
rejectManagedRequest("managed inference broker denied a route outside the provider dialect");
|
|
477
|
-
}
|
|
478
561
|
const clientModelId = providerLocalModelId(modelScope.harnessModelId);
|
|
479
562
|
const approved = constantTimeStringEqual(requestedModel, modelScope.harnessModelId) || constantTimeStringEqual(requestedModel, modelScope.gatewayModelAlias) || clientModelId !== null && constantTimeStringEqual(requestedModel, clientModelId);
|
|
480
563
|
if (!approved) {
|
|
481
564
|
rejectManagedRequest("managed inference broker denied a model outside the approved lease");
|
|
482
565
|
}
|
|
483
566
|
payload.model = modelScope.wireModel;
|
|
484
|
-
enforceRequestEnvelope(payload, path, modelScope.requestEnvelope, modelScope);
|
|
567
|
+
enforceRequestEnvelope(payload, path, modelScope.requestEnvelope, modelScope, promptCacheControl);
|
|
485
568
|
const sanitized = new TextEncoder().encode(JSON.stringify(payload));
|
|
486
569
|
if (sanitized.byteLength > modelScope.requestEnvelope.maxInputBytes) {
|
|
487
570
|
rejectManagedRequest("managed inference broker input byte envelope exceeded");
|
|
@@ -493,7 +576,7 @@ function assertApprovedEnvelope(method, path, body, modelScope, legacyModel) {
|
|
|
493
576
|
}
|
|
494
577
|
return body;
|
|
495
578
|
}
|
|
496
|
-
function enforceRequestEnvelope(payload, path, envelope, modelScope) {
|
|
579
|
+
function enforceRequestEnvelope(payload, path, envelope, modelScope, promptCacheControl = "refuse") {
|
|
497
580
|
if (payload.extra_body != null) {
|
|
498
581
|
rejectManagedRequest("managed inference broker denied a caller-supplied extra body");
|
|
499
582
|
}
|
|
@@ -587,7 +670,7 @@ function enforceRequestEnvelope(payload, path, envelope, modelScope) {
|
|
|
587
670
|
}
|
|
588
671
|
payload.max_reasoning_tokens = Math.min(value, envelope.maxReasoningTokens);
|
|
589
672
|
}
|
|
590
|
-
enforcePromptCacheEnvelope(payload, envelope, modelScope);
|
|
673
|
+
enforcePromptCacheEnvelope(payload, envelope, modelScope, promptCacheControl);
|
|
591
674
|
}
|
|
592
675
|
function rejectManagedRequest(message) {
|
|
593
676
|
throw new import_contract.ModelProxyError(import_contract.MODEL_PROXY_ERROR.REQUEST_REJECTED, message);
|
|
@@ -600,6 +683,19 @@ function containsObjectKey(value, target) {
|
|
|
600
683
|
const record = value;
|
|
601
684
|
return Object.prototype.hasOwnProperty.call(record, target) || Object.values(record).some((item) => containsObjectKey(item, target));
|
|
602
685
|
}
|
|
686
|
+
function deleteObjectKey(value, target) {
|
|
687
|
+
if (Array.isArray(value)) {
|
|
688
|
+
for (const item of value)
|
|
689
|
+
deleteObjectKey(item, target);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
if (!value || typeof value !== "object")
|
|
693
|
+
return;
|
|
694
|
+
const record = value;
|
|
695
|
+
delete record[target];
|
|
696
|
+
for (const item of Object.values(record))
|
|
697
|
+
deleteObjectKey(item, target);
|
|
698
|
+
}
|
|
603
699
|
function objectKeyValues(value, target, found = []) {
|
|
604
700
|
if (Array.isArray(value)) {
|
|
605
701
|
for (const item of value)
|
|
@@ -623,13 +719,15 @@ function supportsManagedPromptCaching(modelScope) {
|
|
|
623
719
|
const model = nonEmpty(modelScope.wireModel)?.replace(SUPPORTS_MANAGED_PROMPT_CACHING_RE, "").toLowerCase();
|
|
624
720
|
return modelScope.upstreamProvider === "openai" && Boolean(model?.startsWith("gpt-5.6"));
|
|
625
721
|
}
|
|
626
|
-
function enforcePromptCacheEnvelope(payload, envelope, modelScope) {
|
|
722
|
+
function enforcePromptCacheEnvelope(payload, envelope, modelScope, promptCacheControl = "refuse") {
|
|
627
723
|
const model = nonEmpty(modelScope.wireModel)?.replace(SUPPORTS_MANAGED_PROMPT_CACHING_RE, "").toLowerCase();
|
|
628
724
|
const claudeCacheControlFamily = ["anthropic", "openrouter", "bedrock"].includes(modelScope.upstreamProvider) && model?.includes("claude");
|
|
629
725
|
if (claudeCacheControlFamily) {
|
|
630
726
|
if (envelope.allowPromptCaching) {
|
|
631
727
|
rejectManagedRequest("managed inference broker has no prompt cache policy for the leased model");
|
|
632
728
|
}
|
|
729
|
+
if (promptCacheControl === "strip")
|
|
730
|
+
deleteObjectKey(payload, "cache_control");
|
|
633
731
|
if (containsObjectKey(payload, "cache_control") || containsObjectKey(payload, "prompt_cache_breakpoint") || payload.prompt_cache_key != null || payload.prompt_cache_options != null || payload.prompt_cache_retention != null) {
|
|
634
732
|
rejectManagedRequest("managed inference broker denied prompt caching outside the lease envelope");
|
|
635
733
|
}
|
|
@@ -741,6 +839,7 @@ async function* responseBody(response, maxBytes, onComplete = () => {
|
|
|
741
839
|
INFERENCE_BROKER_HOST,
|
|
742
840
|
INFERENCE_BROKER_ORIGIN,
|
|
743
841
|
INFERENCE_BROKER_SOCKET_ENV,
|
|
842
|
+
LOOPBACK_BROKER_NO_PROXY_HOSTS,
|
|
744
843
|
MANAGED_PROMPT_CACHING_ENV,
|
|
745
844
|
MANAGED_SESSION_ENV,
|
|
746
845
|
MANAGED_STATUS_PATH,
|
|
@@ -750,5 +849,6 @@ async function* responseBody(response, maxBytes, onComplete = () => {
|
|
|
750
849
|
isGatewayCredential,
|
|
751
850
|
isManagedInferenceModelScope,
|
|
752
851
|
managedClientModelId,
|
|
852
|
+
noProxyEnvWithHosts,
|
|
753
853
|
startManagedInferenceBroker
|
|
754
854
|
});
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* ESM and CJS are both emitted because the daemon is ESM and the CLI is CJS, and
|
|
52
52
|
* this package exists precisely so both can host the broker.
|
|
53
53
|
*/
|
|
54
|
-
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, type ManagedSessionStatus, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, type GatewayCredential, type ManagedCapabilityRefresh, type ManagedCapabilityRefreshResult, type ManagedInferenceBrokerOptions, type ManagedInferenceBrokerSession, type ManagedInferenceInputTokenAccounting, type ManagedInferenceModelScope, type ManagedInferenceRequestEnvelope, type ManagedReasoningPolicy, } from './managed-inference-broker.js';
|
|
54
|
+
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, LOOPBACK_BROKER_NO_PROXY_HOSTS, noProxyEnvWithHosts, type ManagedSessionStatus, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, type GatewayCredential, type ManagedCapabilityRefresh, type ManagedCapabilityRefreshResult, type ManagedInferenceBrokerOptions, type ManagedInferenceBrokerSession, type ManagedInferenceBrokerTransport, type ManagedInferenceEndpoint, type ManagedInferenceLoopbackSession, type ManagedInferenceInputTokenAccounting, type ManagedInferenceModelScope, type ManagedInferenceRequestEnvelope, type ManagedReasoningPolicy, } from './managed-inference-broker.js';
|
|
55
55
|
export { minimumCapabilityWindowMs, scheduleRenewalDelay, startRenewalLoop, type CapabilityRefreshOutcome, type RenewalLoop, type RenewalLoopOptions, type RenewalOutcome, type RenewalStopReason, } from './managed-inference-renewal.js';
|
|
56
56
|
export { ModelProxyLoopbackServer, type ModelProxyForwarder } from './loopback-server.js';
|
|
57
57
|
export * from './contract.js';
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* ESM and CJS are both emitted because the daemon is ESM and the CLI is CJS, and
|
|
52
52
|
* this package exists precisely so both can host the broker.
|
|
53
53
|
*/
|
|
54
|
-
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, } from './managed-inference-broker.js';
|
|
54
|
+
export { INFERENCE_BROKER_ORIGIN, INFERENCE_BROKER_SOCKET_ENV, MANAGED_SESSION_ENV, MANAGED_PROMPT_CACHING_ENV, MANAGED_STATUS_PATH, INFERENCE_BROKER_HOST, inferenceBrokerNoProxyEnv, LOOPBACK_BROKER_NO_PROXY_HOSTS, noProxyEnvWithHosts, buildManagedInferenceRelayCredential, startManagedInferenceBroker, isManagedInferenceModelScope, } from './managed-inference-broker.js';
|
|
55
55
|
export { minimumCapabilityWindowMs, scheduleRenewalDelay, startRenewalLoop, } from './managed-inference-renewal.js';
|
|
56
56
|
export { ModelProxyLoopbackServer } from './loopback-server.js';
|
|
57
57
|
// Re-exported in full because `daemon/src/model-proxy/contract.ts` becomes a
|
|
@@ -117,6 +117,40 @@ export interface ManagedInferenceBrokerOptions {
|
|
|
117
117
|
fetchImpl?: FetchLike;
|
|
118
118
|
/** Trusted cross-uid group for a Dedicated Runtime harness child. */
|
|
119
119
|
socketGroupId?: number;
|
|
120
|
+
/**
|
|
121
|
+
* How the harness reaches the broker. `unix-socket` (the default) is a 0600
|
|
122
|
+
* socket the harness addresses through {@link INFERENCE_BROKER_SOCKET_ENV}.
|
|
123
|
+
* `loopback-tcp` is a 127.0.0.1 ephemeral port for a closed runtime that can
|
|
124
|
+
* only speak HTTP over TCP (the GitHub Copilot runtime); the bearer is then
|
|
125
|
+
* handed out only through {@link ManagedInferenceEndpoint.bearerToken} and is
|
|
126
|
+
* never written into `env`.
|
|
127
|
+
*/
|
|
128
|
+
transport?: ManagedInferenceBrokerTransport;
|
|
129
|
+
/**
|
|
130
|
+
* What a managed lease that does NOT allow prompt caching does with an
|
|
131
|
+
* Anthropic-dialect `cache_control` marker. `refuse` (the default) fails the
|
|
132
|
+
* request. `strip` removes the markers and forwards the request uncached,
|
|
133
|
+
* for a harness that always sends them and cannot be told not to (Claude
|
|
134
|
+
* Code, OSK-24457). Stripping can only lower what a request costs: a cache
|
|
135
|
+
* write is billed above an ordinary input token, an uncached read is not.
|
|
136
|
+
* Every other prompt-cache field is still refused, and a lease that ALLOWS
|
|
137
|
+
* caching for a Claude-family model is still refused (there is no policy for
|
|
138
|
+
* it yet), whichever value is set.
|
|
139
|
+
*/
|
|
140
|
+
promptCacheControl?: 'refuse' | 'strip';
|
|
141
|
+
}
|
|
142
|
+
export type ManagedInferenceBrokerTransport = 'unix-socket' | 'loopback-tcp';
|
|
143
|
+
/**
|
|
144
|
+
* A `loopback-tcp` broker's address. The bearer is a function rather than a
|
|
145
|
+
* value so it can be read per request (an SDK `bearerTokenProvider`) and stops
|
|
146
|
+
* authenticating anything once `stop()` has run.
|
|
147
|
+
*/
|
|
148
|
+
export interface ManagedInferenceEndpoint {
|
|
149
|
+
/** `http://127.0.0.1:<port>`, no path. */
|
|
150
|
+
readonly origin: string;
|
|
151
|
+
/** The lease's upstream dialect family, so a caller can pick the client wire. */
|
|
152
|
+
readonly upstreamProvider: ManagedInferenceModelScope['upstreamProvider'] | null;
|
|
153
|
+
bearerToken(): string;
|
|
120
154
|
}
|
|
121
155
|
export interface ManagedInferenceBrokerSession {
|
|
122
156
|
/** Safe-to-deliver child environment. It intentionally never includes the gateway key. */
|
|
@@ -133,6 +167,10 @@ export interface ManagedInferenceBrokerSession {
|
|
|
133
167
|
reasoningPolicy?: ManagedReasoningPolicy;
|
|
134
168
|
stop(): Promise<void>;
|
|
135
169
|
}
|
|
170
|
+
/** A `loopback-tcp` broker: no socket, and no bearer in `env`. */
|
|
171
|
+
export interface ManagedInferenceLoopbackSession extends Omit<ManagedInferenceBrokerSession, 'socketPath'> {
|
|
172
|
+
endpoint: ManagedInferenceEndpoint;
|
|
173
|
+
}
|
|
136
174
|
/**
|
|
137
175
|
* OSK-3893 — reserved local path the engine reads for its managed-session readout.
|
|
138
176
|
*
|
|
@@ -210,6 +248,20 @@ export declare function inferenceBrokerNoProxyEnv(env: Readonly<Record<string, s
|
|
|
210
248
|
NO_PROXY: string;
|
|
211
249
|
no_proxy: string;
|
|
212
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* The loopback hosts a `loopback-tcp` broker is reached on. A harness that
|
|
253
|
+
* honours HTTP(S)_PROXY would otherwise send its model traffic, relay token
|
|
254
|
+
* included, to the proxy instead of to this machine (OSK-24457).
|
|
255
|
+
*/
|
|
256
|
+
export declare const LOOPBACK_BROKER_NO_PROXY_HOSTS: readonly string[];
|
|
257
|
+
/**
|
|
258
|
+
* {@link inferenceBrokerNoProxyEnv} for any set of hosts: both spellings, each
|
|
259
|
+
* keeping its existing entries in order and gaining every missing host once.
|
|
260
|
+
*/
|
|
261
|
+
export declare function noProxyEnvWithHosts(env: Readonly<Record<string, string | undefined>>, hosts: readonly string[]): {
|
|
262
|
+
NO_PROXY: string;
|
|
263
|
+
no_proxy: string;
|
|
264
|
+
};
|
|
213
265
|
export declare const MANAGED_SESSION_ENV = "OVERSKY_MANAGED_SESSION";
|
|
214
266
|
export declare const MANAGED_PROMPT_CACHING_ENV = "OVERSKY_MANAGED_PROMPT_CACHING";
|
|
215
267
|
export declare function managedClientModelId(scope: ManagedInferenceModelScope): string;
|
|
@@ -238,7 +290,12 @@ export declare function buildManagedInferenceRelayCredential(credential: Gateway
|
|
|
238
290
|
* execution; a failure to do so becomes an auth failure rather than a
|
|
239
291
|
* direct-provider fallback.
|
|
240
292
|
*/
|
|
241
|
-
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions
|
|
293
|
+
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions & {
|
|
294
|
+
transport: 'loopback-tcp';
|
|
295
|
+
}): Promise<ManagedInferenceLoopbackSession>;
|
|
296
|
+
export declare function startManagedInferenceBroker(options: ManagedInferenceBrokerOptions & {
|
|
297
|
+
transport?: 'unix-socket';
|
|
298
|
+
}): Promise<ManagedInferenceBrokerSession>;
|
|
242
299
|
/**
|
|
243
300
|
* Classify a NON-OK lease renewal response.
|
|
244
301
|
*
|