# Addon Integration Shim

ApiVault ships a ready-to-use zero-config integration shim for addon authors.

## Required action

Copy this file into the target addon folder:

```text
ApiVault/Integrations/ApiVaultAddonShim.lua
```

Add it near the end of the target addon's `.toc`:

```toc
## OptionalDeps: ApiVault
ApiVaultAddonShim.lua
```

If the addon already has `## OptionalDeps`, append `ApiVault` to that line.

No Lua edits are required.

## What the zero-config shim reports

The shim automatically registers with ApiVault when ApiVault is available and exposes standard callbacks for:

- metadata
- capabilities
- version info
- status
- SavedVariables status
- self-test
- runtime summary
- debug snapshot
- full report
- logs
- recent errors
- API traces
- event traces
- secure-risk reports
- checkpoints
- sessions
- pending report requests

SavedVariables are detected through runtime TOC metadata when exposed and through common DB-name checks such as `AddonNameDB`, `AddonName_DB`, `AddonNameSettings`, `AddonNameConfig` and `AddonNameCache`. The shim does not read source files.

## Optional advanced overrides

Advanced addons may override callbacks through `ns.ApiVaultIntegration`, but this is not needed for normal integration.

Supported override names:

```lua
OnGetMetadata
OnGetCapabilities
OnGetVersionInfo
OnGetStatus
OnGetSavedVariablesStatus
OnRunSelfTest
OnBuildRuntimeSummary
OnBuildDebugSnapshot
OnBuildReport
OnGetLogs
OnGetRecentErrors
OnGetAPITraces
OnGetEventTraces
OnGetSecureRisks
OnGetCheckpoints
OnRequest
OnBridgeUnavailable
OnBeforeRegister
OnAfterRegister
```

## Safe failure behavior

If ApiVault is not installed or not loaded, the shim does not throw errors and does not block the target addon.

## ApiVault panels

After installation and `/reload`:

- `/av addons` shows whether the addon is integrated.
- `/av reports` shows available reports and callbacks.
- `/av docs` search `shim` shows this workflow.

## Safety policy

The shim does not force-load ApiVault, does not perform protected actions, does not read files at runtime, and does not register `COMBAT_LOG_EVENT_UNFILTERED`.
