@skrr-ai/cli 0.1.170 → 0.1.172

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.
Files changed (46) hide show
  1. package/dist/commands/agents/always-on/recovery-close.d.ts +4 -0
  2. package/dist/commands/agents/always-on/recovery-close.js +5 -1
  3. package/dist/commands/agents/always-on/recovery-review.js +29 -2
  4. package/dist/commands/harnesses/models.d.ts +12 -0
  5. package/dist/commands/harnesses/models.js +14 -2
  6. package/dist/commands/harnesses/rollouts/grant.d.ts +21 -0
  7. package/dist/commands/harnesses/rollouts/grant.js +56 -0
  8. package/dist/commands/harnesses/rollouts/list.d.ts +24 -0
  9. package/dist/commands/harnesses/rollouts/list.js +87 -0
  10. package/dist/commands/harnesses/rollouts/revoke.d.ts +22 -0
  11. package/dist/commands/harnesses/rollouts/revoke.js +56 -0
  12. package/dist/commands/machines/hosted/exec.d.ts +19 -0
  13. package/dist/commands/machines/hosted/exec.js +59 -5
  14. package/dist/commands/machines/hosted/list.js +8 -1
  15. package/dist/commands/machines/hosted/start.js +10 -1
  16. package/dist/lib/first-party-harness-broker.js +6 -0
  17. package/dist/lib/harness-tiers.d.ts +6 -4
  18. package/dist/lib/harness-tiers.js +12 -10
  19. package/dist/lib/hosted-machines.d.ts +13 -0
  20. package/dist/lib/hosted-machines.js +34 -1
  21. package/dist/lib/provider-rollouts.d.ts +58 -0
  22. package/dist/lib/provider-rollouts.js +23 -0
  23. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.cjs +8 -0
  24. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.d.cts +23 -0
  25. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +2381 -0
  26. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +11 -2
  27. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +1 -5
  28. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.d.ts +165 -0
  29. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.js +132 -0
  30. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +11 -2
  31. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +1 -5
  32. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.d.ts +165 -0
  33. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.js +203 -0
  34. package/dist/node_modules/@skrr-ai/auth-core/package.json +14 -0
  35. package/dist/node_modules/@skrr-ai/data-provider/index.js +11600 -11591
  36. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +1 -1
  37. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +4 -0
  38. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +58 -1
  39. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +171 -61
  40. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +1 -1
  41. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +1 -1
  42. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +58 -1
  43. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +217 -88
  44. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  45. package/oclif.manifest.json +298 -5
  46. package/package.json +5 -2
@@ -0,0 +1,203 @@
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
+ import { FIRST_PARTY_HARNESS_PROVIDER, canonicalHarnessProvider } from './firstPartyHarness.js';
39
+ export const INFERENCE_BROKER_CREDENTIAL_SHAPES = Object.freeze(['managed-lease', 'gateway', 'byok-local']);
40
+ /**
41
+ * Announced by a daemon whose broker route carries the Claude Code and Codex
42
+ * credentials (OSK-24457). An older daemon put a gateway grant for either into
43
+ * the harness's environment (`ANTHROPIC_AUTH_TOKEN`, the Codex provider key),
44
+ * so the server sends such a daemon none.
45
+ */
46
+ export const HARNESS_CREDENTIAL_BROKER_CAPABILITY = 'harness_credential_broker_v1';
47
+ /**
48
+ * Announced by a daemon whose broker route carries the first-party harness's
49
+ * credentials and puts none into its environment (OSK-24515). An older daemon
50
+ * put the grant into the harness's environment. Pending until contract
51
+ * (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon is still sent one.
52
+ */
53
+ export const FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY = 'first_party_harness_credential_broker_v1';
54
+ /**
55
+ * Announced by a daemon whose broker route carries a managed pi lease
56
+ * (OSK-24468): the daemon starts pi in RPC mode against a private provider
57
+ * that points at its loopback broker, and routes every tool call through its
58
+ * own permission authority. A daemon without it refuses a pi request that
59
+ * carries any credential, so the server sends such a daemon none.
60
+ */
61
+ export const PI_CREDENTIAL_BROKER_CAPABILITY = 'pi_credential_broker_v1';
62
+ /**
63
+ * Announced by a daemon whose broker redeems a managed lease with a session
64
+ * token of its own, minted for `INFERENCE_RELAY_AUDIENCE` (OSK-24515). An older
65
+ * daemon's broker forwarded the token the harness itself holds
66
+ * (`OVERSKY_SESSION_TOKEN`), which the relay stops honouring at contract.
67
+ * Pending until then (`INFERENCE_BROKER_PENDING_CAPABILITIES`): such a daemon
68
+ * is still admitted a lease.
69
+ */
70
+ export const MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY = 'managed_inference_broker_token_v1';
71
+ /**
72
+ * The audience of the session token a broker redeems at the inference relay
73
+ * (`/api/agentic/sessions/:id/inference/*`). A token minted with it is refused
74
+ * everywhere else. Once the relay takes only this audience (the contract half
75
+ * of OSK-24515), the token a harness holds for `skrr` and its tool callbacks is
76
+ * refused there, so a harness that can read its own environment holds nothing
77
+ * it can spend inference with (invariant I1). Until then the relay takes both
78
+ * and logs `inference_relay_session_audience` for the older one.
79
+ */
80
+ export const INFERENCE_RELAY_AUDIENCE = 'inference';
81
+ /** The audience of a session token minted without one: every route but the inference relay's. */
82
+ export const SESSION_TOKEN_AUDIENCE = 'session';
83
+ /** The capability a daemon announces when it can carry a shape at all, beyond its harness's entry. */
84
+ const SHAPE_ANNOUNCED_BY = Object.freeze({ 'managed-lease': MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY });
85
+ function harness(provider, carries, announcedBy, { platformMachine }) {
86
+ return Object.freeze({
87
+ provider,
88
+ carries: Object.freeze([...carries]),
89
+ announcedBy,
90
+ platformMachine,
91
+ });
92
+ }
93
+ export const INFERENCE_BROKER_HARNESSES = Object.freeze([
94
+ harness(FIRST_PARTY_HARNESS_PROVIDER, ['managed-lease', 'gateway', 'byok-local'], FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY, { platformMachine: true }),
95
+ harness('claude', ['managed-lease', 'gateway'], HARNESS_CREDENTIAL_BROKER_CAPABILITY, {
96
+ platformMachine: true,
97
+ }),
98
+ harness('codex', ['managed-lease', 'gateway'], HARNESS_CREDENTIAL_BROKER_CAPABILITY, {
99
+ platformMachine: true,
100
+ }),
101
+ // The Copilot SDK broker takes platform credits only as a managed lease. No
102
+ // platform machine image bakes its runtime; its placement there is still
103
+ // being evaluated (`packages/llm/harnesses/copilot-sdk.yaml`).
104
+ harness('copilot-sdk', ['managed-lease'], null, { platformMachine: false }),
105
+ // pi takes platform credits only as a managed lease, through the daemon's
106
+ // loopback broker (OSK-24468). Not yet offered on a platform machine: the
107
+ // image bakes it at its pin (`guest-harness-pins.json`), but its registry
108
+ // placement there is still `evaluating` (`packages/llm/harnesses/pi.yaml`),
109
+ // and a baked binary is not an admission.
110
+ harness('pi', ['managed-lease'], PI_CREDENTIAL_BROKER_CAPABILITY, { platformMachine: false }),
111
+ ]);
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 const PLATFORM_MACHINE_HARNESS_PROVIDERS = Object.freeze(INFERENCE_BROKER_HARNESSES.filter((entry) => entry.platformMachine).map((entry) => entry.provider));
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 function isPlatformMachineHarness(provider) {
124
+ return inferenceBrokerHarness(provider)?.platformMachine === true;
125
+ }
126
+ /**
127
+ * The listed harness for a provider name, or null. The first-party harness is
128
+ * matched in every accepted spelling and never in a former one, which no entry
129
+ * owns; every other name must be canonical already.
130
+ */
131
+ export function inferenceBrokerHarness(provider) {
132
+ if (typeof provider !== 'string' || !provider)
133
+ return null;
134
+ const canonical = canonicalHarnessProvider(provider);
135
+ return INFERENCE_BROKER_HARNESSES.find((entry) => entry.provider === canonical) ?? null;
136
+ }
137
+ /**
138
+ * Capabilities a current daemon announces that the server does not REQUIRE
139
+ * yet: the expand half of OSK-24515. Daemon and CLI releases ship from `main`
140
+ * while the server ships from `beta` at promotion, so no release order makes
141
+ * the clients arrive first, and a daemon already in the field (a platform
142
+ * machine's image pins one) would otherwise lose a credential it uses today.
143
+ * A daemon that lacks one is served exactly as before the capability existed,
144
+ * and the server logs `inference_grant_legacy_daemon` (`inferenceBrokerPendingGaps`)
145
+ * so the fleet's adoption can be counted.
146
+ *
147
+ * The contract change empties this list, after which `inferenceBrokerCarries`
148
+ * requires every capability. Its merge criterion is in
149
+ * `docs/architecture/managed-inference-execution-shapes-2026-08-12.md` §15.
150
+ */
151
+ export const INFERENCE_BROKER_PENDING_CAPABILITIES = Object.freeze([
152
+ FIRST_PARTY_HARNESS_CREDENTIAL_BROKER_CAPABILITY,
153
+ MANAGED_INFERENCE_BROKER_TOKEN_CAPABILITY,
154
+ ]);
155
+ /** Every capability a daemon announces when it brokers `shape` for `provider`, or null when it never can. */
156
+ function announcedCapabilitiesFor(provider, shape) {
157
+ const entry = inferenceBrokerHarness(provider);
158
+ if (!entry || !entry.carries.includes(shape))
159
+ return null;
160
+ return [entry.announcedBy, SHAPE_ANNOUNCED_BY[shape]].filter((capability) => typeof capability === 'string');
161
+ }
162
+ function announces(announced, capability) {
163
+ return Array.isArray(announced) && announced.includes(capability);
164
+ }
165
+ /**
166
+ * Whether a daemon announcing `announced` brokers a credential of `shape` for
167
+ * `provider`. False for an unlisted harness, for a shape its entry does not
168
+ * carry, and for a daemon that does not announce a required capability of the
169
+ * entry or the shape. A pending capability is not required yet
170
+ * (`INFERENCE_BROKER_PENDING_CAPABILITIES`). An absent or unreadable capability
171
+ * list announces nothing.
172
+ */
173
+ export function inferenceBrokerCarries(provider, shape, announced) {
174
+ const capabilities = announcedCapabilitiesFor(provider, shape);
175
+ if (!capabilities)
176
+ return false;
177
+ return capabilities
178
+ .filter((capability) => !INFERENCE_BROKER_PENDING_CAPABILITIES.includes(capability))
179
+ .every((capability) => announces(announced, capability));
180
+ }
181
+ /**
182
+ * The pending capabilities a daemon announcing `announced` lacks for `shape` of
183
+ * `provider`: the reasons contract will refuse what expand still serves. Empty
184
+ * when the daemon announces them all, and when the harness or the shape is
185
+ * never carried (refused already, so nothing changes at contract).
186
+ */
187
+ export function inferenceBrokerPendingGaps(provider, shape, announced) {
188
+ const capabilities = announcedCapabilitiesFor(provider, shape);
189
+ if (!capabilities)
190
+ return [];
191
+ return capabilities.filter((capability) => INFERENCE_BROKER_PENDING_CAPABILITIES.includes(capability) &&
192
+ !announces(announced, capability));
193
+ }
194
+ /**
195
+ * Every capability the server sends a credential by, for the daemon to announce
196
+ * and the server's register guard to keep (`registerGuards.scopeAnnouncedCapabilities`).
197
+ */
198
+ export const INFERENCE_BROKER_CAPABILITIES = Object.freeze([
199
+ ...new Set([
200
+ ...INFERENCE_BROKER_HARNESSES.map((entry) => entry.announcedBy),
201
+ ...Object.values(SHAPE_ANNOUNCED_BY),
202
+ ].filter((capability) => typeof capability === 'string')),
203
+ ]);
@@ -8,6 +8,10 @@
8
8
  "types": "./dist/cjs/scheduled-stream-wire.d.cts",
9
9
  "default": "./dist/cjs/scheduled-stream-wire.cjs"
10
10
  },
11
+ "./codex-model-catalog": {
12
+ "types": "./dist/cjs/codex-model-catalog.d.cts",
13
+ "default": "./dist/cjs/codex-model-catalog.cjs"
14
+ },
11
15
  "./desktop-daemon-proof": {
12
16
  "import": {
13
17
  "types": "./dist/esm/desktopDaemonProof.d.ts",
@@ -68,6 +72,16 @@
68
72
  "default": "./dist/cjs/firstPartyHarness.js"
69
73
  }
70
74
  },
75
+ "./inference-broker-harnesses": {
76
+ "import": {
77
+ "types": "./dist/esm/inferenceBrokerHarnesses.d.ts",
78
+ "default": "./dist/esm/inferenceBrokerHarnesses.js"
79
+ },
80
+ "require": {
81
+ "types": "./dist/cjs/inferenceBrokerHarnesses.d.ts",
82
+ "default": "./dist/cjs/inferenceBrokerHarnesses.js"
83
+ }
84
+ },
71
85
  "./harness-skill-layout": {
72
86
  "import": {
73
87
  "types": "./dist/esm/harnessSkillLayout.d.ts",