@loop-voice-agent/web 0.1.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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/client.d.ts +143 -0
- package/dist/client.js +364 -0
- package/dist/client.js.map +1 -0
- package/dist/controlPlane.d.ts +58 -0
- package/dist/controlPlane.js +75 -0
- package/dist/controlPlane.js.map +1 -0
- package/dist/emitter.d.ts +34 -0
- package/dist/emitter.js +69 -0
- package/dist/emitter.js.map +1 -0
- package/dist/endedReason.d.ts +46 -0
- package/dist/endedReason.js +50 -0
- package/dist/endedReason.js.map +1 -0
- package/dist/events.d.ts +81 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +11 -0
- package/dist/messages.js +75 -0
- package/dist/messages.js.map +1 -0
- package/dist/session.d.ts +78 -0
- package/dist/session.js +268 -0
- package/dist/session.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAoB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAiC5C,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C,MAAM,iBAAiB,GAA0B;IAC/C,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF,MAAM,iBAAiB,GAA0B;IAC/C,KAAK,EAAE,E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,2CAA2C,CAAC,CAAC;AAEhF,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAU,EAAE,CACxC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hop 1 of starting a call: ask the platform for a session.
|
|
3
|
+
*
|
|
4
|
+
* `POST {baseUrl}/v1/calls/web` with a publishable key returns the call id, a
|
|
5
|
+
* short-lived signed session token, and the URL of the voice worker that will
|
|
6
|
+
* carry the media. The browser never holds a secret: the publishable key is
|
|
7
|
+
* gated by the origin allow-list registered against it, and the session token
|
|
8
|
+
* it receives is bound to this one call and expires in minutes.
|
|
9
|
+
*/
|
|
10
|
+
/** Per-call context. Everything here is optional; the agent supplies defaults. */
|
|
11
|
+
export interface CallContext {
|
|
12
|
+
/**
|
|
13
|
+
* Values for `{{placeholders}}` in the agent's prompt and greeting, for THIS
|
|
14
|
+
* call. Per-call values win over the agent's defaults.
|
|
15
|
+
*/
|
|
16
|
+
readonly variables?: Record<string, string>;
|
|
17
|
+
/** Override the agent's configured language for this call, e.g. `"hi"`. */
|
|
18
|
+
readonly language?: string;
|
|
19
|
+
/** `video` renders a talking-head avatar; `audio` is voice only. */
|
|
20
|
+
readonly channel?: "audio" | "video";
|
|
21
|
+
/** Opaque data echoed back on the completion webhook. Never shown to the agent. */
|
|
22
|
+
readonly metadata?: Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* An already-captured display stream to share for the whole call.
|
|
25
|
+
*
|
|
26
|
+
* Passing it here puts the track in the INITIAL offer, which avoids a
|
|
27
|
+
* renegotiation round trip while the user waits to connect. It is also the
|
|
28
|
+
* shape most apps already have, since screen capture has to be requested from
|
|
29
|
+
* a user gesture before the call starts. Use `startScreenShare()` when the
|
|
30
|
+
* stream only becomes available mid-call.
|
|
31
|
+
*
|
|
32
|
+
* Not sent to the control plane — it never leaves the browser's peer
|
|
33
|
+
* connection.
|
|
34
|
+
*/
|
|
35
|
+
readonly screenStream?: MediaStream;
|
|
36
|
+
}
|
|
37
|
+
/** What hop 1 hands back. */
|
|
38
|
+
export interface WebCallSession {
|
|
39
|
+
readonly callId: string;
|
|
40
|
+
readonly sessionToken: string;
|
|
41
|
+
readonly voiceWorkerUrl: string;
|
|
42
|
+
}
|
|
43
|
+
/** Thrown when hop 1 fails. Carries the HTTP status when there was one. */
|
|
44
|
+
export declare class ControlPlaneError extends Error {
|
|
45
|
+
readonly status: number;
|
|
46
|
+
constructor(message: string, status: number);
|
|
47
|
+
}
|
|
48
|
+
/** Minimal fetch shape, so tests can inject one without a DOM. */
|
|
49
|
+
export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
50
|
+
/**
|
|
51
|
+
* Start a web call and return its session bundle.
|
|
52
|
+
*
|
|
53
|
+
* The key travels as a bearer token. A 403 here is almost always the origin
|
|
54
|
+
* allow-list rather than a bad key — the message says so, because the
|
|
55
|
+
* alternative is an integrator rotating a perfectly good key while the real
|
|
56
|
+
* fix is registering the origin they are calling from.
|
|
57
|
+
*/
|
|
58
|
+
export declare const startWebCall: (baseUrl: string, publicKey: string, agentId: string, context: CallContext, fetchImpl: FetchLike, signal?: AbortSignal) => Promise<WebCallSession>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hop 1 of starting a call: ask the platform for a session.
|
|
3
|
+
*
|
|
4
|
+
* `POST {baseUrl}/v1/calls/web` with a publishable key returns the call id, a
|
|
5
|
+
* short-lived signed session token, and the URL of the voice worker that will
|
|
6
|
+
* carry the media. The browser never holds a secret: the publishable key is
|
|
7
|
+
* gated by the origin allow-list registered against it, and the session token
|
|
8
|
+
* it receives is bound to this one call and expires in minutes.
|
|
9
|
+
*/
|
|
10
|
+
/** Thrown when hop 1 fails. Carries the HTTP status when there was one. */
|
|
11
|
+
export class ControlPlaneError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
constructor(message, status) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "ControlPlaneError";
|
|
16
|
+
this.status = status;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const trimSlash = (url) => url.replace(/\/+$/, "");
|
|
20
|
+
const isSession = (value) => {
|
|
21
|
+
if (typeof value !== "object" || value === null)
|
|
22
|
+
return false;
|
|
23
|
+
const v = value;
|
|
24
|
+
return (typeof v.callId === "string" &&
|
|
25
|
+
typeof v.sessionToken === "string" &&
|
|
26
|
+
typeof v.voiceWorkerUrl === "string");
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Start a web call and return its session bundle.
|
|
30
|
+
*
|
|
31
|
+
* The key travels as a bearer token. A 403 here is almost always the origin
|
|
32
|
+
* allow-list rather than a bad key — the message says so, because the
|
|
33
|
+
* alternative is an integrator rotating a perfectly good key while the real
|
|
34
|
+
* fix is registering the origin they are calling from.
|
|
35
|
+
*/
|
|
36
|
+
export const startWebCall = async (baseUrl, publicKey, agentId, context, fetchImpl, signal) => {
|
|
37
|
+
const url = `${trimSlash(baseUrl)}/v1/calls/web`;
|
|
38
|
+
const body = { agentId };
|
|
39
|
+
if (context.variables && Object.keys(context.variables).length > 0) {
|
|
40
|
+
body.variables = context.variables;
|
|
41
|
+
}
|
|
42
|
+
if (context.language)
|
|
43
|
+
body.language = context.language;
|
|
44
|
+
if (context.channel)
|
|
45
|
+
body.channel = context.channel;
|
|
46
|
+
if (context.metadata && Object.keys(context.metadata).length > 0) {
|
|
47
|
+
body.metadata = context.metadata;
|
|
48
|
+
}
|
|
49
|
+
let response;
|
|
50
|
+
try {
|
|
51
|
+
response = await fetchImpl(url, {
|
|
52
|
+
method: "POST",
|
|
53
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${publicKey}` },
|
|
54
|
+
body: JSON.stringify(body),
|
|
55
|
+
...(signal ? { signal } : {}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const reason = err instanceof Error ? err.message : "network error";
|
|
60
|
+
throw new ControlPlaneError(`Could not reach ${url}: ${reason}`, 0);
|
|
61
|
+
}
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const detail = await response.text().catch(() => "");
|
|
64
|
+
const hint = response.status === 403
|
|
65
|
+
? " — check that this page's origin is registered on the publishable key"
|
|
66
|
+
: "";
|
|
67
|
+
throw new ControlPlaneError(`${url} returned ${response.status}${hint}: ${detail.slice(0, 300)}`, response.status);
|
|
68
|
+
}
|
|
69
|
+
const json = await response.json().catch(() => null);
|
|
70
|
+
if (!isSession(json)) {
|
|
71
|
+
throw new ControlPlaneError("Unexpected response shape — expected { callId, sessionToken, voiceWorkerUrl }", response.status);
|
|
72
|
+
}
|
|
73
|
+
return json;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=controlPlane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlPlane.js","sourceRoot":"","sources":["../src/controlPlane.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqCH,2EAA2E;AAC3E,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,MAAM,CAAS;IACxB,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAKD,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEnE,MAAM,SAAS,GAAG,CAAC,KAAc,EAA2B,EAAE;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAA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**
|
|
3
|
+
* A small typed event emitter.
|
|
4
|
+
*
|
|
5
|
+
* Hand-rolled rather than pulled from a dependency: this package ships to
|
|
6
|
+
* browsers and its whole value is being small and self-contained, so a
|
|
7
|
+
* fifty-line emitter is worth more than a transitive dependency in a consumer's
|
|
8
|
+
* bundle.
|
|
9
|
+
*
|
|
10
|
+
* One behaviour is deliberate and load-bearing: a throwing handler must not
|
|
11
|
+
* stop the other handlers for that event, and must not propagate back into the
|
|
12
|
+
* WebRTC callback that emitted it. A consumer's render error would otherwise
|
|
13
|
+
* take down the media teardown path with it.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Emitter {
|
|
16
|
+
private readonly handlers;
|
|
17
|
+
/** Subscribe. Returns an unsubscribe function for convenience. */
|
|
18
|
+
on<E extends VoiceAgentEventName>(event: E, handler: VoiceAgentEventMap[E]): () => void;
|
|
19
|
+
/** Subscribe for exactly one emission. */
|
|
20
|
+
once<E extends VoiceAgentEventName>(event: E, handler: VoiceAgentEventMap[E]): () => void;
|
|
21
|
+
/** Unsubscribe a specific handler. */
|
|
22
|
+
off<E extends VoiceAgentEventName>(event: E, handler: VoiceAgentEventMap[E]): void;
|
|
23
|
+
/** Drop every handler — used on teardown so a disposed client leaks nothing. */
|
|
24
|
+
removeAll(): void;
|
|
25
|
+
/** Number of handlers bound to an event. Exposed for tests. */
|
|
26
|
+
listenerCount(event: VoiceAgentEventName): number;
|
|
27
|
+
/**
|
|
28
|
+
* Emit to every handler bound at the time of the call.
|
|
29
|
+
*
|
|
30
|
+
* Iterates a COPY of the handler set so a handler that unsubscribes itself —
|
|
31
|
+
* or subscribes another — during dispatch cannot mutate the set being walked.
|
|
32
|
+
*/
|
|
33
|
+
emit<E extends VoiceAgentEventName>(event: E, ...args: Parameters<VoiceAgentEventMap[E]>): void;
|
|
34
|
+
}
|
package/dist/emitter.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small typed event emitter.
|
|
3
|
+
*
|
|
4
|
+
* Hand-rolled rather than pulled from a dependency: this package ships to
|
|
5
|
+
* browsers and its whole value is being small and self-contained, so a
|
|
6
|
+
* fifty-line emitter is worth more than a transitive dependency in a consumer's
|
|
7
|
+
* bundle.
|
|
8
|
+
*
|
|
9
|
+
* One behaviour is deliberate and load-bearing: a throwing handler must not
|
|
10
|
+
* stop the other handlers for that event, and must not propagate back into the
|
|
11
|
+
* WebRTC callback that emitted it. A consumer's render error would otherwise
|
|
12
|
+
* take down the media teardown path with it.
|
|
13
|
+
*/
|
|
14
|
+
export class Emitter {
|
|
15
|
+
handlers = new Map();
|
|
16
|
+
/** Subscribe. Returns an unsubscribe function for convenience. */
|
|
17
|
+
on(event, handler) {
|
|
18
|
+
let set = this.handlers.get(event);
|
|
19
|
+
if (!set) {
|
|
20
|
+
set = new Set();
|
|
21
|
+
this.handlers.set(event, set);
|
|
22
|
+
}
|
|
23
|
+
set.add(handler);
|
|
24
|
+
return () => this.off(event, handler);
|
|
25
|
+
}
|
|
26
|
+
/** Subscribe for exactly one emission. */
|
|
27
|
+
once(event, handler) {
|
|
28
|
+
const wrapped = ((...args) => {
|
|
29
|
+
off();
|
|
30
|
+
handler(...args);
|
|
31
|
+
});
|
|
32
|
+
const off = this.on(event, wrapped);
|
|
33
|
+
return off;
|
|
34
|
+
}
|
|
35
|
+
/** Unsubscribe a specific handler. */
|
|
36
|
+
off(event, handler) {
|
|
37
|
+
this.handlers.get(event)?.delete(handler);
|
|
38
|
+
}
|
|
39
|
+
/** Drop every handler — used on teardown so a disposed client leaks nothing. */
|
|
40
|
+
removeAll() {
|
|
41
|
+
this.handlers.clear();
|
|
42
|
+
}
|
|
43
|
+
/** Number of handlers bound to an event. Exposed for tests. */
|
|
44
|
+
listenerCount(event) {
|
|
45
|
+
return this.handlers.get(event)?.size ?? 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Emit to every handler bound at the time of the call.
|
|
49
|
+
*
|
|
50
|
+
* Iterates a COPY of the handler set so a handler that unsubscribes itself —
|
|
51
|
+
* or subscribes another — during dispatch cannot mutate the set being walked.
|
|
52
|
+
*/
|
|
53
|
+
emit(event, ...args) {
|
|
54
|
+
const set = this.handlers.get(event);
|
|
55
|
+
if (!set || set.size === 0)
|
|
56
|
+
return;
|
|
57
|
+
for (const handler of [...set]) {
|
|
58
|
+
try {
|
|
59
|
+
handler(...args);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
// A consumer's handler throwing is their bug, not a reason to abandon
|
|
63
|
+
// the remaining handlers or to unwind into WebRTC's callback.
|
|
64
|
+
console.error("[loop-voice-agent] event handler threw", { event, err });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,OAAO;IACD,QAAQ,GAAG,IAAI,GAAG,EAAwD,CAAC;IAE5F,kEAAkE;IAClE,EAAE,CAAgC,KAAQ,EAAE,OAA8B;QACxE,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,OAAqC,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,0CAA0C;IAC1C,IAAI,CAAgC,KAAQ,EAAE,OAA8B;QAC1E,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,IAAe,EAAE,EA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
3
|
+
*
|
|
4
|
+
* These strings are a CONTRACT, not labels. A consuming app classifies a call
|
|
5
|
+
* as clean or failed by pattern-matching them, and routes the user to a retry
|
|
6
|
+
* screen or a completion screen on that basis. Renaming one silently changes
|
|
7
|
+
* which screen a candidate sees.
|
|
8
|
+
*
|
|
9
|
+
* The values are drawn from the vocabulary Vapi emits, because the first
|
|
10
|
+
* consumer of this SDK already has that classifier written against it:
|
|
11
|
+
*
|
|
12
|
+
* /error|did-not-receive|customer-audio|pipeline|failed|
|
|
13
|
+
* no-microphone|did-not-give-microphone|no-audio/i
|
|
14
|
+
*
|
|
15
|
+
* Every reason below is deliberately either inside or outside that pattern, and
|
|
16
|
+
* `endedReason.test.ts` asserts each one lands on the intended side. A new
|
|
17
|
+
* reason must be added there too — the test is what stops a well-meant addition
|
|
18
|
+
* from quietly being classified as a clean hangup.
|
|
19
|
+
*/
|
|
20
|
+
/** A call that ended the way it was supposed to. */
|
|
21
|
+
export declare const CLEAN_ENDED_REASONS: {
|
|
22
|
+
/** The local side called `stop()` — the user hung up. */
|
|
23
|
+
readonly CUSTOMER_ENDED_CALL: "customer-ended-call";
|
|
24
|
+
/** The agent ended the call itself (its end-call tool, or a closing phrase). */
|
|
25
|
+
readonly ASSISTANT_ENDED_CALL: "assistant-ended-call";
|
|
26
|
+
/** The server's configured maximum call duration elapsed. */
|
|
27
|
+
readonly EXCEEDED_MAX_DURATION: "exceeded-max-duration";
|
|
28
|
+
};
|
|
29
|
+
/** A call that failed. Consumers route these to a retry / troubleshooting path. */
|
|
30
|
+
export declare const FAILED_ENDED_REASONS: {
|
|
31
|
+
/** ICE never established, or the peer connection dropped to `failed`. */
|
|
32
|
+
readonly CONNECTION_FAILED: "pipeline-error-connection-failed";
|
|
33
|
+
/** Nothing acknowledged the call within the connect budget. */
|
|
34
|
+
readonly CONNECTION_TIMEOUT: "pipeline-error-connection-timeout";
|
|
35
|
+
/** `getUserMedia` was rejected — the browser mic prompt was declined. */
|
|
36
|
+
readonly NO_MICROPHONE_PERMISSION: "customer-did-not-give-microphone-permission";
|
|
37
|
+
/** A track was acquired but carried no audio the agent could hear. */
|
|
38
|
+
readonly NO_CUSTOMER_AUDIO: "error-assistant-did-not-receive-customer-audio";
|
|
39
|
+
/** The media path died mid-call for a reason we could not attribute. */
|
|
40
|
+
readonly PIPELINE_ERROR: "pipeline-error-media-disconnected";
|
|
41
|
+
};
|
|
42
|
+
export type CleanEndedReason = (typeof CLEAN_ENDED_REASONS)[keyof typeof CLEAN_ENDED_REASONS];
|
|
43
|
+
export type FailedEndedReason = (typeof FAILED_ENDED_REASONS)[keyof typeof FAILED_ENDED_REASONS];
|
|
44
|
+
export type EndedReason = CleanEndedReason | FailedEndedReason | (string & {});
|
|
45
|
+
/** Whether a reason reads as a failure to the consumer-side classifier. */
|
|
46
|
+
export declare const isAbnormalEndedReason: (reason: string | undefined) => boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary of `endedReason` values a `call-end` event can carry.
|
|
3
|
+
*
|
|
4
|
+
* These strings are a CONTRACT, not labels. A consuming app classifies a call
|
|
5
|
+
* as clean or failed by pattern-matching them, and routes the user to a retry
|
|
6
|
+
* screen or a completion screen on that basis. Renaming one silently changes
|
|
7
|
+
* which screen a candidate sees.
|
|
8
|
+
*
|
|
9
|
+
* The values are drawn from the vocabulary Vapi emits, because the first
|
|
10
|
+
* consumer of this SDK already has that classifier written against it:
|
|
11
|
+
*
|
|
12
|
+
* /error|did-not-receive|customer-audio|pipeline|failed|
|
|
13
|
+
* no-microphone|did-not-give-microphone|no-audio/i
|
|
14
|
+
*
|
|
15
|
+
* Every reason below is deliberately either inside or outside that pattern, and
|
|
16
|
+
* `endedReason.test.ts` asserts each one lands on the intended side. A new
|
|
17
|
+
* reason must be added there too — the test is what stops a well-meant addition
|
|
18
|
+
* from quietly being classified as a clean hangup.
|
|
19
|
+
*/
|
|
20
|
+
/** A call that ended the way it was supposed to. */
|
|
21
|
+
export const CLEAN_ENDED_REASONS = {
|
|
22
|
+
/** The local side called `stop()` — the user hung up. */
|
|
23
|
+
CUSTOMER_ENDED_CALL: "customer-ended-call",
|
|
24
|
+
/** The agent ended the call itself (its end-call tool, or a closing phrase). */
|
|
25
|
+
ASSISTANT_ENDED_CALL: "assistant-ended-call",
|
|
26
|
+
/** The server's configured maximum call duration elapsed. */
|
|
27
|
+
EXCEEDED_MAX_DURATION: "exceeded-max-duration",
|
|
28
|
+
};
|
|
29
|
+
/** A call that failed. Consumers route these to a retry / troubleshooting path. */
|
|
30
|
+
export const FAILED_ENDED_REASONS = {
|
|
31
|
+
/** ICE never established, or the peer connection dropped to `failed`. */
|
|
32
|
+
CONNECTION_FAILED: "pipeline-error-connection-failed",
|
|
33
|
+
/** Nothing acknowledged the call within the connect budget. */
|
|
34
|
+
CONNECTION_TIMEOUT: "pipeline-error-connection-timeout",
|
|
35
|
+
/** `getUserMedia` was rejected — the browser mic prompt was declined. */
|
|
36
|
+
NO_MICROPHONE_PERMISSION: "customer-did-not-give-microphone-permission",
|
|
37
|
+
/** A track was acquired but carried no audio the agent could hear. */
|
|
38
|
+
NO_CUSTOMER_AUDIO: "error-assistant-did-not-receive-customer-audio",
|
|
39
|
+
/** The media path died mid-call for a reason we could not attribute. */
|
|
40
|
+
PIPELINE_ERROR: "pipeline-error-media-disconnected",
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The classifier a consuming app is expected to apply, reproduced here so the
|
|
44
|
+
* SDK can be tested against the SAME rule its consumers use rather than against
|
|
45
|
+
* a paraphrase of it.
|
|
46
|
+
*/
|
|
47
|
+
const ABNORMAL_PATTERN = /error|did-not-receive|customer-audio|pipeline|failed|no-microphone|did-not-give-microphone|no-audio/i;
|
|
48
|
+
/** Whether a reason reads as a failure to the consumer-side classifier. */
|
|
49
|
+
export const isAbnormalEndedReason = (reason) => typeof reason === "string" && ABNORMAL_PATTERN.test(reason);
|
|
50
|
+
//# sourceMappingURL=endedReason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endedReason.js","sourceRoot":"","sources":["../src/endedReason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,yDAAyD;IACzD,mBAAmB,EAAE,qBAAqB;IAC1C,gFAAgF;IAChF,oBAAoB,EAAE,sBAAsB;IAC5C,6DAA6D;IAC7D,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAEX,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,yEAAyE;IACzE,iBAAiB,EAAE,kCAAkC;IACrD,+DAA+D;IAC/D,kBAAkB,EAAE,mCAAmC;IACvD,yEAAyE;IACzE,wBAAwB,EAAE,6CAA6C;IACvE,sEAAsE;IACtE,iBAAiB,EAAE,gDAAgD;IACnE,wEAAwE;IACxE,cAAc,EAAE,mCAAmC;CAC3C,CAAC;AAMX;;;;GAIG;AACH,MAAM,gBAAgB,GACpB,sGAAsG,CAAC;AAEzG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAW,EAAE,CAC3E,OAAO,MAAM,KAAK,QAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { EndedReason } from "./endedReason.js";
|
|
2
|
+
/**
|
|
3
|
+
* The event surface. Six names, chosen to match what a Vapi-shaped consumer
|
|
4
|
+
* already binds, so migrating an existing integration is an import change
|
|
5
|
+
* rather than a rewrite of its event handlers.
|
|
6
|
+
*/
|
|
7
|
+
/** A single transcript turn as it reaches the browser. */
|
|
8
|
+
export interface TranscriptMessage {
|
|
9
|
+
readonly type: "transcript";
|
|
10
|
+
/** Who spoke. Anything the server sends that is not `assistant` is a user turn. */
|
|
11
|
+
readonly role: "assistant" | "user";
|
|
12
|
+
/**
|
|
13
|
+
* `partial` is an in-progress guess that will be superseded; `final` is
|
|
14
|
+
* settled text. A consumer typically overwrites on partial and appends on
|
|
15
|
+
* final. Until the server emits interim results, every turn arrives `final`.
|
|
16
|
+
*/
|
|
17
|
+
readonly transcriptType: "partial" | "final";
|
|
18
|
+
/** The spoken text. */
|
|
19
|
+
readonly transcript: string;
|
|
20
|
+
/** ISO-8601 timestamp the server attached to the turn, when it sent one. */
|
|
21
|
+
readonly timestamp?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Any other message the server puts on the wire. Passed through verbatim rather
|
|
25
|
+
* than dropped, so a server that starts sending a new message type surfaces to
|
|
26
|
+
* consumers without an SDK release.
|
|
27
|
+
*/
|
|
28
|
+
export interface UnknownMessage {
|
|
29
|
+
readonly type: string;
|
|
30
|
+
readonly [key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
export type VoiceAgentMessage = TranscriptMessage | UnknownMessage;
|
|
33
|
+
/** Payload of the `call-end` event. */
|
|
34
|
+
export interface CallEndPayload {
|
|
35
|
+
/** Why the call ended. See endedReason.ts — these strings are a contract. */
|
|
36
|
+
readonly endedReason: EndedReason;
|
|
37
|
+
/** The platform call id, when one was assigned before the call ended. */
|
|
38
|
+
readonly callId?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Payload of the `error` event. */
|
|
41
|
+
export interface VoiceAgentErrorPayload {
|
|
42
|
+
/** A human-readable message safe to show a user. */
|
|
43
|
+
readonly message: string;
|
|
44
|
+
/**
|
|
45
|
+
* A stable code for programmatic handling. Prefer branching on this rather
|
|
46
|
+
* than on `message`, which is copy and may be reworded.
|
|
47
|
+
*/
|
|
48
|
+
readonly code: VoiceAgentErrorCode;
|
|
49
|
+
/** The underlying cause, when there was one. */
|
|
50
|
+
readonly cause?: unknown;
|
|
51
|
+
}
|
|
52
|
+
export type VoiceAgentErrorCode =
|
|
53
|
+
/**
|
|
54
|
+
* The call was stopped before it connected. Reported ONLY as the rejection of
|
|
55
|
+
* the pending `start()`, never as an `error` event — a deliberate cancel is
|
|
56
|
+
* not a failure and must not surface to the user as one.
|
|
57
|
+
*/
|
|
58
|
+
"cancelled" | "missing-public-key" | "missing-agent-id" | "already-started" | "control-plane-failed" | "media-plane-failed" | "microphone-denied" | "connection-timeout" | "connection-failed" | "no-active-call" | "screen-share-failed";
|
|
59
|
+
/**
|
|
60
|
+
* The event map. Handlers are typed by event name, so binding `call-end` and
|
|
61
|
+
* reading `payload.endedReason` type-checks without a cast.
|
|
62
|
+
*/
|
|
63
|
+
export interface VoiceAgentEventMap {
|
|
64
|
+
/** Media is flowing — the call is live. */
|
|
65
|
+
"call-start": () => void;
|
|
66
|
+
/** The call ended, cleanly or otherwise. Fires at most once per call. */
|
|
67
|
+
"call-end": (payload: CallEndPayload) => void;
|
|
68
|
+
/** The agent started speaking. */
|
|
69
|
+
"speech-start": () => void;
|
|
70
|
+
/** The agent stopped speaking. */
|
|
71
|
+
"speech-end": () => void;
|
|
72
|
+
/** A message from the server — most often a transcript turn. */
|
|
73
|
+
message: (message: VoiceAgentMessage) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Something went wrong. Emitted INSTEAD of `call-end` when the failure
|
|
76
|
+
* happened before the call ever started, so a consumer never has to
|
|
77
|
+
* de-duplicate two notifications of the same failure.
|
|
78
|
+
*/
|
|
79
|
+
error: (payload: VoiceAgentErrorPayload) => void;
|
|
80
|
+
}
|
|
81
|
+
export type VoiceAgentEventName = keyof VoiceAgentEventMap;
|
package/dist/events.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@loop-voice-agent/web` — browser SDK for the Loop Voice Agent platform.
|
|
3
|
+
*
|
|
4
|
+
* Start a voice call from a publishable key and an agent id:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { VoiceAgent } from "@loop-voice-agent/web";
|
|
8
|
+
*
|
|
9
|
+
* const client = new VoiceAgent(publishableKey, { baseUrl: "https://api.example.com" });
|
|
10
|
+
* client.on("message", (m) => { if (m.type === "transcript") append(m); });
|
|
11
|
+
* client.on("call-end", ({ endedReason }) => finish(endedReason));
|
|
12
|
+
* await client.start(agentId, { variables: { candidate_name: "Asha" } });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The key is publishable by design — it is safe in a bundle because its
|
|
16
|
+
* authority is capped at starting a call and it only works from origins the
|
|
17
|
+
* tenant registered against it. The prompt, model and voice never reach the
|
|
18
|
+
* browser; the agent is an opaque id.
|
|
19
|
+
*/
|
|
20
|
+
export { VoiceAgent, VoiceAgentError } from "./client.js";
|
|
21
|
+
export type { CallStatus, VoiceAgentOptions } from "./client.js";
|
|
22
|
+
export type { CallContext, WebCallSession } from "./controlPlane.js";
|
|
23
|
+
export { ControlPlaneError } from "./controlPlane.js";
|
|
24
|
+
export { CLEAN_ENDED_REASONS, FAILED_ENDED_REASONS, isAbnormalEndedReason } from "./endedReason.js";
|
|
25
|
+
export type { CleanEndedReason, EndedReason, FailedEndedReason } from "./endedReason.js";
|
|
26
|
+
export { isTranscriptMessage } from "./messages.js";
|
|
27
|
+
export type { CallEndPayload, TranscriptMessage, UnknownMessage, VoiceAgentErrorCode, VoiceAgentErrorPayload, VoiceAgentEventMap, VoiceAgentEventName, VoiceAgentMessage, } from "./events.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@loop-voice-agent/web` — browser SDK for the Loop Voice Agent platform.
|
|
3
|
+
*
|
|
4
|
+
* Start a voice call from a publishable key and an agent id:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { VoiceAgent } from "@loop-voice-agent/web";
|
|
8
|
+
*
|
|
9
|
+
* const client = new VoiceAgent(publishableKey, { baseUrl: "https://api.example.com" });
|
|
10
|
+
* client.on("message", (m) => { if (m.type === "transcript") append(m); });
|
|
11
|
+
* client.on("call-end", ({ endedReason }) => finish(endedReason));
|
|
12
|
+
* await client.start(agentId, { variables: { candidate_name: "Asha" } });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The key is publishable by design — it is safe in a bundle because its
|
|
16
|
+
* authority is capped at starting a call and it only works from origins the
|
|
17
|
+
* tenant registered against it. The prompt, model and voice never reach the
|
|
18
|
+
* browser; the agent is an opaque id.
|
|
19
|
+
*/
|
|
20
|
+
export { VoiceAgent, VoiceAgentError } from "./client.js";
|
|
21
|
+
export { ControlPlaneError } from "./controlPlane.js";
|
|
22
|
+
export { CLEAN_ENDED_REASONS, FAILED_ENDED_REASONS, isAbnormalEndedReason } from "./endedReason.js";
|
|
23
|
+
export { isTranscriptMessage } from "./messages.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TranscriptMessage, VoiceAgentMessage } from "./events.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse one data-channel frame into an event payload, or `null` to drop it.
|
|
4
|
+
*
|
|
5
|
+
* Dropped: non-JSON, non-objects, frames with no `type`, keep-alive frames, and
|
|
6
|
+
* transcript turns whose text is empty once trimmed — an empty turn would
|
|
7
|
+
* otherwise render as a blank bubble in a consumer's transcript view.
|
|
8
|
+
*/
|
|
9
|
+
export declare const decodeMessage: (raw: unknown) => VoiceAgentMessage | null;
|
|
10
|
+
/** Whether a decoded message is a transcript turn. Exposed for consumers. */
|
|
11
|
+
export declare const isTranscriptMessage: (m: VoiceAgentMessage) => m is TranscriptMessage;
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decoding what arrives on the WebRTC data channel.
|
|
3
|
+
*
|
|
4
|
+
* The wire format is the server's, and it is NOT the shape consumers bind to:
|
|
5
|
+
* the server sends `{type, role, content, ts}` while the event surface exposes
|
|
6
|
+
* `{type, role, transcriptType, transcript, timestamp}`. That translation lives
|
|
7
|
+
* here rather than in the client, so the adaptation is one small pure function
|
|
8
|
+
* with its own tests instead of a branch buried in a socket callback.
|
|
9
|
+
*
|
|
10
|
+
* Everything is defensive. This data crosses a network boundary and is parsed
|
|
11
|
+
* from a string; a malformed frame must produce `null` and be dropped, never
|
|
12
|
+
* throw inside the data-channel handler and tear the call down.
|
|
13
|
+
*/
|
|
14
|
+
/** Frames that are transport bookkeeping, not content, and are never surfaced. */
|
|
15
|
+
const CONTROL_FRAMES = new Set(["ping", "pong"]);
|
|
16
|
+
const asRecord = (value) => typeof value === "object" && value !== null ? value : null;
|
|
17
|
+
/**
|
|
18
|
+
* Parse one data-channel frame into an event payload, or `null` to drop it.
|
|
19
|
+
*
|
|
20
|
+
* Dropped: non-JSON, non-objects, frames with no `type`, keep-alive frames, and
|
|
21
|
+
* transcript turns whose text is empty once trimmed — an empty turn would
|
|
22
|
+
* otherwise render as a blank bubble in a consumer's transcript view.
|
|
23
|
+
*/
|
|
24
|
+
export const decodeMessage = (raw) => {
|
|
25
|
+
if (typeof raw !== "string")
|
|
26
|
+
return null;
|
|
27
|
+
const trimmed = raw.trim();
|
|
28
|
+
if (trimmed.length === 0 || CONTROL_FRAMES.has(trimmed))
|
|
29
|
+
return null;
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(trimmed);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const frame = asRecord(parsed);
|
|
38
|
+
if (!frame || typeof frame.type !== "string")
|
|
39
|
+
return null;
|
|
40
|
+
if (frame.type === "transcript")
|
|
41
|
+
return decodeTranscript(frame);
|
|
42
|
+
// Anything else is forwarded verbatim, so a server that starts sending a new
|
|
43
|
+
// message type reaches consumers without an SDK release.
|
|
44
|
+
return frame;
|
|
45
|
+
};
|
|
46
|
+
const decodeTranscript = (frame) => {
|
|
47
|
+
// The server has used `content` since before this SDK existed; `transcript`
|
|
48
|
+
// is accepted too so the field can be renamed server-side without a flag day.
|
|
49
|
+
const text = typeof frame.content === "string" ? frame.content : frame.transcript;
|
|
50
|
+
if (typeof text !== "string")
|
|
51
|
+
return null;
|
|
52
|
+
const transcript = text.trim();
|
|
53
|
+
if (transcript.length === 0)
|
|
54
|
+
return null;
|
|
55
|
+
// Anything not explicitly `assistant` is a user turn. Consumers render the
|
|
56
|
+
// two differently, and mislabelling the agent as the user is far more
|
|
57
|
+
// confusing than the reverse, so the agent side requires an exact match.
|
|
58
|
+
const role = frame.role === "assistant" ? "assistant" : "user";
|
|
59
|
+
// Interim results are opt-in on the wire. A server that does not send
|
|
60
|
+
// `transcriptType` is sending settled text, so `final` is the safe default —
|
|
61
|
+
// treating unmarked turns as partial would make them vanish when the next
|
|
62
|
+
// turn arrived.
|
|
63
|
+
const transcriptType = frame.transcriptType === "partial" ? "partial" : "final";
|
|
64
|
+
const timestamp = typeof frame.ts === "string" ? frame.ts : undefined;
|
|
65
|
+
return {
|
|
66
|
+
type: "transcript",
|
|
67
|
+
role,
|
|
68
|
+
transcriptType,
|
|
69
|
+
transcript,
|
|
70
|
+
...(timestamp ? { timestamp } : {}),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** Whether a decoded message is a transcript turn. Exposed for consumers. */
|
|
74
|
+
export const isTranscriptMessage = (m) => m.type === "transcript";
|
|
75
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,kFAAkF;AAClF,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjD,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAkC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAE,KAAiC,CAAC,CAAC,CAAC,IAAI,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAY,EAA4B,EAAE;IACtE,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAErE,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE1D,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEhE,6EAA6E;IAC7E,yDAAyD;IACzD,OAAO,KAA0B,CAAC;AACpC,CAAC,CAAC;A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