Skip to content
WIP

This guide is a work in progress. Barry is also a work in progress.

@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";

HarnessId = string


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 = "hosted" | "instrumented" | "guest"

Who is at the controls of a session, and so what Barry holds.


ModelKind = "completion" | "embedding" | "decision"


ModelRef = `${VendorId}/${string}`

A model as its vendor names it: ollama/qwen3:4b, anthropic/claude-opus-5.


VendorId = string

const HARNESS_ID_MAX_LENGTH: 64 = 64


const HARNESS_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.


const HarnessIdSchema: 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.


const MODE_IDS: readonly ModeId[]

generateId(): string

A new opaque id: 21 URL-safe characters, as nanoid makes them, from Web Crypto so it runs anywhere.

string


isHarnessId(id): boolean

Parameter Type
id string

boolean


modelRef(vendor, model): `${string}/${string}`

Parameter Type
vendor string
model string

`${string}/${string}`


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.

Parameter Type
ref string

{ model: string; vendor: string; } | undefined