@mentingo/luma-sdk 0.0.0-stage → 0.4.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/dist/index.cjs ADDED
@@ -0,0 +1,1751 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AI_MENTOR_CONFIGURATION_TYPES: () => AI_MENTOR_CONFIGURATION_TYPES,
34
+ AUDIO_PROVIDER_STATES: () => AUDIO_PROVIDER_STATES,
35
+ AUDIO_RECOVERY_STATES: () => AUDIO_RECOVERY_STATES,
36
+ AiCapability: () => AiCapability,
37
+ AiCapabilityMode: () => AiCapabilityMode,
38
+ AiCapabilityProvider: () => AiCapabilityProvider,
39
+ AiModelDomain: () => AiModelDomain,
40
+ AiModelProfileKind: () => AiModelProfileKind,
41
+ AuthoringSubscriptionError: () => AuthoringSubscriptionError,
42
+ EXTERNAL_AUDIO_CLIENT_RECONNECT_GRACE_MS: () => EXTERNAL_AUDIO_CLIENT_RECONNECT_GRACE_MS,
43
+ EXTERNAL_AUDIO_MAX_BUFFERED_CHUNKS: () => EXTERNAL_AUDIO_MAX_BUFFERED_CHUNKS,
44
+ EXTERNAL_AUDIO_MAX_RECOVERY_ATTEMPTS: () => EXTERNAL_AUDIO_MAX_RECOVERY_ATTEMPTS,
45
+ EXTERNAL_AUDIO_OPERATION: () => EXTERNAL_AUDIO_OPERATION,
46
+ EXTERNAL_AUDIO_RECOVERY_STATE: () => EXTERNAL_AUDIO_RECOVERY_STATE,
47
+ EXTERNAL_AUDIO_RECOVERY_TIMEOUT_MS: () => EXTERNAL_AUDIO_RECOVERY_TIMEOUT_MS,
48
+ EXTERNAL_AUDIO_TERMINAL_RECOVERY_ERROR_CODES: () => EXTERNAL_AUDIO_TERMINAL_RECOVERY_ERROR_CODES,
49
+ LEARNER_TRANSCRIPT_STATUSES: () => LEARNER_TRANSCRIPT_STATUSES,
50
+ LUMA_AI_CAPABILITIES: () => LUMA_AI_CAPABILITIES,
51
+ LUMA_AI_CAPABILITY_MODES: () => LUMA_AI_CAPABILITY_MODES,
52
+ LUMA_AI_CAPABILITY_PROVIDERS: () => LUMA_AI_CAPABILITY_PROVIDERS,
53
+ LUMA_AI_MODEL_DOMAINS: () => LUMA_AI_MODEL_DOMAINS,
54
+ LUMA_AI_MODEL_PROFILE_KINDS: () => LUMA_AI_MODEL_PROFILE_KINDS,
55
+ LUMA_AUDIO_ACTIONS: () => LUMA_AUDIO_ACTIONS,
56
+ LUMA_AUDIO_FORMATS: () => LUMA_AUDIO_FORMATS,
57
+ LUMA_CAPTURE_PROFILES: () => LUMA_CAPTURE_PROFILES,
58
+ LUMA_MENTOR_STREAM_EVENT_TYPES: () => LUMA_MENTOR_STREAM_EVENT_TYPES,
59
+ LUMA_SOCKET_EMIT_EVENTS: () => LUMA_SOCKET_EMIT_EVENTS,
60
+ LUMA_SOCKET_LISTEN_EVENTS: () => LUMA_SOCKET_LISTEN_EVENTS,
61
+ LUMA_SOCKET_MESSAGE_TYPES: () => LUMA_SOCKET_MESSAGE_TYPES,
62
+ LUMA_VOICE_TIMING_PRECISION: () => LUMA_VOICE_TIMING_PRECISION,
63
+ LumaAdminApiKeysClient: () => LumaAdminApiKeysClient,
64
+ LumaAdminClient: () => LumaAdminClient,
65
+ LumaAdminModelProfilesClient: () => LumaAdminModelProfilesClient,
66
+ LumaAiClient: () => LumaAiClient,
67
+ LumaAuthoringClient: () => LumaAuthoringClient,
68
+ LumaClient: () => LumaClient,
69
+ LumaConfigurationClient: () => LumaConfigurationClient,
70
+ LumaMentorClient: () => LumaMentorClient,
71
+ ReasoningEffort: () => ReasoningEffort,
72
+ TRANSCRIPTION_MODES: () => TRANSCRIPTION_MODES,
73
+ TTSProvider: () => TTSProvider,
74
+ TaskKind: () => TaskKind,
75
+ TextToSpeechProvider: () => TextToSpeechProvider,
76
+ TurnPartKind: () => TurnPartKind,
77
+ TurnPartStatus: () => TurnPartStatus,
78
+ TurnStatus: () => TurnStatus,
79
+ consumeAuthoringEventStream: () => consumeAuthoringEventStream,
80
+ createLumaClient: () => createLumaClient,
81
+ createLumaSocket: () => createLumaSocket
82
+ });
83
+ module.exports = __toCommonJS(index_exports);
84
+
85
+ // src/api/generated-api.ts
86
+ var import_axios = __toESM(require("axios"), 1);
87
+ var TurnStatus = /* @__PURE__ */ ((TurnStatus2) => {
88
+ TurnStatus2["Queued"] = "queued";
89
+ TurnStatus2["Running"] = "running";
90
+ TurnStatus2["WaitingAuthor"] = "waiting_author";
91
+ TurnStatus2["Completed"] = "completed";
92
+ TurnStatus2["Failed"] = "failed";
93
+ TurnStatus2["Stopped"] = "stopped";
94
+ return TurnStatus2;
95
+ })(TurnStatus || {});
96
+ var TurnPartStatus = /* @__PURE__ */ ((TurnPartStatus2) => {
97
+ TurnPartStatus2["Streaming"] = "streaming";
98
+ TurnPartStatus2["Completed"] = "completed";
99
+ TurnPartStatus2["Failed"] = "failed";
100
+ TurnPartStatus2["Stopped"] = "stopped";
101
+ TurnPartStatus2["Review"] = "review";
102
+ return TurnPartStatus2;
103
+ })(TurnPartStatus || {});
104
+ var TurnPartKind = /* @__PURE__ */ ((TurnPartKind2) => {
105
+ TurnPartKind2["Text"] = "text";
106
+ TurnPartKind2["Tool"] = "tool";
107
+ TurnPartKind2["Proposal"] = "proposal";
108
+ TurnPartKind2["Question"] = "question";
109
+ return TurnPartKind2;
110
+ })(TurnPartKind || {});
111
+ var TextToSpeechProvider = /* @__PURE__ */ ((TextToSpeechProvider2) => {
112
+ TextToSpeechProvider2["Cartesia"] = "cartesia";
113
+ TextToSpeechProvider2["Elevenlabs"] = "elevenlabs";
114
+ return TextToSpeechProvider2;
115
+ })(TextToSpeechProvider || {});
116
+ var TaskKind = /* @__PURE__ */ ((TaskKind3) => {
117
+ TaskKind3["Plan"] = "plan";
118
+ TaskKind3["Route"] = "route";
119
+ TaskKind3["Research"] = "research";
120
+ TaskKind3["DetailedPlan"] = "detailed_plan";
121
+ TaskKind3["Lesson"] = "lesson";
122
+ TaskKind3["Edit"] = "edit";
123
+ TaskKind3["Source"] = "source";
124
+ TaskKind3["Asset"] = "asset";
125
+ TaskKind3["CourseReview"] = "course_review";
126
+ return TaskKind3;
127
+ })(TaskKind || {});
128
+ var TTSProvider = /* @__PURE__ */ ((TTSProvider2) => {
129
+ TTSProvider2["Cartesia"] = "cartesia";
130
+ TTSProvider2["Elevenlabs"] = "elevenlabs";
131
+ TTSProvider2["Fish"] = "fish";
132
+ return TTSProvider2;
133
+ })(TTSProvider || {});
134
+ var ReasoningEffort = /* @__PURE__ */ ((ReasoningEffort3) => {
135
+ ReasoningEffort3["Low"] = "low";
136
+ ReasoningEffort3["Medium"] = "medium";
137
+ ReasoningEffort3["High"] = "high";
138
+ return ReasoningEffort3;
139
+ })(ReasoningEffort || {});
140
+ var AiModelProfileKind = /* @__PURE__ */ ((AiModelProfileKind2) => {
141
+ AiModelProfileKind2["Chat"] = "chat";
142
+ AiModelProfileKind2["Image"] = "image";
143
+ AiModelProfileKind2["Embedding"] = "embedding";
144
+ AiModelProfileKind2["SpeechToText"] = "speechToText";
145
+ AiModelProfileKind2["TextToSpeech"] = "textToSpeech";
146
+ return AiModelProfileKind2;
147
+ })(AiModelProfileKind || {});
148
+ var AiModelDomain = /* @__PURE__ */ ((AiModelDomain2) => {
149
+ AiModelDomain2["AiMentor"] = "aiMentor";
150
+ AiModelDomain2["AiMentorJudge"] = "aiMentorJudge";
151
+ AiModelDomain2["AiMentorConfigurationGenerator"] = "aiMentorConfigurationGenerator";
152
+ AiModelDomain2["AiJudgeConfigurationGenerator"] = "aiJudgeConfigurationGenerator";
153
+ AiModelDomain2["AiJudgeConfigurationValidator"] = "aiJudgeConfigurationValidator";
154
+ AiModelDomain2["Translations"] = "translations";
155
+ AiModelDomain2["CourseGeneration"] = "courseGeneration";
156
+ AiModelDomain2["CourseGenerationVisualAssets"] = "courseGenerationVisualAssets";
157
+ AiModelDomain2["CourseGenerationEmbeddings"] = "courseGenerationEmbeddings";
158
+ AiModelDomain2["Embeddings"] = "embeddings";
159
+ AiModelDomain2["DictationTranscription"] = "dictationTranscription";
160
+ AiModelDomain2["VoiceTranscription"] = "voiceTranscription";
161
+ AiModelDomain2["VoiceTts"] = "voiceTts";
162
+ return AiModelDomain2;
163
+ })(AiModelDomain || {});
164
+ var AiCapabilityProvider = /* @__PURE__ */ ((AiCapabilityProvider2) => {
165
+ AiCapabilityProvider2["Luma"] = "luma";
166
+ AiCapabilityProvider2["MentingoCore"] = "mentingo-core";
167
+ return AiCapabilityProvider2;
168
+ })(AiCapabilityProvider || {});
169
+ var AiCapabilityMode = /* @__PURE__ */ ((AiCapabilityMode2) => {
170
+ AiCapabilityMode2["Core"] = "core";
171
+ AiCapabilityMode2["Custom"] = "custom";
172
+ AiCapabilityMode2["Disabled"] = "disabled";
173
+ return AiCapabilityMode2;
174
+ })(AiCapabilityMode || {});
175
+ var AiCapability = /* @__PURE__ */ ((AiCapability2) => {
176
+ AiCapability2["CourseGeneration"] = "courseGeneration";
177
+ AiCapability2["CourseGenerationVisualAssets"] = "courseGenerationVisualAssets";
178
+ AiCapability2["CourseGenerationEmbeddings"] = "courseGenerationEmbeddings";
179
+ AiCapability2["AiMentorChat"] = "aiMentorChat";
180
+ AiCapability2["AiMentorJudge"] = "aiMentorJudge";
181
+ AiCapability2["AiMentorConfigurationGenerator"] = "aiMentorConfigurationGenerator";
182
+ AiCapability2["AiJudgeConfigurationGenerator"] = "aiJudgeConfigurationGenerator";
183
+ AiCapability2["AiJudgeConfigurationValidator"] = "aiJudgeConfigurationValidator";
184
+ AiCapability2["AiMentorRagEmbeddings"] = "aiMentorRagEmbeddings";
185
+ AiCapability2["TranslationGeneration"] = "translationGeneration";
186
+ AiCapability2["DictationTranscription"] = "dictationTranscription";
187
+ AiCapability2["VoiceTranscription"] = "voiceTranscription";
188
+ AiCapability2["VoiceMentor"] = "voiceMentor";
189
+ AiCapability2["VoiceTextToSpeech"] = "voiceTextToSpeech";
190
+ return AiCapability2;
191
+ })(AiCapability || {});
192
+ var HttpClient = class {
193
+ constructor({
194
+ securityWorker,
195
+ secure,
196
+ format,
197
+ ...axiosConfig
198
+ } = {}) {
199
+ this.securityData = null;
200
+ this.setSecurityData = (data) => {
201
+ this.securityData = data;
202
+ };
203
+ this.request = async ({
204
+ secure,
205
+ path,
206
+ type,
207
+ query,
208
+ format,
209
+ body,
210
+ ...params
211
+ }) => {
212
+ const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
213
+ const requestParams = this.mergeRequestParams(params, secureParams);
214
+ const responseFormat = format || this.format || void 0;
215
+ if (type === "multipart/form-data" /* FormData */ && body && body !== null && typeof body === "object") {
216
+ body = this.createFormData(body);
217
+ }
218
+ if (type === "text/plain" /* Text */ && body && body !== null && typeof body !== "string") {
219
+ body = JSON.stringify(body);
220
+ }
221
+ return this.instance.request({
222
+ ...requestParams,
223
+ headers: {
224
+ ...requestParams.headers || {},
225
+ ...type ? { "Content-Type": type } : {}
226
+ },
227
+ params: query,
228
+ responseType: responseFormat,
229
+ data: body,
230
+ url: path
231
+ });
232
+ };
233
+ this.instance = import_axios.default.create({
234
+ ...axiosConfig,
235
+ baseURL: axiosConfig.baseURL || ""
236
+ });
237
+ this.secure = secure;
238
+ this.format = format;
239
+ this.securityWorker = securityWorker;
240
+ }
241
+ mergeRequestParams(params1, params2) {
242
+ const method = params1.method || params2 && params2.method;
243
+ return {
244
+ ...this.instance.defaults,
245
+ ...params1,
246
+ ...params2 || {},
247
+ headers: {
248
+ ...method && this.instance.defaults.headers[method.toLowerCase()] || {},
249
+ ...params1.headers || {},
250
+ ...params2 && params2.headers || {}
251
+ }
252
+ };
253
+ }
254
+ stringifyFormItem(formItem) {
255
+ if (typeof formItem === "object" && formItem !== null) {
256
+ return JSON.stringify(formItem);
257
+ } else {
258
+ return `${formItem}`;
259
+ }
260
+ }
261
+ createFormData(input) {
262
+ if (input instanceof FormData) {
263
+ return input;
264
+ }
265
+ return Object.keys(input || {}).reduce((formData, key) => {
266
+ const property = input[key];
267
+ const propertyContent = property instanceof Array ? property : [property];
268
+ for (const formItem of propertyContent) {
269
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
270
+ formData.append(
271
+ key,
272
+ isFileType ? formItem : this.stringifyFormItem(formItem)
273
+ );
274
+ }
275
+ return formData;
276
+ }, new FormData());
277
+ }
278
+ };
279
+ var API = class extends HttpClient {
280
+ constructor() {
281
+ super(...arguments);
282
+ this.api = {
283
+ /**
284
+ * @description Returns whether required API-key-scoped provider secrets are configured for course generation and voice mentor. Authorization header required: `X-API-Key: <luma_api_key>`.
285
+ *
286
+ * @tags Public - Require API Key
287
+ * @name GetConfigurationStatusApiPublicV1AiConfigurationGet
288
+ * @summary Get Public API Configuration Status
289
+ * @request GET:/api/public/v1/ai/configuration
290
+ * @secure
291
+ */
292
+ getConfigurationStatusApiPublicV1AiConfigurationGet: (params = {}) => this.request({
293
+ path: `/api/public/v1/ai/configuration`,
294
+ method: "GET",
295
+ secure: true,
296
+ format: "json",
297
+ ...params
298
+ }),
299
+ /**
300
+ * No description
301
+ *
302
+ * @tags Public - Require API Key
303
+ * @name MentorChatApiPublicV1AiMentorChatPost
304
+ * @summary Stream Mentor Chat With Custom Runtime
305
+ * @request POST:/api/public/v1/ai/mentor/chat
306
+ * @secure
307
+ */
308
+ mentorChatApiPublicV1AiMentorChatPost: (data, params = {}) => this.request({
309
+ path: `/api/public/v1/ai/mentor/chat`,
310
+ method: "POST",
311
+ body: data,
312
+ secure: true,
313
+ type: "application/json" /* Json */,
314
+ ...params
315
+ }),
316
+ /**
317
+ * No description
318
+ *
319
+ * @tags Public - Require API Key
320
+ * @name GenerateMentorChatApiPublicV1AiMentorChatGeneratePost
321
+ * @summary Generate Mentor Chat Message With Custom Runtime
322
+ * @request POST:/api/public/v1/ai/mentor/chat/generate
323
+ * @secure
324
+ */
325
+ generateMentorChatApiPublicV1AiMentorChatGeneratePost: (data, params = {}) => this.request({
326
+ path: `/api/public/v1/ai/mentor/chat/generate`,
327
+ method: "POST",
328
+ body: data,
329
+ secure: true,
330
+ type: "application/json" /* Json */,
331
+ format: "json",
332
+ ...params
333
+ }),
334
+ /**
335
+ * No description
336
+ *
337
+ * @tags Public - Require API Key
338
+ * @name MentorJudgeApiPublicV1AiMentorJudgePost
339
+ * @summary Run AI Mentor Judge With Custom Runtime
340
+ * @request POST:/api/public/v1/ai/mentor/judge
341
+ * @secure
342
+ */
343
+ mentorJudgeApiPublicV1AiMentorJudgePost: (data, params = {}) => this.request({
344
+ path: `/api/public/v1/ai/mentor/judge`,
345
+ method: "POST",
346
+ body: data,
347
+ secure: true,
348
+ type: "application/json" /* Json */,
349
+ format: "json",
350
+ ...params
351
+ }),
352
+ /**
353
+ * No description
354
+ *
355
+ * @tags Public - Require API Key
356
+ * @name GenerateMentorConfigurationApiPublicV1AiMentorConfigurationGeneratePost
357
+ * @summary Generate AI Mentor Configuration With Custom Runtime
358
+ * @request POST:/api/public/v1/ai/mentor-configuration/generate
359
+ * @secure
360
+ */
361
+ generateMentorConfigurationApiPublicV1AiMentorConfigurationGeneratePost: (data, params = {}) => this.request({
362
+ path: `/api/public/v1/ai/mentor-configuration/generate`,
363
+ method: "POST",
364
+ body: data,
365
+ secure: true,
366
+ type: "application/json" /* Json */,
367
+ format: "json",
368
+ ...params
369
+ }),
370
+ /**
371
+ * No description
372
+ *
373
+ * @tags Public - Require API Key
374
+ * @name ValidateMentorConfigurationApiPublicV1AiMentorConfigurationValidatePost
375
+ * @summary Validate AI Mentor Configuration With Custom Runtime
376
+ * @request POST:/api/public/v1/ai/mentor-configuration/validate
377
+ * @secure
378
+ */
379
+ validateMentorConfigurationApiPublicV1AiMentorConfigurationValidatePost: (data, params = {}) => this.request({
380
+ path: `/api/public/v1/ai/mentor-configuration/validate`,
381
+ method: "POST",
382
+ body: data,
383
+ secure: true,
384
+ type: "application/json" /* Json */,
385
+ format: "json",
386
+ ...params
387
+ }),
388
+ /**
389
+ * No description
390
+ *
391
+ * @tags Public - Require API Key
392
+ * @name GenerateJudgeConfigurationApiPublicV1AiJudgeConfigurationGeneratePost
393
+ * @summary Generate AI Judge Configuration With Custom Runtime
394
+ * @request POST:/api/public/v1/ai/judge-configuration/generate
395
+ * @secure
396
+ */
397
+ generateJudgeConfigurationApiPublicV1AiJudgeConfigurationGeneratePost: (data, params = {}) => this.request({
398
+ path: `/api/public/v1/ai/judge-configuration/generate`,
399
+ method: "POST",
400
+ body: data,
401
+ secure: true,
402
+ type: "application/json" /* Json */,
403
+ format: "json",
404
+ ...params
405
+ }),
406
+ /**
407
+ * No description
408
+ *
409
+ * @tags Public - Require API Key
410
+ * @name ValidateJudgeConfigurationApiPublicV1AiJudgeConfigurationValidatePost
411
+ * @summary Validate AI Judge Configuration With Custom Runtime
412
+ * @request POST:/api/public/v1/ai/judge-configuration/validate
413
+ * @secure
414
+ */
415
+ validateJudgeConfigurationApiPublicV1AiJudgeConfigurationValidatePost: (data, params = {}) => this.request({
416
+ path: `/api/public/v1/ai/judge-configuration/validate`,
417
+ method: "POST",
418
+ body: data,
419
+ secure: true,
420
+ type: "application/json" /* Json */,
421
+ format: "json",
422
+ ...params
423
+ }),
424
+ /**
425
+ * No description
426
+ *
427
+ * @tags Public - Require API Key
428
+ * @name GenerateTranslationsApiPublicV1AiTranslationsGeneratePost
429
+ * @summary Generate Translations With Custom Runtime
430
+ * @request POST:/api/public/v1/ai/translations/generate
431
+ * @secure
432
+ */
433
+ generateTranslationsApiPublicV1AiTranslationsGeneratePost: (data, params = {}) => this.request({
434
+ path: `/api/public/v1/ai/translations/generate`,
435
+ method: "POST",
436
+ body: data,
437
+ secure: true,
438
+ type: "application/json" /* Json */,
439
+ format: "json",
440
+ ...params
441
+ }),
442
+ /**
443
+ * No description
444
+ *
445
+ * @tags Public - Require API Key
446
+ * @name CreateEmbeddingsApiPublicV1AiEmbeddingsPost
447
+ * @summary Create Embeddings With Custom Runtime
448
+ * @request POST:/api/public/v1/ai/embeddings
449
+ * @secure
450
+ */
451
+ createEmbeddingsApiPublicV1AiEmbeddingsPost: (data, params = {}) => this.request({
452
+ path: `/api/public/v1/ai/embeddings`,
453
+ method: "POST",
454
+ body: data,
455
+ secure: true,
456
+ type: "application/json" /* Json */,
457
+ format: "json",
458
+ ...params
459
+ }),
460
+ /**
461
+ * No description
462
+ *
463
+ * @tags Public - Require API Key
464
+ * @name TranscribeDictationApiPublicV1AiTranscriptionsPost
465
+ * @summary Transcribe Dictation Audio With Custom Runtime
466
+ * @request POST:/api/public/v1/ai/transcriptions
467
+ * @secure
468
+ */
469
+ transcribeDictationApiPublicV1AiTranscriptionsPost: (data, params = {}) => this.request({
470
+ path: `/api/public/v1/ai/transcriptions`,
471
+ method: "POST",
472
+ body: data,
473
+ secure: true,
474
+ type: "multipart/form-data" /* FormData */,
475
+ format: "json",
476
+ ...params
477
+ }),
478
+ /**
479
+ * @description Open or restore the organization-scoped course authoring session.
480
+ *
481
+ * @tags Public - Require API Key
482
+ * @name CreateSessionApiPublicV1AuthoringSessionsPost
483
+ * @summary Create Session
484
+ * @request POST:/api/public/v1/authoring/sessions
485
+ * @secure
486
+ */
487
+ createSessionApiPublicV1AuthoringSessionsPost: (data, params = {}) => this.request({
488
+ path: `/api/public/v1/authoring/sessions`,
489
+ method: "POST",
490
+ body: data,
491
+ secure: true,
492
+ type: "application/json" /* Json */,
493
+ format: "json",
494
+ ...params
495
+ }),
496
+ /**
497
+ * @description List one server-filtered, offset-paginated page of durable course conversations in stable latest-activity order.
498
+ *
499
+ * @tags Public - Require API Key
500
+ * @name ListSessionsApiPublicV1AuthoringSessionsGet
501
+ * @summary List Sessions
502
+ * @request GET:/api/public/v1/authoring/sessions
503
+ * @secure
504
+ */
505
+ listSessionsApiPublicV1AuthoringSessionsGet: (query, params = {}) => this.request({
506
+ path: `/api/public/v1/authoring/sessions`,
507
+ method: "GET",
508
+ query,
509
+ secure: true,
510
+ format: "json",
511
+ ...params
512
+ }),
513
+ /**
514
+ * @description Return the authorized durable workspace snapshot, including task state.
515
+ *
516
+ * @tags Public - Require API Key
517
+ * @name GetSessionApiPublicV1AuthoringSessionsSessionIdGet
518
+ * @summary Get Session
519
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}
520
+ * @secure
521
+ */
522
+ getSessionApiPublicV1AuthoringSessionsSessionIdGet: (sessionId, params = {}) => this.request({
523
+ path: `/api/public/v1/authoring/sessions/${sessionId}`,
524
+ method: "GET",
525
+ secure: true,
526
+ format: "json",
527
+ ...params
528
+ }),
529
+ /**
530
+ * @description Page older saved turns and their review artifacts by a stable request cursor.
531
+ *
532
+ * @tags Public - Require API Key
533
+ * @name GetOlderTurnsApiPublicV1AuthoringSessionsSessionIdTurnsGet
534
+ * @summary Get Older Turns
535
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}/turns
536
+ * @secure
537
+ */
538
+ getOlderTurnsApiPublicV1AuthoringSessionsSessionIdTurnsGet: (sessionId, query, params = {}) => this.request({
539
+ path: `/api/public/v1/authoring/sessions/${sessionId}/turns`,
540
+ method: "GET",
541
+ query,
542
+ secure: true,
543
+ format: "json",
544
+ ...params
545
+ }),
546
+ /**
547
+ * @description Read an ordered page after the supplied durable cursor for client replay.
548
+ *
549
+ * @tags Public - Require API Key
550
+ * @name GetEventsApiPublicV1AuthoringSessionsSessionIdEventsGet
551
+ * @summary Get Events
552
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}/events
553
+ * @secure
554
+ */
555
+ getEventsApiPublicV1AuthoringSessionsSessionIdEventsGet: (sessionId, query, params = {}) => this.request({
556
+ path: `/api/public/v1/authoring/sessions/${sessionId}/events`,
557
+ method: "GET",
558
+ query,
559
+ secure: true,
560
+ format: "json",
561
+ ...params
562
+ }),
563
+ /**
564
+ * @description Accept an idempotent authoring command and return its durable acknowledgement.
565
+ *
566
+ * @tags Public - Require API Key
567
+ * @name CommandApiPublicV1AuthoringSessionsSessionIdCommandsPost
568
+ * @summary Command
569
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/commands
570
+ * @secure
571
+ */
572
+ commandApiPublicV1AuthoringSessionsSessionIdCommandsPost: (sessionId, data, params = {}) => this.request({
573
+ path: `/api/public/v1/authoring/sessions/${sessionId}/commands`,
574
+ method: "POST",
575
+ body: data,
576
+ secure: true,
577
+ type: "application/json" /* Json */,
578
+ format: "json",
579
+ ...params
580
+ }),
581
+ /**
582
+ * @description Accept one organization-scoped selected-detail callback and resume its fenced task.
583
+ *
584
+ * @tags Public - Require API Key
585
+ * @name FulfillContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFulfillmentPost
586
+ * @summary Fulfill Context
587
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/context-requests/{context_request_id}/fulfillment
588
+ * @secure
589
+ */
590
+ fulfillContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFulfillmentPost: (sessionId, contextRequestId, data, params = {}) => this.request({
591
+ path: `/api/public/v1/authoring/sessions/${sessionId}/context-requests/${contextRequestId}/fulfillment`,
592
+ method: "POST",
593
+ body: data,
594
+ secure: true,
595
+ type: "application/json" /* Json */,
596
+ format: "json",
597
+ ...params
598
+ }),
599
+ /**
600
+ * @description Record one bounded Core-side context failure and terminate only its waiting task.
601
+ *
602
+ * @tags Public - Require API Key
603
+ * @name FailContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFailurePost
604
+ * @summary Fail Context
605
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/context-requests/{context_request_id}/failure
606
+ * @secure
607
+ */
608
+ failContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFailurePost: (sessionId, contextRequestId, data, params = {}) => this.request({
609
+ path: `/api/public/v1/authoring/sessions/${sessionId}/context-requests/${contextRequestId}/failure`,
610
+ method: "POST",
611
+ body: data,
612
+ secure: true,
613
+ type: "application/json" /* Json */,
614
+ format: "json",
615
+ ...params
616
+ }),
617
+ /**
618
+ * @description Freeze a validated selection of reviewed proposals for Core application. This does not write course content to Core.
619
+ *
620
+ * @tags Public - Require API Key
621
+ * @name PrepareExportApiPublicV1AuthoringSessionsSessionIdExportsPost
622
+ * @summary Prepare Export
623
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/exports
624
+ * @secure
625
+ */
626
+ prepareExportApiPublicV1AuthoringSessionsSessionIdExportsPost: (sessionId, data, params = {}) => this.request({
627
+ path: `/api/public/v1/authoring/sessions/${sessionId}/exports`,
628
+ method: "POST",
629
+ body: data,
630
+ secure: true,
631
+ type: "application/json" /* Json */,
632
+ format: "json",
633
+ ...params
634
+ }),
635
+ /**
636
+ * @description Read the immutable application bundle previously frozen for this session.
637
+ *
638
+ * @tags Public - Require API Key
639
+ * @name GetExportApiPublicV1AuthoringSessionsSessionIdExportsExportIdGet
640
+ * @summary Get Export
641
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}/exports/{export_id}
642
+ * @secure
643
+ */
644
+ getExportApiPublicV1AuthoringSessionsSessionIdExportsExportIdGet: (sessionId, exportId, params = {}) => this.request({
645
+ path: `/api/public/v1/authoring/sessions/${sessionId}/exports/${exportId}`,
646
+ method: "GET",
647
+ secure: true,
648
+ format: "json",
649
+ ...params
650
+ }),
651
+ /**
652
+ * @description Record Core application feedback against the corresponding frozen export.
653
+ *
654
+ * @tags Public - Require API Key
655
+ * @name ReceiptApiPublicV1AuthoringSessionsSessionIdReceiptsPost
656
+ * @summary Receipt
657
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/receipts
658
+ * @secure
659
+ */
660
+ receiptApiPublicV1AuthoringSessionsSessionIdReceiptsPost: (sessionId, data, params = {}) => this.request({
661
+ path: `/api/public/v1/authoring/sessions/${sessionId}/receipts`,
662
+ method: "POST",
663
+ body: data,
664
+ secure: true,
665
+ type: "application/json" /* Json */,
666
+ format: "json",
667
+ ...params
668
+ }),
669
+ /**
670
+ * @description Stream durable events after authorization, using Redis only as a wake-up hint. The generator rechecks integration access and reads SQL to recover missed notifications. Closing this response does not cancel authoring tasks.
671
+ *
672
+ * @tags Public - Require API Key
673
+ * @name SubscribeEventsApiPublicV1AuthoringSessionsSessionIdEventsStreamGet
674
+ * @summary Subscribe Events
675
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}/events/stream
676
+ * @secure
677
+ */
678
+ subscribeEventsApiPublicV1AuthoringSessionsSessionIdEventsStreamGet: (sessionId, query, params = {}) => this.request({
679
+ path: `/api/public/v1/authoring/sessions/${sessionId}/events/stream`,
680
+ method: "GET",
681
+ query,
682
+ secure: true,
683
+ ...params
684
+ }),
685
+ /**
686
+ * @description Store an authorized upload and enqueue source processing under its command identity.
687
+ *
688
+ * @tags Public - Require API Key
689
+ * @name UploadSourceApiPublicV1AuthoringSessionsSessionIdSourcesPost
690
+ * @summary Upload Source
691
+ * @request POST:/api/public/v1/authoring/sessions/{session_id}/sources
692
+ * @secure
693
+ */
694
+ uploadSourceApiPublicV1AuthoringSessionsSessionIdSourcesPost: (sessionId, data, params = {}) => this.request({
695
+ path: `/api/public/v1/authoring/sessions/${sessionId}/sources`,
696
+ method: "POST",
697
+ body: data,
698
+ secure: true,
699
+ type: "multipart/form-data" /* FormData */,
700
+ format: "json",
701
+ ...params
702
+ }),
703
+ /**
704
+ * @description Return an authorized asset revision with private, non-cacheable response headers.
705
+ *
706
+ * @tags Public - Require API Key
707
+ * @name DownloadAssetApiPublicV1AuthoringSessionsSessionIdAssetsAssetIdGet
708
+ * @summary Download Asset
709
+ * @request GET:/api/public/v1/authoring/sessions/{session_id}/assets/{asset_id}
710
+ * @secure
711
+ */
712
+ downloadAssetApiPublicV1AuthoringSessionsSessionIdAssetsAssetIdGet: (sessionId, assetId, query, params = {}) => this.request({
713
+ path: `/api/public/v1/authoring/sessions/${sessionId}/assets/${assetId}`,
714
+ method: "GET",
715
+ query,
716
+ secure: true,
717
+ ...params
718
+ }),
719
+ /**
720
+ * No description
721
+ *
722
+ * @tags Public - Require Admin API Key
723
+ * @name ListOrganizationApiKeysApiPublicV1AdminOrganizationsOrganizationIdApiKeysGet
724
+ * @summary List Organization Api Keys
725
+ * @request GET:/api/public/v1/admin/organizations/{organization_id}/api-keys
726
+ * @secure
727
+ */
728
+ listOrganizationApiKeysApiPublicV1AdminOrganizationsOrganizationIdApiKeysGet: (organizationId, params = {}) => this.request({
729
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys`,
730
+ method: "GET",
731
+ secure: true,
732
+ format: "json",
733
+ ...params
734
+ }),
735
+ /**
736
+ * No description
737
+ *
738
+ * @tags Public - Require Admin API Key
739
+ * @name CreateOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysPost
740
+ * @summary Create Organization Api Key
741
+ * @request POST:/api/public/v1/admin/organizations/{organization_id}/api-keys
742
+ * @secure
743
+ */
744
+ createOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysPost: (organizationId, data, params = {}) => this.request({
745
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys`,
746
+ method: "POST",
747
+ body: data,
748
+ secure: true,
749
+ type: "application/json" /* Json */,
750
+ format: "json",
751
+ ...params
752
+ }),
753
+ /**
754
+ * No description
755
+ *
756
+ * @tags Public - Require Admin API Key
757
+ * @name GetOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdGet
758
+ * @summary Get Organization Api Key
759
+ * @request GET:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}
760
+ * @secure
761
+ */
762
+ getOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdGet: (organizationId, apiKeyId, params = {}) => this.request({
763
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}`,
764
+ method: "GET",
765
+ secure: true,
766
+ format: "json",
767
+ ...params
768
+ }),
769
+ /**
770
+ * No description
771
+ *
772
+ * @tags Public - Require Admin API Key
773
+ * @name UpdateOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdPatch
774
+ * @summary Update Organization Api Key
775
+ * @request PATCH:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}
776
+ * @secure
777
+ */
778
+ updateOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdPatch: (organizationId, apiKeyId, data, params = {}) => this.request({
779
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}`,
780
+ method: "PATCH",
781
+ body: data,
782
+ secure: true,
783
+ type: "application/json" /* Json */,
784
+ format: "json",
785
+ ...params
786
+ }),
787
+ /**
788
+ * No description
789
+ *
790
+ * @tags Public - Require Admin API Key
791
+ * @name RevokeOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdDelete
792
+ * @summary Revoke Organization Api Key
793
+ * @request DELETE:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}
794
+ * @secure
795
+ */
796
+ revokeOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdDelete: (organizationId, apiKeyId, params = {}) => this.request({
797
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}`,
798
+ method: "DELETE",
799
+ secure: true,
800
+ format: "json",
801
+ ...params
802
+ }),
803
+ /**
804
+ * No description
805
+ *
806
+ * @tags Public - Require Admin API Key
807
+ * @name GetOrganizationApiKeyConfigurationApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdConfigurationGet
808
+ * @summary Get Organization Api Key Configuration
809
+ * @request GET:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}/configuration
810
+ * @secure
811
+ */
812
+ getOrganizationApiKeyConfigurationApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdConfigurationGet: (organizationId, apiKeyId, params = {}) => this.request({
813
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}/configuration`,
814
+ method: "GET",
815
+ secure: true,
816
+ format: "json",
817
+ ...params
818
+ }),
819
+ /**
820
+ * No description
821
+ *
822
+ * @tags Public - Require Admin API Key
823
+ * @name ListOrganizationApiKeyAssignmentsApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsGet
824
+ * @summary List Organization Api Key Assignments
825
+ * @request GET:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}/ai-model-assignments
826
+ * @secure
827
+ */
828
+ listOrganizationApiKeyAssignmentsApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsGet: (organizationId, apiKeyId, params = {}) => this.request({
829
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}/ai-model-assignments`,
830
+ method: "GET",
831
+ secure: true,
832
+ format: "json",
833
+ ...params
834
+ }),
835
+ /**
836
+ * No description
837
+ *
838
+ * @tags Public - Require Admin API Key
839
+ * @name UpdateOrganizationApiKeyAssignmentApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsDomainPatch
840
+ * @summary Update Organization Api Key Assignment
841
+ * @request PATCH:/api/public/v1/admin/organizations/{organization_id}/api-keys/{api_key_id}/ai-model-assignments/{domain}
842
+ * @secure
843
+ */
844
+ updateOrganizationApiKeyAssignmentApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsDomainPatch: (organizationId, apiKeyId, domain, data, params = {}) => this.request({
845
+ path: `/api/public/v1/admin/organizations/${organizationId}/api-keys/${apiKeyId}/ai-model-assignments/${domain}`,
846
+ method: "PATCH",
847
+ body: data,
848
+ secure: true,
849
+ type: "application/json" /* Json */,
850
+ format: "json",
851
+ ...params
852
+ }),
853
+ /**
854
+ * No description
855
+ *
856
+ * @tags Public - Require Admin API Key
857
+ * @name ListOrganizationAiModelProfilesApiPublicV1AdminOrganizationsOrganizationIdAiModelProfilesGet
858
+ * @summary List Organization Ai Model Profiles
859
+ * @request GET:/api/public/v1/admin/organizations/{organization_id}/ai-model-profiles
860
+ * @secure
861
+ */
862
+ listOrganizationAiModelProfilesApiPublicV1AdminOrganizationsOrganizationIdAiModelProfilesGet: (organizationId, params = {}) => this.request({
863
+ path: `/api/public/v1/admin/organizations/${organizationId}/ai-model-profiles`,
864
+ method: "GET",
865
+ secure: true,
866
+ format: "json",
867
+ ...params
868
+ })
869
+ };
870
+ }
871
+ };
872
+
873
+ // src/types.ts
874
+ var AI_MENTOR_CONFIGURATION_TYPES = {
875
+ TEACHER: "teacher",
876
+ ROLEPLAY: "roleplay"
877
+ };
878
+ var LUMA_AI_CAPABILITY_MODES = {
879
+ CORE: "core" /* Core */,
880
+ CUSTOM: "custom" /* Custom */,
881
+ DISABLED: "disabled" /* Disabled */
882
+ };
883
+ var LUMA_AI_CAPABILITY_PROVIDERS = {
884
+ LUMA: "luma" /* Luma */,
885
+ MENTINGO_CORE: "mentingo-core" /* MentingoCore */
886
+ };
887
+ var LUMA_AI_CAPABILITIES = {
888
+ COURSE_GENERATION: "courseGeneration" /* CourseGeneration */,
889
+ COURSE_GENERATION_VISUAL_ASSETS: "courseGenerationVisualAssets" /* CourseGenerationVisualAssets */,
890
+ COURSE_GENERATION_EMBEDDINGS: "courseGenerationEmbeddings" /* CourseGenerationEmbeddings */,
891
+ AI_MENTOR_CHAT: "aiMentorChat" /* AiMentorChat */,
892
+ AI_MENTOR_JUDGE: "aiMentorJudge" /* AiMentorJudge */,
893
+ AI_MENTOR_CONFIGURATION_GENERATOR: "aiMentorConfigurationGenerator" /* AiMentorConfigurationGenerator */,
894
+ AI_JUDGE_CONFIGURATION_GENERATOR: "aiJudgeConfigurationGenerator" /* AiJudgeConfigurationGenerator */,
895
+ AI_JUDGE_CONFIGURATION_VALIDATOR: "aiJudgeConfigurationValidator" /* AiJudgeConfigurationValidator */,
896
+ AI_MENTOR_RAG_EMBEDDINGS: "aiMentorRagEmbeddings" /* AiMentorRagEmbeddings */,
897
+ TRANSLATION_GENERATION: "translationGeneration" /* TranslationGeneration */,
898
+ DICTATION_TRANSCRIPTION: "dictationTranscription" /* DictationTranscription */,
899
+ VOICE_TRANSCRIPTION: "voiceTranscription" /* VoiceTranscription */,
900
+ VOICE_MENTOR: "voiceMentor" /* VoiceMentor */,
901
+ VOICE_TEXT_TO_SPEECH: "voiceTextToSpeech" /* VoiceTextToSpeech */
902
+ };
903
+
904
+ // src/http/ai.ts
905
+ var LumaAiClient = class {
906
+ constructor(apiClient) {
907
+ this.apiClient = apiClient;
908
+ }
909
+ async createEmbeddings(opts) {
910
+ const response = await this.apiClient.api.createEmbeddingsApiPublicV1AiEmbeddingsPost(opts);
911
+ return response.data;
912
+ }
913
+ async generateJudgeConfiguration(opts) {
914
+ const response = await this.apiClient.api.generateJudgeConfigurationApiPublicV1AiJudgeConfigurationGeneratePost(
915
+ opts
916
+ );
917
+ return response.data;
918
+ }
919
+ async generateMentorConfiguration(opts) {
920
+ const configurationType = opts.configurationType === AI_MENTOR_CONFIGURATION_TYPES.TEACHER ? "teacher" /* Teacher */ : "roleplay" /* Roleplay */;
921
+ const response = await this.apiClient.api.generateMentorConfigurationApiPublicV1AiMentorConfigurationGeneratePost(
922
+ { ...opts, configurationType }
923
+ );
924
+ return response.data;
925
+ }
926
+ async validateJudgeConfiguration(opts) {
927
+ const response = await this.apiClient.api.validateJudgeConfigurationApiPublicV1AiJudgeConfigurationValidatePost(
928
+ opts
929
+ );
930
+ return response.data;
931
+ }
932
+ async validateMentorConfiguration(opts) {
933
+ const response = await this.apiClient.api.validateMentorConfigurationApiPublicV1AiMentorConfigurationValidatePost(
934
+ opts
935
+ );
936
+ return response.data;
937
+ }
938
+ async generateTranslations(opts) {
939
+ const response = await this.apiClient.api.generateTranslationsApiPublicV1AiTranslationsGeneratePost(opts);
940
+ return response.data;
941
+ }
942
+ async transcribeDictation(opts) {
943
+ const response = await this.apiClient.api.transcribeDictationApiPublicV1AiTranscriptionsPost(opts);
944
+ return response.data;
945
+ }
946
+ };
947
+
948
+ // src/http/admin.ts
949
+ var ADMIN_API_KEY_REQUIRED_MESSAGE = "Luma API key is required. Pass apiKey to createLumaClient({ apiKey }).";
950
+ var AdminApiExecutions = class {
951
+ constructor(apiClient, apiKey) {
952
+ this.apiClient = apiClient;
953
+ this.apiKey = apiKey;
954
+ }
955
+ assertAdminApiKey() {
956
+ if (!this.apiKey?.trim()) {
957
+ throw new Error(ADMIN_API_KEY_REQUIRED_MESSAGE);
958
+ }
959
+ }
960
+ async listApiKeys(opts) {
961
+ this.assertAdminApiKey();
962
+ const response = await this.apiClient.api.listOrganizationApiKeysApiPublicV1AdminOrganizationsOrganizationIdApiKeysGet(
963
+ opts.organizationId
964
+ );
965
+ return response.data;
966
+ }
967
+ async createApiKey(opts) {
968
+ this.assertAdminApiKey();
969
+ const response = await this.apiClient.api.createOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysPost(
970
+ opts.organizationId,
971
+ { name: opts.name }
972
+ );
973
+ return response.data;
974
+ }
975
+ async getApiKey(opts) {
976
+ this.assertAdminApiKey();
977
+ const response = await this.apiClient.api.getOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdGet(
978
+ opts.organizationId,
979
+ opts.apiKeyId
980
+ );
981
+ return response.data;
982
+ }
983
+ async updateApiKey(opts) {
984
+ this.assertAdminApiKey();
985
+ const { organizationId, apiKeyId, ...data } = opts;
986
+ const response = await this.apiClient.api.updateOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdPatch(
987
+ organizationId,
988
+ apiKeyId,
989
+ data
990
+ );
991
+ return response.data;
992
+ }
993
+ async revokeApiKey(opts) {
994
+ this.assertAdminApiKey();
995
+ const response = await this.apiClient.api.revokeOrganizationApiKeyApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdDelete(
996
+ opts.organizationId,
997
+ opts.apiKeyId
998
+ );
999
+ return response.data;
1000
+ }
1001
+ async getConfiguration(opts) {
1002
+ this.assertAdminApiKey();
1003
+ const response = await this.apiClient.api.getOrganizationApiKeyConfigurationApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdConfigurationGet(
1004
+ opts.organizationId,
1005
+ opts.apiKeyId
1006
+ );
1007
+ return response.data;
1008
+ }
1009
+ async listAssignments(opts) {
1010
+ this.assertAdminApiKey();
1011
+ const response = await this.apiClient.api.listOrganizationApiKeyAssignmentsApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsGet(
1012
+ opts.organizationId,
1013
+ opts.apiKeyId
1014
+ );
1015
+ return response.data;
1016
+ }
1017
+ async updateAssignment(opts) {
1018
+ this.assertAdminApiKey();
1019
+ const response = await this.apiClient.api.updateOrganizationApiKeyAssignmentApiPublicV1AdminOrganizationsOrganizationIdApiKeysApiKeyIdAiModelAssignmentsDomainPatch(
1020
+ opts.organizationId,
1021
+ opts.apiKeyId,
1022
+ opts.domain,
1023
+ {
1024
+ mode: opts.mode,
1025
+ modelProfileId: opts.modelProfileId
1026
+ }
1027
+ );
1028
+ return response.data;
1029
+ }
1030
+ async listModelProfiles(opts) {
1031
+ this.assertAdminApiKey();
1032
+ const response = await this.apiClient.api.listOrganizationAiModelProfilesApiPublicV1AdminOrganizationsOrganizationIdAiModelProfilesGet(
1033
+ opts.organizationId
1034
+ );
1035
+ return response.data;
1036
+ }
1037
+ };
1038
+ var LumaAdminApiKeysClient = class {
1039
+ constructor(executions) {
1040
+ this.executions = executions;
1041
+ }
1042
+ list(opts) {
1043
+ return this.executions.listApiKeys(opts);
1044
+ }
1045
+ create(opts) {
1046
+ return this.executions.createApiKey(opts);
1047
+ }
1048
+ get(opts) {
1049
+ return this.executions.getApiKey(opts);
1050
+ }
1051
+ update(opts) {
1052
+ return this.executions.updateApiKey(opts);
1053
+ }
1054
+ revoke(opts) {
1055
+ return this.executions.revokeApiKey(opts);
1056
+ }
1057
+ getConfiguration(opts) {
1058
+ return this.executions.getConfiguration(opts);
1059
+ }
1060
+ listAssignments(opts) {
1061
+ return this.executions.listAssignments(opts);
1062
+ }
1063
+ updateAssignment(opts) {
1064
+ return this.executions.updateAssignment(opts);
1065
+ }
1066
+ };
1067
+ var LumaAdminModelProfilesClient = class {
1068
+ constructor(executions) {
1069
+ this.executions = executions;
1070
+ }
1071
+ list(opts) {
1072
+ return this.executions.listModelProfiles(opts);
1073
+ }
1074
+ };
1075
+ var LumaAdminClient = class {
1076
+ constructor(apiClient, apiKey) {
1077
+ const executions = new AdminApiExecutions(apiClient, apiKey);
1078
+ this.apiKeys = new LumaAdminApiKeysClient(executions);
1079
+ this.modelProfiles = new LumaAdminModelProfilesClient(executions);
1080
+ }
1081
+ };
1082
+
1083
+ // src/http/admin.constants.ts
1084
+ var LUMA_AI_MODEL_DOMAINS = {
1085
+ AI_MENTOR: "aiMentor" /* AiMentor */,
1086
+ AI_MENTOR_CONFIGURATION_GENERATOR: "aiMentorConfigurationGenerator" /* AiMentorConfigurationGenerator */,
1087
+ AI_MENTOR_JUDGE: "aiMentorJudge" /* AiMentorJudge */,
1088
+ AI_JUDGE_CONFIGURATION_GENERATOR: "aiJudgeConfigurationGenerator" /* AiJudgeConfigurationGenerator */,
1089
+ AI_JUDGE_CONFIGURATION_VALIDATOR: "aiJudgeConfigurationValidator" /* AiJudgeConfigurationValidator */,
1090
+ TRANSLATIONS: "translations" /* Translations */,
1091
+ COURSE_GENERATION: "courseGeneration" /* CourseGeneration */,
1092
+ COURSE_GENERATION_VISUAL_ASSETS: "courseGenerationVisualAssets" /* CourseGenerationVisualAssets */,
1093
+ COURSE_GENERATION_EMBEDDINGS: "courseGenerationEmbeddings" /* CourseGenerationEmbeddings */,
1094
+ EMBEDDINGS: "embeddings" /* Embeddings */,
1095
+ DICTATION_TRANSCRIPTION: "dictationTranscription" /* DictationTranscription */,
1096
+ VOICE_TRANSCRIPTION: "voiceTranscription" /* VoiceTranscription */,
1097
+ VOICE_TTS: "voiceTts" /* VoiceTts */
1098
+ };
1099
+ var LUMA_AI_MODEL_PROFILE_KINDS = {
1100
+ CHAT: "chat" /* Chat */,
1101
+ IMAGE: "image" /* Image */,
1102
+ EMBEDDING: "embedding" /* Embedding */,
1103
+ SPEECH_TO_TEXT: "speechToText" /* SpeechToText */,
1104
+ TEXT_TO_SPEECH: "textToSpeech" /* TextToSpeech */
1105
+ };
1106
+
1107
+ // src/http/authoring.types.ts
1108
+ var AuthoringSubscriptionError = class extends Error {
1109
+ /** Preserve the machine-readable terminal reason for consumer recovery decisions. */
1110
+ constructor(code) {
1111
+ super(`Authoring event subscription ended: ${code}`);
1112
+ this.name = "AuthoringSubscriptionError";
1113
+ this.code = code;
1114
+ }
1115
+ };
1116
+
1117
+ // src/http/authoring.stream.ts
1118
+ var MAX_FRAME_CHARACTERS = 1048576;
1119
+ var toText = (chunk, decoder) => {
1120
+ if (typeof chunk === "string") return chunk;
1121
+ if (chunk instanceof Uint8Array) return decoder.decode(chunk, { stream: true });
1122
+ throw new Error("Unsupported authoring event stream chunk");
1123
+ };
1124
+ async function* streamChunks(body) {
1125
+ if (typeof body === "string" || body instanceof Uint8Array) {
1126
+ yield body;
1127
+ return;
1128
+ }
1129
+ if (typeof body !== "object" || body === null) {
1130
+ throw new Error("Authoring event stream body is unavailable");
1131
+ }
1132
+ const stream = body;
1133
+ const iteratorFactory = stream[Symbol.asyncIterator];
1134
+ if (iteratorFactory) {
1135
+ const iterator = iteratorFactory.call(stream);
1136
+ let completed = false;
1137
+ try {
1138
+ while (true) {
1139
+ const item = await iterator.next();
1140
+ if (item.done) {
1141
+ completed = true;
1142
+ return;
1143
+ }
1144
+ yield item.value;
1145
+ }
1146
+ } finally {
1147
+ if (!completed) await iterator.return?.();
1148
+ }
1149
+ }
1150
+ if (stream.getReader) {
1151
+ const reader = stream.getReader();
1152
+ try {
1153
+ while (true) {
1154
+ const item = await reader.read();
1155
+ if (item.done) return;
1156
+ yield item.value;
1157
+ }
1158
+ } finally {
1159
+ await reader.cancel?.();
1160
+ reader.releaseLock();
1161
+ }
1162
+ }
1163
+ throw new Error("Authoring event stream is not readable");
1164
+ }
1165
+ var parseFrame = (raw) => {
1166
+ let event = "message";
1167
+ let id;
1168
+ const data = [];
1169
+ for (const line of raw.split("\n")) {
1170
+ if (!line || line.startsWith(":")) continue;
1171
+ const separator = line.indexOf(":");
1172
+ const field = separator === -1 ? line : line.slice(0, separator);
1173
+ let value = separator === -1 ? "" : line.slice(separator + 1);
1174
+ if (value.startsWith(" ")) value = value.slice(1);
1175
+ if (field === "event") event = value;
1176
+ if (field === "id") id = value;
1177
+ if (field === "data") data.push(value);
1178
+ }
1179
+ if (data.length === 0) return null;
1180
+ return { event, id, data: data.join("\n") };
1181
+ };
1182
+ var isAuthoringEvent = (value) => {
1183
+ if (typeof value !== "object" || value === null) return false;
1184
+ const event = value;
1185
+ return event.schemaVersion === 1 && typeof event.eventId === "string" && typeof event.sessionId === "string" && Number.isSafeInteger(event.sequence) && Number(event.sequence) > 0 && typeof event.occurredAt === "string" && typeof event.type === "string" && typeof event.payload === "object" && event.payload !== null;
1186
+ };
1187
+ var terminalError = (data) => {
1188
+ const value = JSON.parse(data);
1189
+ if (typeof value !== "object" || value === null || !("code" in value)) {
1190
+ throw new Error("Invalid authoring.error event payload");
1191
+ }
1192
+ const code = value.code;
1193
+ if (code !== "history_expired" && code !== "permission_revoked") {
1194
+ throw new Error(`Unknown authoring.error code: ${String(code)}`);
1195
+ }
1196
+ return new AuthoringSubscriptionError(code);
1197
+ };
1198
+ var deliverFrame = async (frame, options) => {
1199
+ if (frame.event === "authoring.error") {
1200
+ const error = terminalError(frame.data);
1201
+ await options.onError?.(error);
1202
+ throw error;
1203
+ }
1204
+ if (frame.event !== "authoring.event") return;
1205
+ const value = JSON.parse(frame.data);
1206
+ if (!isAuthoringEvent(value)) throw new Error("Invalid authoring.event payload");
1207
+ if (value.sessionId !== options.sessionId) {
1208
+ throw new Error("Authoring event session does not match subscription");
1209
+ }
1210
+ if (frame.id !== void 0 && frame.id !== String(value.sequence)) {
1211
+ throw new Error("Authoring event id does not match sequence");
1212
+ }
1213
+ await options.onEvent(value);
1214
+ };
1215
+ var consumeAuthoringEventStream = async (body, options) => {
1216
+ const decoder = new TextDecoder();
1217
+ let buffer = "";
1218
+ for await (const chunk of streamChunks(body)) {
1219
+ buffer += toText(chunk, decoder);
1220
+ buffer = buffer.replace(/\r\n/g, "\n");
1221
+ let boundary = buffer.indexOf("\n\n");
1222
+ while (boundary !== -1) {
1223
+ if (boundary > MAX_FRAME_CHARACTERS) {
1224
+ throw new Error("Authoring event stream frame exceeds size limit");
1225
+ }
1226
+ const frame = parseFrame(buffer.slice(0, boundary));
1227
+ buffer = buffer.slice(boundary + 2);
1228
+ if (frame) await deliverFrame(frame, options);
1229
+ boundary = buffer.indexOf("\n\n");
1230
+ }
1231
+ if (buffer.length > MAX_FRAME_CHARACTERS) {
1232
+ throw new Error("Authoring event stream frame exceeds size limit");
1233
+ }
1234
+ }
1235
+ buffer += decoder.decode();
1236
+ if (buffer.replace(/\r\n/g, "\n").trim()) {
1237
+ throw new Error("Authoring event stream ended with a truncated frame");
1238
+ }
1239
+ };
1240
+
1241
+ // src/http/authoring.ts
1242
+ var LumaAuthoringClient = class {
1243
+ /** Reuse the authenticated generated client and its configured HTTP policy. */
1244
+ constructor(apiClient) {
1245
+ this.apiClient = apiClient;
1246
+ }
1247
+ /** Open or restore the organization/course session using the caller command identity. */
1248
+ async createSession(options) {
1249
+ const response = await this.apiClient.api.createSessionApiPublicV1AuthoringSessionsPost(options);
1250
+ return response.data;
1251
+ }
1252
+ /** List one server-filtered, offset-paginated page of a course's independent conversations in server-defined latest-activity order. */
1253
+ async listSessions(options) {
1254
+ const response = await this.apiClient.api.listSessionsApiPublicV1AuthoringSessionsGet({
1255
+ course_id: options.courseId,
1256
+ keyword: options.keyword,
1257
+ page: options.page,
1258
+ perPage: options.perPage
1259
+ });
1260
+ return response.data;
1261
+ }
1262
+ /** Read the durable workspace snapshot used for initial rendering and resynchronization. */
1263
+ async getSession(options) {
1264
+ const response = await this.apiClient.api.getSessionApiPublicV1AuthoringSessionsSessionIdGet(
1265
+ options.sessionId
1266
+ );
1267
+ return response.data;
1268
+ }
1269
+ /** Read an older, stable keyset page of turns and the records for their review cards. */
1270
+ async getOlderTurns(options) {
1271
+ const response = await this.apiClient.api.getOlderTurnsApiPublicV1AuthoringSessionsSessionIdTurnsGet(
1272
+ options.sessionId,
1273
+ { beforeRequestId: options.beforeRequestId }
1274
+ );
1275
+ return response.data;
1276
+ }
1277
+ /** Read one ordered event page after a durable cursor; callers own pagination. */
1278
+ async getEvents(options) {
1279
+ const response = await this.apiClient.api.getEventsApiPublicV1AuthoringSessionsSessionIdEventsGet(
1280
+ options.sessionId,
1281
+ {
1282
+ afterSequence: options.afterSequence,
1283
+ limit: options.limit
1284
+ }
1285
+ );
1286
+ return response.data;
1287
+ }
1288
+ /** Consume one SSE connection until closure or failure.
1289
+ * The caller owns reconnect and cursor persistence; aborting only closes the
1290
+ * subscription and never stops generation. Terminal access/history errors reject. */
1291
+ async subscribeEvents(options) {
1292
+ const controller = new AbortController();
1293
+ const abort = () => controller.abort(options.signal?.reason);
1294
+ if (options.signal?.aborted) abort();
1295
+ options.signal?.addEventListener("abort", abort, { once: true });
1296
+ try {
1297
+ const response = await this.apiClient.api.subscribeEventsApiPublicV1AuthoringSessionsSessionIdEventsStreamGet(
1298
+ options.sessionId,
1299
+ { afterSequence: options.afterSequence },
1300
+ {
1301
+ format: "stream",
1302
+ headers: { Accept: "text/event-stream" },
1303
+ signal: controller.signal
1304
+ }
1305
+ );
1306
+ await consumeAuthoringEventStream(response.data, options);
1307
+ } finally {
1308
+ options.signal?.removeEventListener("abort", abort);
1309
+ controller.abort();
1310
+ }
1311
+ }
1312
+ /** Upload a source under a stable command ID; processing completes asynchronously. */
1313
+ async uploadSource(options) {
1314
+ const response = await this.apiClient.api.uploadSourceApiPublicV1AuthoringSessionsSessionIdSourcesPost(
1315
+ options.sessionId,
1316
+ { file: options.file, commandId: options.commandId }
1317
+ );
1318
+ return response.data;
1319
+ }
1320
+ /** Download one authorized asset revision with a response-size bound.
1321
+ * Defaults to 32 MiB. Pass the frozen manifest size when known; invalid limits
1322
+ * and oversized responses reject without returning partial asset data. */
1323
+ async downloadAsset(options) {
1324
+ const maxBytes = options.maxBytes ?? 32 * 1024 * 1024;
1325
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
1326
+ throw new RangeError("Asset maxBytes must be a nonnegative safe integer");
1327
+ }
1328
+ const response = await this.apiClient.api.downloadAssetApiPublicV1AuthoringSessionsSessionIdAssetsAssetIdGet(
1329
+ options.sessionId,
1330
+ options.assetId,
1331
+ { revision: options.revision },
1332
+ { format: "arraybuffer", signal: options.signal, maxContentLength: maxBytes }
1333
+ );
1334
+ const data = response.data;
1335
+ const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
1336
+ if (bytes.byteLength > maxBytes) throw new RangeError("Asset response exceeds maxBytes");
1337
+ const contentType = response.headers["content-type"];
1338
+ return {
1339
+ assetId: options.assetId,
1340
+ revision: options.revision ?? 1,
1341
+ bytes,
1342
+ mimeType: typeof contentType === "string" ? contentType : void 0
1343
+ };
1344
+ }
1345
+ /** Submit a command with its stable identity and return the server acknowledgement.
1346
+ * An acknowledgement records acceptance, not completion of provider work. */
1347
+ async sendCommand(options) {
1348
+ const response = await this.apiClient.api.commandApiPublicV1AuthoringSessionsSessionIdCommandsPost(
1349
+ options.sessionId,
1350
+ options.command
1351
+ );
1352
+ return response.data;
1353
+ }
1354
+ /** Deliver only the selected Core-authorized context for a pending fenced task. */
1355
+ async fulfillContext(options) {
1356
+ const response = await this.apiClient.api.fulfillContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFulfillmentPost(
1357
+ options.sessionId,
1358
+ options.contextRequestId,
1359
+ options.response
1360
+ );
1361
+ return response.data;
1362
+ }
1363
+ /** Settle one pending context request when Core cannot return authorized detail. */
1364
+ async failContext(options) {
1365
+ const response = await this.apiClient.api.failContextApiPublicV1AuthoringSessionsSessionIdContextRequestsContextRequestIdFailurePost(
1366
+ options.sessionId,
1367
+ options.contextRequestId,
1368
+ options.failure
1369
+ );
1370
+ return response.data;
1371
+ }
1372
+ /** Freeze selected reviewed changes for Core; this operation does not apply them. */
1373
+ async prepareExport(options) {
1374
+ const response = await this.apiClient.api.prepareExportApiPublicV1AuthoringSessionsSessionIdExportsPost(
1375
+ options.sessionId,
1376
+ options.request
1377
+ );
1378
+ return response.data;
1379
+ }
1380
+ /** Retrieve the previously frozen bundle without regenerating its content. */
1381
+ async getExport(options) {
1382
+ const response = await this.apiClient.api.getExportApiPublicV1AuthoringSessionsSessionIdExportsExportIdGet(
1383
+ options.sessionId,
1384
+ options.exportId
1385
+ );
1386
+ return response.data;
1387
+ }
1388
+ /** Deliver Core application feedback so Luma can reconcile the reviewed changes. */
1389
+ async recordReceipt(options) {
1390
+ const response = await this.apiClient.api.receiptApiPublicV1AuthoringSessionsSessionIdReceiptsPost(
1391
+ options.sessionId,
1392
+ options.receipt
1393
+ );
1394
+ return response.data;
1395
+ }
1396
+ };
1397
+
1398
+ // src/http/client.ts
1399
+ var import_node_https = require("https");
1400
+
1401
+ // src/http/configuration.ts
1402
+ var LumaConfigurationClient = class {
1403
+ constructor(apiClient) {
1404
+ this.apiClient = apiClient;
1405
+ }
1406
+ async get() {
1407
+ const response = await this.apiClient.api.getConfigurationStatusApiPublicV1AiConfigurationGet();
1408
+ return response.data;
1409
+ }
1410
+ };
1411
+
1412
+ // src/http/mentor.ts
1413
+ var LumaMentorClient = class {
1414
+ constructor(apiClient) {
1415
+ this.apiClient = apiClient;
1416
+ }
1417
+ streamChat(opts, requestOptions = {}) {
1418
+ return this.apiClient.api.mentorChatApiPublicV1AiMentorChatPost(opts, {
1419
+ format: "stream",
1420
+ signal: requestOptions.signal
1421
+ });
1422
+ }
1423
+ chat(opts, requestOptions = {}) {
1424
+ return this.streamChat(opts, requestOptions);
1425
+ }
1426
+ async generateChat(opts) {
1427
+ const response = await this.apiClient.api.generateMentorChatApiPublicV1AiMentorChatGeneratePost(opts);
1428
+ return response.data;
1429
+ }
1430
+ async judge(opts) {
1431
+ const response = await this.apiClient.api.mentorJudgeApiPublicV1AiMentorJudgePost(opts);
1432
+ return response.data;
1433
+ }
1434
+ };
1435
+
1436
+ // src/http/client.ts
1437
+ var LumaClient = class {
1438
+ /** Configure authenticated transports; TLS verification stays enabled unless explicitly disabled. */
1439
+ constructor(opts) {
1440
+ const httpsAgent = opts.httpsAgent ?? (opts.allowInsecureTls ? new import_node_https.Agent({ rejectUnauthorized: false }) : void 0);
1441
+ this.apiClient = new API({
1442
+ baseURL: opts.baseURL,
1443
+ secure: true,
1444
+ httpsAgent,
1445
+ headers: {
1446
+ "X-API-Key": opts.apiKey
1447
+ }
1448
+ });
1449
+ const adminApiClient = new API({
1450
+ baseURL: opts.baseURL,
1451
+ secure: true,
1452
+ httpsAgent,
1453
+ headers: {
1454
+ "X-Admin-API-Key": opts.apiKey
1455
+ }
1456
+ });
1457
+ this.ai = new LumaAiClient(this.apiClient);
1458
+ this.admin = new LumaAdminClient(adminApiClient, opts.apiKey);
1459
+ this.authoring = new LumaAuthoringClient(this.apiClient);
1460
+ this.configuration = new LumaConfigurationClient(this.apiClient);
1461
+ this.mentor = new LumaMentorClient(this.apiClient);
1462
+ }
1463
+ };
1464
+ var createLumaClient = (opts) => {
1465
+ return new LumaClient(opts);
1466
+ };
1467
+
1468
+ // src/socket/types.ts
1469
+ var LUMA_SOCKET_MESSAGE_TYPES = {
1470
+ AUDIO_START: "audio.start",
1471
+ AUDIO_CHUNK: "audio.chunk",
1472
+ AUDIO_RECONNECT: "audio.reconnect",
1473
+ AUDIO_RECOVERED: "audio.recovered",
1474
+ AUDIO_STOP: "audio.stop",
1475
+ CLIENT_SPEECH_START: "client.speech.start",
1476
+ CLIENT_SPEECH_END: "client.speech.end",
1477
+ MENTOR_TEXT_DELTA: "mentor.text.delta",
1478
+ MENTOR_TEXT_END: "mentor.text.end",
1479
+ MENTOR_TEXT_ERROR: "mentor.text.error"
1480
+ };
1481
+ var LUMA_AUDIO_ACTIONS = {
1482
+ VOICE_MENTOR: "VOICE_MENTOR"
1483
+ };
1484
+ var LUMA_AUDIO_FORMATS = {
1485
+ PCM_S16LE: "pcm_s16le"
1486
+ };
1487
+ var LUMA_SOCKET_LISTEN_EVENTS = {
1488
+ SERVER_CONNECTED: "server:connected",
1489
+ PONG: "pong",
1490
+ AUDIO_STARTED: "audio:start",
1491
+ AUDIO_CHUNKED: "audio:chunked",
1492
+ AUDIO_CHUNK_ERROR: "audio:chunk_error",
1493
+ AUDIO_RECOVERED: "audio:recovered",
1494
+ AUDIO_RECONNECT_ERROR: "audio:reconnect_error",
1495
+ AUDIO_STOPPED: "audio:stopped",
1496
+ LEARNER_TRANSCRIPTION: "learner:transcription",
1497
+ AUDIO_OUTPUT_ALIGNMENT: "audio:output:alignment",
1498
+ AUDIO_OUTPUT_CHUNK: "audio:output:chunk",
1499
+ AUDIO_OUTPUT_INTERRUPTED: "audio:output:interrupted",
1500
+ AUDIO_OUTPUT_ERROR: "audio:output:error",
1501
+ AUDIO_OUTPUT_COMPLETE: "audio:output:complete"
1502
+ };
1503
+ var LUMA_MENTOR_STREAM_EVENT_TYPES = {
1504
+ LEARNER_TRANSCRIPTION: "learner.transcription",
1505
+ AUDIO_OUTPUT_ALIGNMENT: "audio.output.alignment",
1506
+ AUDIO_OUTPUT_CHUNK: "audio.output.chunk",
1507
+ AUDIO_OUTPUT_INTERRUPTED: "audio.output.interrupted",
1508
+ AUDIO_OUTPUT_ERROR: "audio.output.error",
1509
+ AUDIO_OUTPUT_COMPLETE: "audio.output.complete"
1510
+ };
1511
+ var LUMA_SOCKET_EMIT_EVENTS = {
1512
+ START_AUDIO: "start_audio",
1513
+ AUDIO_CHUNK: "audio_chunk",
1514
+ AUDIO_RECONNECT: "audio_reconnect",
1515
+ AUDIO_STOP: "audio_stop",
1516
+ CLIENT_SPEECH_START: "client_speech_start",
1517
+ CLIENT_SPEECH_END: "client_speech_end",
1518
+ MENTOR_TEXT_DELTA: "mentor_text_delta",
1519
+ MENTOR_TEXT_END: "mentor_text_end",
1520
+ MENTOR_TEXT_ERROR: "mentor_text_error",
1521
+ PING: "ping",
1522
+ TRIGGER_TTS: "trigger_tts"
1523
+ };
1524
+ var TRANSCRIPTION_MODES = {
1525
+ PAUSE_BATCH: "pause_batch",
1526
+ REALTIME_STREAM: "realtime_stream"
1527
+ };
1528
+ var LUMA_CAPTURE_PROFILES = {
1529
+ CONTINUOUS_PCM: "continuous_pcm",
1530
+ VAD_SEGMENTED: "vad_segmented"
1531
+ };
1532
+ var AUDIO_RECOVERY_STATES = {
1533
+ LISTENING: "listening",
1534
+ MENTOR_ACTIVE: "mentor_active",
1535
+ USER_SPEAKING: "user_speaking"
1536
+ };
1537
+ var AUDIO_PROVIDER_STATES = {
1538
+ CONNECTED: "connected",
1539
+ RESTARTED: "restarted",
1540
+ NOT_APPLICABLE: "not_applicable"
1541
+ };
1542
+ var LEARNER_TRANSCRIPT_STATUSES = {
1543
+ PARTIAL: "partial",
1544
+ FINAL: "final"
1545
+ };
1546
+
1547
+ // src/socket/constants.ts
1548
+ var LUMA_VOICE_TIMING_PRECISION = {
1549
+ WORD: "word",
1550
+ SEGMENT: "segment",
1551
+ BOUNDARY_ESTIMATE: "boundary_estimate",
1552
+ UNKNOWN: "unknown"
1553
+ };
1554
+ var EXTERNAL_AUDIO_RECOVERY_STATE = {
1555
+ CONNECTED: "connected",
1556
+ RECOVERING: "recovering",
1557
+ FAILED: "failed"
1558
+ };
1559
+ var EXTERNAL_AUDIO_OPERATION = {
1560
+ CHUNK: "chunk",
1561
+ SPEECH_START: "speech_start",
1562
+ SPEECH_END: "speech_end"
1563
+ };
1564
+ var EXTERNAL_AUDIO_MAX_RECOVERY_ATTEMPTS = 8;
1565
+ var EXTERNAL_AUDIO_MAX_BUFFERED_CHUNKS = 1024;
1566
+ var EXTERNAL_AUDIO_CLIENT_RECONNECT_GRACE_MS = 1e4;
1567
+ var EXTERNAL_AUDIO_RECOVERY_TIMEOUT_MS = 15e3;
1568
+ var EXTERNAL_AUDIO_TERMINAL_RECOVERY_ERROR_CODES = [
1569
+ "AUDIO_SESSION_RUN_REPLACED",
1570
+ "AUDIO_SESSION_CLOSED",
1571
+ "AUDIO_SESSION_RUN_MISMATCH",
1572
+ "AUDIO_SESSION_RUN_ID_UNAVAILABLE"
1573
+ ];
1574
+
1575
+ // src/socket/client.ts
1576
+ var import_socket = require("socket.io-client");
1577
+ var createLumaSocket = (opts) => {
1578
+ const socket = (0, import_socket.io)(opts.baseURL, {
1579
+ transports: ["websocket", "polling"],
1580
+ autoConnect: false,
1581
+ secure: true,
1582
+ rejectUnauthorized: !opts.allowInsecureTls,
1583
+ auth: {
1584
+ apiKey: opts.apiKey,
1585
+ sessionId: opts.socketData?.sessionId,
1586
+ currentSocketUser: {
1587
+ userId: opts.socketData?.userId,
1588
+ lessonId: opts.socketData?.lessonId
1589
+ }
1590
+ },
1591
+ path: "/api/ws/socket.io"
1592
+ });
1593
+ socket.startAudio = (payload) => {
1594
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.START_AUDIO, payload);
1595
+ return socket;
1596
+ };
1597
+ socket.sendAudioChunk = (payload, chunk) => {
1598
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.AUDIO_CHUNK, payload, chunk);
1599
+ return socket;
1600
+ };
1601
+ socket.reconnectAudio = (payload) => {
1602
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.AUDIO_RECONNECT, payload);
1603
+ return socket;
1604
+ };
1605
+ socket.stopAudio = (payload) => {
1606
+ socket.emit(
1607
+ LUMA_SOCKET_EMIT_EVENTS.AUDIO_STOP,
1608
+ payload ?? { type: LUMA_SOCKET_MESSAGE_TYPES.AUDIO_STOP }
1609
+ );
1610
+ return socket;
1611
+ };
1612
+ socket.sendClientSpeechStart = (payload) => {
1613
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.CLIENT_SPEECH_START, payload);
1614
+ return socket;
1615
+ };
1616
+ socket.sendClientSpeechEnd = (payload) => {
1617
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.CLIENT_SPEECH_END, payload);
1618
+ return socket;
1619
+ };
1620
+ socket.sendMentorTextDelta = (payload) => {
1621
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.MENTOR_TEXT_DELTA, payload);
1622
+ return socket;
1623
+ };
1624
+ socket.sendMentorTextEnd = (payload) => {
1625
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.MENTOR_TEXT_END, payload);
1626
+ return socket;
1627
+ };
1628
+ socket.sendMentorTextError = (payload) => {
1629
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.MENTOR_TEXT_ERROR, payload);
1630
+ return socket;
1631
+ };
1632
+ socket.sendPing = (payload) => {
1633
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.PING, payload);
1634
+ return socket;
1635
+ };
1636
+ socket.sendTTSTrigger = (payload) => {
1637
+ socket.emit(LUMA_SOCKET_EMIT_EVENTS.TRIGGER_TTS, payload);
1638
+ return socket;
1639
+ };
1640
+ socket.onServerConnected = (handler) => {
1641
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.SERVER_CONNECTED, handler);
1642
+ return socket;
1643
+ };
1644
+ socket.onAudioStarted = (handler) => {
1645
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_STARTED, handler);
1646
+ return socket;
1647
+ };
1648
+ socket.onAudioChunked = (handler) => {
1649
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_CHUNKED, handler);
1650
+ return socket;
1651
+ };
1652
+ socket.onAudioChunkError = (handler) => {
1653
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_CHUNK_ERROR, handler);
1654
+ return socket;
1655
+ };
1656
+ socket.onAudioRecovered = (handler) => {
1657
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_RECOVERED, handler);
1658
+ return socket;
1659
+ };
1660
+ socket.onAudioReconnectError = (handler) => {
1661
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_RECONNECT_ERROR, handler);
1662
+ return socket;
1663
+ };
1664
+ socket.onAudioStopped = (handler) => {
1665
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_STOPPED, handler);
1666
+ return socket;
1667
+ };
1668
+ socket.onLearnerTranscription = (handler) => {
1669
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.LEARNER_TRANSCRIPTION, handler);
1670
+ return socket;
1671
+ };
1672
+ socket.onMentorTranscription = (handler) => {
1673
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.LEARNER_TRANSCRIPTION, (payload) => {
1674
+ if (payload.data.status === LEARNER_TRANSCRIPT_STATUSES.FINAL) handler(payload);
1675
+ });
1676
+ return socket;
1677
+ };
1678
+ socket.onAudioOutputChunk = (handler) => {
1679
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_OUTPUT_CHUNK, handler);
1680
+ return socket;
1681
+ };
1682
+ socket.onAudioOutputAlignment = (handler) => {
1683
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_OUTPUT_ALIGNMENT, handler);
1684
+ return socket;
1685
+ };
1686
+ socket.onAudioOutputInterrupted = (handler) => {
1687
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_OUTPUT_INTERRUPTED, handler);
1688
+ return socket;
1689
+ };
1690
+ socket.onAudioOutputError = (handler) => {
1691
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_OUTPUT_ERROR, handler);
1692
+ return socket;
1693
+ };
1694
+ socket.onAudioOutputComplete = (handler) => {
1695
+ socket.on(LUMA_SOCKET_LISTEN_EVENTS.AUDIO_OUTPUT_COMPLETE, handler);
1696
+ return socket;
1697
+ };
1698
+ return socket;
1699
+ };
1700
+ // Annotate the CommonJS export names for ESM import in node:
1701
+ 0 && (module.exports = {
1702
+ AI_MENTOR_CONFIGURATION_TYPES,
1703
+ AUDIO_PROVIDER_STATES,
1704
+ AUDIO_RECOVERY_STATES,
1705
+ AiCapability,
1706
+ AiCapabilityMode,
1707
+ AiCapabilityProvider,
1708
+ AiModelDomain,
1709
+ AiModelProfileKind,
1710
+ AuthoringSubscriptionError,
1711
+ EXTERNAL_AUDIO_CLIENT_RECONNECT_GRACE_MS,
1712
+ EXTERNAL_AUDIO_MAX_BUFFERED_CHUNKS,
1713
+ EXTERNAL_AUDIO_MAX_RECOVERY_ATTEMPTS,
1714
+ EXTERNAL_AUDIO_OPERATION,
1715
+ EXTERNAL_AUDIO_RECOVERY_STATE,
1716
+ EXTERNAL_AUDIO_RECOVERY_TIMEOUT_MS,
1717
+ EXTERNAL_AUDIO_TERMINAL_RECOVERY_ERROR_CODES,
1718
+ LEARNER_TRANSCRIPT_STATUSES,
1719
+ LUMA_AI_CAPABILITIES,
1720
+ LUMA_AI_CAPABILITY_MODES,
1721
+ LUMA_AI_CAPABILITY_PROVIDERS,
1722
+ LUMA_AI_MODEL_DOMAINS,
1723
+ LUMA_AI_MODEL_PROFILE_KINDS,
1724
+ LUMA_AUDIO_ACTIONS,
1725
+ LUMA_AUDIO_FORMATS,
1726
+ LUMA_CAPTURE_PROFILES,
1727
+ LUMA_MENTOR_STREAM_EVENT_TYPES,
1728
+ LUMA_SOCKET_EMIT_EVENTS,
1729
+ LUMA_SOCKET_LISTEN_EVENTS,
1730
+ LUMA_SOCKET_MESSAGE_TYPES,
1731
+ LUMA_VOICE_TIMING_PRECISION,
1732
+ LumaAdminApiKeysClient,
1733
+ LumaAdminClient,
1734
+ LumaAdminModelProfilesClient,
1735
+ LumaAiClient,
1736
+ LumaAuthoringClient,
1737
+ LumaClient,
1738
+ LumaConfigurationClient,
1739
+ LumaMentorClient,
1740
+ ReasoningEffort,
1741
+ TRANSCRIPTION_MODES,
1742
+ TTSProvider,
1743
+ TaskKind,
1744
+ TextToSpeechProvider,
1745
+ TurnPartKind,
1746
+ TurnPartStatus,
1747
+ TurnStatus,
1748
+ consumeAuthoringEventStream,
1749
+ createLumaClient,
1750
+ createLumaSocket
1751
+ });