@leumas/capability-sdk
The register-capability SDK — any page/plugin registers live functioncalls the Leviathan widget picks up on mount (and drops on unmount), plus the client-side trigger runtime (wakeword/hotkey/dom)...
@leumas/capability-sdk
Register capabilities from any component — Leviathan picks them up live. The frontend half of the programmability layer (ported from leumas-cursor-agent-mvp's Leviathan, see provenance files): scope-map capability registry, client trigger runtime (wakeword/wakephrase/hotkey/dom/route/idle), client action registry (matching @leumas/actions manifests), the safe flows engine, self-authored runtime capabilities, and the realtime-voice WebRTC hook.
import { CapabilityProvider, TriggerRuntime, useRegisterCapability, createClientActionRegistry } from '@leumas/capability-sdk';
import { LeviathanWidget } from '@leumas/leviathan';
// App root (Studio/Web): provider → trigger runtime → widget
<CapabilityProvider>
<TriggerRuntime actionRegistry={createClientActionRegistry({ navigate })}>
<App />
<LeviathanWidget client={leviathanClient} />
</TriggerRuntime>
</CapabilityProvider>
// Any page: capabilities register on mount, unregister on unmount
useRegisterCapability([
{ name: 'add_contact', description: 'Add a contact', parameters: {...}, call: (args) => addContact(args) },
], { scopeId: 'contacts', pageTitle: 'Contacts' });
Everything meets on the shared bus (capabilities:changed, leviathan:open, trigger:fired, action:run, wakeword:simulate — simulateHear('leviathan') is the mic-free test hook). Rules with runtime:'client' arm in the browser; server rules reach the page as SSE directives.
What it exports
54 exports: 7 components, 8 hooks, 39 helpers. Import from @leumas/capability-sdk.
ALLOWED_PRIMITIVESCapabilityProviderCLIENT_TRIGGER_ADAPTERSGLOBAL_SCOPEPOLICY_MODESPOLICY_MODESTriggerRuntimeuseAutomationStreamuseCapabilitiesuseCapabilityContextuseGlobalToolsusePageCapabilitiesuseRealtimeVoiceuseRegisterCapabilityuseTriggerRuntimeapplyCapabilityPolicyapplyCapabilityPolicybuildDefineCapabilityToolbuildRuntimeCapabilitybusbusclearLedgercollectRealtimeResponsecompileArgcompileArgscreateBuscreateBuscreateClientActionRegistrycreateDefaultPrimitivescreateGlobalToolsdescribePolicydescribePolicyemptyPolicyemptyPolicyevalConditionextractRealtimeTextFromOutputfailinterpolateisSpeechBlockedloadListenerEnablednoteScopenoteScopeGoneokparseRealtimeEventreadLedgerretrySpeechrunCapabilityStepsrunFlowsaveListenerEnabledsimulateHeartoClientToolstoRealtimeToolsvalidateCapabilitiesvalidateSteps