> For the complete documentation index, see [llms.txt](https://docs.privalo.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.privalo.dev/scripts/essentials/poligrafo/exports.md).

# EXPORTS

#### Bridge (editable sin desencriptar)

La integración con el framework vive en **`bridge/client.lua`** y **`bridge/server.lua`**, y están en `escrow_ignore` (junto a `config.lua` y `locales/`). Puedes **editarlos aunque el recurso esté encriptado**:

* `bridge/server.lua` → `PV_GetMeta(src, key)` (estrés/alcohol/drogas) y `PV_GetJob(src)` (trabajo).
* `bridge/client.lua` → `PV_Notify(desc)` (cómo se muestran las notificaciones).

Así adaptas el script a tu core/notify/metadata sin tocar la lógica principal.

#### Exports — SERVIDOR

| Export                                                 | Descripción                                                   |
| ------------------------------------------------------ | ------------------------------------------------------------- |
| `exports.pv_poligrafo:SetChances(truth, lie)`          | Cambia las probabilidades en caliente. Devuelve `truth, lie`. |
| `exports.pv_poligrafo:GetChances()`                    | Devuelve `truth, lie` actuales.                               |
| \`exports.pv\_poligrafo:ForceNextResult(kitId, 'truth' | 'lie')\`                                                      |
| `exports.pv_poligrafo:GetKit(kitId)`                   | `{ owner, interviewer, interviewee, active }` o `nil`.        |
| `exports.pv_poligrafo:EndAllSessions()`                | Cierra y retira todas las sesiones/kits.                      |

#### Exports — CLIENTE

| Export                                         | Descripción                                             |
| ---------------------------------------------- | ------------------------------------------------------- |
| `exports.pv_poligrafo:placeKit()`              | Despliega el kit frente al jugador (igual que el item). |
| `exports.pv_poligrafo:isInSession()`           | `'interviewer'` / `'interviewee'` / `false`.            |
| `exports.pv_poligrafo:openPlayerPicker(kitId)` | Abre el selector de jugador cercano.                    |

#### Hook de resultado (servidor)

Cada vez que se calcula un resultado se dispara un evento para que lo uses en MDT / Discord / logs:

```lua
AddEventHandler('pv_polygraph:server:onResult', function(data)
    -- data = { kitId, interviewer, interviewee, question, answer, result }  ('truth' | 'lie')
    print(('%s -> %s'):format(data.question, data.result))
end)
```

#### Otros hooks configurables

* **Notificaciones propias:** `Config.Bridge.Notify = 'custom'` + `Config.Bridge.CustomNotifyEvent`.
* **Metadata externa** (estrés/alcohol/drogas desde tu propio recurso):

  ```lua
  Config.MetadataProvider = { resource = 'mi_estres', method = 'getStat' }
  -- el script llamará exports['mi_estres']:getStat(src, key)
  ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.privalo.dev/scripts/essentials/poligrafo/exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
