| Version | 0.1.0 |
| Purity | pure zero-dep (browser-safe) |
| Purpose | The unified capability-inventory seam: neutral CapabilityRecord types + the CapabilitySource trait + the read-fan-in CapabilityMultiplexer. |
| Workspace deps | none |
| External deps | none (runtime). Dev only: tsup, typescript, vitest, @clawboo/tsconfig. |
CapabilitySource trait, and the multiplexer; the five concrete server-side adapters live in apps/web/server/lib/capabilitySource/. One merged CapabilityRecord stream feeds both the Ghost Graph and the Capabilities dashboard. Package shape mirrors @clawboo/agent-registry; the read()-fan-in trait mirrors @clawboo/scheduler.
Public API
All exports come from the single. barrel (src/index.ts). No subpath exports.
Functions
| Export | Signature | Contract |
|---|---|---|
makeCapabilityId | (sourceId: CapabilitySourceId, rawKey: string) => string | Composes the source-namespaced id ${sourceId}:${rawKey}. |
parseCapabilityId | (id: string) => { sourceId: CapabilitySourceId; rawKey: string } | null | Splits an id back into source + raw key on the FIRST : (so a rawKey containing : survives); null when no known source prefix matches. |
unsupported | (sourceId: CapabilitySourceId, action: string, manageability?: CapabilityManageability) => never | The canonical throw every observe-only source.write() raises; constructs and throws UnsupportedCapabilityWriteError (default manageability = 'observe-only'). |
Classes
| Export | Description |
|---|---|
CapabilityMultiplexer | The fan-in over registered sources. register(source), list(), get(id), read() (per-source try/catch → one merged { records, sources }, never rejects), write(action) (owner-routed by spec.via for install or id-prefix for enable/disable; unknown source → throws UnknownCapabilityError). |
UnknownCapabilityError | extends Error. code = 'unknown_capability', target: string. Thrown for an action targeting an unknown source or unparseable id. REST maps to 404. |
UnsupportedCapabilityWriteError | extends Error. code = 'unsupported_capability_write', sourceId, action, manageability. Thrown for a write aimed at a tier that forbids it. REST maps to 422. |
Types & interfaces
Records (records.ts):
| Export | Kind | Contract |
|---|---|---|
CapabilityRecord | interface | The normalized capability row every source projects into: superset of ToolDescriptor adding kind/runtime/scope/manageability. Carries id, sourceKey, name, description, agentId | null, source, server-evaluated available + diagnostics, status, optional writable/hint, provenance | null, dormant tenantId | null, and syncedAt (ISO). |
CapabilitySourceId | union | 'native' | 'hermes' | 'claude-code' | 'codex' | 'openclaw', the five read-adapter / id-prefix keys. |
CapabilityRuntime | union | Owning runtime, open set: 'openclaw' | 'clawboo-native' | 'claude-code' | 'codex' | 'hermes' | 'human' | (string & {}). 'human' is the humans-in-the-graph seam. |
CapabilityKind | union | 'skill' | 'tool' | 'connector'. |
CapabilityScope | union | 'team' | 'agent' | 'global'. |
CapabilityManageability | union | 'managed' | 'external-write' | 'runtime-of-record' | 'observe-only', the tier the UI + write() path are a pure function of. |
CapabilityOrigin | union | Where the record was read from: 'brokered-mcp' | 'curated-skill' | 'filesystem-skill-md' | 'mcp-connector' | 'runtime-builtin' | 'openclaw-extension' | 'external-vendor-cli'. |
CapabilityStatus | union | 'ready' | 'disabled' | 'manageable-but-pending-auth' | 'unavailable'. |
CapabilityAvailability | union | Declarative requirement: { auth } | { config } | { env } | { plugin } | { allOf: [] } | { anyOf: [] }. Local structural mirror of @clawboo/db’s AvailabilityRequirement. |
CapabilityProvenance | interface | Ed25519 provenance seam: signerId?, signature?, signedAt?. |
CanonicalMcpServer | interface | Runtime-neutral MCP server spec (the transcoder input): name, transport: 'stdio' | 'http', optional command/args/env/url. |
source.ts):
| Export | Kind | Contract |
|---|---|---|
CapabilitySource | interface | readonly id: CapabilitySourceId; read(): Promise<CapabilityReadResult> (NEVER rejects; degradation is the status); write(action): Promise<CapabilityRecord | null> (throws the typed errors; observe-only → unsupported()). |
CapabilityReadResult | interface | { records: CapabilityRecord[]; status: SourceReadStatus }. |
SourceReadStatus | interface | { sourceId, ok, degraded, reason?, at }, per-source liveness. |
CapabilityWriteAction | union | { kind: 'install'; spec } | { kind: 'enable'; id } | { kind: 'disable'; id }. |
CapabilityInstallSpec | interface | A connector/skill install: via (the owning adapter), agentId, runtime, kind, name, optional mcpServer/skillContent, dormant tenantId?. |
CapabilityApprovalDecision | union | 'allow_once' | 'allow_always' | 'deny', reused by the REST approve action (resolves a tool_call_approvals row, NOT a source-routed write). |
registry.ts):
| Export | Kind | Contract |
|---|---|---|
MergedCapabilityRead | interface | { records: CapabilityRecord[]; sources: SourceReadStatus[] }, the merged read shape. |
Used by
apps/web/server/lib/capabilitySource/, the five concrete adapters (native.ts,hermes.ts,claudeCode.ts,codex.ts,openclaw.ts),registry.ts(constructs theCapabilityMultiplexer),service.ts,mapper.ts,helpers.ts, andtranscoder.ts.apps/web/server/api/capabilities.ts, the/api/capabilitiesREST surface.apps/web/src/lib/capabilitiesClient.ts, the browser client (re-exportsCapabilityRecord,SourceReadStatus).apps/web/src/features/graph/(store.ts,useGraphData.ts) andapps/web/src/features/agent-detail/useMiniGraphData.ts, the Ghost Graph consumes the same stream.
Source
Barrel:packages/capability-registry/src/index.ts (re-exports records.ts, source.ts, errors.ts, registry.ts).
See also
- Capabilities concept, capability inventory + manageability tiers.
/api/capabilitiesREST, the merged stream + write actions.@clawboo/agent-registry, the package-shape precedent.@clawboo/scheduler, theread()-fan-in trait precedent.