Treat `undefined` as a non-cacheable sentinel by deleting the cache entry
when the callback resolves to `undefined`, ensuring future calls retry
instead of serving stale data.
Always return the in-flight promise when a refresh is running so callers
don’t receive an expired cached value. Preserve the original timestamp
until refresh succeeds and only update it on successful recompute to
avoid masking failed refreshes.
Introduce a shared in-flight + TTL cache to dedupe concurrent
getClient() and org ID resolution calls, and clear cached client state
when auth becomes invalid to avoid repeated use of stale credentials.
Move share/ingest modules under kilo-sessions and update bootstrap and
session share/unshare/remove flows to use KiloSessions. Update ingest
queue test imports accordingly.
Add `kilo_meta` items to the ingest queue with a stable key so updates
coalesce, and send metadata derived from `KILO_PLATFORM` and `KILO_ORG_ID`
during session sync.
Move per-session debounce/retry ingest logic into a reusable IngestQueue
helper and wire ShareNext to use it, including an auth error callback to
clear cached credentials. Add test coverage for coalescing, throttling,
retry/backoff, and non-retryable failures.
Coalesce ingest updates with a per-session due time and schedule flushes
to respect active backoff windows.
Retry transient failures (network, 429, 5xx, etc.) with capped exponential
backoff and a small retry budget, while avoiding overwriting newer queued
updates during in-flight retries.
Add ingest-disabled guardrails to share and unshare, and harden
session removal by encoding the session id and logging network/HTTP
failures instead of throwing.
Add `KILO_DISABLE_SESSION_INGEST` to skip session ingest initialization.
Also cache the ingest client briefly to reduce repeated auth/token checks and
surface clearer errors when session creation requests fail.
Coalesce frequent session updates into a per-session debounce queue with
stable entity keys to reduce redundant POSTs. Improve resilience by
handling async init/full sync errors, validating responses, and requeueing
failed batches without overwriting newer updates.
Throw explicit errors when sharing is disabled or credentials are missing,
validate session sync initialization, and check HTTP responses/public_id
before persisting the share URL.
Avoid eager import of ShareNext by dynamically importing it only when
removing a session, reducing initialization coupling and preventing
import-time issues.