@dual-os/elevenlabs-api 0.0.0-stage → 3.0.4
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 +4 -0
- package/README.md +24 -2
- package/Runner.js +5537 -0
- package/Runner.js.map +59 -0
- package/bundle-inventory.json +1 -0
- package/dist/_virtual/_rolldown/runtime.js +10 -0
- package/dist/_virtual/_rolldown/runtime.js.map +9 -0
- package/dist/auth.d.ts +21 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +17 -0
- package/dist/auth.js.map +9 -0
- package/dist/generated/http.d.ts +81 -0
- package/dist/generated/http.d.ts.map +1 -0
- package/dist/generated/http.js +64 -0
- package/dist/generated/http.js.map +9 -0
- package/dist/generated/operations.d.ts +13961 -0
- package/dist/generated/operations.d.ts.map +1 -0
- package/dist/generated/operations.js +3602 -0
- package/dist/generated/operations.js.map +9 -0
- package/dist/generated/plugin.d.ts +1723 -0
- package/dist/generated/plugin.d.ts.map +1 -0
- package/dist/generated/plugin.js +2683 -0
- package/dist/generated/plugin.js.map +10 -0
- package/dist/triggers.d.ts +124 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +17 -0
- package/dist/triggers.js.map +9 -0
- package/dual-plugin.json +1 -0
- package/licenses/@dual-os_sdk@0.9.0/LICENSE +4 -0
- package/licenses/@effect_platform-node-shared@4.1.2/LICENSE +21 -0
- package/licenses/@effect_platform-node@4.1.2/LICENSE +21 -0
- package/licenses/effect@4.1.2/LICENSE +21 -0
- package/package.json +1 -6
- package/plugin-2jdfj02n.js +18 -0
- package/plugin-2jdfj02n.js.map +10 -0
- package/plugin-3mqs2t8k.js +1294 -0
- package/plugin-3mqs2t8k.js.map +18 -0
- package/plugin-4r725dtm.js +19148 -0
- package/plugin-4r725dtm.js.map +158 -0
- package/plugin-cgmzkbrx.js +62 -0
- package/plugin-cgmzkbrx.js.map +10 -0
- package/plugin-dmkfjk3p.js +16763 -0
- package/plugin-dmkfjk3p.js.map +10 -0
- package/plugin-mmevetrv.js +226 -0
- package/plugin-mmevetrv.js.map +10 -0
- package/plugin.json +47 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
pipe,
|
|
4
|
+
isNullish,
|
|
5
|
+
none,
|
|
6
|
+
some,
|
|
7
|
+
match,
|
|
8
|
+
fromNullishOr,
|
|
9
|
+
fromUndefinedOr,
|
|
10
|
+
map,
|
|
11
|
+
flatMap,
|
|
12
|
+
filter,
|
|
13
|
+
exists,
|
|
14
|
+
isReadonlyArrayEmpty,
|
|
15
|
+
get2,
|
|
16
|
+
findFirst,
|
|
17
|
+
contains,
|
|
18
|
+
map3,
|
|
19
|
+
filter2,
|
|
20
|
+
dedupe,
|
|
21
|
+
minutes,
|
|
22
|
+
hours,
|
|
23
|
+
toMillis,
|
|
24
|
+
currentTimeMillis,
|
|
25
|
+
between,
|
|
26
|
+
parse,
|
|
27
|
+
split,
|
|
28
|
+
fromOption2,
|
|
29
|
+
map4,
|
|
30
|
+
catchTag,
|
|
31
|
+
mapError,
|
|
32
|
+
tapError,
|
|
33
|
+
fn,
|
|
34
|
+
fromIterable2,
|
|
35
|
+
has2,
|
|
36
|
+
decodeUnknownEffect,
|
|
37
|
+
encodeUnknownEffect,
|
|
38
|
+
optionalKey,
|
|
39
|
+
Unknown,
|
|
40
|
+
String3,
|
|
41
|
+
Struct,
|
|
42
|
+
Record,
|
|
43
|
+
StructWithRest,
|
|
44
|
+
ArraySchema,
|
|
45
|
+
Union,
|
|
46
|
+
Finite,
|
|
47
|
+
isBetween,
|
|
48
|
+
Int,
|
|
49
|
+
NonEmptyString,
|
|
50
|
+
fromJsonString,
|
|
51
|
+
Uint8Array2,
|
|
52
|
+
paginate,
|
|
53
|
+
runCollect,
|
|
54
|
+
Action_exports,
|
|
55
|
+
Trigger_exports
|
|
56
|
+
} from "./plugin-4r725dtm.js";
|
|
57
|
+
import {
|
|
58
|
+
WorkspaceWebhookEventType2,
|
|
59
|
+
ConversationSummaryResponseModel2,
|
|
60
|
+
agentsPlatform_getConversationHistoriesRoute2,
|
|
61
|
+
workspace_createWorkspaceWebhookRoute2,
|
|
62
|
+
workspace_deleteWorkspaceWebhookRoute2,
|
|
63
|
+
workspace_editWorkspaceWebhookRoute2
|
|
64
|
+
} from "./plugin-dmkfjk3p.js";
|
|
65
|
+
|
|
66
|
+
// dist/triggers.js
|
|
67
|
+
var tolerance = minutes(30);
|
|
68
|
+
var webhookName = "Dual";
|
|
69
|
+
var Event = StructWithRest(Struct({
|
|
70
|
+
data: optionalKey(Record(String3, Unknown)),
|
|
71
|
+
event_timestamp: optionalKey(Union([Finite, String3])),
|
|
72
|
+
type: String3
|
|
73
|
+
}), [Record(String3, Unknown)]);
|
|
74
|
+
var SignedDelivery = Struct({
|
|
75
|
+
headers: Struct({ "elevenlabs-signature": String3 }),
|
|
76
|
+
rawBody: Union([Uint8Array2, String3])
|
|
77
|
+
});
|
|
78
|
+
var triggers2 = [Trigger_exports.webhook("event", {
|
|
79
|
+
description: "Creates a signed ElevenLabs workspace webhook, subscribes it to the selected workspace events and deletes it on deactivation. Select the webhook, named Dual, as the post-call webhook of an agent to also receive post_call_transcription, post_call_audio and call_initiation_failure. Only workspace administrators can manage webhooks.",
|
|
80
|
+
name: "ElevenLabs event",
|
|
81
|
+
config: Struct({
|
|
82
|
+
events: ArraySchema(WorkspaceWebhookEventType2).annotate({ description: "Workspace events to subscribe to: speech_to_text for asynchronous transcriptions requested with webhook enabled, voice_library_removal_notice, agent_qa, and flows for image, video and template run results requested with a webhook" }),
|
|
83
|
+
types: optionalKey(ArraySchema(NonEmptyString).annotate({ description: "Only report deliveries of these types, such as post_call_transcription or speech_to_text_transcription; leave empty to report every delivery" }))
|
|
84
|
+
}),
|
|
85
|
+
output: Event,
|
|
86
|
+
state: Struct({
|
|
87
|
+
secret: String3,
|
|
88
|
+
webhookId: String3
|
|
89
|
+
})
|
|
90
|
+
}), Trigger_exports.polling("conversation-ended", {
|
|
91
|
+
description: "Polls Agents Platform conversations and reports each one that is done or failed after a silent first check. Only conversations that started within the lookback window are read, so a conversation that ends later than that is not reported.",
|
|
92
|
+
name: "Conversation ended",
|
|
93
|
+
config: Struct({
|
|
94
|
+
agentId: optionalKey(NonEmptyString.annotate({ description: "Only report conversations of this agent; leave empty for every agent" })),
|
|
95
|
+
lookbackHours: optionalKey(Int.check(isBetween({
|
|
96
|
+
maximum: 72,
|
|
97
|
+
minimum: 1
|
|
98
|
+
})).annotate({ description: "How many hours after its start a conversation is still watched, 2 by default" }))
|
|
99
|
+
}),
|
|
100
|
+
output: ConversationSummaryResponseModel2,
|
|
101
|
+
state: Struct({ seen: ArraySchema(String3) })
|
|
102
|
+
})];
|
|
103
|
+
var handlers2 = {
|
|
104
|
+
"conversation-ended": { poll: fn("ElevenLabs.conversationEnded.poll")(function* (input, context) {
|
|
105
|
+
const now = yield* currentTimeMillis;
|
|
106
|
+
const ended = yield* pipe(paginate({ cursor: none() }, (page) => map4(agentsPlatform_getConversationHistoriesRoute2.run({
|
|
107
|
+
...match(fromUndefinedOr(input.config.agentId), {
|
|
108
|
+
onNone: () => ({}),
|
|
109
|
+
onSome: (agent_id) => ({ agent_id })
|
|
110
|
+
}),
|
|
111
|
+
call_start_after_unix: Math.floor((now - toMillis(hours(input.config.lookbackHours ?? 2))) / 1000),
|
|
112
|
+
...match(page.cursor, {
|
|
113
|
+
onNone: () => ({}),
|
|
114
|
+
onSome: (cursor) => ({ cursor })
|
|
115
|
+
}),
|
|
116
|
+
exclude_statuses: [
|
|
117
|
+
"initiated",
|
|
118
|
+
"in-progress",
|
|
119
|
+
"processing"
|
|
120
|
+
],
|
|
121
|
+
page_size: 100,
|
|
122
|
+
summary_mode: "include"
|
|
123
|
+
}, context), (found) => [found.conversations, pipe(fromNullishOr(found.next_cursor), filter(() => found.has_more), map((cursor) => ({ cursor: some(cursor) })))])), runCollect);
|
|
124
|
+
return {
|
|
125
|
+
events: match(fromUndefinedOr(input.state), {
|
|
126
|
+
onNone: () => [],
|
|
127
|
+
onSome: (previous) => pipe(ended, filter2((conversation) => !has2(fromIterable2(previous.seen), conversation.conversation_id)), map3((conversation) => ({
|
|
128
|
+
key: `conversation:${conversation.conversation_id}`,
|
|
129
|
+
payload: conversation
|
|
130
|
+
})))
|
|
131
|
+
}),
|
|
132
|
+
state: { seen: dedupe(map3(ended, (conversation) => conversation.conversation_id)) }
|
|
133
|
+
};
|
|
134
|
+
}) },
|
|
135
|
+
event: {
|
|
136
|
+
activate: fn("ElevenLabs.event.activate")(function* (input, context) {
|
|
137
|
+
const created = yield* workspace_createWorkspaceWebhookRoute2.run({ payload: { settings: {
|
|
138
|
+
auth_type: "hmac",
|
|
139
|
+
name: webhookName,
|
|
140
|
+
webhook_url: input.webhookUrl
|
|
141
|
+
} } }, context);
|
|
142
|
+
const remove = workspace_deleteWorkspaceWebhookRoute2.run({ webhook_id: created.webhook_id }, context);
|
|
143
|
+
const secret = created.webhook_secret;
|
|
144
|
+
if (isNullish(secret)) {
|
|
145
|
+
yield* remove;
|
|
146
|
+
return yield* Action_exports.ActionHandlerError.make({ message: "ElevenLabs did not return the signing secret of the new webhook" });
|
|
147
|
+
}
|
|
148
|
+
yield* pipe(workspace_editWorkspaceWebhookRoute2.run({
|
|
149
|
+
payload: {
|
|
150
|
+
events: input.config.events,
|
|
151
|
+
is_disabled: false,
|
|
152
|
+
name: webhookName,
|
|
153
|
+
retry_enabled: true
|
|
154
|
+
},
|
|
155
|
+
webhook_id: created.webhook_id
|
|
156
|
+
}, context), tapError(() => remove));
|
|
157
|
+
return { state: {
|
|
158
|
+
secret,
|
|
159
|
+
webhookId: created.webhook_id
|
|
160
|
+
} };
|
|
161
|
+
}),
|
|
162
|
+
deactivate: fn("ElevenLabs.event.deactivate")(function* (input, context) {
|
|
163
|
+
if (input.state === undefined)
|
|
164
|
+
return;
|
|
165
|
+
const webhookId = input.state.webhookId;
|
|
166
|
+
yield* pipe(workspace_deleteWorkspaceWebhookRoute2.run({ webhook_id: webhookId }, context), catchTag("ActionHandlerError", () => workspace_editWorkspaceWebhookRoute2.run({
|
|
167
|
+
payload: {
|
|
168
|
+
events: [],
|
|
169
|
+
is_disabled: true,
|
|
170
|
+
name: webhookName
|
|
171
|
+
},
|
|
172
|
+
webhook_id: webhookId
|
|
173
|
+
}, context)));
|
|
174
|
+
}),
|
|
175
|
+
parse: fn("ElevenLabs.event.parse")(function* (input) {
|
|
176
|
+
const payload = yield* decodeUnknownEffect(Event)(input.request.body);
|
|
177
|
+
const types = input.config.types ?? [];
|
|
178
|
+
if (!isReadonlyArrayEmpty(types) && !contains(types, payload.type))
|
|
179
|
+
return {
|
|
180
|
+
events: [],
|
|
181
|
+
state: input.state
|
|
182
|
+
};
|
|
183
|
+
const digest = yield* Trigger_exports.bodyDigest(input.request.rawBody ?? (yield* encodeUnknownEffect(fromJsonString(Unknown))(input.request.body)));
|
|
184
|
+
return {
|
|
185
|
+
events: [{
|
|
186
|
+
key: `${payload.type}:${digest}`,
|
|
187
|
+
payload
|
|
188
|
+
}],
|
|
189
|
+
state: input.state
|
|
190
|
+
};
|
|
191
|
+
}),
|
|
192
|
+
verify: fn("ElevenLabs.event.verify")(function* (input) {
|
|
193
|
+
const forged = Action_exports.ActionHandlerError.make({
|
|
194
|
+
message: "Invalid ElevenLabs webhook signature",
|
|
195
|
+
status: 401
|
|
196
|
+
});
|
|
197
|
+
if (input.state === undefined)
|
|
198
|
+
return yield* forged;
|
|
199
|
+
const delivery = yield* mapError(decodeUnknownEffect(SignedDelivery)({
|
|
200
|
+
...input.request,
|
|
201
|
+
headers: input.request.headers ?? {}
|
|
202
|
+
}), () => forged);
|
|
203
|
+
const pairs = pipe(delivery.headers["elevenlabs-signature"], split(","), map3(split("=")));
|
|
204
|
+
function field(name) {
|
|
205
|
+
return pipe(pairs, findFirst((pair) => pair[0] === name && pair.length === 2), flatMap((pair) => get2(pair, 1)));
|
|
206
|
+
}
|
|
207
|
+
const now = yield* currentTimeMillis;
|
|
208
|
+
const timestamp = yield* pipe(field("t"), filter((seconds) => exists(parse(seconds), (parsed) => between(parsed * 1000, {
|
|
209
|
+
maximum: now + toMillis(tolerance),
|
|
210
|
+
minimum: now - toMillis(tolerance)
|
|
211
|
+
}))), fromOption2, mapError(() => forged));
|
|
212
|
+
if (!(yield* Trigger_exports.verifyHmac({
|
|
213
|
+
algorithm: "sha256",
|
|
214
|
+
encoding: "hex",
|
|
215
|
+
message: [`${timestamp}.`, delivery.rawBody],
|
|
216
|
+
secret: input.state.secret,
|
|
217
|
+
signature: yield* mapError(fromOption2(field("v0")), () => forged)
|
|
218
|
+
})))
|
|
219
|
+
return yield* forged;
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
export { triggers2, handlers2 };
|
|
224
|
+
|
|
225
|
+
//# debugId=AE82479A01E741BD64756E2164756E21
|
|
226
|
+
//# sourceMappingURL=plugin-mmevetrv.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../bundle-input/dist/triggers.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { ConversationSummaryResponseModel, WorkspaceWebhookEventType, agentsPlatform_getConversationHistoriesRoute, workspace_createWorkspaceWebhookRoute, workspace_deleteWorkspaceWebhookRoute, workspace_editWorkspaceWebhookRoute } from \"./generated/operations.js\";\nimport { Array, Clock, Duration, Effect, HashSet, Number, Option, Predicate, Schema, Stream, String, pipe } from \"effect\";\nimport { Action, Trigger } from \"@dual-os/sdk\";\n//#region src/triggers.ts\nconst tolerance = Duration.minutes(30);\nconst webhookName = \"Dual\";\nconst Event = Schema.StructWithRest(Schema.Struct({\n\tdata: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),\n\tevent_timestamp: Schema.optionalKey(Schema.Union([Schema.Finite, Schema.String])),\n\ttype: Schema.String\n}), [Schema.Record(Schema.String, Schema.Unknown)]);\nconst SignedDelivery = Schema.Struct({\n\theaders: Schema.Struct({ \"elevenlabs-signature\": Schema.String }),\n\trawBody: Schema.Union([Schema.Uint8Array, Schema.String])\n});\nconst triggers = [Trigger.webhook(\"event\", {\n\tdescription: \"Creates a signed ElevenLabs workspace webhook, subscribes it to the selected workspace events and deletes it on deactivation. Select the webhook, named Dual, as the post-call webhook of an agent to also receive post_call_transcription, post_call_audio and call_initiation_failure. Only workspace administrators can manage webhooks.\",\n\tname: \"ElevenLabs event\",\n\tconfig: Schema.Struct({\n\t\tevents: Schema.Array(WorkspaceWebhookEventType).annotate({ description: \"Workspace events to subscribe to: speech_to_text for asynchronous transcriptions requested with webhook enabled, voice_library_removal_notice, agent_qa, and flows for image, video and template run results requested with a webhook\" }),\n\t\ttypes: Schema.optionalKey(Schema.Array(Schema.NonEmptyString).annotate({ description: \"Only report deliveries of these types, such as post_call_transcription or speech_to_text_transcription; leave empty to report every delivery\" }))\n\t}),\n\toutput: Event,\n\tstate: Schema.Struct({\n\t\tsecret: Schema.String,\n\t\twebhookId: Schema.String\n\t})\n}), Trigger.polling(\"conversation-ended\", {\n\tdescription: \"Polls Agents Platform conversations and reports each one that is done or failed after a silent first check. Only conversations that started within the lookback window are read, so a conversation that ends later than that is not reported.\",\n\tname: \"Conversation ended\",\n\tconfig: Schema.Struct({\n\t\tagentId: Schema.optionalKey(Schema.NonEmptyString.annotate({ description: \"Only report conversations of this agent; leave empty for every agent\" })),\n\t\tlookbackHours: Schema.optionalKey(Schema.Int.check(Schema.isBetween({\n\t\t\tmaximum: 72,\n\t\t\tminimum: 1\n\t\t})).annotate({ description: \"How many hours after its start a conversation is still watched, 2 by default\" }))\n\t}),\n\toutput: ConversationSummaryResponseModel,\n\tstate: Schema.Struct({ seen: Schema.Array(Schema.String) })\n})];\nconst handlers = {\n\t\"conversation-ended\": { poll: Effect.fn(\"ElevenLabs.conversationEnded.poll\")(function* (input, context) {\n\t\tconst now = yield* Clock.currentTimeMillis;\n\t\tconst ended = yield* pipe(Stream.paginate({ cursor: Option.none() }, (page) => Effect.map(agentsPlatform_getConversationHistoriesRoute.run({\n\t\t\t...Option.match(Option.fromUndefinedOr(input.config.agentId), {\n\t\t\t\tonNone: () => ({}),\n\t\t\t\tonSome: (agent_id) => ({ agent_id })\n\t\t\t}),\n\t\t\tcall_start_after_unix: Math.floor((now - Duration.toMillis(Duration.hours(input.config.lookbackHours ?? 2))) / 1e3),\n\t\t\t...Option.match(page.cursor, {\n\t\t\t\tonNone: () => ({}),\n\t\t\t\tonSome: (cursor) => ({ cursor })\n\t\t\t}),\n\t\t\texclude_statuses: [\n\t\t\t\t\"initiated\",\n\t\t\t\t\"in-progress\",\n\t\t\t\t\"processing\"\n\t\t\t],\n\t\t\tpage_size: 100,\n\t\t\tsummary_mode: \"include\"\n\t\t}, context), (found) => [found.conversations, pipe(Option.fromNullishOr(found.next_cursor), Option.filter(() => found.has_more), Option.map((cursor) => ({ cursor: Option.some(cursor) })))])), Stream.runCollect);\n\t\treturn {\n\t\t\tevents: Option.match(Option.fromUndefinedOr(input.state), {\n\t\t\t\tonNone: () => [],\n\t\t\t\tonSome: (previous) => pipe(ended, Array.filter((conversation) => !HashSet.has(HashSet.fromIterable(previous.seen), conversation.conversation_id)), Array.map((conversation) => ({\n\t\t\t\t\tkey: `conversation:${conversation.conversation_id}`,\n\t\t\t\t\tpayload: conversation\n\t\t\t\t})))\n\t\t\t}),\n\t\t\tstate: { seen: Array.dedupe(Array.map(ended, (conversation) => conversation.conversation_id)) }\n\t\t};\n\t}) },\n\tevent: {\n\t\tactivate: Effect.fn(\"ElevenLabs.event.activate\")(function* (input, context) {\n\t\t\tconst created = yield* workspace_createWorkspaceWebhookRoute.run({ payload: { settings: {\n\t\t\t\tauth_type: \"hmac\",\n\t\t\t\tname: webhookName,\n\t\t\t\twebhook_url: input.webhookUrl\n\t\t\t} } }, context);\n\t\t\tconst remove = workspace_deleteWorkspaceWebhookRoute.run({ webhook_id: created.webhook_id }, context);\n\t\t\tconst secret = created.webhook_secret;\n\t\t\tif (Predicate.isNullish(secret)) {\n\t\t\t\tyield* remove;\n\t\t\t\treturn yield* Action.ActionHandlerError.make({ message: \"ElevenLabs did not return the signing secret of the new webhook\" });\n\t\t\t}\n\t\t\tyield* pipe(workspace_editWorkspaceWebhookRoute.run({\n\t\t\t\tpayload: {\n\t\t\t\t\tevents: input.config.events,\n\t\t\t\t\tis_disabled: false,\n\t\t\t\t\tname: webhookName,\n\t\t\t\t\tretry_enabled: true\n\t\t\t\t},\n\t\t\t\twebhook_id: created.webhook_id\n\t\t\t}, context), Effect.tapError(() => remove));\n\t\t\treturn { state: {\n\t\t\t\tsecret,\n\t\t\t\twebhookId: created.webhook_id\n\t\t\t} };\n\t\t}),\n\t\tdeactivate: Effect.fn(\"ElevenLabs.event.deactivate\")(function* (input, context) {\n\t\t\tif (input.state === void 0) return;\n\t\t\tconst webhookId = input.state.webhookId;\n\t\t\tyield* pipe(workspace_deleteWorkspaceWebhookRoute.run({ webhook_id: webhookId }, context), Effect.catchTag(\"ActionHandlerError\", () => workspace_editWorkspaceWebhookRoute.run({\n\t\t\t\tpayload: {\n\t\t\t\t\tevents: [],\n\t\t\t\t\tis_disabled: true,\n\t\t\t\t\tname: webhookName\n\t\t\t\t},\n\t\t\t\twebhook_id: webhookId\n\t\t\t}, context)));\n\t\t}),\n\t\tparse: Effect.fn(\"ElevenLabs.event.parse\")(function* (input) {\n\t\t\tconst payload = yield* Schema.decodeUnknownEffect(Event)(input.request.body);\n\t\t\tconst types = input.config.types ?? [];\n\t\t\tif (!Array.isReadonlyArrayEmpty(types) && !Array.contains(types, payload.type)) return {\n\t\t\t\tevents: [],\n\t\t\t\tstate: input.state\n\t\t\t};\n\t\t\tconst digest = yield* Trigger.bodyDigest(input.request.rawBody ?? (yield* Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(input.request.body)));\n\t\t\treturn {\n\t\t\t\tevents: [{\n\t\t\t\t\tkey: `${payload.type}:${digest}`,\n\t\t\t\t\tpayload\n\t\t\t\t}],\n\t\t\t\tstate: input.state\n\t\t\t};\n\t\t}),\n\t\tverify: Effect.fn(\"ElevenLabs.event.verify\")(function* (input) {\n\t\t\tconst forged = Action.ActionHandlerError.make({\n\t\t\t\tmessage: \"Invalid ElevenLabs webhook signature\",\n\t\t\t\tstatus: 401\n\t\t\t});\n\t\t\tif (input.state === void 0) return yield* forged;\n\t\t\tconst delivery = yield* Effect.mapError(Schema.decodeUnknownEffect(SignedDelivery)({\n\t\t\t\t...input.request,\n\t\t\t\theaders: input.request.headers ?? {}\n\t\t\t}), () => forged);\n\t\t\tconst pairs = pipe(delivery.headers[\"elevenlabs-signature\"], String.split(\",\"), Array.map(String.split(\"=\")));\n\t\t\tfunction field(name) {\n\t\t\t\treturn pipe(pairs, Array.findFirst((pair) => pair[0] === name && pair.length === 2), Option.flatMap((pair) => Array.get(pair, 1)));\n\t\t\t}\n\t\t\tconst now = yield* Clock.currentTimeMillis;\n\t\t\tconst timestamp = yield* pipe(field(\"t\"), Option.filter((seconds) => Option.exists(Number.parse(seconds), (parsed) => Number.between(parsed * 1e3, {\n\t\t\t\tmaximum: now + Duration.toMillis(tolerance),\n\t\t\t\tminimum: now - Duration.toMillis(tolerance)\n\t\t\t}))), Effect.fromOption, Effect.mapError(() => forged));\n\t\t\tif (!(yield* Trigger.verifyHmac({\n\t\t\t\talgorithm: \"sha256\",\n\t\t\t\tencoding: \"hex\",\n\t\t\t\tmessage: [`${timestamp}.`, delivery.rawBody],\n\t\t\t\tsecret: input.state.secret,\n\t\t\t\tsignature: yield* Effect.mapError(Effect.fromOption(field(\"v0\")), () => forged)\n\t\t\t}))) return yield* forged;\n\t\t})\n\t}\n};\n//#endregion\nexport { handlers, triggers };\n\n//# sourceMappingURL=triggers.js.map"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,YAAY,QAAiB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,KAAK,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,QAAe,CAAC,SAAS,KAAU,MAAM,CAAC,CAAC,CAAC;AAAA;AAAA,MAElI,MAAM,MAAM,OAAO;AAAA,MACnB,MAAM,YAAY,OAAO,KAAK,MAAM,GAAG,GAAG,OAAc,CAAC,YAAY,OAAc,MAAa,OAAO,GAAG,CAAC,WAAW,QAAe,SAAS,MAAK;AAAA,QAClJ,SAAS,MAAM,SAAkB,SAAS;AAAA,QAC1C,SAAS,MAAM,SAAkB,SAAS;AAAA,MAC3C,CAAC,CAAC,CAAC,GAAG,aAAmB,SAAgB,MAAM,MAAM,CAAC;AAAA,MACtD,IAAI,EAAE,OAAO,gBAAQ,WAAW;AAAA,QAC/B,WAAW;AAAA,QACX,UAAU;AAAA,QACV,SAAS,CAAC,GAAG,cAAc,SAAS,OAAO;AAAA,QAC3C,QAAQ,MAAM,MAAM;AAAA,QACpB,WAAW,OAAO,SAAgB,YAAkB,MAAM,IAAI,CAAC,GAAG,MAAM,MAAM;AAAA,MAC/E,CAAC;AAAA,QAAI,OAAO,OAAO;AAAA,KACnB;AAAA,EACF;AACD;",
|
|
8
|
+
"debugId": "AE82479A01E741BD64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exports": {
|
|
3
|
+
"definition": { "export": "elevenlabsApiPluginBase", "subpath": "./definition" },
|
|
4
|
+
"executable": { "export": "elevenlabsApiPlugin", "subpath": "./executable" }
|
|
5
|
+
},
|
|
6
|
+
"identity": { "package": "@dual-os/elevenlabs-api", "plugin": "elevenlabs-api" },
|
|
7
|
+
"openapi": {
|
|
8
|
+
"metadata": { "description": "ElevenLabs integration for the Dual SDK", "name": "ElevenLabs" },
|
|
9
|
+
"provider": {
|
|
10
|
+
"metadata": {
|
|
11
|
+
"categories": ["telephony", "communication"],
|
|
12
|
+
"description": "ElevenLabs text to speech, speech to text, voice changer, dialogue, sound effects, music, dubbing, voices and voice cloning, Studio projects, pronunciation dictionaries, history and Agents Platform agents, conversations, knowledge bases, tools, phone numbers and batch calls",
|
|
13
|
+
"docsUrl": "https://elevenlabs.io/docs/api-reference",
|
|
14
|
+
"homepageUrl": "https://elevenlabs.io",
|
|
15
|
+
"iconUrl": "https://elevenlabs.io/favicon.ico"
|
|
16
|
+
},
|
|
17
|
+
"name": "ElevenLabs",
|
|
18
|
+
"specs": [
|
|
19
|
+
{
|
|
20
|
+
"exclude": [
|
|
21
|
+
"/docs",
|
|
22
|
+
"/v1/single-use-token/{*}",
|
|
23
|
+
"/v1/service-accounts/{*}/api-keys/**",
|
|
24
|
+
"/v1/workspaces/api-keys/**",
|
|
25
|
+
"/v1/workspace/auth-connections/**",
|
|
26
|
+
"/v1/convai/conversation/get-signed-url",
|
|
27
|
+
"/v1/convai/conversation/token",
|
|
28
|
+
"/v1/convai/realtime/client_secrets",
|
|
29
|
+
"/v1/convai/twilio/register-call",
|
|
30
|
+
"POST /v1/audio-isolation/stream",
|
|
31
|
+
"POST /v1/text-to-speech/{*}/stream/**",
|
|
32
|
+
"POST /v1/text-to-dialogue/stream/**",
|
|
33
|
+
"POST /v1/voice-changer/{*}/stream",
|
|
34
|
+
"POST /v1/music/stream",
|
|
35
|
+
"POST /v1/music/detailed/stream"
|
|
36
|
+
],
|
|
37
|
+
"kind": "document",
|
|
38
|
+
"overlay": "openapi.overlay.yaml",
|
|
39
|
+
"source": "openapi.json",
|
|
40
|
+
"sourceUrl": "https://api.elevenlabs.io/openapi.json"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"target": "internal"
|
|
45
|
+
},
|
|
46
|
+
"schemaVersion": 1
|
|
47
|
+
}
|