@pouchy_ai/companion-sdk 0.69.0 → 0.71.0

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/src/client.ts CHANGED
@@ -2086,6 +2086,7 @@ export class CompanionClient {
2086
2086
  const transcript: { role: 'user' | 'assistant'; text: string }[] = [];
2087
2087
  const callerOnTranscript = opts?.onTranscript;
2088
2088
  const callerOnError = opts?.onError;
2089
+ const callerOnEnd = opts?.onEnd;
2089
2090
  // Cleanup must run whichever side ends the call — the app calling close()
2090
2091
  // OR a provider-initiated teardown (pc failure / EL disconnect), which
2091
2092
  // surfaces as onError with no close() following. Idempotent. `unsub` is
@@ -2118,6 +2119,17 @@ export class CompanionClient {
2118
2119
  onError: (err) => {
2119
2120
  cleanup();
2120
2121
  callerOnError?.(err);
2122
+ },
2123
+ // Always passed down (0.71.0), so the provider leg reports every end
2124
+ // here; the caller's own contract is applied on this side. A clean
2125
+ // remote end still consolidates memory (/end), and a caller WITHOUT
2126
+ // onEnd still gets it on onError as `call disconnected`, as before.
2127
+ onEnd: (end) => {
2128
+ cleanup();
2129
+ if (callerOnEnd) callerOnEnd(end);
2130
+ else if (end.reason === 'agent' || end.reason === 'remote') {
2131
+ callerOnError?.(new Error('call disconnected'));
2132
+ }
2121
2133
  }
2122
2134
  };
2123
2135
 
package/src/index.ts CHANGED
@@ -56,9 +56,10 @@ export {
56
56
  HOST_CONTROL_TOOL_NAMES,
57
57
  AVATAR_VISUAL_TOOLS,
58
58
  AVATAR_VISUAL_TOOL_NAMES,
59
- stripAudioTags
59
+ stripAudioTags,
60
+ extractAudioTags
60
61
  } from './call';
61
- export type { CompanionCall, CompanionCallOptions, VoiceToolBridge } from './call';
62
+ export type { CallEnd, CompanionCall, CompanionCallOptions, VoiceToolBridge } from './call';
62
63
  // Exported because a self-plumbed integration (one that calls startCall and
63
64
  // opens the EL session itself) has to name this variable exactly; a literal
64
65
  // typed at their end is the silent-failure path this constant exists to close.