Metadata-Version: 2.4
Name: rpa-bot-sdk-core
Version: 1.2.0
Summary: Orchestrator bot-side core: server client, pause/stop, logging, config loading. Shared by rpa-bot-sdk-performer and rpa-bot-sdk-dispatcher.
Author: Kasun Perera
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pandas
Requires-Dist: openpyxl
Provides-Extra: sqlcipher
Requires-Dist: sqlcipher3-binary; extra == "sqlcipher"
Requires-Dist: keyring; extra == "sqlcipher"
Provides-Extra: screenshot
Requires-Dist: pyautogui; extra == "screenshot"

# rpa-bot-sdk-core

The Orchestrator bot-side code shared by every role: `DbClient` (server auth,
queue, assets, storage, human-in-the-loop over HTTP, or a local SQLite queue
in StandaloneMode), `PauseController`/`checkpoint`, `start_command_listener`,
structured logging, `init_all_settings()` (Config.xlsx loader),
`take_screenshot()`, and the `safe_*` UI-action wrappers.

## Server-issued PAUSE/STOP actually reaching the bot

`PauseController`/`checkpoint()` are purely local — they only read/write an
in-process flag. Something still has to notice the server recorded a
PAUSE/RESUME/STOP and set/clear that flag; that something is
`start_command_listener()`, a daemon thread polling once a second. Call it
once, early in `main.py`, right after `db_client.register_run_token(...)`:

```python
from rpa_bot_sdk_core import start_command_listener

start_command_listener(db_client, pause_controller, run_label=run_id,
                       on_stop=lambda: setattr(ctx, "stop_requested", True))
```

Skip this and a bot that reaches a "PAUSE received, waiting for RESUME" wait
(see `rpa-bot-sdk-dispatcher`'s `DispatchState` / `rpa-bot-sdk-performer`'s
`GetTransactionState`) has nothing to wake it back up — it sits until
`MaxPauseDuration` elapses and auto-converts to STOP, even if the server's
own record was resumed within seconds. This is a straight port of the
"ASYNC PAUSE"/"ASYNC RESUME" listener thread pattern already proven in
production bots generated by `enterprise_patch.py`; a bot built directly
from `rpa-bot-sdk-dispatcher`/`-performer` needs this one explicit call to
get the same behaviour.

Neither a Performer nor a Dispatcher project installs this directly — it's
the shared dependency of [`rpa-bot-sdk-performer`](../performer/README.md)
and [`rpa-bot-sdk-dispatcher`](../dispatcher/README.md), pulled in
automatically by whichever of those two a project actually needs.

Bump this package's version specifically when the server contract itself
changes (a `db_client.py` field/action). A change confined to one role's own
orchestration (e.g. `QueueManager`) belongs in that role's package instead.
