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