@arcforge/types 2.0.146 → 2.0.148

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/types",
3
- "version": "2.0.146",
3
+ "version": "2.0.148",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./src/index.ts",
package/src/blueprint.ts CHANGED
@@ -9,6 +9,7 @@ import { AxonTool } from "./tools"
9
9
  import { AxonScript } from "./scripts"
10
10
  import { AxonPrompt } from "./prompts"
11
11
  import { AxonKnowledge } from "./knowledge"
12
+ import type { ProviderEntry } from "./tui"
12
13
 
13
14
  /**
14
15
  * The blueprint is the boundary between CLI and runtime.
@@ -75,6 +76,21 @@ export type AxonBlueprint = {
75
76
  */
76
77
  profilePolicy?: CapsulePartialConfig["policy"]
77
78
 
79
+ /**
80
+ * The inference sources the OWNING PROFILE declares, merged ahead of the
81
+ * agent's own at boot.
82
+ *
83
+ * Resolved at LOAD for the same reason `profilePolicy` is: a blueprint
84
+ * travels — it is what `axon deploy` ships — and a deployed agent runs on
85
+ * a machine with no profile. Baking a user's Ollama daemon into an
86
+ * artifact would carry one machine's inference to another, where it
87
+ * describes a localhost that is not there.
88
+ *
89
+ * Absent means the agent runs on whatever it declares for itself, which
90
+ * for a deployment is the managed route and nothing else.
91
+ */
92
+ profileProviders?: ProviderEntry[]
93
+
78
94
  /**
79
95
  * The brain. REQUIRED and never defaulted: an agent without a brain is
80
96
  * not an agent — normalization fails loudly when it's missing. The CLI
@@ -133,6 +149,7 @@ export type AxonPartialBlueprint = {
133
149
  bootFilePath?: string
134
150
  config?: AxonBlueprint["config"]
135
151
  profilePolicy?: AxonBlueprint["profilePolicy"]
152
+ profileProviders?: AxonBlueprint["profileProviders"]
136
153
  cognet?: CognetBlueprint
137
154
  env?: AxonBlueprint["env"]
138
155
  tools?: AxonBlueprint["tools"]
@@ -1,4 +1,4 @@
1
- import type { CapsulePolicy, EscalationCall } from "./policy"
1
+ import type { CapsulePolicy, EscalationCall, PolicyBucket, PolicyRule } from "./policy"
2
2
  import type { AxonScopeModule } from "./scope"
3
3
 
4
4
  export type CapsuleHostRequest = {
@@ -95,7 +95,14 @@ export type CapsuleBlueprint = {
95
95
  * care about; CapsuleBlueprint()/mergeCapsuleConfig() fill in the rest.
96
96
  */
97
97
  export type CapsulePartialConfig = Partial<Omit<CapsuleBlueprint, "policy">> & {
98
- policy?: Partial<Omit<CapsulePolicy, "process">> & {
99
- process?: Partial<CapsulePolicy["process"]>
98
+ /**
99
+ * As AUTHORED — every enforcement surface also accepts one bare rule
100
+ * covering the whole surface (`tools: "escalate"`), which `Blueprint()`
101
+ * normalises into the keyed shape the capsule enforces. See `PolicyBucket`.
102
+ */
103
+ policy?: Partial<Omit<CapsulePolicy, "process" | "tools" | "network">> & {
104
+ process?: Partial<CapsulePolicy["process"]> | PolicyRule
105
+ tools?: PolicyBucket
106
+ network?: PolicyBucket
100
107
  }
101
108
  }
@@ -1,5 +1,6 @@
1
1
  import type { AxonEntryEvent } from "../session/events/entries"
2
2
  import type { CognetDefinition } from "./cognet"
3
+ import type { EngineRequirements } from "../inference"
3
4
 
4
5
  /**
5
6
  * The cognet slot in the agent blueprint — how a brain reaches the runtime.
@@ -36,6 +37,19 @@ export type CognetBlueprint = {
36
37
  * time and the runtime cannot tell the difference.
37
38
  */
38
39
  models?: Readonly<Record<string, string>>
40
+
41
+ /**
42
+ * The inference roles this brain declared, carried from its own
43
+ * cognet.config.ts.
44
+ *
45
+ * Here rather than read off the loaded definition because resolution has
46
+ * to happen BEFORE the cognet loads: a required role with nothing to
47
+ * fill it must stop the boot, and a brain that has already begun running
48
+ * is a brain that will reach for an engine that is not there. The
49
+ * bundle's own copy stays authoritative for what it was built against;
50
+ * this is the copy the runtime plans with.
51
+ */
52
+ engines?: EngineRequirements
39
53
  } & (
40
54
  | {
41
55
  /** Absolute path to the compiled bundle — <agent>/.agent/cognet/cognet.mjs. */
@@ -1,6 +1,7 @@
1
1
  import type { AxonBlueprint } from "../blueprint"
2
2
  import type { KernelAbi, CognetWake } from "../kernel/abi"
3
3
  import type { AxonEntryEvent } from "../session/events/entries"
4
+ import type { EngineRequirements } from "../inference"
4
5
 
5
6
  /**
6
7
  * A cognet definition — one cognition artifact, what defineCognet()
@@ -74,37 +75,33 @@ export type CognetConfig = {
74
75
  maxTicksPerWake?: number
75
76
 
76
77
  /**
77
- * Model weights this brain needs, by the name IT calls them.
78
+ * The inference this brain needs, by the names IT calls them.
78
79
  *
79
80
  * ```ts
80
- * models: {
81
- * vad: "hf:runanywhere/silero-vad-v5/silero_vad.onnx",
82
- * asr: "hf:ggerganov/whisper.cpp/ggml-base.en.bin",
81
+ * engines: {
82
+ * main: { type: "generate", in: "text", out: "text", context: 100_000 },
83
+ * percept: { type: "generate", in: "text", out: "text", parallel: true, optional: true },
83
84
  * }
84
85
  * ```
85
86
  *
86
- * Weights are DATA, not code — a `.onnx` file is inert until something
87
- * reads it. The runtime that executes it (onnxruntime, llama.cpp) is an
88
- * ordinary npm dependency the cognet imports, chosen by the author. This
89
- * field only says which bytes are needed; how to run them is cognition.
87
+ * The demand half of the same indirection `models:` makes for weights:
88
+ * the key is the cognet's private vocabulary and the user never types it,
89
+ * because a user who had to name a brain's roles would be wiring one
90
+ * specific brain into their setup. `kernel.engine("percept")` says what
91
+ * the engine is FOR; what fills it is decided at boot against whatever
92
+ * providers the user declared.
90
93
  *
91
- * That is also why there is no unified `runModel()`: every model has its
92
- * own tensor signature, so a generic invoke could only pass `unknown`
93
- * through. Acquisition collapses to one mechanism; inference cannot.
94
+ * Constraints are STRUCTURAL — the things that break a brain rather than
95
+ * slow it down. There is deliberately no way to demand a good model:
96
+ * quality is the user's tradeoff, and a cognet that could refuse one
97
+ * would be overruling the person whose machine it is running on.
94
98
  *
95
- * A MAP, not a list, because the key is the brain's own vocabulary.
96
- * `kernel.models.vad` says what the weight is FOR; the specifier says
97
- * where it came from. Swapping to a different VAD is one line here rather
98
- * than an edit at every call site — and a brain that referenced its
99
- * supply chain at every use would have learned something it does not
100
- * need to know.
101
- *
102
- * Axon fetches, verifies and caches these; the resolved paths arrive at
103
- * load through `kernel.models`, never read from this config. A path is
104
- * environmental, and a cognet learns nothing about its environment except
105
- * through the kernel.
99
+ * A required role with nothing to fill it fails at `axon prepare`, never
100
+ * at the first tick. An optional one is the degradation path — the cognet
101
+ * asks `kernel.engine.has(name)` and takes a cheaper route.
106
102
  */
107
- models?: Record<string, ModelRef>
103
+ engines?: EngineRequirements
104
+
108
105
  }
109
106
 
110
107
  /**
package/src/config.ts CHANGED
@@ -1,23 +1,20 @@
1
- import { EngineConfig } from "./engine"
2
1
  import { CapsulePartialConfig } from "./capsule-config"
3
2
  import { DeployConfig } from "./deploy"
4
3
  import { ModuleEntry } from "./module"
5
4
  import { CognetConfig } from "./cognet/cognet"
5
+ import type { ProviderEntry } from "./tui"
6
6
 
7
7
  /**
8
8
  * Authoring configuration for an Axon agent.
9
9
  *
10
10
  * This is the object passed to `defineAgent()` in `axon.config.ts`. It controls
11
- * the agent's description, inference engine, sandbox policy, environment,
12
- * deployment, installed module options, workspace integration, and HTTP server.
11
+ * the agent's inference sources, sandbox policy, environment, deployment,
12
+ * installed module options, workspace integration, and HTTP server.
13
13
  *
14
14
  * ```ts
15
- * import { Axon } from "@arcforge/engines"
16
15
  * import TelegramModule from "../modules/telegram/module.config"
17
16
  *
18
17
  * export default defineAgent({
19
- * description: "Answers support questions from repository context",
20
- * engine: Axon({ model: "auto" }), // curated models
21
18
  * modules: [
22
19
  * "@axon/github", // registry — auto-installed
23
20
  * TelegramModule, // source import
@@ -60,8 +57,58 @@ export type AxonConfig<EventMap extends Record<string, unknown> = Record<string,
60
57
  deploy?: DeployConfig
61
58
 
62
59
 
63
- /** Engine used for model inference. Omit for mock/default behavior in local scaffolds. */
64
- engine?: EngineConfig
60
+
61
+ /**
62
+ * Which model drives this agent's cortex.
63
+ *
64
+ * ```ts
65
+ * model: "codex:gpt-5.6-terra" // a specific route
66
+ * model: "gpt-5.6-terra" // whichever route supplies it
67
+ * ```
68
+ *
69
+ * A PREFERENCE, never a constraint. Resolution tries the pin first and
70
+ * falls back to ordinary ranking when the user's providers cannot supply
71
+ * it — so a published agent stays runnable by someone who has no Codex
72
+ * connection, rather than carrying its author's account setup as a hard
73
+ * dependency. The role's declared requirements still govern: a pin that
74
+ * names a model too small for the cognet's context is ignored, not
75
+ * honoured into a broken run.
76
+ *
77
+ * A STRING, not a constructor call, because this is the one inference
78
+ * decision a user makes by hand and a picker edits by machine. The old
79
+ * `engine: Codex({ model })` needed AST surgery to change one field; a
80
+ * string is written by whoever is writing it.
81
+ *
82
+ * Applies to the cognet's PRIMARY role only. Which model fills a percept
83
+ * or a compression role is resolution's business — a user choosing those
84
+ * individually is the wiring this design exists to abolish.
85
+ */
86
+ model?: string
87
+
88
+ /**
89
+ * Inference sources for THIS agent, appended to whatever the active
90
+ * profile already declares.
91
+ *
92
+ * ```ts
93
+ * providers: [Axon(), Ollama({ url: "http://box.local:11434" })]
94
+ * ```
95
+ *
96
+ * Replaces the old `engine:` field, which named ONE model for the whole
97
+ * agent. That could not survive a cognet declaring several roles, and it
98
+ * put the choice in the wrong place besides: which model to use is the
99
+ * user's, expressed once on their profile, while an agent only says what
100
+ * sources it needs beyond what they already have.
101
+ *
102
+ * Most agents declare nothing: a user's providers live on their profile
103
+ * and every agent inherits them, which is what makes installing an agent
104
+ * a download rather than a setup. This exists for the agent that needs a
105
+ * source its user would not otherwise have — a self-hosted endpoint it
106
+ * ships against, a local daemon it assumes.
107
+ *
108
+ * Additive, never a replacement: an agent cannot take a provider away
109
+ * from the user who is running it.
110
+ */
111
+ providers?: ProviderEntry[]
65
112
 
66
113
  /**
67
114
  * Cognet selection — which brain this agent runs.
package/src/engine.ts CHANGED
@@ -113,6 +113,22 @@ export type EngineCloud = {
113
113
  }
114
114
  }
115
115
  }
116
+ registry: {
117
+ models: {
118
+ /**
119
+ * The merged public catalogue — one entry per canonical model,
120
+ * every route it can be run through attached.
121
+ *
122
+ * Here because a provider now has to answer "what can I supply"
123
+ * before any model is chosen, and the answer for a hosted route
124
+ * lives in the registry. Same reason the rest of this type
125
+ * exists: @arclabs/cloud depends on this package, so the client
126
+ * cannot be imported and the slice engines need is spelled at
127
+ * the seam instead.
128
+ */
129
+ all(): Promise<CloudModelCatalog>
130
+ }
131
+ }
116
132
  cloud: {
117
133
  engine: {
118
134
  /**
@@ -130,6 +146,27 @@ export type EngineCloud = {
130
146
  }
131
147
  }
132
148
 
149
+ /**
150
+ * The registry's merged model catalogue, as engines consume it.
151
+ *
152
+ * Structurally the same shape @arclabs/cloud returns; spelled here for the
153
+ * same reason as EngineCloud itself. `modality` is OpenRouter's own
154
+ * `"text+image->text"` string — carried rather than pre-parsed so the
155
+ * classification table stays in one place.
156
+ */
157
+ export type CloudModelCatalog = {
158
+ models: Array<{
159
+ id: string
160
+ name: string
161
+ context: number
162
+ /** e.g. "text+image->text". Absent when the upstream source omits it. */
163
+ modality?: string
164
+ routes: Array<{ via: string; model: string }>
165
+ }>
166
+ /** A source that failed — never silently a shorter list. */
167
+ failures: Array<{ source: string; message: string }>
168
+ }
169
+
133
170
  /** One managed-inference call — the request plus how to route it. */
134
171
  export type EngineCloudStream = {
135
172
  request: AxonEngineRequest
@@ -165,9 +202,67 @@ export type CodexToken = {
165
202
  * handles, never model-visible content.
166
203
  */
167
204
  export type AxonEngineDriver = {
205
+ /**
206
+ * Absent on the generate driver, deliberately.
207
+ *
208
+ * Every driver this package has ever built is a generate driver, and
209
+ * requiring an existing one to declare `kind: "generate"` would break
210
+ * every published adapter for a discriminant the union can infer from
211
+ * `stream` being present. The two new kinds declare theirs.
212
+ */
213
+ readonly kind?: "generate"
168
214
  stream(req: AxonEngineRequest): AsyncGenerator<AxonEngineRawEvent>
169
215
  }
170
216
 
217
+ /**
218
+ * What a provider builds for one resolved capability.
219
+ *
220
+ * A union keyed on the capability's type, mirroring KernelEngine on the ABI:
221
+ * the kernel wraps whichever of these it is given with telemetry and hands
222
+ * the matching handle to the cognet. One construction seam
223
+ * (`AxonProvider.create`) rather than three, because who picked the model is
224
+ * not the transport's business and splitting the seam would mean three places
225
+ * every boot path has to agree about.
226
+ *
227
+ * These are DUMB. A driver knows how to talk to one model; it does not parse
228
+ * a grammar, touch the bus, or commit anything — the runtime's Engine()
229
+ * manager owns all of that, so the AIR protocol is implemented exactly once.
230
+ */
231
+ export type AxonDriver = AxonEngineDriver | AxonTransformDriver | AxonStreamDriver
232
+
233
+ /**
234
+ * One shot in, one shot out.
235
+ *
236
+ * `input` and the result are BOTH unknown here, deliberately: what a depth
237
+ * map or an embedding means is the cognet's business, and a driver contract
238
+ * that named those shapes would be the transport layer growing an opinion
239
+ * about tensor semantics. Adapters per model family are where that knowledge
240
+ * lives.
241
+ */
242
+ export type AxonTransformDriver = {
243
+ readonly kind: "transform"
244
+ transform(input: unknown, opts?: { onProgress?: (progress: { fraction?: number; message?: string }) => void }): Promise<unknown>
245
+ }
246
+
247
+ /**
248
+ * A stateful sequential feed.
249
+ *
250
+ * `open()` is where the expensive part happens once — building the execution
251
+ * graph — and every push after it shares the model's hidden state. That is
252
+ * the whole reason this is not a transform: Silero's LSTM is what lets it
253
+ * tell a pause mid-sentence from silence, and N independent calls destroy it.
254
+ */
255
+ export type AxonStreamDriver = {
256
+ readonly kind: "stream"
257
+ open(): AxonDriverSession
258
+ }
259
+
260
+ export type AxonDriverSession = {
261
+ push(input: unknown): Promise<unknown>
262
+ reset(): void
263
+ close(): void
264
+ }
265
+
171
266
  /**
172
267
  * Raw wire events from a driver.
173
268
  * text:delta — a chunk of model output (AIR-formatted text, unparsed)
@@ -207,6 +302,19 @@ export type AxonEngine = {
207
302
  * would silently discard every block the model emitted.
208
303
  */
209
304
  export type AxonEngineCall = AxonEngineRequest & {
305
+ /**
306
+ * Which of the cognet's declared roles serves this call.
307
+ *
308
+ * The brain's own word — "main", "percept", "compress" — never a model or
309
+ * a provider. What fills it was decided at boot against whatever the user
310
+ * declared, so the same source runs on a frontier route for one person
311
+ * and a local model for another with nothing in the cognet changing.
312
+ *
313
+ * Omitted uses the agent's single `engine:`, which is what every cognet
314
+ * that never declared roles does.
315
+ */
316
+ role?: string
317
+
210
318
  /** The output grammar to parse the reply with. Must match what the caller rendered. */
211
319
  protocol?: AirProtocolName
212
320
  /**
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from "./connect"
4
4
  export * from "./define"
5
5
  export * from "./deploy"
6
6
  export * from "./engine"
7
+ export * from "./inference"
7
8
  export * from "./error"
8
9
  export * from "./http"
9
10
  export * from "./instance"
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Inference requirements and supply — the contract between what a cognet
3
+ * NEEDS and what a user HAS.
4
+ *
5
+ * The indirection is the point, and it is the same one `models:` already
6
+ * makes for weights: the cognet declares a NAME it made up and the shape of
7
+ * the thing that name stands for; the user declares a POOL of providers; a
8
+ * resolver connects them. Neither side learns about the other. A cognet that
9
+ * could name a provider would stop being portable to a machine that has a
10
+ * different one, and a user who had to name a cognet's roles would be wiring
11
+ * — which is the thing this exists to abolish.
12
+ *
13
+ * @see https://axon.arclabs.it/docs/v2/cognets/engine/kernel-contract
14
+ */
15
+
16
+ /**
17
+ * How an engine is CALLED. Closed, small, and expensive to extend on
18
+ * purpose — each member is a distinct handle shape on the kernel ABI, so
19
+ * adding one adds a verb.
20
+ *
21
+ * This is the axis that survives contact with the ~60 task tags a model hub
22
+ * publishes, because those are discovery labels (three names for "image+text
23
+ * in, text out") while these are interaction patterns. Summarization and
24
+ * translation are prompts, not kinds; depth estimation and object detection
25
+ * differ only in what the returned bytes MEAN, which is deliberately not
26
+ * this package's business.
27
+ *
28
+ * - "generate" — autoregressive, streamed, sampled. LLMs, VLMs, most TTS.
29
+ * - "transform" — one shot in, one shot out. ASR, embeddings, classifiers,
30
+ * detection, depth, segmentation, image generation.
31
+ * - "stream" — stateful sequential feed, order significant. VAD,
32
+ * streaming ASR, trackers. Needs a session handle because
33
+ * hidden state lives across calls.
34
+ */
35
+ export type EngineType = "generate" | "transform" | "stream"
36
+
37
+ /**
38
+ * What crosses the boundary, in and out.
39
+ *
40
+ * Open-ended by intent: this is a MATCHING vocabulary, not a payload
41
+ * taxonomy. The kernel refuses to interpret what a depth map or an embedding
42
+ * means — same refusal `models:` already makes about weights — so a member
43
+ * here only has to be specific enough for a resolver to tell two models
44
+ * apart.
45
+ *
46
+ * "score", "vector" and "depth" are output shapes rather than modalities in
47
+ * the strict sense. They earn their place because a cognet asking for a VAD
48
+ * and a cognet asking for speech-to-text both say `in: "audio"`, and the
49
+ * output is the only thing that separates them.
50
+ */
51
+ export type Modality =
52
+ | "text"
53
+ | "image"
54
+ | "audio"
55
+ | "video"
56
+ | "vector"
57
+ | "score"
58
+ | "depth"
59
+
60
+ /**
61
+ * One named engine a cognet requires, as declared in `cognet.config.ts`.
62
+ *
63
+ * CONSTRAINTS ARE STRUCTURAL ONLY. Every field here is something that
64
+ * BREAKS the brain when unmet, never something that merely makes it worse:
65
+ * a context window too small means the render does not fit; a text-only
66
+ * model handed an image cannot answer at all. Quality is deliberately
67
+ * absent — a weak model still parses, still fits, and still runs, so which
68
+ * one to use is the user's tradeoff to make and never the cognet's to
69
+ * refuse. That is also what keeps model benchmarking off this critical
70
+ * path: nothing here needs a score to be resolvable.
71
+ */
72
+ export type EngineRequirement = {
73
+ /** Which handle shape the cognet's code is written against. */
74
+ type: EngineType
75
+
76
+ /** Accepted input modalities. A single value is shorthand for one. */
77
+ in: Modality | Modality[]
78
+
79
+ /** Produced output modalities. A single value is shorthand for one. */
80
+ out: Modality | Modality[]
81
+
82
+ /**
83
+ * Minimum usable context window, in tokens. Only meaningful for
84
+ * "generate" — a VAD has no context and declaring one is a category
85
+ * error the resolver ignores rather than fails on.
86
+ */
87
+ context?: number
88
+
89
+ /** The reply must be parseable as structured output (AIR blocks, JSON mode). */
90
+ structured?: boolean
91
+
92
+ /**
93
+ * This role is fanned out — the cognet issues several calls at once and
94
+ * wants as many as it can get.
95
+ *
96
+ * A REQUEST, never a threshold. The count a cognet would name is a fact
97
+ * about a machine it cannot see, and asserting one turns "runs slowly"
98
+ * into "refuses to install" for exactly the users who most need it to
99
+ * degrade. One slot is N sequential calls: slower, still correct, never
100
+ * zero. A cognet that wants to branch on how much it got reads `slots`
101
+ * off the handle.
102
+ */
103
+ parallel?: boolean
104
+
105
+ /**
106
+ * The brain runs without this. Absent means required, and a required
107
+ * role with no candidate is a hard failure at prepare.
108
+ *
109
+ * This is the whole degradation story: a cognet checks
110
+ * `kernel.engine.has(name)` and takes a cheaper path when a role is
111
+ * unfilled, which is what lets compression, filtering and attention land
112
+ * without breaking a user who has one local model and no network.
113
+ */
114
+ optional?: boolean
115
+
116
+ /**
117
+ * This role is what the user's model picker edits.
118
+ *
119
+ * A CONVENTION of the binding layer, never a privilege in the kernel:
120
+ * the handle a primary role returns is identical to any other. It exists
121
+ * because "the current model" has to mean something to a UI, and naming
122
+ * the role explicitly beats hardcoding the string "main" — a cognet with
123
+ * two peer reasoners must not be forced to call one of them main.
124
+ *
125
+ * At most one per cognet.
126
+ */
127
+ primary?: boolean
128
+ }
129
+
130
+ /**
131
+ * What a cognet declares — role name to requirement.
132
+ *
133
+ * A MAP, for the reason `models:` is a map: the key is the brain's own
134
+ * vocabulary. `kernel.engine("percept")` says what the engine is FOR, and
135
+ * swapping what fills it is the user's business, expressed nowhere in the
136
+ * cognet's source.
137
+ */
138
+ export type EngineRequirements = Record<string, EngineRequirement>
139
+
140
+ /**
141
+ * One model a provider can actually supply, normalized across providers.
142
+ *
143
+ * The supply-side counterpart of EngineRequirement, and the thing a resolver
144
+ * matches against. Deliberately a superset of what any single provider
145
+ * reports: a field a provider cannot answer is absent, never fabricated, and
146
+ * a matcher treats absent as "unknown" rather than "no" for everything
147
+ * except the constraints a cognet declared.
148
+ */
149
+ export type EngineCapability = {
150
+ /** Provider-qualified identifier, e.g. "anthropic/claude-sonnet-4-6". */
151
+ id: string
152
+
153
+ /** Which provider can supply it — the route, in picker terms. */
154
+ provider: string
155
+
156
+ /** Human label for pickers and diagnostics. */
157
+ name: string
158
+
159
+ type: EngineType
160
+ in: Modality[]
161
+ out: Modality[]
162
+
163
+ /** Context window in tokens. Absent when the source does not report one. */
164
+ context?: number
165
+
166
+ /** Structured output is supported. Absent means unknown. */
167
+ structured?: boolean
168
+
169
+ /**
170
+ * Runs on this machine rather than over the network.
171
+ *
172
+ * The one fact that decides whether an agent works with the network off,
173
+ * which is why it is a first-class field and not an inference from the
174
+ * provider name.
175
+ */
176
+ local?: boolean
177
+
178
+ /**
179
+ * Concurrent calls this binding can sustain. Absent means unbounded
180
+ * (the ordinary answer for a hosted route); 1 means strictly sequential.
181
+ */
182
+ slots?: number
183
+
184
+ /** Weights footprint in bytes — what a local admission check measures against. */
185
+ bytes?: number
186
+ }
187
+
188
+ /**
189
+ * A resolved binding: the role, and what got put in it.
190
+ *
191
+ * The cognet never sees this. It is what `axon prepare` reports, what the
192
+ * TUI renders, and what the kernel holds so `kernel.engine(name)` is a map
193
+ * lookup rather than a query — resolution happens once, at boot, so a call
194
+ * site can never block on it and can never fail differently on the second
195
+ * tick than the first.
196
+ */
197
+ export type EngineBinding = {
198
+ role: string
199
+ requirement: EngineRequirement
200
+ capability: EngineCapability
201
+ /** Concurrency actually granted — what the handle reports as `slots`. */
202
+ slots: number
203
+ }
204
+
205
+ /** Why a role could not be filled — one entry per unmet requirement. */
206
+ export type EngineUnmet = {
207
+ role: string
208
+ requirement: EngineRequirement
209
+ /**
210
+ * Human-readable account of what was rejected and why, one line per
211
+ * near-miss candidate. Present so `axon prepare` can say "your models
212
+ * fit everything except the 100k context" instead of "unresolved".
213
+ */
214
+ reasons: string[]
215
+ }
216
+
217
+ /**
218
+ * The outcome of resolution — every role accounted for, nothing thrown.
219
+ *
220
+ * Total rather than throwing because the caller decides severity: a missing
221
+ * OPTIONAL role is ordinary and the brain degrades around it, while a
222
+ * missing required one must stop `axon prepare`. A resolver that threw would
223
+ * make the first case impossible to express.
224
+ */
225
+ export type EngineResolution = {
226
+ bound: EngineBinding[]
227
+ /**
228
+ * The model the agent pinned, when nothing available could supply it.
229
+ *
230
+ * A pin is a preference, so an unsatisfiable one is not an error — the
231
+ * agent still runs on whatever ranking chose. But it must not be SILENT:
232
+ * a user who picked a model and got a different one has to be told which,
233
+ * and why, or the picker looks broken. Absent when there was no pin, or
234
+ * when the pin was honoured.
235
+ */
236
+ unhonoured?: { pin: string; reason: string }
237
+ /** Unfilled roles, both optional and required. */
238
+ unmet: EngineUnmet[]
239
+ /** Unfilled roles that were NOT optional — non-empty means the agent cannot run. */
240
+ missing: EngineUnmet[]
241
+ }