mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 20:35:22 +08:00
2.0 KiB
2.0 KiB
Shared runtime source candidate (SDK >=0.7.4)
This source declares sharedRuntime: shared-runtime-v1 and componentModel: stateless-v1.
It is source-reviewed for the multi-tenant contract; it is not certified and makes no
claim of live tenant acceptance.
- The QWeather API key and subscription type are read per invocation from
self.plugin.get_config(). Nothing is copied onto the plugin or the command component, so a shared worker never serves one installation with another installation's key. - The HTTP fan-out (
Weather.load_data) is fully async:pkg/weather_data._get_datauseshttpx.AsyncClientand is awaited by the command handler. The previous synchronousrequests.Session().getchain is gone, so a slow upstream no longer stalls other tenants sharing the event loop. Per-request timeout is 10 s. - The fan-out is structured: if one request fails, or the invocation is cancelled, the remaining request tasks are cancelled and awaited to completion before the error is propagated, so no request task (and no in-flight use of this invocation's API key) outlives the command call.
- The command module no longer mutates
sys.pathat import or call time; the plugin root is only expected onsys.paththe way the SDK loadscomponents/pkgpackages.
Per-invocation vs process state
- There is no process-global tenant state: a
Weatherdata object (city, key, api type, fetched values) is created inside each invocation and discarded when it returns. - Consequently there is nothing keyed by an installation binding and nothing to release in
on_installation_revoked; the command component holds no caches.
Known limits
- Each call creates its own
httpx.AsyncClient(matching the previous per-callrequests.Session); there is no connection pooling across invocations. - Only the fixed QWeather endpoints are called; no proxy/egress policy is configured here.
- No claim of certification; independent review and two-Workspace invocation acceptance are still required.