phonic 0.30.37 → 0.30.39
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/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/conversations/client/Socket.d.ts +3 -2
- package/dist/cjs/api/resources/conversations/client/Socket.js +3 -0
- package/dist/cjs/api/types/ConfigPayload.d.ts +6 -2
- package/dist/cjs/api/types/Conversation.d.ts +15 -2
- package/dist/cjs/api/types/Conversation.js +7 -0
- package/dist/cjs/api/types/Voice.d.ts +2 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/conversations/client/Socket.d.mts +3 -2
- package/dist/esm/api/resources/conversations/client/Socket.mjs +3 -0
- package/dist/esm/api/types/ConfigPayload.d.mts +6 -2
- package/dist/esm/api/types/Conversation.d.mts +15 -2
- package/dist/esm/api/types/Conversation.mjs +7 -0
- package/dist/esm/api/types/Voice.d.mts +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,8 @@ class PhonicClient {
|
|
|
51
51
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
52
52
|
"X-Fern-Language": "JavaScript",
|
|
53
53
|
"X-Fern-SDK-Name": "phonic",
|
|
54
|
-
"X-Fern-SDK-Version": "0.30.
|
|
55
|
-
"User-Agent": "phonic/0.30.
|
|
54
|
+
"X-Fern-SDK-Version": "0.30.39",
|
|
55
|
+
"User-Agent": "phonic/0.30.39",
|
|
56
56
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
57
57
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
58
58
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -7,7 +7,7 @@ export declare namespace ConversationsSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload;
|
|
10
|
+
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.AssistantStartedSpeakingPayload | Phonic.AssistantFinishedSpeakingPayload | Phonic.ErrorPayload;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -40,6 +40,7 @@ export declare class ConversationsSocket {
|
|
|
40
40
|
sendConfig(message: Phonic.ConfigPayload): void;
|
|
41
41
|
sendAudioChunk(message: Phonic.AudioChunkPayload): void;
|
|
42
42
|
sendUpdateSystemPrompt(message: Phonic.UpdateSystemPromptPayload): void;
|
|
43
|
+
sendAddSystemMessage(message: Phonic.AddSystemMessagePayload): void;
|
|
43
44
|
sendSetExternalId(message: Phonic.SetExternalIdPayload): void;
|
|
44
45
|
sendSetTwilioCallSid(message: Phonic.SetTwilioCallSidPayload): void;
|
|
45
46
|
sendToolCallOutput(message: Phonic.ToolCallOutputPayload): void;
|
|
@@ -60,5 +61,5 @@ export declare class ConversationsSocket {
|
|
|
60
61
|
/** Send a binary payload to the websocket. */
|
|
61
62
|
protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
62
63
|
/** Send a JSON payload to the websocket. */
|
|
63
|
-
protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.SetExternalIdPayload | Phonic.SetTwilioCallSidPayload | Phonic.ToolCallOutputPayload): void;
|
|
64
|
+
protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.AddSystemMessagePayload | Phonic.SetExternalIdPayload | Phonic.SetTwilioCallSidPayload | Phonic.ToolCallOutputPayload): void;
|
|
64
65
|
}
|
|
@@ -103,6 +103,9 @@ class ConversationsSocket {
|
|
|
103
103
|
sendUpdateSystemPrompt(message) {
|
|
104
104
|
this.sendWithBuffering(() => this.sendJson(message));
|
|
105
105
|
}
|
|
106
|
+
sendAddSystemMessage(message) {
|
|
107
|
+
this.sendWithBuffering(() => this.sendJson(message));
|
|
108
|
+
}
|
|
106
109
|
sendSetExternalId(message) {
|
|
107
110
|
this.sendWithBuffering(() => this.sendJson(message));
|
|
108
111
|
}
|
|
@@ -51,8 +51,8 @@ export interface ConfigPayload {
|
|
|
51
51
|
recognized_languages?: string[];
|
|
52
52
|
/** Keywords to boost in speech recognition */
|
|
53
53
|
boosted_keywords?: string[];
|
|
54
|
-
/**
|
|
55
|
-
tools?:
|
|
54
|
+
/** Names of tools available to the assistant. */
|
|
55
|
+
tools?: ConfigPayload.Tools.Item[];
|
|
56
56
|
/** Template variables for system prompt and welcome message */
|
|
57
57
|
template_variables?: Record<string, string>;
|
|
58
58
|
}
|
|
@@ -86,4 +86,8 @@ export declare namespace ConfigPayload {
|
|
|
86
86
|
readonly Pcm8000: "pcm_8000";
|
|
87
87
|
readonly Mulaw8000: "mulaw_8000";
|
|
88
88
|
};
|
|
89
|
+
type Tools = Tools.Item[];
|
|
90
|
+
namespace Tools {
|
|
91
|
+
type Item = string | Record<string, unknown>;
|
|
92
|
+
}
|
|
89
93
|
}
|
|
@@ -13,6 +13,8 @@ export interface Conversation {
|
|
|
13
13
|
project: Conversation.Project;
|
|
14
14
|
/** External ID for conversation tracking. */
|
|
15
15
|
external_id: string | null;
|
|
16
|
+
/** The origin of the conversation. */
|
|
17
|
+
origin: Conversation.Origin;
|
|
16
18
|
/** The STS model used. */
|
|
17
19
|
model: string;
|
|
18
20
|
/** Will be `true` if welcome message was automatically generated. */
|
|
@@ -35,10 +37,10 @@ export interface Conversation {
|
|
|
35
37
|
post_call_transcript: string | null;
|
|
36
38
|
/** Duration of the conversation in milliseconds. */
|
|
37
39
|
duration_ms: number;
|
|
38
|
-
/** Presigned URL to the conversation audio file. */
|
|
40
|
+
/** Presigned URL to the conversation audio file. Expires in 1 day. */
|
|
39
41
|
audio_url: string | null;
|
|
40
42
|
/** When the conversation started. */
|
|
41
|
-
started_at: string;
|
|
43
|
+
started_at: string | null;
|
|
42
44
|
/** When the conversation ended. */
|
|
43
45
|
ended_at: string | null;
|
|
44
46
|
/** Who or what ended the conversation. */
|
|
@@ -85,6 +87,17 @@ export declare namespace Conversation {
|
|
|
85
87
|
/** The name of the project. */
|
|
86
88
|
name: string;
|
|
87
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The origin of the conversation.
|
|
92
|
+
*/
|
|
93
|
+
type Origin = "web" | "direct" | "inbound" | "outbound" | "replay";
|
|
94
|
+
const Origin: {
|
|
95
|
+
readonly Web: "web";
|
|
96
|
+
readonly Direct: "direct";
|
|
97
|
+
readonly Inbound: "inbound";
|
|
98
|
+
readonly Outbound: "outbound";
|
|
99
|
+
readonly Replay: "replay";
|
|
100
|
+
};
|
|
88
101
|
/**
|
|
89
102
|
* The background noise type used in the conversation.
|
|
90
103
|
*/
|
|
@@ -6,6 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Conversation = void 0;
|
|
7
7
|
var Conversation;
|
|
8
8
|
(function (Conversation) {
|
|
9
|
+
Conversation.Origin = {
|
|
10
|
+
Web: "web",
|
|
11
|
+
Direct: "direct",
|
|
12
|
+
Inbound: "inbound",
|
|
13
|
+
Outbound: "outbound",
|
|
14
|
+
Replay: "replay",
|
|
15
|
+
};
|
|
9
16
|
Conversation.BackgroundNoise = {
|
|
10
17
|
Office: "office",
|
|
11
18
|
CallCenter: "call-center",
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.39";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -15,8 +15,8 @@ export class PhonicClient {
|
|
|
15
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
16
16
|
"X-Fern-Language": "JavaScript",
|
|
17
17
|
"X-Fern-SDK-Name": "phonic",
|
|
18
|
-
"X-Fern-SDK-Version": "0.30.
|
|
19
|
-
"User-Agent": "phonic/0.30.
|
|
18
|
+
"X-Fern-SDK-Version": "0.30.39",
|
|
19
|
+
"User-Agent": "phonic/0.30.39",
|
|
20
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
21
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
22
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -7,7 +7,7 @@ export declare namespace ConversationsSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload;
|
|
10
|
+
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.AssistantStartedSpeakingPayload | Phonic.AssistantFinishedSpeakingPayload | Phonic.ErrorPayload;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -40,6 +40,7 @@ export declare class ConversationsSocket {
|
|
|
40
40
|
sendConfig(message: Phonic.ConfigPayload): void;
|
|
41
41
|
sendAudioChunk(message: Phonic.AudioChunkPayload): void;
|
|
42
42
|
sendUpdateSystemPrompt(message: Phonic.UpdateSystemPromptPayload): void;
|
|
43
|
+
sendAddSystemMessage(message: Phonic.AddSystemMessagePayload): void;
|
|
43
44
|
sendSetExternalId(message: Phonic.SetExternalIdPayload): void;
|
|
44
45
|
sendSetTwilioCallSid(message: Phonic.SetTwilioCallSidPayload): void;
|
|
45
46
|
sendToolCallOutput(message: Phonic.ToolCallOutputPayload): void;
|
|
@@ -60,5 +61,5 @@ export declare class ConversationsSocket {
|
|
|
60
61
|
/** Send a binary payload to the websocket. */
|
|
61
62
|
protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
62
63
|
/** Send a JSON payload to the websocket. */
|
|
63
|
-
protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.SetExternalIdPayload | Phonic.SetTwilioCallSidPayload | Phonic.ToolCallOutputPayload): void;
|
|
64
|
+
protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.AddSystemMessagePayload | Phonic.SetExternalIdPayload | Phonic.SetTwilioCallSidPayload | Phonic.ToolCallOutputPayload): void;
|
|
64
65
|
}
|
|
@@ -67,6 +67,9 @@ export class ConversationsSocket {
|
|
|
67
67
|
sendUpdateSystemPrompt(message) {
|
|
68
68
|
this.sendWithBuffering(() => this.sendJson(message));
|
|
69
69
|
}
|
|
70
|
+
sendAddSystemMessage(message) {
|
|
71
|
+
this.sendWithBuffering(() => this.sendJson(message));
|
|
72
|
+
}
|
|
70
73
|
sendSetExternalId(message) {
|
|
71
74
|
this.sendWithBuffering(() => this.sendJson(message));
|
|
72
75
|
}
|
|
@@ -51,8 +51,8 @@ export interface ConfigPayload {
|
|
|
51
51
|
recognized_languages?: string[];
|
|
52
52
|
/** Keywords to boost in speech recognition */
|
|
53
53
|
boosted_keywords?: string[];
|
|
54
|
-
/**
|
|
55
|
-
tools?:
|
|
54
|
+
/** Names of tools available to the assistant. */
|
|
55
|
+
tools?: ConfigPayload.Tools.Item[];
|
|
56
56
|
/** Template variables for system prompt and welcome message */
|
|
57
57
|
template_variables?: Record<string, string>;
|
|
58
58
|
}
|
|
@@ -86,4 +86,8 @@ export declare namespace ConfigPayload {
|
|
|
86
86
|
readonly Pcm8000: "pcm_8000";
|
|
87
87
|
readonly Mulaw8000: "mulaw_8000";
|
|
88
88
|
};
|
|
89
|
+
type Tools = Tools.Item[];
|
|
90
|
+
namespace Tools {
|
|
91
|
+
type Item = string | Record<string, unknown>;
|
|
92
|
+
}
|
|
89
93
|
}
|
|
@@ -13,6 +13,8 @@ export interface Conversation {
|
|
|
13
13
|
project: Conversation.Project;
|
|
14
14
|
/** External ID for conversation tracking. */
|
|
15
15
|
external_id: string | null;
|
|
16
|
+
/** The origin of the conversation. */
|
|
17
|
+
origin: Conversation.Origin;
|
|
16
18
|
/** The STS model used. */
|
|
17
19
|
model: string;
|
|
18
20
|
/** Will be `true` if welcome message was automatically generated. */
|
|
@@ -35,10 +37,10 @@ export interface Conversation {
|
|
|
35
37
|
post_call_transcript: string | null;
|
|
36
38
|
/** Duration of the conversation in milliseconds. */
|
|
37
39
|
duration_ms: number;
|
|
38
|
-
/** Presigned URL to the conversation audio file. */
|
|
40
|
+
/** Presigned URL to the conversation audio file. Expires in 1 day. */
|
|
39
41
|
audio_url: string | null;
|
|
40
42
|
/** When the conversation started. */
|
|
41
|
-
started_at: string;
|
|
43
|
+
started_at: string | null;
|
|
42
44
|
/** When the conversation ended. */
|
|
43
45
|
ended_at: string | null;
|
|
44
46
|
/** Who or what ended the conversation. */
|
|
@@ -85,6 +87,17 @@ export declare namespace Conversation {
|
|
|
85
87
|
/** The name of the project. */
|
|
86
88
|
name: string;
|
|
87
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The origin of the conversation.
|
|
92
|
+
*/
|
|
93
|
+
type Origin = "web" | "direct" | "inbound" | "outbound" | "replay";
|
|
94
|
+
const Origin: {
|
|
95
|
+
readonly Web: "web";
|
|
96
|
+
readonly Direct: "direct";
|
|
97
|
+
readonly Inbound: "inbound";
|
|
98
|
+
readonly Outbound: "outbound";
|
|
99
|
+
readonly Replay: "replay";
|
|
100
|
+
};
|
|
88
101
|
/**
|
|
89
102
|
* The background noise type used in the conversation.
|
|
90
103
|
*/
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var Conversation;
|
|
5
5
|
(function (Conversation) {
|
|
6
|
+
Conversation.Origin = {
|
|
7
|
+
Web: "web",
|
|
8
|
+
Direct: "direct",
|
|
9
|
+
Inbound: "inbound",
|
|
10
|
+
Outbound: "outbound",
|
|
11
|
+
Replay: "replay",
|
|
12
|
+
};
|
|
6
13
|
Conversation.BackgroundNoise = {
|
|
7
14
|
Office: "office",
|
|
8
15
|
CallCenter: "call-center",
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.39";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.30.
|
|
1
|
+
export const SDK_VERSION = "0.30.39";
|