@contractspec/integration.providers-impls 2.10.0 → 3.0.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/README.md +7 -1
- package/dist/impls/async-event-queue.d.ts +8 -0
- package/dist/impls/async-event-queue.js +47 -0
- package/dist/impls/health/base-health-provider.d.ts +64 -13
- package/dist/impls/health/base-health-provider.js +506 -156
- package/dist/impls/health/hybrid-health-providers.d.ts +34 -0
- package/dist/impls/health/hybrid-health-providers.js +1088 -0
- package/dist/impls/health/official-health-providers.d.ts +78 -0
- package/dist/impls/health/official-health-providers.js +968 -0
- package/dist/impls/health/provider-normalizers.d.ts +28 -0
- package/dist/impls/health/provider-normalizers.js +287 -0
- package/dist/impls/health/providers.d.ts +2 -39
- package/dist/impls/health/providers.js +895 -184
- package/dist/impls/health-provider-factory.js +1009 -196
- package/dist/impls/index.d.ts +6 -0
- package/dist/impls/index.js +1950 -278
- package/dist/impls/messaging-github.d.ts +17 -0
- package/dist/impls/messaging-github.js +110 -0
- package/dist/impls/messaging-slack.d.ts +14 -0
- package/dist/impls/messaging-slack.js +80 -0
- package/dist/impls/messaging-whatsapp-meta.d.ts +13 -0
- package/dist/impls/messaging-whatsapp-meta.js +52 -0
- package/dist/impls/messaging-whatsapp-twilio.d.ts +13 -0
- package/dist/impls/messaging-whatsapp-twilio.js +82 -0
- package/dist/impls/mistral-conversational.d.ts +23 -0
- package/dist/impls/mistral-conversational.js +476 -0
- package/dist/impls/mistral-conversational.session.d.ts +32 -0
- package/dist/impls/mistral-conversational.session.js +206 -0
- package/dist/impls/mistral-stt.d.ts +17 -0
- package/dist/impls/mistral-stt.js +167 -0
- package/dist/impls/provider-factory.d.ts +5 -1
- package/dist/impls/provider-factory.js +1943 -277
- package/dist/impls/stripe-payments.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1953 -278
- package/dist/messaging.d.ts +1 -0
- package/dist/messaging.js +3 -0
- package/dist/node/impls/async-event-queue.js +46 -0
- package/dist/node/impls/health/base-health-provider.js +506 -156
- package/dist/node/impls/health/hybrid-health-providers.js +1087 -0
- package/dist/node/impls/health/official-health-providers.js +967 -0
- package/dist/node/impls/health/provider-normalizers.js +286 -0
- package/dist/node/impls/health/providers.js +895 -184
- package/dist/node/impls/health-provider-factory.js +1009 -196
- package/dist/node/impls/index.js +1950 -278
- package/dist/node/impls/messaging-github.js +109 -0
- package/dist/node/impls/messaging-slack.js +79 -0
- package/dist/node/impls/messaging-whatsapp-meta.js +51 -0
- package/dist/node/impls/messaging-whatsapp-twilio.js +81 -0
- package/dist/node/impls/mistral-conversational.js +475 -0
- package/dist/node/impls/mistral-conversational.session.js +205 -0
- package/dist/node/impls/mistral-stt.js +166 -0
- package/dist/node/impls/provider-factory.js +1943 -277
- package/dist/node/impls/stripe-payments.js +1 -1
- package/dist/node/index.js +1953 -278
- package/dist/node/messaging.js +2 -0
- package/package.json +156 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MessagingProvider, MessagingSendInput, MessagingSendResult, MessagingUpdateInput } from '../messaging';
|
|
2
|
+
export interface GithubMessagingProviderOptions {
|
|
3
|
+
token: string;
|
|
4
|
+
defaultOwner?: string;
|
|
5
|
+
defaultRepo?: string;
|
|
6
|
+
apiBaseUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class GithubMessagingProvider implements MessagingProvider {
|
|
9
|
+
private readonly token;
|
|
10
|
+
private readonly defaultOwner?;
|
|
11
|
+
private readonly defaultRepo?;
|
|
12
|
+
private readonly apiBaseUrl;
|
|
13
|
+
constructor(options: GithubMessagingProviderOptions);
|
|
14
|
+
sendMessage(input: MessagingSendInput): Promise<MessagingSendResult>;
|
|
15
|
+
updateMessage(messageId: string, input: MessagingUpdateInput): Promise<MessagingSendResult>;
|
|
16
|
+
private resolveTarget;
|
|
17
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/impls/messaging-github.ts
|
|
3
|
+
class GithubMessagingProvider {
|
|
4
|
+
token;
|
|
5
|
+
defaultOwner;
|
|
6
|
+
defaultRepo;
|
|
7
|
+
apiBaseUrl;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.token = options.token;
|
|
10
|
+
this.defaultOwner = options.defaultOwner;
|
|
11
|
+
this.defaultRepo = options.defaultRepo;
|
|
12
|
+
this.apiBaseUrl = options.apiBaseUrl ?? "https://api.github.com";
|
|
13
|
+
}
|
|
14
|
+
async sendMessage(input) {
|
|
15
|
+
const target = this.resolveTarget(input);
|
|
16
|
+
const response = await fetch(`${this.apiBaseUrl}/repos/${target.owner}/${target.repo}/issues/${target.issueNumber}/comments`, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: {
|
|
19
|
+
authorization: `Bearer ${this.token}`,
|
|
20
|
+
accept: "application/vnd.github+json",
|
|
21
|
+
"content-type": "application/json"
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify({ body: input.text })
|
|
24
|
+
});
|
|
25
|
+
const body = await response.json();
|
|
26
|
+
if (!response.ok || !body.id) {
|
|
27
|
+
throw new Error(`GitHub sendMessage failed: ${body.message ?? `HTTP_${response.status}`}`);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
id: String(body.id),
|
|
31
|
+
providerMessageId: body.node_id,
|
|
32
|
+
status: "sent",
|
|
33
|
+
sentAt: new Date,
|
|
34
|
+
metadata: {
|
|
35
|
+
url: body.html_url ?? "",
|
|
36
|
+
owner: target.owner,
|
|
37
|
+
repo: target.repo,
|
|
38
|
+
issueNumber: String(target.issueNumber)
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async updateMessage(messageId, input) {
|
|
43
|
+
const owner = input.metadata?.owner ?? this.defaultOwner;
|
|
44
|
+
const repo = input.metadata?.repo ?? this.defaultRepo;
|
|
45
|
+
if (!owner || !repo) {
|
|
46
|
+
throw new Error("GitHub updateMessage requires owner and repo metadata.");
|
|
47
|
+
}
|
|
48
|
+
const response = await fetch(`${this.apiBaseUrl}/repos/${owner}/${repo}/issues/comments/${messageId}`, {
|
|
49
|
+
method: "PATCH",
|
|
50
|
+
headers: {
|
|
51
|
+
authorization: `Bearer ${this.token}`,
|
|
52
|
+
accept: "application/vnd.github+json",
|
|
53
|
+
"content-type": "application/json"
|
|
54
|
+
},
|
|
55
|
+
body: JSON.stringify({ body: input.text })
|
|
56
|
+
});
|
|
57
|
+
const body = await response.json();
|
|
58
|
+
if (!response.ok || !body.id) {
|
|
59
|
+
throw new Error(`GitHub updateMessage failed: ${body.message ?? `HTTP_${response.status}`}`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
id: String(body.id),
|
|
63
|
+
providerMessageId: body.node_id,
|
|
64
|
+
status: "sent",
|
|
65
|
+
sentAt: new Date,
|
|
66
|
+
metadata: {
|
|
67
|
+
url: body.html_url ?? "",
|
|
68
|
+
owner,
|
|
69
|
+
repo
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
resolveTarget(input) {
|
|
74
|
+
const parsedRecipient = parseRecipient(input.recipientId);
|
|
75
|
+
const owner = parsedRecipient?.owner ?? this.defaultOwner;
|
|
76
|
+
const repo = parsedRecipient?.repo ?? this.defaultRepo;
|
|
77
|
+
const issueNumber = parsedRecipient?.issueNumber ?? parseIssueNumber(input.threadId);
|
|
78
|
+
if (!owner || !repo || issueNumber == null) {
|
|
79
|
+
throw new Error("GitHub sendMessage requires owner/repo and issueNumber (use recipientId like owner/repo#123 or provide defaults + threadId).");
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
owner,
|
|
83
|
+
repo,
|
|
84
|
+
issueNumber
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function parseRecipient(value) {
|
|
89
|
+
if (!value)
|
|
90
|
+
return null;
|
|
91
|
+
const match = value.trim().match(/^([^/]+)\/([^#]+)#(\d+)$/);
|
|
92
|
+
if (!match)
|
|
93
|
+
return null;
|
|
94
|
+
const owner = match[1];
|
|
95
|
+
const repo = match[2];
|
|
96
|
+
const issueNumber = Number(match[3]);
|
|
97
|
+
if (!owner || !repo || !Number.isInteger(issueNumber)) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return { owner, repo, issueNumber };
|
|
101
|
+
}
|
|
102
|
+
function parseIssueNumber(value) {
|
|
103
|
+
if (!value)
|
|
104
|
+
return null;
|
|
105
|
+
const numeric = Number(value);
|
|
106
|
+
return Number.isInteger(numeric) ? numeric : null;
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
GithubMessagingProvider
|
|
110
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MessagingProvider, MessagingSendInput, MessagingSendResult, MessagingUpdateInput } from '../messaging';
|
|
2
|
+
export interface SlackMessagingProviderOptions {
|
|
3
|
+
botToken: string;
|
|
4
|
+
defaultChannelId?: string;
|
|
5
|
+
apiBaseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class SlackMessagingProvider implements MessagingProvider {
|
|
8
|
+
private readonly botToken;
|
|
9
|
+
private readonly defaultChannelId?;
|
|
10
|
+
private readonly apiBaseUrl;
|
|
11
|
+
constructor(options: SlackMessagingProviderOptions);
|
|
12
|
+
sendMessage(input: MessagingSendInput): Promise<MessagingSendResult>;
|
|
13
|
+
updateMessage(messageId: string, input: MessagingUpdateInput): Promise<MessagingSendResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/impls/messaging-slack.ts
|
|
3
|
+
class SlackMessagingProvider {
|
|
4
|
+
botToken;
|
|
5
|
+
defaultChannelId;
|
|
6
|
+
apiBaseUrl;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.botToken = options.botToken;
|
|
9
|
+
this.defaultChannelId = options.defaultChannelId;
|
|
10
|
+
this.apiBaseUrl = options.apiBaseUrl ?? "https://slack.com/api";
|
|
11
|
+
}
|
|
12
|
+
async sendMessage(input) {
|
|
13
|
+
const channel = input.channelId ?? input.recipientId ?? this.defaultChannelId;
|
|
14
|
+
if (!channel) {
|
|
15
|
+
throw new Error("Slack sendMessage requires channelId, recipientId, or defaultChannelId.");
|
|
16
|
+
}
|
|
17
|
+
const payload = {
|
|
18
|
+
channel,
|
|
19
|
+
text: input.text,
|
|
20
|
+
mrkdwn: input.markdown ?? true,
|
|
21
|
+
thread_ts: input.threadId
|
|
22
|
+
};
|
|
23
|
+
const response = await fetch(`${this.apiBaseUrl}/chat.postMessage`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: {
|
|
26
|
+
authorization: `Bearer ${this.botToken}`,
|
|
27
|
+
"content-type": "application/json"
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify(payload)
|
|
30
|
+
});
|
|
31
|
+
const body = await response.json();
|
|
32
|
+
if (!response.ok || !body.ok || !body.ts) {
|
|
33
|
+
throw new Error(`Slack sendMessage failed: ${body.error ?? `HTTP_${response.status}`}`);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
id: `slack:${body.channel ?? channel}:${body.ts}`,
|
|
37
|
+
providerMessageId: body.ts,
|
|
38
|
+
status: "sent",
|
|
39
|
+
sentAt: new Date,
|
|
40
|
+
metadata: {
|
|
41
|
+
channelId: body.channel ?? channel
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async updateMessage(messageId, input) {
|
|
46
|
+
const channel = input.channelId ?? this.defaultChannelId;
|
|
47
|
+
if (!channel) {
|
|
48
|
+
throw new Error("Slack updateMessage requires channelId or defaultChannelId.");
|
|
49
|
+
}
|
|
50
|
+
const response = await fetch(`${this.apiBaseUrl}/chat.update`, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: {
|
|
53
|
+
authorization: `Bearer ${this.botToken}`,
|
|
54
|
+
"content-type": "application/json"
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
channel,
|
|
58
|
+
ts: messageId,
|
|
59
|
+
text: input.text,
|
|
60
|
+
mrkdwn: input.markdown ?? true
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
const body = await response.json();
|
|
64
|
+
if (!response.ok || !body.ok || !body.ts) {
|
|
65
|
+
throw new Error(`Slack updateMessage failed: ${body.error ?? `HTTP_${response.status}`}`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
id: `slack:${body.channel ?? channel}:${body.ts}`,
|
|
69
|
+
providerMessageId: body.ts,
|
|
70
|
+
status: "sent",
|
|
71
|
+
sentAt: new Date,
|
|
72
|
+
metadata: {
|
|
73
|
+
channelId: body.channel ?? channel
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
SlackMessagingProvider
|
|
80
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MessagingProvider, MessagingSendInput, MessagingSendResult } from '../messaging';
|
|
2
|
+
export interface MetaWhatsappMessagingProviderOptions {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
phoneNumberId: string;
|
|
5
|
+
apiVersion?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MetaWhatsappMessagingProvider implements MessagingProvider {
|
|
8
|
+
private readonly accessToken;
|
|
9
|
+
private readonly phoneNumberId;
|
|
10
|
+
private readonly apiVersion;
|
|
11
|
+
constructor(options: MetaWhatsappMessagingProviderOptions);
|
|
12
|
+
sendMessage(input: MessagingSendInput): Promise<MessagingSendResult>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/impls/messaging-whatsapp-meta.ts
|
|
3
|
+
class MetaWhatsappMessagingProvider {
|
|
4
|
+
accessToken;
|
|
5
|
+
phoneNumberId;
|
|
6
|
+
apiVersion;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.accessToken = options.accessToken;
|
|
9
|
+
this.phoneNumberId = options.phoneNumberId;
|
|
10
|
+
this.apiVersion = options.apiVersion ?? "v22.0";
|
|
11
|
+
}
|
|
12
|
+
async sendMessage(input) {
|
|
13
|
+
const to = input.recipientId;
|
|
14
|
+
if (!to) {
|
|
15
|
+
throw new Error("Meta WhatsApp sendMessage requires recipientId.");
|
|
16
|
+
}
|
|
17
|
+
const response = await fetch(`https://graph.facebook.com/${this.apiVersion}/${this.phoneNumberId}/messages`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers: {
|
|
20
|
+
authorization: `Bearer ${this.accessToken}`,
|
|
21
|
+
"content-type": "application/json"
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
messaging_product: "whatsapp",
|
|
25
|
+
to,
|
|
26
|
+
type: "text",
|
|
27
|
+
text: {
|
|
28
|
+
body: input.text,
|
|
29
|
+
preview_url: false
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
const body = await response.json();
|
|
34
|
+
const messageId = body.messages?.[0]?.id;
|
|
35
|
+
if (!response.ok || !messageId) {
|
|
36
|
+
const errorCode = body.error?.code != null ? String(body.error.code) : "";
|
|
37
|
+
throw new Error(`Meta WhatsApp sendMessage failed: ${body.error?.message ?? `HTTP_${response.status}`}${errorCode ? ` (${errorCode})` : ""}`);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
id: messageId,
|
|
41
|
+
providerMessageId: messageId,
|
|
42
|
+
status: "sent",
|
|
43
|
+
sentAt: new Date,
|
|
44
|
+
metadata: {
|
|
45
|
+
phoneNumberId: this.phoneNumberId
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
MetaWhatsappMessagingProvider
|
|
52
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MessagingProvider, MessagingSendInput, MessagingSendResult } from '../messaging';
|
|
2
|
+
export interface TwilioWhatsappMessagingProviderOptions {
|
|
3
|
+
accountSid: string;
|
|
4
|
+
authToken: string;
|
|
5
|
+
fromNumber?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class TwilioWhatsappMessagingProvider implements MessagingProvider {
|
|
8
|
+
private readonly accountSid;
|
|
9
|
+
private readonly authToken;
|
|
10
|
+
private readonly fromNumber?;
|
|
11
|
+
constructor(options: TwilioWhatsappMessagingProviderOptions);
|
|
12
|
+
sendMessage(input: MessagingSendInput): Promise<MessagingSendResult>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/impls/messaging-whatsapp-twilio.ts
|
|
3
|
+
import { Buffer } from "buffer";
|
|
4
|
+
|
|
5
|
+
class TwilioWhatsappMessagingProvider {
|
|
6
|
+
accountSid;
|
|
7
|
+
authToken;
|
|
8
|
+
fromNumber;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.accountSid = options.accountSid;
|
|
11
|
+
this.authToken = options.authToken;
|
|
12
|
+
this.fromNumber = options.fromNumber;
|
|
13
|
+
}
|
|
14
|
+
async sendMessage(input) {
|
|
15
|
+
const to = normalizeWhatsappAddress(input.recipientId);
|
|
16
|
+
const from = normalizeWhatsappAddress(input.channelId ?? this.fromNumber);
|
|
17
|
+
if (!to) {
|
|
18
|
+
throw new Error("Twilio WhatsApp sendMessage requires recipientId.");
|
|
19
|
+
}
|
|
20
|
+
if (!from) {
|
|
21
|
+
throw new Error("Twilio WhatsApp sendMessage requires channelId or configured fromNumber.");
|
|
22
|
+
}
|
|
23
|
+
const params = new URLSearchParams;
|
|
24
|
+
params.set("To", to);
|
|
25
|
+
params.set("From", from);
|
|
26
|
+
params.set("Body", input.text);
|
|
27
|
+
const auth = Buffer.from(`${this.accountSid}:${this.authToken}`).toString("base64");
|
|
28
|
+
const response = await fetch(`https://api.twilio.com/2010-04-01/Accounts/${this.accountSid}/Messages.json`, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: {
|
|
31
|
+
authorization: `Basic ${auth}`,
|
|
32
|
+
"content-type": "application/x-www-form-urlencoded"
|
|
33
|
+
},
|
|
34
|
+
body: params.toString()
|
|
35
|
+
});
|
|
36
|
+
const body = await response.json();
|
|
37
|
+
if (!response.ok || !body.sid) {
|
|
38
|
+
throw new Error(`Twilio WhatsApp sendMessage failed: ${body.error_message ?? `HTTP_${response.status}`}`);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
id: body.sid,
|
|
42
|
+
providerMessageId: body.sid,
|
|
43
|
+
status: mapTwilioStatus(body.status),
|
|
44
|
+
sentAt: new Date,
|
|
45
|
+
errorCode: body.error_code != null ? String(body.error_code) : undefined,
|
|
46
|
+
errorMessage: body.error_message ?? undefined,
|
|
47
|
+
metadata: {
|
|
48
|
+
from,
|
|
49
|
+
to
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function normalizeWhatsappAddress(value) {
|
|
55
|
+
if (!value)
|
|
56
|
+
return null;
|
|
57
|
+
if (value.startsWith("whatsapp:"))
|
|
58
|
+
return value;
|
|
59
|
+
return `whatsapp:${value}`;
|
|
60
|
+
}
|
|
61
|
+
function mapTwilioStatus(status) {
|
|
62
|
+
switch (status) {
|
|
63
|
+
case "queued":
|
|
64
|
+
case "accepted":
|
|
65
|
+
case "scheduled":
|
|
66
|
+
return "queued";
|
|
67
|
+
case "sending":
|
|
68
|
+
return "sending";
|
|
69
|
+
case "delivered":
|
|
70
|
+
return "delivered";
|
|
71
|
+
case "failed":
|
|
72
|
+
case "undelivered":
|
|
73
|
+
case "canceled":
|
|
74
|
+
return "failed";
|
|
75
|
+
case "sent":
|
|
76
|
+
default:
|
|
77
|
+
return "sent";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
TwilioWhatsappMessagingProvider
|
|
82
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type MistralSttProviderOptions } from './mistral-stt';
|
|
2
|
+
import type { ConversationalProvider, ConversationalSession, ConversationalSessionConfig, STTProvider, Voice } from '../voice';
|
|
3
|
+
export interface MistralConversationalProviderOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
defaultModel?: string;
|
|
6
|
+
defaultVoiceId?: string;
|
|
7
|
+
serverURL?: string;
|
|
8
|
+
fetchImpl?: typeof fetch;
|
|
9
|
+
sttProvider?: STTProvider;
|
|
10
|
+
sttOptions?: Omit<MistralSttProviderOptions, 'apiKey' | 'fetchImpl'>;
|
|
11
|
+
}
|
|
12
|
+
export declare class MistralConversationalProvider implements ConversationalProvider {
|
|
13
|
+
private readonly apiKey;
|
|
14
|
+
private readonly defaultModel;
|
|
15
|
+
private readonly defaultVoiceId;
|
|
16
|
+
private readonly baseUrl;
|
|
17
|
+
private readonly fetchImpl;
|
|
18
|
+
private readonly sttProvider;
|
|
19
|
+
constructor(options: MistralConversationalProviderOptions);
|
|
20
|
+
startSession(config: ConversationalSessionConfig): Promise<ConversationalSession>;
|
|
21
|
+
listVoices(): Promise<Voice[]>;
|
|
22
|
+
private completeConversation;
|
|
23
|
+
}
|