{
  "schema": "leumas.docs.page/1",
  "id": "pkg:@leumas/capability-sdk",
  "slug": "packages/capability-sdk",
  "kind": "capabilities",
  "bucket": "package",
  "title": "@leumas/capability-sdk",
  "name": "@leumas/capability-sdk",
  "eyebrow": null,
  "chip": null,
  "summary": "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)...",
  "keywords": [
    "capability-sdk",
    "hotkey",
    "realtime-voice",
    "webrtc",
    "wakeword",
    "leumas capability sdk",
    "unmount",
    "flows"
  ],
  "audience": "both",
  "funnel": {
    "product": null,
    "cta": null
  },
  "body": "# @leumas/capability-sdk\n\n**Register capabilities from any component — Leviathan picks them up live.** The frontend half of\nthe programmability layer (ported from leumas-cursor-agent-mvp's Leviathan, see provenance files):\nscope-map capability registry, client trigger runtime (wakeword/wakephrase/hotkey/dom/route/idle),\nclient action registry (matching `@leumas/actions` manifests), the safe flows engine, self-authored\nruntime capabilities, and the realtime-voice WebRTC hook.\n\n```jsx\nimport { CapabilityProvider, TriggerRuntime, useRegisterCapability, createClientActionRegistry } from '@leumas/capability-sdk';\nimport { LeviathanWidget } from '@leumas/leviathan';\n\n// App root (Studio/Web): provider → trigger runtime → widget\n<CapabilityProvider>\n  <TriggerRuntime actionRegistry={createClientActionRegistry({ navigate })}>\n    <App />\n    <LeviathanWidget client={leviathanClient} />\n  </TriggerRuntime>\n</CapabilityProvider>\n\n// Any page: capabilities register on mount, unregister on unmount\nuseRegisterCapability([\n  { name: 'add_contact', description: 'Add a contact', parameters: {...}, call: (args) => addContact(args) },\n], { scopeId: 'contacts', pageTitle: 'Contacts' });\n```\n\nEverything meets on the shared `bus` (`capabilities:changed`, `leviathan:open`, `trigger:fired`,\n`action:run`, `wakeword:simulate` — `simulateHear('leviathan')` is the mic-free test hook). Rules\nwith `runtime:'client'` arm in the browser; server rules reach the page as SSE directives.\n",
  "source": {
    "path": "shared/packages/capability-sdk/README.md",
    "blobSha": "",
    "commit": "",
    "committedAt": "",
    "provenance": "no-git",
    "bytes": 1672,
    "hash": "3a8cc8af43bc05d7ba0fc87242c3c4f0a373c2b9"
  },
  "urls": {
    "html": "/p/packages/capability-sdk",
    "json": "/docs/packages/capability-sdk.json",
    "md": "/docs/packages/capability-sdk.md"
  },
  "links": {
    "composes": [],
    "usedBy": [
      "pkg:@leumas/chatbots",
      "pkg:@leumas/features",
      "pkg:@leumas/leviathan",
      "pkg:@leumas/studio",
      "pkg:@leumas/web"
    ],
    "product": [
      "pkg:@leumas/admin",
      "pkg:@leumas/studio",
      "pkg:@leumas/web"
    ],
    "howTo": [
      "how-to:programmability"
    ],
    "skills": [
      "skill:leviathan-page-capabilities"
    ]
  },
  "exports": {
    "total": 54,
    "component": 7,
    "hook": 8,
    "helper": 39,
    "names": [
      {
        "n": "ALLOWED_PRIMITIVES",
        "k": "component"
      },
      {
        "n": "CapabilityProvider",
        "k": "component"
      },
      {
        "n": "CLIENT_TRIGGER_ADAPTERS",
        "k": "component"
      },
      {
        "n": "GLOBAL_SCOPE",
        "k": "component"
      },
      {
        "n": "POLICY_MODES",
        "k": "component"
      },
      {
        "n": "POLICY_MODES",
        "k": "component"
      },
      {
        "n": "TriggerRuntime",
        "k": "component"
      },
      {
        "n": "useAutomationStream",
        "k": "hook"
      },
      {
        "n": "useCapabilities",
        "k": "hook"
      },
      {
        "n": "useCapabilityContext",
        "k": "hook"
      },
      {
        "n": "useGlobalTools",
        "k": "hook"
      },
      {
        "n": "usePageCapabilities",
        "k": "hook"
      },
      {
        "n": "useRealtimeVoice",
        "k": "hook"
      },
      {
        "n": "useRegisterCapability",
        "k": "hook"
      },
      {
        "n": "useTriggerRuntime",
        "k": "hook"
      },
      {
        "n": "applyCapabilityPolicy",
        "k": "helper"
      },
      {
        "n": "applyCapabilityPolicy",
        "k": "helper"
      },
      {
        "n": "buildDefineCapabilityTool",
        "k": "helper"
      },
      {
        "n": "buildRuntimeCapability",
        "k": "helper"
      },
      {
        "n": "bus",
        "k": "helper"
      },
      {
        "n": "bus",
        "k": "helper"
      },
      {
        "n": "clearLedger",
        "k": "helper"
      },
      {
        "n": "collectRealtimeResponse",
        "k": "helper"
      },
      {
        "n": "compileArg",
        "k": "helper"
      },
      {
        "n": "compileArgs",
        "k": "helper"
      },
      {
        "n": "createBus",
        "k": "helper"
      },
      {
        "n": "createBus",
        "k": "helper"
      },
      {
        "n": "createClientActionRegistry",
        "k": "helper"
      },
      {
        "n": "createDefaultPrimitives",
        "k": "helper"
      },
      {
        "n": "createGlobalTools",
        "k": "helper"
      },
      {
        "n": "describePolicy",
        "k": "helper"
      },
      {
        "n": "describePolicy",
        "k": "helper"
      },
      {
        "n": "emptyPolicy",
        "k": "helper"
      },
      {
        "n": "emptyPolicy",
        "k": "helper"
      },
      {
        "n": "evalCondition",
        "k": "helper"
      },
      {
        "n": "extractRealtimeTextFromOutput",
        "k": "helper"
      },
      {
        "n": "fail",
        "k": "helper"
      },
      {
        "n": "interpolate",
        "k": "helper"
      },
      {
        "n": "isSpeechBlocked",
        "k": "helper"
      },
      {
        "n": "loadListenerEnabled",
        "k": "helper"
      },
      {
        "n": "noteScope",
        "k": "helper"
      },
      {
        "n": "noteScopeGone",
        "k": "helper"
      },
      {
        "n": "ok",
        "k": "helper"
      },
      {
        "n": "parseRealtimeEvent",
        "k": "helper"
      },
      {
        "n": "readLedger",
        "k": "helper"
      },
      {
        "n": "retrySpeech",
        "k": "helper"
      },
      {
        "n": "runCapabilitySteps",
        "k": "helper"
      },
      {
        "n": "runFlow",
        "k": "helper"
      },
      {
        "n": "saveListenerEnabled",
        "k": "helper"
      },
      {
        "n": "simulateHear",
        "k": "helper"
      },
      {
        "n": "toClientTools",
        "k": "helper"
      },
      {
        "n": "toRealtimeTools",
        "k": "helper"
      },
      {
        "n": "validateCapabilities",
        "k": "helper"
      },
      {
        "n": "validateSteps",
        "k": "helper"
      }
    ]
  }
}
