@barry-rocks/sdk/ids
Shared identifier types and helpers: harness, mode, model, and vendor ids,
parseModelRef and modelRef for vendor/model strings, isHarnessId, and
generateId.
import { … } from "@barry-rocks/sdk/ids";Type Aliases
Section titled “Type Aliases”HarnessId
Section titled “HarnessId”HarnessId =
string
JsonSchema
Section titled “JsonSchema”JsonSchema =
Record<string,unknown>
Plain JSON Schema rather than a zod type: the workspace is split across zod 3 and zod 4, and accepting either would force every contract to pick a side.
ModeId
Section titled “ModeId”ModeId =
"hosted"|"instrumented"|"guest"
Who is at the controls of a session, and so what Barry holds.
ModelKind
Section titled “ModelKind”ModelKind =
"completion"|"embedding"|"decision"
ModelRef
Section titled “ModelRef”ModelRef =
`${VendorId}/${string}`
A model as its vendor names it: ollama/qwen3:4b, anthropic/claude-opus-5.
VendorId
Section titled “VendorId”VendorId =
string
Variables
Section titled “Variables”HARNESS_ID_MAX_LENGTH
Section titled “HARNESS_ID_MAX_LENGTH”
constHARNESS_ID_MAX_LENGTH:64=64
HARNESS_ID_PATTERN
Section titled “HARNESS_ID_PATTERN”
constHARNESS_ID_PATTERN:RegExp
What a harness id may look like — shape, not membership. Ids reach directory names and CLI flags, so one that could not be either is wrong before anyone asks whether that harness is installed; whether it IS is the installed-adapters record’s answer.
A RegExp rather than a zod schema because the workspace is split across zod 3 and zod 4, and both need it.
HarnessIdSchema
Section titled “HarnessIdSchema”
constHarnessIdSchema:ZodString
A validated harness id — SHAPE, not membership.
Was a closed enum of the four Barry ships, which made a third-party adapter
impossible to record. Whether a harness is installed is answered where
installation is recorded (~/.barry/adapters.json, and the
agent_adapters foreign key beneath session rows); this answers whether an
id could be one at all.
MODE_IDS
Section titled “MODE_IDS”
constMODE_IDS: readonlyModeId[]
Functions
Section titled “Functions”generateId()
Section titled “generateId()”generateId():
string
A new opaque id: 21 URL-safe characters, as nanoid makes them, from Web Crypto so it runs anywhere.
Returns
Section titled “Returns”string
isHarnessId()
Section titled “isHarnessId()”isHarnessId(
id):boolean
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”boolean
modelRef()
Section titled “modelRef()”modelRef(
vendor,model):`${string}/${string}`
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
vendor |
string |
model |
string |
Returns
Section titled “Returns”`${string}/${string}`
parseModelRef()
Section titled “parseModelRef()”parseModelRef(
ref): {model:string;vendor:string; } |undefined
Split a ref at its FIRST slash. Model ids may contain slashes themselves —
an Ollama model pulled from Hugging Face is hf.co/org/name — so the vendor
is everything before the first one and the model is everything after.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
string |
Returns
Section titled “Returns”{ model: string; vendor: string; } | undefined