Skip to content

SDK v0.13.3 — Archive transcript on New chat

Latest

Choose a tag to compare

@dmitriyzhuk dmitriyzhuk released this 31 May 23:30
· 13 commits to main since this release

Closes the loop on the New chat UX.

Before

New chat cleared the local panel and reconnected with a fresh anonId. But:

  • token-flow kept the same clientId → server-side transcript was untouched. v0.13.2 patched this with a one-shot skipNextTranscript flag so the replay was suppressed, but history just piled up on the server with no way to roll it over.
  • public flow with stable anonId had the same long-term problem once hub started honoring anonId (planned).

Now

The SDK calls POST /api/agent/<id>/transcript/archive?channel=<clientId> right before the reconnect. Best-effort: if the endpoint isn't there (older hub) or the request fails, we still clear locally and skipNextTranscript keeps the replay from undoing it. Net effect: New chat is consistent regardless of which hub version the embed talks to.

Hub-side implementations

Bridle hub (bridle/nestjs/): new IBridleTranscriptGateway.archive() method on the persistence contract, default falls back to delete(). Integrators override to do the right thing for their storage (rename to timestamped sibling, move to cold tier, etc.). New endpoint POST :agentId/transcript/archive returns { archivedPath? }.

Ranch hub (ranch/api/.../bridle.controller.ts): real implementation. Reads data/sessions/bridle:<channel>.jsonl, writes the same content to data/sessions/bridle:<channel>.<iso-ts>.archived.jsonl, deletes the live file. No-op when the live file is empty/missing. Admins still have full history under .archived. files; visitor gets a clean slate.

Install

CDN — pinned:

<script src="https://bridle.cleanslice.org/sdk/v0.13.3.js" ...></script>

NPM:

bun add @cleanslice/bridle@0.13.3

Changelog: sdk-v0.13.2…sdk-v0.13.3