@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
|
@@ -67,8 +67,17 @@ export declare const HARNESS_TIERS: Readonly<Record<string, HarnessTrustTier>>;
|
|
|
67
67
|
* including empty, whitespace-only, and non-string inputs. Unknown == untrusted.
|
|
68
68
|
*/
|
|
69
69
|
export declare function getHarnessTier(backendName: string): HarnessTrustTier;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* What a tier permits in terms of credential DELIVERY.
|
|
72
|
+
*
|
|
73
|
+
* There is no direct-key policy. Tier 1 used to be `direct-or-gateway`, which let
|
|
74
|
+
* the daemon hand a raw platform provider key to a Tier 1 harness, including an
|
|
75
|
+
* unsigned first-party build. OSK-24415 (unified inference design §7.5.7) deleted
|
|
76
|
+
* the server branch that sent such keys and this allowance with it, so Tier 1 and
|
|
77
|
+
* Tier 2 now receive the same thing. A tier still decides whether an
|
|
78
|
+
* operator-configured `auto` mode stands; it no longer decides how a key arrives.
|
|
79
|
+
*/
|
|
80
|
+
export type CredentialDeliveryPolicy = 'gateway-only' | 'byo-only';
|
|
72
81
|
export declare function credentialPolicyForTier(tier: HarnessTrustTier): CredentialDeliveryPolicy;
|
|
73
82
|
/** How a credential reaches a spawned harness. */
|
|
74
83
|
export type CredentialMode = 'direct-key' | 'gateway' | 'env-map' | 'none';
|
|
@@ -55,11 +55,7 @@ function getHarnessTier(backendName) {
|
|
|
55
55
|
return HARNESS_TIERS[key] ?? 3;
|
|
56
56
|
}
|
|
57
57
|
function credentialPolicyForTier(tier) {
|
|
58
|
-
|
|
59
|
-
return "direct-or-gateway";
|
|
60
|
-
if (tier === 2)
|
|
61
|
-
return "gateway-only";
|
|
62
|
-
return "byo-only";
|
|
58
|
+
return tier === 1 || tier === 2 ? "gateway-only" : "byo-only";
|
|
63
59
|
}
|
|
64
60
|
function tierPermitsConfiguredAutoMode(tier) {
|
|
65
61
|
return tier === 1;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which harnesses a daemon's inference broker carries a credential for, and in
|
|
3
|
+
* which shapes (OSK-24457, invariant I1: no cloud-reusable credential enters
|
|
4
|
+
* the harness process).
|
|
5
|
+
*
|
|
6
|
+
* Declared ONCE, here, because both ends of the wire act on it and the daemon
|
|
7
|
+
* cannot import the API (`@skrr-ai/auth-core/inference-broker-harnesses`):
|
|
8
|
+
*
|
|
9
|
+
* - The daemon's broker route (`daemon/src/connection-helpers/managed-inference-broker-route.ts`)
|
|
10
|
+
* has exactly one entry per harness listed here. Its spec drives every entry
|
|
11
|
+
* with every shape and checks that it brokers exactly the shapes listed, and
|
|
12
|
+
* refuses the rest before spawn.
|
|
13
|
+
* - The server (`api/server/services/ProviderCredentials/resolveProviderCredential.js`)
|
|
14
|
+
* sends a credential only in a shape the harness's entry carries, and only
|
|
15
|
+
* to a daemon that announces the entry (`announcedBy`) and the shape
|
|
16
|
+
* (`SHAPE_ANNOUNCED_BY`), apart from a capability still pending
|
|
17
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`). A `byok-local` descriptor
|
|
18
|
+
* carries no secret, so it is not gated: a daemon that cannot broker it
|
|
19
|
+
* never injects it either.
|
|
20
|
+
*
|
|
21
|
+
* A harness that is not listed is refused before spawn whenever its request
|
|
22
|
+
* carries a credential, so the server sends it none. It runs on its own
|
|
23
|
+
* sign-in, exactly as it would with no gateway configured.
|
|
24
|
+
*
|
|
25
|
+
* `platformMachine` marks the harnesses a platform-managed machine (a Dedicated
|
|
26
|
+
* Runtime, a space machine, a Hosted Machine) offers, which is exactly three
|
|
27
|
+
* (Q11, OSK-24466): Claude Code, Codex and the first-party harness. A listed
|
|
28
|
+
* harness can be one only because a platform machine has no sign-in of its own
|
|
29
|
+
* to fall back on: everything it runs reaches its model through this broker.
|
|
30
|
+
* The daemon on such a machine announces no other harness
|
|
31
|
+
* (`platformMachineCapabilities`, `daemon/src/managed-runtime-guest.ts`), and
|
|
32
|
+
* the server's harness registry (`packages/llm/harnesses/*.yaml`,
|
|
33
|
+
* `platform-machine: available`) is held to the same set by
|
|
34
|
+
* `api/server/services/Harness/__tests__/harnessSelection.spec.js`.
|
|
35
|
+
*
|
|
36
|
+
* Pure: no `node:` imports and nothing read at module load.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* A credential shape a session request can carry.
|
|
40
|
+
*
|
|
41
|
+
* - `managed-lease`: a `gateway-relay` credential bound to one model and one
|
|
42
|
+
* harness (`managedInference: true`), redeemed through the session relay.
|
|
43
|
+
* - `gateway`: a compatibility-mode grant (`source: 'gateway'`), the metering
|
|
44
|
+
* gateway's base URL plus a scoped virtual key.
|
|
45
|
+
* - `byok-local`: a non-secret descriptor of the person's own key, redeemed
|
|
46
|
+
* from the machine's keychain.
|
|
47
|
+
*/
|
|
48
|
+
export type InferenceBrokerCredentialShape = 'managed-lease' | 'gateway' | 'byok-local';
|
|
49
|
+
export declare const INFERENCE_BROKER_CREDENTIAL_SHAPES: readonly InferenceBrokerCredentialShape[];
|
|
50
|
+
/**
|
|
51
|
+
* Announced by a daemon whose broker route carries the Claude Code and Codex
|
|
52
|
+
* credentials (OSK-24457). An older daemon put a gateway grant for either into
|
|
53
|
+
* the harness's environment (`ANTHROPIC_AUTH_TOKEN`, the Codex provider key),
|
|
54
|
+
* so the server sends such a daemon none.
|
|
55
|
+
*/
|
|
56
|
+
export declare const HARNESS_CREDENTIAL_BROKER_CAPABILITY = "harness_credential_broker_v1";
|
|
57
|
+
/**
|
|
58
|
+
* Announced by a daemon whose broker route carries the first-party harness's
|
|
59
|
+
* credentials and puts none into its environment (OSK-24515). An older daemon
|
|
60
|
+
* put the grant into the harness's environment. Pending until contract
|
|
61
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon is still sent one.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY = "first_party_harness_credential_broker_v1";
|
|
64
|
+
/**
|
|
65
|
+
* Announced by a daemon whose broker route carries a managed pi lease
|
|
66
|
+
* (OSK-24468): the daemon starts pi in RPC mode against a private provider
|
|
67
|
+
* that points at its loopback broker, and routes every tool call through its
|
|
68
|
+
* own permission authority. A daemon without it refuses a pi request that
|
|
69
|
+
* carries any credential, so the server sends such a daemon none.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PI_CREDENTIAL_BROKER_CAPABILITY = "pi_credential_broker_v1";
|
|
72
|
+
/**
|
|
73
|
+
* Announced by a daemon whose broker redeems a managed lease with a session
|
|
74
|
+
* token of its own, minted for `INFERENCE_RELAY_AUDIENCE` (OSK-24515). An older
|
|
75
|
+
* daemon's broker forwarded the token the harness itself holds
|
|
76
|
+
* (`OVERSKY_SESSION_TOKEN`), which the relay stops honouring at contract.
|
|
77
|
+
* Pending until then (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon
|
|
78
|
+
* is still admitted a lease.
|
|
79
|
+
*/
|
|
80
|
+
export declare const MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY = "managed_inference_broker_token_v1";
|
|
81
|
+
/**
|
|
82
|
+
* The audience of the session token a broker redeems at the inference relay
|
|
83
|
+
* (`/api/agentic/sessions/:id/inference/*`). A token minted with it is refused
|
|
84
|
+
* everywhere else. Once the relay takes only this audience (the contract half
|
|
85
|
+
* of OSK-24515), the token a harness holds for `skrr` and its tool callbacks is
|
|
86
|
+
* refused there, so a harness that can read its own environment holds nothing
|
|
87
|
+
* it can spend inference with (invariant I1). Until then the relay takes both
|
|
88
|
+
* and logs `inference_relay_session_audience` for the older one.
|
|
89
|
+
*/
|
|
90
|
+
export declare const INFERENCE_RELAY_AUDIENCE = "inference";
|
|
91
|
+
/** The audience of a session token minted without one: every route but the inference relay's. */
|
|
92
|
+
export declare const SESSION_TOKEN_AUDIENCE = "session";
|
|
93
|
+
export interface InferenceBrokerHarness {
|
|
94
|
+
/** Canonical provider spelling. */
|
|
95
|
+
readonly provider: string;
|
|
96
|
+
/** The shapes the harness's broker entry carries. Every other shape is refused before spawn. */
|
|
97
|
+
readonly carries: readonly InferenceBrokerCredentialShape[];
|
|
98
|
+
/**
|
|
99
|
+
* The capability a daemon announces when its route has this entry, or null
|
|
100
|
+
* when every daemon that can run the harness already brokers it (the Copilot
|
|
101
|
+
* SDK's lease-only broker predates OSK-24457).
|
|
102
|
+
*/
|
|
103
|
+
readonly announcedBy: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Whether a platform-managed machine offers this harness: its image installs
|
|
106
|
+
* it at a pinned version, it starts as the tenant uid through the guest's
|
|
107
|
+
* setuid wrapper, and it reaches its model only through this broker.
|
|
108
|
+
*/
|
|
109
|
+
readonly platformMachine: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare const INFERENCE_BROKER_HARNESSES: readonly InferenceBrokerHarness[];
|
|
112
|
+
/**
|
|
113
|
+
* The canonical providers a platform-managed machine offers, in registry order:
|
|
114
|
+
* the first-party harness, Claude Code and Codex. Every other harness is
|
|
115
|
+
* neither announced by such a machine's daemon nor admitted by the server.
|
|
116
|
+
*/
|
|
117
|
+
export declare const PLATFORM_MACHINE_HARNESS_PROVIDERS: readonly string[];
|
|
118
|
+
/**
|
|
119
|
+
* Whether a platform-managed machine offers the harness a provider name
|
|
120
|
+
* denotes. Matches the first-party harness in every accepted spelling, like
|
|
121
|
+
* `inferenceBrokerHarness`; false for anything unlisted or unreadable.
|
|
122
|
+
*/
|
|
123
|
+
export declare function isPlatformMachineHarness(provider: unknown): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The listed harness for a provider name, or null. The first-party harness is
|
|
126
|
+
* matched in every accepted spelling and never in a former one, which no entry
|
|
127
|
+
* owns; every other name must be canonical already.
|
|
128
|
+
*/
|
|
129
|
+
export declare function inferenceBrokerHarness(provider: unknown): InferenceBrokerHarness | null;
|
|
130
|
+
/**
|
|
131
|
+
* Capabilities a current daemon announces that the server does not REQUIRE
|
|
132
|
+
* yet: the expand half of OSK-24515. Daemon and CLI releases ship from `main`
|
|
133
|
+
* while the server ships from `beta` at promotion, so no release order makes
|
|
134
|
+
* the clients arrive first, and a daemon already in the field (a platform
|
|
135
|
+
* machine's image pins one) would otherwise lose a credential it uses today.
|
|
136
|
+
* A daemon that lacks one is served exactly as before the capability existed,
|
|
137
|
+
* and the server logs `inference_grant_legacy_daemon` (`inferenceBrokerPendingGaps`)
|
|
138
|
+
* so the fleet's adoption can be counted.
|
|
139
|
+
*
|
|
140
|
+
* The contract change empties this list, after which `inferenceBrokerCarries`
|
|
141
|
+
* requires every capability. Its merge criterion is in
|
|
142
|
+
* `docs/architecture/managed-inference-execution-shapes-2026-08-12.md` §15.
|
|
143
|
+
*/
|
|
144
|
+
export declare const INFERENCE_BROKER_PENDING_CAPABILITIES: readonly string[];
|
|
145
|
+
/**
|
|
146
|
+
* Whether a daemon announcing `announced` brokers a credential of `shape` for
|
|
147
|
+
* `provider`. False for an unlisted harness, for a shape its entry does not
|
|
148
|
+
* carry, and for a daemon that does not announce a required capability of the
|
|
149
|
+
* entry or the shape. A pending capability is not required yet
|
|
150
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`). An absent or unreadable capability
|
|
151
|
+
* list announces nothing.
|
|
152
|
+
*/
|
|
153
|
+
export declare function inferenceBrokerCarries(provider: unknown, shape: InferenceBrokerCredentialShape, announced: readonly unknown[] | null | undefined): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* The pending capabilities a daemon announcing `announced` lacks for `shape` of
|
|
156
|
+
* `provider`: the reasons contract will refuse what expand still serves. Empty
|
|
157
|
+
* when the daemon announces them all, and when the harness or the shape is
|
|
158
|
+
* never carried (refused already, so nothing changes at contract).
|
|
159
|
+
*/
|
|
160
|
+
export declare function inferenceBrokerPendingGaps(provider: unknown, shape: InferenceBrokerCredentialShape, announced: readonly unknown[] | null | undefined): string[];
|
|
161
|
+
/**
|
|
162
|
+
* Every capability the server sends a credential by, for the daemon to announce
|
|
163
|
+
* and the server's register guard to keep (`registerGuards.scopeAnnouncedCapabilities`).
|
|
164
|
+
*/
|
|
165
|
+
export declare const INFERENCE_BROKER_CAPABILITIES: readonly string[];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var inferenceBrokerHarnesses_exports = {};
|
|
20
|
+
__export(inferenceBrokerHarnesses_exports, {
|
|
21
|
+
FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY: () => FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY,
|
|
22
|
+
HARNESS_CREDENTIAL_BROKER_CAPABILITY: () => HARNESS_CREDENTIAL_BROKER_CAPABILITY,
|
|
23
|
+
INFERENCE_BROKER_CAPABILITIES: () => INFERENCE_BROKER_CAPABILITIES,
|
|
24
|
+
INFERENCE_BROKER_CREDENTIAL_SHAPES: () => INFERENCE_BROKER_CREDENTIAL_SHAPES,
|
|
25
|
+
INFERENCE_BROKER_HARNESSES: () => INFERENCE_BROKER_HARNESSES,
|
|
26
|
+
INFERENCE_BROKER_PENDING_CAPABILITIES: () => INFERENCE_BROKER_PENDING_CAPABILITIES,
|
|
27
|
+
INFERENCE_RELAY_AUDIENCE: () => INFERENCE_RELAY_AUDIENCE,
|
|
28
|
+
MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY: () => MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY,
|
|
29
|
+
PI_CREDENTIAL_BROKER_CAPABILITY: () => PI_CREDENTIAL_BROKER_CAPABILITY,
|
|
30
|
+
PLATFORM_MACHINE_HARNESS_PROVIDERS: () => PLATFORM_MACHINE_HARNESS_PROVIDERS,
|
|
31
|
+
SESSION_TOKEN_AUDIENCE: () => SESSION_TOKEN_AUDIENCE,
|
|
32
|
+
inferenceBrokerCarries: () => inferenceBrokerCarries,
|
|
33
|
+
inferenceBrokerHarness: () => inferenceBrokerHarness,
|
|
34
|
+
inferenceBrokerPendingGaps: () => inferenceBrokerPendingGaps,
|
|
35
|
+
isPlatformMachineHarness: () => isPlatformMachineHarness
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(inferenceBrokerHarnesses_exports);
|
|
38
|
+
var import_firstPartyHarness = require("./firstPartyHarness.js");
|
|
39
|
+
const INFERENCE_BROKER_CREDENTIAL_SHAPES = Object.freeze(["managed-lease", "gateway", "byok-local"]);
|
|
40
|
+
const HARNESS_CREDENTIAL_BROKER_CAPABILITY = "harness_credential_broker_v1";
|
|
41
|
+
const FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY = "first_party_harness_credential_broker_v1";
|
|
42
|
+
const PI_CREDENTIAL_BROKER_CAPABILITY = "pi_credential_broker_v1";
|
|
43
|
+
const MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY = "managed_inference_broker_token_v1";
|
|
44
|
+
const INFERENCE_RELAY_AUDIENCE = "inference";
|
|
45
|
+
const SESSION_TOKEN_AUDIENCE = "session";
|
|
46
|
+
const SHAPE_ANNOUNCED_BY = Object.freeze({ "managed-lease": MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY });
|
|
47
|
+
function harness(provider, carries, announcedBy, { platformMachine }) {
|
|
48
|
+
return Object.freeze({
|
|
49
|
+
provider,
|
|
50
|
+
carries: Object.freeze([...carries]),
|
|
51
|
+
announcedBy,
|
|
52
|
+
platformMachine
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const INFERENCE_BROKER_HARNESSES = Object.freeze([
|
|
56
|
+
harness(import_firstPartyHarness.FIRST_PARTY_HARNESS_PROVIDER, ["managed-lease", "gateway", "byok-local"], FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY, { platformMachine: true }),
|
|
57
|
+
harness("claude", ["managed-lease", "gateway"], HARNESS_CREDENTIAL_BROKER_CAPABILITY, {
|
|
58
|
+
platformMachine: true
|
|
59
|
+
}),
|
|
60
|
+
harness("codex", ["managed-lease", "gateway"], HARNESS_CREDENTIAL_BROKER_CAPABILITY, {
|
|
61
|
+
platformMachine: true
|
|
62
|
+
}),
|
|
63
|
+
// The Copilot SDK broker takes platform credits only as a managed lease. No
|
|
64
|
+
// platform machine image bakes its runtime; its placement there is still
|
|
65
|
+
// being evaluated (`packages/llm/harnesses/copilot-sdk.yaml`).
|
|
66
|
+
harness("copilot-sdk", ["managed-lease"], null, { platformMachine: false }),
|
|
67
|
+
// pi takes platform credits only as a managed lease, through the daemon's
|
|
68
|
+
// loopback broker (OSK-24468). Not yet offered on a platform machine: the
|
|
69
|
+
// image bakes it at its pin (`guest-harness-pins.json`), but its registry
|
|
70
|
+
// placement there is still `evaluating` (`packages/llm/harnesses/pi.yaml`),
|
|
71
|
+
// and a baked binary is not an admission.
|
|
72
|
+
harness("pi", ["managed-lease"], PI_CREDENTIAL_BROKER_CAPABILITY, { platformMachine: false })
|
|
73
|
+
]);
|
|
74
|
+
const PLATFORM_MACHINE_HARNESS_PROVIDERS = Object.freeze(INFERENCE_BROKER_HARNESSES.filter((entry) => entry.platformMachine).map((entry) => entry.provider));
|
|
75
|
+
function isPlatformMachineHarness(provider) {
|
|
76
|
+
return inferenceBrokerHarness(provider)?.platformMachine === true;
|
|
77
|
+
}
|
|
78
|
+
function inferenceBrokerHarness(provider) {
|
|
79
|
+
if (typeof provider !== "string" || !provider)
|
|
80
|
+
return null;
|
|
81
|
+
const canonical = (0, import_firstPartyHarness.canonicalHarnessProvider)(provider);
|
|
82
|
+
return INFERENCE_BROKER_HARNESSES.find((entry) => entry.provider === canonical) ?? null;
|
|
83
|
+
}
|
|
84
|
+
const INFERENCE_BROKER_PENDING_CAPABILITIES = Object.freeze([
|
|
85
|
+
FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY,
|
|
86
|
+
MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY
|
|
87
|
+
]);
|
|
88
|
+
function announcedCapabilitiesFor(provider, shape) {
|
|
89
|
+
const entry = inferenceBrokerHarness(provider);
|
|
90
|
+
if (!entry || !entry.carries.includes(shape))
|
|
91
|
+
return null;
|
|
92
|
+
return [entry.announcedBy, SHAPE_ANNOUNCED_BY[shape]].filter((capability) => typeof capability === "string");
|
|
93
|
+
}
|
|
94
|
+
function announces(announced, capability) {
|
|
95
|
+
return Array.isArray(announced) && announced.includes(capability);
|
|
96
|
+
}
|
|
97
|
+
function inferenceBrokerCarries(provider, shape, announced) {
|
|
98
|
+
const capabilities = announcedCapabilitiesFor(provider, shape);
|
|
99
|
+
if (!capabilities)
|
|
100
|
+
return false;
|
|
101
|
+
return capabilities.filter((capability) => !INFERENCE_BROKER_PENDING_CAPABILITIES.includes(capability)).every((capability) => announces(announced, capability));
|
|
102
|
+
}
|
|
103
|
+
function inferenceBrokerPendingGaps(provider, shape, announced) {
|
|
104
|
+
const capabilities = announcedCapabilitiesFor(provider, shape);
|
|
105
|
+
if (!capabilities)
|
|
106
|
+
return [];
|
|
107
|
+
return capabilities.filter((capability) => INFERENCE_BROKER_PENDING_CAPABILITIES.includes(capability) && !announces(announced, capability));
|
|
108
|
+
}
|
|
109
|
+
const INFERENCE_BROKER_CAPABILITIES = Object.freeze([
|
|
110
|
+
...new Set([
|
|
111
|
+
...INFERENCE_BROKER_HARNESSES.map((entry) => entry.announcedBy),
|
|
112
|
+
...Object.values(SHAPE_ANNOUNCED_BY)
|
|
113
|
+
].filter((capability) => typeof capability === "string"))
|
|
114
|
+
]);
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY,
|
|
118
|
+
HARNESS_CREDENTIAL_BROKER_CAPABILITY,
|
|
119
|
+
INFERENCE_BROKER_CAPABILITIES,
|
|
120
|
+
INFERENCE_BROKER_CREDENTIAL_SHAPES,
|
|
121
|
+
INFERENCE_BROKER_HARNESSES,
|
|
122
|
+
INFERENCE_BROKER_PENDING_CAPABILITIES,
|
|
123
|
+
INFERENCE_RELAY_AUDIENCE,
|
|
124
|
+
MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY,
|
|
125
|
+
PI_CREDENTIAL_BROKER_CAPABILITY,
|
|
126
|
+
PLATFORM_MACHINE_HARNESS_PROVIDERS,
|
|
127
|
+
SESSION_TOKEN_AUDIENCE,
|
|
128
|
+
inferenceBrokerCarries,
|
|
129
|
+
inferenceBrokerHarness,
|
|
130
|
+
inferenceBrokerPendingGaps,
|
|
131
|
+
isPlatformMachineHarness
|
|
132
|
+
});
|
|
@@ -67,8 +67,17 @@ export declare const HARNESS_TIERS: Readonly<Record<string, HarnessTrustTier>>;
|
|
|
67
67
|
* including empty, whitespace-only, and non-string inputs. Unknown == untrusted.
|
|
68
68
|
*/
|
|
69
69
|
export declare function getHarnessTier(backendName: string): HarnessTrustTier;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* What a tier permits in terms of credential DELIVERY.
|
|
72
|
+
*
|
|
73
|
+
* There is no direct-key policy. Tier 1 used to be `direct-or-gateway`, which let
|
|
74
|
+
* the daemon hand a raw platform provider key to a Tier 1 harness, including an
|
|
75
|
+
* unsigned first-party build. OSK-24415 (unified inference design §7.5.7) deleted
|
|
76
|
+
* the server branch that sent such keys and this allowance with it, so Tier 1 and
|
|
77
|
+
* Tier 2 now receive the same thing. A tier still decides whether an
|
|
78
|
+
* operator-configured `auto` mode stands; it no longer decides how a key arrives.
|
|
79
|
+
*/
|
|
80
|
+
export type CredentialDeliveryPolicy = 'gateway-only' | 'byo-only';
|
|
72
81
|
export declare function credentialPolicyForTier(tier: HarnessTrustTier): CredentialDeliveryPolicy;
|
|
73
82
|
/** How a credential reaches a spawned harness. */
|
|
74
83
|
export type CredentialMode = 'direct-key' | 'gateway' | 'env-map' | 'none';
|
|
@@ -94,11 +94,7 @@ export function getHarnessTier(backendName) {
|
|
|
94
94
|
return HARNESS_TIERS[key] ?? 3;
|
|
95
95
|
}
|
|
96
96
|
export function credentialPolicyForTier(tier) {
|
|
97
|
-
|
|
98
|
-
return 'direct-or-gateway';
|
|
99
|
-
if (tier === 2)
|
|
100
|
-
return 'gateway-only';
|
|
101
|
-
return 'byo-only';
|
|
97
|
+
return tier === 1 || tier === 2 ? 'gateway-only' : 'byo-only';
|
|
102
98
|
}
|
|
103
99
|
/**
|
|
104
100
|
* May an operator-configured `auto` permission mode SURVIVE for this tier?
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which harnesses a daemon's inference broker carries a credential for, and in
|
|
3
|
+
* which shapes (OSK-24457, invariant I1: no cloud-reusable credential enters
|
|
4
|
+
* the harness process).
|
|
5
|
+
*
|
|
6
|
+
* Declared ONCE, here, because both ends of the wire act on it and the daemon
|
|
7
|
+
* cannot import the API (`@skrr-ai/auth-core/inference-broker-harnesses`):
|
|
8
|
+
*
|
|
9
|
+
* - The daemon's broker route (`daemon/src/connection-helpers/managed-inference-broker-route.ts`)
|
|
10
|
+
* has exactly one entry per harness listed here. Its spec drives every entry
|
|
11
|
+
* with every shape and checks that it brokers exactly the shapes listed, and
|
|
12
|
+
* refuses the rest before spawn.
|
|
13
|
+
* - The server (`api/server/services/ProviderCredentials/resolveProviderCredential.js`)
|
|
14
|
+
* sends a credential only in a shape the harness's entry carries, and only
|
|
15
|
+
* to a daemon that announces the entry (`announcedBy`) and the shape
|
|
16
|
+
* (`SHAPE_ANNOUNCED_BY`), apart from a capability still pending
|
|
17
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`). A `byok-local` descriptor
|
|
18
|
+
* carries no secret, so it is not gated: a daemon that cannot broker it
|
|
19
|
+
* never injects it either.
|
|
20
|
+
*
|
|
21
|
+
* A harness that is not listed is refused before spawn whenever its request
|
|
22
|
+
* carries a credential, so the server sends it none. It runs on its own
|
|
23
|
+
* sign-in, exactly as it would with no gateway configured.
|
|
24
|
+
*
|
|
25
|
+
* `platformMachine` marks the harnesses a platform-managed machine (a Dedicated
|
|
26
|
+
* Runtime, a space machine, a Hosted Machine) offers, which is exactly three
|
|
27
|
+
* (Q11, OSK-24466): Claude Code, Codex and the first-party harness. A listed
|
|
28
|
+
* harness can be one only because a platform machine has no sign-in of its own
|
|
29
|
+
* to fall back on: everything it runs reaches its model through this broker.
|
|
30
|
+
* The daemon on such a machine announces no other harness
|
|
31
|
+
* (`platformMachineCapabilities`, `daemon/src/managed-runtime-guest.ts`), and
|
|
32
|
+
* the server's harness registry (`packages/llm/harnesses/*.yaml`,
|
|
33
|
+
* `platform-machine: available`) is held to the same set by
|
|
34
|
+
* `api/server/services/Harness/__tests__/harnessSelection.spec.js`.
|
|
35
|
+
*
|
|
36
|
+
* Pure: no `node:` imports and nothing read at module load.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* A credential shape a session request can carry.
|
|
40
|
+
*
|
|
41
|
+
* - `managed-lease`: a `gateway-relay` credential bound to one model and one
|
|
42
|
+
* harness (`managedInference: true`), redeemed through the session relay.
|
|
43
|
+
* - `gateway`: a compatibility-mode grant (`source: 'gateway'`), the metering
|
|
44
|
+
* gateway's base URL plus a scoped virtual key.
|
|
45
|
+
* - `byok-local`: a non-secret descriptor of the person's own key, redeemed
|
|
46
|
+
* from the machine's keychain.
|
|
47
|
+
*/
|
|
48
|
+
export type InferenceBrokerCredentialShape = 'managed-lease' | 'gateway' | 'byok-local';
|
|
49
|
+
export declare const INFERENCE_BROKER_CREDENTIAL_SHAPES: readonly InferenceBrokerCredentialShape[];
|
|
50
|
+
/**
|
|
51
|
+
* Announced by a daemon whose broker route carries the Claude Code and Codex
|
|
52
|
+
* credentials (OSK-24457). An older daemon put a gateway grant for either into
|
|
53
|
+
* the harness's environment (`ANTHROPIC_AUTH_TOKEN`, the Codex provider key),
|
|
54
|
+
* so the server sends such a daemon none.
|
|
55
|
+
*/
|
|
56
|
+
export declare const HARNESS_CREDENTIAL_BROKER_CAPABILITY = "harness_credential_broker_v1";
|
|
57
|
+
/**
|
|
58
|
+
* Announced by a daemon whose broker route carries the first-party harness's
|
|
59
|
+
* credentials and puts none into its environment (OSK-24515). An older daemon
|
|
60
|
+
* put the grant into the harness's environment. Pending until contract
|
|
61
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon is still sent one.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY = "first_party_harness_credential_broker_v1";
|
|
64
|
+
/**
|
|
65
|
+
* Announced by a daemon whose broker route carries a managed pi lease
|
|
66
|
+
* (OSK-24468): the daemon starts pi in RPC mode against a private provider
|
|
67
|
+
* that points at its loopback broker, and routes every tool call through its
|
|
68
|
+
* own permission authority. A daemon without it refuses a pi request that
|
|
69
|
+
* carries any credential, so the server sends such a daemon none.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PI_CREDENTIAL_BROKER_CAPABILITY = "pi_credential_broker_v1";
|
|
72
|
+
/**
|
|
73
|
+
* Announced by a daemon whose broker redeems a managed lease with a session
|
|
74
|
+
* token of its own, minted for `INFERENCE_RELAY_AUDIENCE` (OSK-24515). An older
|
|
75
|
+
* daemon's broker forwarded the token the harness itself holds
|
|
76
|
+
* (`OVERSKY_SESSION_TOKEN`), which the relay stops honouring at contract.
|
|
77
|
+
* Pending until then (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon
|
|
78
|
+
* is still admitted a lease.
|
|
79
|
+
*/
|
|
80
|
+
export declare const MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY = "managed_inference_broker_token_v1";
|
|
81
|
+
/**
|
|
82
|
+
* The audience of the session token a broker redeems at the inference relay
|
|
83
|
+
* (`/api/agentic/sessions/:id/inference/*`). A token minted with it is refused
|
|
84
|
+
* everywhere else. Once the relay takes only this audience (the contract half
|
|
85
|
+
* of OSK-24515), the token a harness holds for `skrr` and its tool callbacks is
|
|
86
|
+
* refused there, so a harness that can read its own environment holds nothing
|
|
87
|
+
* it can spend inference with (invariant I1). Until then the relay takes both
|
|
88
|
+
* and logs `inference_relay_session_audience` for the older one.
|
|
89
|
+
*/
|
|
90
|
+
export declare const INFERENCE_RELAY_AUDIENCE = "inference";
|
|
91
|
+
/** The audience of a session token minted without one: every route but the inference relay's. */
|
|
92
|
+
export declare const SESSION_TOKEN_AUDIENCE = "session";
|
|
93
|
+
export interface InferenceBrokerHarness {
|
|
94
|
+
/** Canonical provider spelling. */
|
|
95
|
+
readonly provider: string;
|
|
96
|
+
/** The shapes the harness's broker entry carries. Every other shape is refused before spawn. */
|
|
97
|
+
readonly carries: readonly InferenceBrokerCredentialShape[];
|
|
98
|
+
/**
|
|
99
|
+
* The capability a daemon announces when its route has this entry, or null
|
|
100
|
+
* when every daemon that can run the harness already brokers it (the Copilot
|
|
101
|
+
* SDK's lease-only broker predates OSK-24457).
|
|
102
|
+
*/
|
|
103
|
+
readonly announcedBy: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Whether a platform-managed machine offers this harness: its image installs
|
|
106
|
+
* it at a pinned version, it starts as the tenant uid through the guest's
|
|
107
|
+
* setuid wrapper, and it reaches its model only through this broker.
|
|
108
|
+
*/
|
|
109
|
+
readonly platformMachine: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare const INFERENCE_BROKER_HARNESSES: readonly InferenceBrokerHarness[];
|
|
112
|
+
/**
|
|
113
|
+
* The canonical providers a platform-managed machine offers, in registry order:
|
|
114
|
+
* the first-party harness, Claude Code and Codex. Every other harness is
|
|
115
|
+
* neither announced by such a machine's daemon nor admitted by the server.
|
|
116
|
+
*/
|
|
117
|
+
export declare const PLATFORM_MACHINE_HARNESS_PROVIDERS: readonly string[];
|
|
118
|
+
/**
|
|
119
|
+
* Whether a platform-managed machine offers the harness a provider name
|
|
120
|
+
* denotes. Matches the first-party harness in every accepted spelling, like
|
|
121
|
+
* `inferenceBrokerHarness`; false for anything unlisted or unreadable.
|
|
122
|
+
*/
|
|
123
|
+
export declare function isPlatformMachineHarness(provider: unknown): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The listed harness for a provider name, or null. The first-party harness is
|
|
126
|
+
* matched in every accepted spelling and never in a former one, which no entry
|
|
127
|
+
* owns; every other name must be canonical already.
|
|
128
|
+
*/
|
|
129
|
+
export declare function inferenceBrokerHarness(provider: unknown): InferenceBrokerHarness | null;
|
|
130
|
+
/**
|
|
131
|
+
* Capabilities a current daemon announces that the server does not REQUIRE
|
|
132
|
+
* yet: the expand half of OSK-24515. Daemon and CLI releases ship from `main`
|
|
133
|
+
* while the server ships from `beta` at promotion, so no release order makes
|
|
134
|
+
* the clients arrive first, and a daemon already in the field (a platform
|
|
135
|
+
* machine's image pins one) would otherwise lose a credential it uses today.
|
|
136
|
+
* A daemon that lacks one is served exactly as before the capability existed,
|
|
137
|
+
* and the server logs `inference_grant_legacy_daemon` (`inferenceBrokerPendingGaps`)
|
|
138
|
+
* so the fleet's adoption can be counted.
|
|
139
|
+
*
|
|
140
|
+
* The contract change empties this list, after which `inferenceBrokerCarries`
|
|
141
|
+
* requires every capability. Its merge criterion is in
|
|
142
|
+
* `docs/architecture/managed-inference-execution-shapes-2026-08-12.md` §15.
|
|
143
|
+
*/
|
|
144
|
+
export declare const INFERENCE_BROKER_PENDING_CAPABILITIES: readonly string[];
|
|
145
|
+
/**
|
|
146
|
+
* Whether a daemon announcing `announced` brokers a credential of `shape` for
|
|
147
|
+
* `provider`. False for an unlisted harness, for a shape its entry does not
|
|
148
|
+
* carry, and for a daemon that does not announce a required capability of the
|
|
149
|
+
* entry or the shape. A pending capability is not required yet
|
|
150
|
+
* (`INFERENCE_BROKER_PENDING_CAPABILITIES`). An absent or unreadable capability
|
|
151
|
+
* list announces nothing.
|
|
152
|
+
*/
|
|
153
|
+
export declare function inferenceBrokerCarries(provider: unknown, shape: InferenceBrokerCredentialShape, announced: readonly unknown[] | null | undefined): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* The pending capabilities a daemon announcing `announced` lacks for `shape` of
|
|
156
|
+
* `provider`: the reasons contract will refuse what expand still serves. Empty
|
|
157
|
+
* when the daemon announces them all, and when the harness or the shape is
|
|
158
|
+
* never carried (refused already, so nothing changes at contract).
|
|
159
|
+
*/
|
|
160
|
+
export declare function inferenceBrokerPendingGaps(provider: unknown, shape: InferenceBrokerCredentialShape, announced: readonly unknown[] | null | undefined): string[];
|
|
161
|
+
/**
|
|
162
|
+
* Every capability the server sends a credential by, for the daemon to announce
|
|
163
|
+
* and the server's register guard to keep (`registerGuards.scopeAnnouncedCapabilities`).
|
|
164
|
+
*/
|
|
165
|
+
export declare const INFERENCE_BROKER_CAPABILITIES: readonly string[];
|