@barry-rocks/sdk/adapters/models
The contract for model adapters: completion, embedding, and decision models, their requests, availability and compatibility checks, and the errors a model route raises.
import { … } from "@barry-rocks/sdk/adapters/models";Classes
Section titled “Classes”ModelsNotInstalled
Section titled “ModelsNotInstalled”Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModelsNotInstalled():
ModelsNotInstalled
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
ModelUnavailableError
Section titled “ModelUnavailableError”The model cannot serve requests at all: unreachable, unauthenticated, or not installed. Distinct from an ordinary failure so a caller sweeping many items stops once instead of recording one outage as N per-item failures.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModelUnavailableError(
message,cause?):ModelUnavailableError
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message |
string |
cause? |
unknown |
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”| Property | Modifier | Type | Overrides |
|---|---|---|---|
cause? |
readonly |
unknown |
Error.cause |
RouteRefused
Section titled “RouteRefused”A model or vendor this harness cannot run, phrased for whoever chose it.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RouteRefused(
message):RouteRefused
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message |
string |
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Interfaces
Section titled “Interfaces”AvailableModels
Section titled “AvailableModels”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
models |
Model[] |
- |
source |
"discovered" | "catalog" |
discovered came from the endpoint; catalog is Barry’s curated list. |
stale |
boolean |
True when discovery was possible and failed, so the catalog stands in. A silently shortened list reads as a complete one; this is what says it is not. |
Properties
Section titled “Properties”Compatibility
Section titled “Compatibility”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
baseUrl |
BaseUrl |
- |
egressSandbox? |
boolean |
Whether Barry’s egress proxy has been shown to hold for requests here. |
structuredOutput? |
"native" | "prompted" |
Measured per endpoint, not inherited from the API it imitates: a compatible API can accept a schema field and ignore it. Absent means “prompted” — the safe reading until someone verifies otherwise. |
with |
string |
- |
Completion
Section titled “Completion”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
servedModel |
string | null |
The model that actually served the request, for the audit trail. |
structured? |
unknown |
Present when schema was set and the reply validated against it. |
text |
string |
- |
usage? |
TokenUsage |
- |
CompletionModel
Section titled “CompletionModel”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”Methods
Section titled “Methods”complete()
Section titled “complete()”complete(
request):Promise<Completion>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
CompletionRequest |
Returns
Section titled “Returns”Promise<Completion>
CompletionRequest
Section titled “CompletionRequest”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
keepAliveMs? |
number |
How long a local model stays loaded after this call. For a caller on a timer longer than the vendor’s default, which would otherwise cold-start every call. Vendors with no such notion ignore it. |
maxTokens? |
number |
- |
prompt |
string |
- |
schema? |
JsonSchema |
- |
system? |
string |
- |
temperature? |
number |
- |
timeoutMs? |
number |
- |
Decision
Section titled “Decision”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
answers |
Record<string, Answer> |
Keyed by the names the questions were given. |
servedModel |
string | null |
The model that actually served the request, for the audit trail. |
usage? |
TokenUsage |
- |
DecisionModel
Section titled “DecisionModel”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type |
|---|---|
ref |
`${string}/${string}` |
Methods
Section titled “Methods”decide()
Section titled “decide()”decide(
request):Promise<Decision>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
DecisionRequest |
Returns
Section titled “Returns”Promise<Decision>
DecisionRequest
Section titled “DecisionRequest”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
questions |
Record<string, Question> |
- |
state |
string | Record<string, unknown> | string[] |
What the questions are about. |
timeoutMs? |
number |
- |
EmbeddingModel
Section titled “EmbeddingModel”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type |
|---|---|
dimensions? |
number |
ref |
`${string}/${string}` |
Methods
Section titled “Methods”embed()
Section titled “embed()”embed(
request):Promise<Embeddings>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
EmbeddingRequest |
Returns
Section titled “Returns”Promise<Embeddings>
EmbeddingRequest
Section titled “EmbeddingRequest”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”Embeddings
Section titled “Embeddings”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
servedModel |
string | null |
- |
vectors |
number[][] |
One vector per input, in the order given. |
Endpoint
Section titled “Endpoint”A resolved address and credential, ready to send a request to.
Properties
Section titled “Properties”| Property | Type |
|---|---|
apiKey? |
string |
baseUrl |
string |
egressSandbox? |
boolean |
structuredOutput? |
"native" | "prompted" |
HostProbes
Section titled “HostProbes”What the checks need from the host, passed in so they can be tested.
Properties
Section titled “Properties”| Property | Type |
|---|---|
platform |
Platform |
Methods
Section titled “Methods”run(
command,args): {code:number;stdout:string; } |null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
command |
string |
args |
readonly string[] |
Returns
Section titled “Returns”{ code: number; stdout: string; } | null
which()
Section titled “which()”which(
command):string|null
Absolute path of a command on PATH, or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
command |
string |
Returns
Section titled “Returns”string | null
ListedModel
Section titled “ListedModel”Properties
Section titled “Properties”| Property | Type |
|---|---|
id |
string |
parameterSize? |
string |
sizeBytes? |
number |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
dimensions? |
number |
- |
id |
string |
- |
kind |
ModelKind |
- |
label |
string |
- |
local? |
boolean |
- |
note? |
string |
A caveat shown in pickers — e.g. a measured failure at tool calling. |
roles? |
("default" | "small")[] |
default is used when nothing names a model; small for Barry’s own cheap internal calls. |
structuredOutput? |
"native" | "prompted" |
- |
ModelProviders
Section titled “ModelProviders”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
refused |
Map<string, string[]> |
Refusals from the most recent load; selections remain recorded for repair. |
Methods
Section titled “Methods”add(
path,options?):Promise<{contractVersion:1;factoryExport:string;packageName:string;path:string;shipped?:true;version:string; }>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
path |
string |
options? |
{ shipped?: true; } |
options.shipped? |
true |
Returns
Section titled “Returns”Promise<{ contractVersion: 1; factoryExport: string; packageName: string; path: string; shipped?: true; version: string; }>
installed()
Section titled “installed()”installed():
object[]
Returns
Section titled “Returns”object[]
load()
Section titled “load()”load(
packageNames?):Promise<VendorFactories>
Omitted names load registered selections. A named missing selection fails explicitly.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
packageNames? |
readonly string[] |
Returns
Section titled “Returns”Promise<VendorFactories>
remove()
Section titled “remove()”remove(
packageName):boolean
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
packageName |
string |
Returns
Section titled “Returns”boolean
ModelProviderStoreOptions
Section titled “ModelProviderStoreOptions”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
file |
string |
- |
importModule? |
(entry) => Promise<unknown> |
Absolute module entry point; tests may inject imports without contacting a provider. |
Models
Section titled “Models”Methods
Section titled “Methods”available()
Section titled “available()”available(
vendor,at?):Promise<AvailableModels>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendor |
string |
at? |
Partial<Endpoint> |
Returns
Section titled “Returns”Promise<AvailableModels>
byRole()
Section titled “byRole()”byRole(
vendor,role,kind?):`${string}/${string}`|undefined
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendor |
string |
role |
"default" | "small" |
kind? |
ModelKind |
Returns
Section titled “Returns”`${string}/${string}` | undefined
check()
Section titled “check()”check(
ref,at?):Promise<Check[]>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
`${string}/${string}` |
at? |
Partial<Endpoint> |
Returns
Section titled “Returns”Promise<Check[]>
completion()
Section titled “completion()”completion(
ref,at?):CompletionModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
`${string}/${string}` |
at? |
Partial<Endpoint> |
Returns
Section titled “Returns”decision()
Section titled “decision()”decision(
ref,at?):DecisionModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
`${string}/${string}` |
at? |
Partial<Endpoint> |
Returns
Section titled “Returns”embedding()
Section titled “embedding()”embedding(
ref,at?):EmbeddingModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
`${string}/${string}` |
at? |
Partial<Endpoint> |
Returns
Section titled “Returns”endpoint()
Section titled “endpoint()”endpoint(
vendor,compatibleWith?):Endpoint|undefined
Where to send a request, with its credential. compatibleWith asks for
the vendor’s imitation of another vendor’s API — how a harness reaches a
model its own vendor does not serve. undefined when there is no such door.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendor |
string |
compatibleWith? |
string |
Returns
Section titled “Returns”Endpoint | undefined
get(
ref):Model|undefined
The catalog entry, when there is one. Unknown ids still resolve everywhere else.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
`${string}/${string}` |
Returns
Section titled “Returns”Model | undefined
vendors()
Section titled “vendors()”vendors():
Vendor[]
Returns
Section titled “Returns”Vendor[]
ModelsOptions
Section titled “ModelsOptions”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
env? |
Record<string, string | undefined> |
Where credentials and address overrides are read. Defaults to process.env. |
OfferedModelInfo
Section titled “OfferedModelInfo”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
id |
string |
- |
label |
string |
- |
note? |
string |
A caveat worth showing where the model is picked, such as a measured weakness. |
OfferingHarness
Section titled “OfferingHarness”Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Type | Description | Inherited from |
|---|---|---|---|
aliases? |
readonly string[] |
Former ids it still answers to: an identity’s default may name one. | RoutingHarness.aliases |
capabilities |
Pick<HarnessCapabilities, "endpoint" | "withoutKey"> |
- | RoutingHarness.capabilities |
id |
string |
- | RoutingHarness.id |
offeredModels? |
readonly OfferedModel[] |
- | - |
vendor? |
string |
- | RoutingHarness.vendor |
Properties
Section titled “Properties”RouteRequest
Section titled “RouteRequest”Properties
Section titled “Properties”RoutingHarness
Section titled “RoutingHarness”Extended by
Section titled “Extended by”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
aliases? |
readonly string[] |
Former ids it still answers to: an identity’s default may name one. |
capabilities |
Pick<HarnessCapabilities, "endpoint" | "withoutKey"> |
- |
id |
string |
- |
vendor? |
string |
- |
TokenUsage
Section titled “TokenUsage”The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Properties
Section titled “Properties”Vendor
Section titled “Vendor”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
baseUrl? |
BaseUrl |
Absent for a vendor Barry never calls directly (cursor serves only through its harness). |
compatible? |
Compatibility[] |
Other vendors’ APIs this vendor also serves — z.ai and Ollama speak Anthropic’s Messages API, Ollama speaks OpenAI’s too. A harness reaches a model of this vendor only through one of these. |
credential |
{ env: string; field?: "username" | "password" | "notes" | "uri"; item?: string; } | { placeholder: string; } | null |
null for a vendor that needs none. A placeholder is always sent and is not authentication: without one, a harness falls back to the user’s own login and sends a real token to whatever endpoint it was pointed at. The env form carries an optional default vault item: when the identity does not define the variable, the gate reads item.field from the identity’s vault. Env-only keeps working — the identity must define the variable — and the checker warns on it. |
id |
string |
- |
label |
string |
- |
models |
Model[] |
- |
Methods
Section titled “Methods”check()?
Section titled “check()?”
optionalcheck(endpoint,model?):Promise<Check[]>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
endpoint |
Endpoint |
model? |
string |
Returns
Section titled “Returns”Promise<Check[]>
completion()?
Section titled “completion()?”
optionalcompletion(model,endpoint):CompletionModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
model |
string |
endpoint |
Endpoint |
Returns
Section titled “Returns”decision()?
Section titled “decision()?”
optionaldecision(model,endpoint):DecisionModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
model |
string |
endpoint |
Endpoint |
Returns
Section titled “Returns”embedding()?
Section titled “embedding()?”
optionalembedding(model,endpoint):EmbeddingModel
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
model |
string |
endpoint |
Endpoint |
Returns
Section titled “Returns”listModels()?
Section titled “listModels()?”
optionallistModels(endpoint):Promise<ListedModel[]>
What this endpoint actually serves right now, where the vendor can say.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
endpoint |
Endpoint |
Returns
Section titled “Returns”Promise<ListedModel[]>
VendorCode
Section titled “VendorCode”The vendor call code an adapter package may ship beside its adapter.
A harness adapter owns a session model; a vendor-carrying adapter also owns call code for vendors Barry does not ship — its own rows and the factories that serve them, installed and recorded like the adapter itself. The rows are snapshotted into the installed record, so the catalog a picker reads costs no imports; the factories load when the process that hosts models asks for them.
Properties
Section titled “Properties”| Property | Type |
|---|---|
factories |
VendorFactories |
vendors |
Vendor[] |
VendorFactories
Section titled “VendorFactories”The per-kind call code, keyed by the vendor id it serves. What a kind directory exports; what turns parsed catalog data into callable vendors.
Properties
Section titled “Properties”| Property | Type |
|---|---|
check? |
Partial<Record<string, (endpoint, model?) => Promise<Check[]>>> |
completion? |
Partial<Record<string, (model, endpoint) => CompletionModel>> |
decision? |
Partial<Record<string, (model, endpoint) => DecisionModel>> |
embedding? |
Partial<Record<string, (model, endpoint) => EmbeddingModel>> |
listModels? |
Partial<Record<string, (endpoint) => Promise<ListedModel[]>>> |
Type Aliases
Section titled “Type Aliases”Answer
Section titled “Answer”Answer = {
confidence?:number;probability:number;type:"boolean";value:boolean; } | {confidence?:number;probabilities?:Record<string,number>;type:"choice";value:string; } | {confidence?:number;legend?:string;type:"score";value:number; }
The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
BaseUrl
Section titled “BaseUrl”BaseUrl =
string| {env?:string;fallback?:string;path?:string; }
Where a vendor listens: a fixed URL, or an env override with the vendor’s own default behind it. A local daemon’s default is its vendor’s documented port (Ollama’s 11434); Barry keeps no port table of other people’s software.
InstalledModelProvider
Section titled “InstalledModelProvider”InstalledModelProvider =
z.infer<typeofregistration>
Platform
Section titled “Platform”Platform =
"aix"|"android"|"darwin"|"freebsd"|"haiku"|"linux"|"openbsd"|"sunos"|"win32"|"cygwin"|"netbsd"
Platform names are wire data and must also be usable without Node declarations.
Question
Section titled “Question”Question = {
instructions:string;type:"boolean"; } | {instructions:string;options:string[];type:"choice"; } | {instructions:string;levels:string[];type:"score"; }
The model contracts: what a model can be asked, and the Models door every
caller reaches one through.
Everything needed to WRITE a vendor or call a model, and nothing that
implements one. The vendors Barry ships live in registered bags’ vendor declarations with the call
code attached by the installation composition root; a
composition root hands them to createModels and installs the result.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ instructions: string; type: "boolean"; }
Type Literal
Section titled “Type Literal”{ instructions: string; options: string[]; type: "choice"; }
Type Literal
Section titled “Type Literal”{ instructions: string; levels: string[]; type: "score"; }
2–10 labelled levels.
ShippedModelProvider
Section titled “ShippedModelProvider”ShippedModelProvider =
Pick<InstalledModelProvider,"packageName"|"version"|"path"> &object
Type Declaration
Section titled “Type Declaration”| Name | Type |
|---|---|
contractVersion |
unknown |
factoryExport |
unknown |
Variables
Section titled “Variables”registration
Section titled “registration”
constregistration:ZodObject<{contractVersion:ZodLiteral<1>;factoryExport:ZodString;packageName:ZodString;path:ZodString;shipped:ZodOptional<ZodLiteral<true>>;version:ZodString; },$strict>
SHIPPED_VENDORS
Section titled “SHIPPED_VENDORS”
constSHIPPED_VENDORS:Vendor[]
SHIPPED_VENDORS_YAML
Section titled “SHIPPED_VENDORS_YAML”
constSHIPPED_VENDORS_YAML:string
VendorCatalogSchema
Section titled “VendorCatalogSchema”
constVendorCatalogSchema:ZodArray<ZodObject<{baseUrl:ZodOptional<ZodUnion<readonly [ZodString,ZodObject<{env:ZodOptional<ZodString>;fallback:ZodOptional<ZodString>;path:ZodOptional<ZodString>; },$strict>]>>;compatible:ZodOptional<ZodArray<ZodObject<{baseUrl:ZodUnion<readonly [ZodString,ZodObject<{env: …;fallback: …;path: …; },$strict>]>;egressSandbox:ZodOptional<ZodBoolean>;structuredOutput:ZodOptional<ZodEnum<{native:"native";prompted:"prompted"; }>>;with:ZodString; },$strict>>>;credential:ZodUnion<readonly [ZodObject<{env:ZodString;field:ZodOptional<ZodEnum<{notes:"notes";password:"password";uri:"uri";username:"username"; }>>;item:ZodOptional<ZodString>; },$strict>,ZodObject<{placeholder:ZodString; },$strict>,ZodNull]>;id:ZodString;label:ZodString;models:ZodArray<ZodObject<{dimensions:ZodOptional<ZodNumber>;id:ZodString;kind:ZodEnum<{completion:"completion";decision:"decision";embedding:"embedding"; }>;label:ZodString;local:ZodOptional<ZodBoolean>;note:ZodOptional<ZodString>;roles:ZodOptional<ZodArray<ZodEnum<{default:"default";small:"small"; }>>>;structuredOutput:ZodOptional<ZodEnum<{native:"native";prompted:"prompted"; }>>; },$strict>>; },$strict>>
Functions
Section titled “Functions”answerViaJson()
Section titled “answerViaJson()”answerViaJson(
questions,raw):Record<string,Answer>
Validate a model’s JSON into answers, failing loudly on anything unusable.
A missing key, a choice outside the offered set, or a score outside the level range all throw naming the question — the caller can retry or fall back, but it is never handed a value the model invented.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
questions |
Record<string, Question> |
raw |
string |
Returns
Section titled “Returns”Record<string, Answer>
assembleVendors()
Section titled “assembleVendors()”assembleVendors(
specs,factories):Vendor[]
Attach the call code to the catalog data.
A factory keyed by a vendor the catalog does not list is refused rather than silently dropped: a misspelled id would otherwise leave that vendor’s models unpickable-at and the failure would surface frames away from the typo that caused it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
specs |
readonly Vendor[] |
factories |
VendorFactories |
Returns
Section titled “Returns”Vendor[]
checkRequirements()
Section titled “checkRequirements()”checkRequirements(
requirements,probes):Check[]
binary, version and pin — in that order, always all three. Credentials are not a host requirement: they are declared per harness bag and enforced by the session gate against the identity’s sources.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
requirements |
Requirements |
probes |
HostProbes |
Returns
Section titled “Returns”Check[]
createModels()
Section titled “createModels()”createModels(
vendors,options?):Models
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendors |
readonly Vendor[] |
options |
ModelsOptions |
Returns
Section titled “Returns”defineVendor()
Section titled “defineVendor()”defineVendor(
vendor):Vendor
Checks what no type can: each model id appears once, and at most one model
of a kind claims each role — two default completion models would make the
choice depend on file order.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendor |
Vendor |
Returns
Section titled “Returns”defineVendorCode()
Section titled “defineVendorCode()”defineVendorCode(
code):VendorCode
Give a vendor-code literal its type, and refuse incoherence by name: a factory keyed by a vendor this code does not declare would dangle forever — no row, so no ref can ever reach it — and the moment to learn that is the install, not the first call.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
code |
VendorCode |
Returns
Section titled “Returns”describeQuestions()
Section titled “describeQuestions()”describeQuestions(
questions):string
Describe the questions as a system prompt.
Says the shape once, per question, in the model’s own terms — an enum lists its options, a score lists its levels with their indices. Vaguer phrasing (“answer as JSON”) produces keys that do not match and values out of range.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
questions |
Record<string, Question> |
Returns
Section titled “Returns”string
formatChecks()
Section titled “formatChecks()”formatChecks(
title,checks):string[]
One line per check, passes included, then the fixes for what failed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
title |
string |
checks |
readonly Check[] |
Returns
Section titled “Returns”string[]
installedModels()
Section titled “installedModels()”installedModels():
Models
The models this process was started with.
Throws ModelsNotInstalled — never a “model unavailable” — when nothing was
installed: the two need different fixes, and reading a wiring mistake as an
unavailable model is how a sweep once skipped every run while the daemon was
up with the model pulled.
Returns
Section titled “Returns”installModels()
Section titled “installModels()”installModels(
models):void
Called once by whatever process starts — the API, the engine, the CLI, a job.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
models |
Models |
Returns
Section titled “Returns”void
isOfferedModel()
Section titled “isOfferedModel()”isOfferedModel(
harness,vendors,id):boolean
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
OfferingHarness |
vendors |
readonly Vendor[] |
id |
string |
Returns
Section titled “Returns”boolean
keylessRouteRefusal()
Section titled “keylessRouteRefusal()”keylessRouteRefusal(
harness,route,vendors,env):string|null
Why routing this session to its endpoint would hand the user’s own login to another vendor, or null when it would not.
A harness whose fallback without a key is the user’s subscription login sends that login wherever it is pointed. So an endpoint that needs a key, reached without one, is refused rather than warned about: the request would fail at the vendor anyway, having carried the credential there.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
RoutingHarness |
route |
Route |
vendors |
readonly Vendor[] |
env |
Record<string, string | undefined> |
Returns
Section titled “Returns”string | null
loadModelProviders()
Section titled “loadModelProviders()”loadModelProviders(
options):ModelProviders
No discovery of siblings and no implicit defaults: add is the installation’s selection.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ModelProviderStoreOptions |
Returns
Section titled “Returns”mergeVendorFactories()
Section titled “mergeVendorFactories()”mergeVendorFactories(…
sources):VendorFactories
Compose independently installed providers without silently replacing one.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…sources |
VendorFactories[] |
Returns
Section titled “Returns”offeredModels()
Section titled “offeredModels()”offeredModels(
harness,vendors):OfferedModelInfo[]
A harness’s own vendor’s completion models, then those of each vendor it can be routed to; a harness with no vendor offers the list it declares.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
OfferingHarness |
vendors |
readonly Vendor[] |
Returns
Section titled “Returns”parseVendorCatalog()
Section titled “parseVendorCatalog()”parseVendorCatalog(
text):Vendor[]
Parse a legacy standalone catalog. Refuses, by name: an unknown or misspelled key
(the schema is strict — a typo’d field must not parse as absence), a model
id twice in one vendor, two default models of a kind, and a compatibility
door naming a vendor the file does not list.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
Returns
Section titled “Returns”Vendor[]
parseVersion()
Section titled “parseVersion()”parseVersion(
requirements,output):string|null
The version a binary’s output reports, by the requirement’s pattern. null
when the pattern finds nothing — Barry’s declaration is out of date, which is
not the same as the harness being missing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
requirements |
Requirements |
output |
string |
Returns
Section titled “Returns”string | null
preflightLine()
Section titled “preflightLine()”preflightLine(
subject,checks):string
The one line barry start prints before launching — always a line, success included.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
subject |
string |
checks |
readonly Check[] |
Returns
Section titled “Returns”string
reachableVendors()
Section titled “reachableVendors()”reachableVendors(
harness,vendors):Vendor[]
Other vendors serving this harness vendor’s API, on a harness Barry can point at them.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
RoutingHarness |
vendors |
readonly Vendor[] |
Returns
Section titled “Returns”Vendor[]
registeredVendorRows()
Section titled “registeredVendorRows()”registeredVendorRows(
registry?,includeShipped?):Vendor[]
Catalogs are installed declarations, independent of identity packing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
registry? |
BagRegistry |
includeShipped? |
boolean |
Returns
Section titled “Returns”Vendor[]
routedEndpoint()
Section titled “routedEndpoint()”routedEndpoint(
harness,model,vendors,env,override?):Endpoint|undefined
Where a harness reaches a model another vendor serves: that vendor’s door for the harness vendor’s API, with its key, resolved against the session’s env — which is where an identity’s keys and a session’s BARRY_OLLAMA_URL live, not the process’s.
Undefined for the harness’s own vendor’s model, for a model named without its vendor, and for a harness Barry cannot point anywhere: the harness then uses its own settings, which Barry never overrides.
override moves only an address resolved at runtime (a local daemon’s); a
vendor’s fixed address is its own.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
RoutingHarness |
model |
string | undefined |
vendors |
readonly Vendor[] |
env |
Record<string, string | undefined> |
override |
{ baseUrl?: string; } |
override.baseUrl? |
string |
Returns
Section titled “Returns”Endpoint | undefined
routedVendorOf()
Section titled “routedVendorOf()”routedVendorOf(
harness,model,vendors):Vendor|undefined
The vendor serving model that this harness can be pointed at, if any.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
RoutingHarness |
model |
string |
vendors |
readonly Vendor[] |
Returns
Section titled “Returns”Vendor | undefined
routeModel()
Section titled “routeModel()”routeModel(
harness,given,vendors):Route
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
RoutingHarness |
given |
RouteRequest |
vendors |
readonly Vendor[] |
Returns
Section titled “Returns”shippedModelProviders()
Section titled “shippedModelProviders()”shippedModelProviders(
root):ShippedModelProvider[]
Discover declarations without importing code or requiring a built package.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
root |
string |
Returns
Section titled “Returns”suggestOfferedModels()
Section titled “suggestOfferedModels()”suggestOfferedModels(
harness,vendors,partial):string[]
Offered models close to a (possibly misspelled) id. Substring matches win; otherwise a fuzzy subsequence match, so “claude-huiku” still suggests “claude-haiku-4-5”.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
harness |
OfferingHarness |
vendors |
readonly Vendor[] |
partial |
string |
Returns
Section titled “Returns”string[]
validateVendorCatalog()
Section titled “validateVendorCatalog()”validateVendorCatalog(
vendors,checkCompatibility?):Vendor[]
Validate catalog relationships independently of its containing file.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
vendors |
Vendor[] |
undefined |
checkCompatibility |
boolean |
true |
Returns
Section titled “Returns”Vendor[]