med-scribe-alliance-ts-sdk 2.0.23 → 2.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -544,7 +544,7 @@ export interface UploadEventRetry {
544
544
  };
545
545
  }
546
546
  export type UploadEvent = UploadEventProgress | UploadEventFailed | UploadEventRetry;
547
- export type SessionEventType = "created" | "ended" | "status_update" | "partial_result";
547
+ export type SessionEventType = "created" | "ended" | "discarded" | "status_update" | "partial_result";
548
548
  export interface SessionEventCreated {
549
549
  type: "created";
550
550
  timestamp: string;
@@ -555,6 +555,14 @@ export interface SessionEventEnded {
555
555
  timestamp: string;
556
556
  data: EndSessionResponse;
557
557
  }
558
+ export interface SessionEventDiscarded {
559
+ type: "discarded";
560
+ timestamp: string;
561
+ data: {
562
+ sessionId: string | null;
563
+ reason: "cleared" | "cancelled" | "reset";
564
+ };
565
+ }
558
566
  export interface SessionEventStatusUpdate {
559
567
  type: "status_update";
560
568
  timestamp: string;
@@ -565,7 +573,7 @@ export interface SessionEventPartialResult {
565
573
  timestamp: string;
566
574
  data: any;
567
575
  }
568
- export type SessionEvent = SessionEventCreated | SessionEventEnded | SessionEventStatusUpdate | SessionEventPartialResult;
576
+ export type SessionEvent = SessionEventCreated | SessionEventEnded | SessionEventDiscarded | SessionEventStatusUpdate | SessionEventPartialResult;
569
577
  export type ErrorEventType = "vad_error" | "worker_error" | "transport_error" | "validation_error";
570
578
  interface ErrorEvent$1 {
571
579
  type: ErrorEventType;
@@ -770,6 +778,15 @@ export declare class ScribeClient {
770
778
  * Update the Bearer token. Propagates to transport, active recorder, and worker.
771
779
  */
772
780
  setAccessToken(token: string): void;
781
+ /**
782
+ * Lightweight cleanup between back-to-back sessions.
783
+ *
784
+ * Stops any active recording, resets the recording pipeline (VAD, mic,
785
+ * buffers, worker), and clears the current session reference. Does NOT
786
+ * touch callbacks, discovery cache, transport, or initialization state —
787
+ * use `reset()` for a full teardown.
788
+ */
789
+ clearRecordingState(): void;
773
790
  /**
774
791
  * Full reset — stops recording if active, clears all caches and state.
775
792
  */
package/dist/index.mjs CHANGED
@@ -1981,7 +1981,14 @@ var ie = class {
1981
1981
  }
1982
1982
  async cancelSession(e) {
1983
1983
  let t = e ?? this.recordingManager.getActiveSession()?.session_id ?? this.sessionManager.getCurrentSession()?.session_id;
1984
- return this.recordingManager.isRecording() && this.recordingManager.forceStop(), this.recordingManager.reset(), this.sessionManager.clearCurrentSession(), this.updateSession({
1984
+ return this.recordingManager.isRecording() && this.recordingManager.forceStop(), this.recordingManager.reset(), this.sessionManager.clearCurrentSession(), this.callbackRegistry.dispatch("onSessionEvent", {
1985
+ type: "discarded",
1986
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1987
+ data: {
1988
+ sessionId: t ?? null,
1989
+ reason: "cancelled"
1990
+ }
1991
+ }), this.updateSession({
1985
1992
  user_status: "cancelled",
1986
1993
  processing_status: "cancelled"
1987
1994
  }, t);
@@ -2014,6 +2021,9 @@ var ie = class {
2014
2021
  setAccessToken(e) {
2015
2022
  this.config.accessToken = e, this.transport.setAuthToken(e), this.recordingManager.updateAuthToken(e);
2016
2023
  }
2024
+ clearRecordingState() {
2025
+ this.recordingManager.isRecording() && this.recordingManager.forceStop(), this.recordingManager.reset(), this.sessionManager.clearCurrentSession();
2026
+ }
2017
2027
  async reset() {
2018
2028
  try {
2019
2029
  this.recordingManager.isRecording() && await this.recordingManager.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "med-scribe-alliance-ts-sdk",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "description": "TypeScript SDK for the MedScribe Alliance Protocol",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",