Skip to main content
Version0.1.0
Puritypure zero-dep (browser-safe)
PurposeThe unified capability-inventory seam: neutral CapabilityRecord types + the CapabilitySource trait + the read-fan-in CapabilityMultiplexer.
Workspace depsnone
External depsnone (runtime). Dev only: tsup, typescript, vitest, @clawboo/tsconfig.
clawboo OBSERVES every capability across all five runtimes (OpenClaw, clawboo-native, Claude Code, Codex, Hermes) and MANAGES only what the owning runtime cedes. This package holds ONLY the neutral types, the 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

ExportSignatureContract
makeCapabilityId(sourceId: CapabilitySourceId, rawKey: string) => stringComposes the source-namespaced id ${sourceId}:${rawKey}.
parseCapabilityId(id: string) => { sourceId: CapabilitySourceId; rawKey: string } | nullSplits 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) => neverThe canonical throw every observe-only source.write() raises; constructs and throws UnsupportedCapabilityWriteError (default manageability = 'observe-only').

Classes

ExportDescription
CapabilityMultiplexerThe 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).
UnknownCapabilityErrorextends Error. code = 'unknown_capability', target: string. Thrown for an action targeting an unknown source or unparseable id. REST maps to 404.
UnsupportedCapabilityWriteErrorextends 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):
ExportKindContract
CapabilityRecordinterfaceThe 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).
CapabilitySourceIdunion'native' | 'hermes' | 'claude-code' | 'codex' | 'openclaw', the five read-adapter / id-prefix keys.
CapabilityRuntimeunionOwning runtime, open set: 'openclaw' | 'clawboo-native' | 'claude-code' | 'codex' | 'hermes' | 'human' | (string & {}). 'human' is the humans-in-the-graph seam.
CapabilityKindunion'skill' | 'tool' | 'connector'.
CapabilityScopeunion'team' | 'agent' | 'global'.
CapabilityManageabilityunion'managed' | 'external-write' | 'runtime-of-record' | 'observe-only', the tier the UI + write() path are a pure function of.
CapabilityOriginunionWhere the record was read from: 'brokered-mcp' | 'curated-skill' | 'filesystem-skill-md' | 'mcp-connector' | 'runtime-builtin' | 'openclaw-extension' | 'external-vendor-cli'.
CapabilityStatusunion'ready' | 'disabled' | 'manageable-but-pending-auth' | 'unavailable'.
CapabilityAvailabilityunionDeclarative requirement: { auth } | { config } | { env } | { plugin } | { allOf: [] } | { anyOf: [] }. Local structural mirror of @clawboo/db’s AvailabilityRequirement.
CapabilityProvenanceinterfaceEd25519 provenance seam: signerId?, signature?, signedAt?.
CanonicalMcpServerinterfaceRuntime-neutral MCP server spec (the transcoder input): name, transport: 'stdio' | 'http', optional command/args/env/url.
Source trait (source.ts):
ExportKindContract
CapabilitySourceinterfacereadonly id: CapabilitySourceId; read(): Promise<CapabilityReadResult> (NEVER rejects; degradation is the status); write(action): Promise<CapabilityRecord | null> (throws the typed errors; observe-onlyunsupported()).
CapabilityReadResultinterface{ records: CapabilityRecord[]; status: SourceReadStatus }.
SourceReadStatusinterface{ sourceId, ok, degraded, reason?, at }, per-source liveness.
CapabilityWriteActionunion{ kind: 'install'; spec } | { kind: 'enable'; id } | { kind: 'disable'; id }.
CapabilityInstallSpecinterfaceA connector/skill install: via (the owning adapter), agentId, runtime, kind, name, optional mcpServer/skillContent, dormant tenantId?.
CapabilityApprovalDecisionunion'allow_once' | 'allow_always' | 'deny', reused by the REST approve action (resolves a tool_call_approvals row, NOT a source-routed write).
Multiplexer (registry.ts):
ExportKindContract
MergedCapabilityReadinterface{ 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 the CapabilityMultiplexer), service.ts, mapper.ts, helpers.ts, and transcoder.ts.
  • apps/web/server/api/capabilities.ts, the /api/capabilities REST surface.
  • apps/web/src/lib/capabilitiesClient.ts, the browser client (re-exports CapabilityRecord, SourceReadStatus).
  • apps/web/src/features/graph/ (store.ts, useGraphData.ts) and apps/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