@lssm/integration.providers-impls 0.0.0-canary-20251220002821 → 0.0.0-canary-20251220021406

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.
@@ -37,7 +37,7 @@ var ElevenLabsVoiceProvider = class {
37
37
  language: voice.labels?.language ?? void 0,
38
38
  metadata: {
39
39
  category: voice.category ?? "",
40
- previewUrl: voice.previewUrl ?? void 0,
40
+ ...voice.previewUrl ? { previewUrl: voice.previewUrl } : {},
41
41
  ...(() => {
42
42
  const { language, ...rest } = voice.labels ?? {};
43
43
  return rest;
@@ -1 +1 @@
1
- {"version":3,"file":"elevenlabs-voice.js","names":["FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n>","SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n>","chunks: Uint8Array[]"],"sources":["../../src/impls/elevenlabs-voice.ts"],"sourcesContent":["import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';\nimport type { ElevenLabs } from '@elevenlabs/elevenlabs-js';\n\nimport type {\n Voice,\n VoiceProvider,\n VoiceSynthesisInput,\n VoiceSynthesisResult,\n} from '../voice';\n\nexport interface ElevenLabsVoiceProviderOptions {\n apiKey: string;\n defaultVoiceId?: string;\n modelId?: string;\n client?: ElevenLabsClient;\n}\n\nconst FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n> = {\n mp3: 'mp3_44100_128',\n wav: 'pcm_44100',\n ogg: 'mp3_44100_128',\n pcm: 'pcm_16000',\n};\n\nconst SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n> = {\n mp3_22050_32: 22050,\n mp3_44100_32: 44100,\n mp3_44100_64: 44100,\n mp3_44100_96: 44100,\n mp3_44100_128: 44100,\n mp3_44100_192: 44100,\n pcm_16000: 16000,\n pcm_22050: 22050,\n pcm_24000: 24000,\n pcm_44100: 44100,\n ulaw_8000: 8000,\n};\n\nexport class ElevenLabsVoiceProvider implements VoiceProvider {\n private readonly client: ElevenLabsClient;\n private readonly defaultVoiceId?: string;\n private readonly modelId?: string;\n\n constructor(options: ElevenLabsVoiceProviderOptions) {\n this.client =\n options.client ??\n new ElevenLabsClient({\n apiKey: options.apiKey,\n });\n this.defaultVoiceId = options.defaultVoiceId;\n this.modelId = options.modelId;\n }\n\n async listVoices(): Promise<Voice[]> {\n const response = await this.client.voices.getAll();\n return (response.voices ?? []).map((voice) => ({\n id: voice.voiceId ?? '',\n name: voice.name ?? '',\n description: voice.description ?? undefined,\n language: voice.labels?.language ?? undefined,\n metadata: {\n category: voice.category ?? '',\n previewUrl: voice.previewUrl ?? undefined,\n ...(() => {\n const { language, ...rest } = voice.labels ?? {};\n return rest;\n })(),\n },\n })) as any[];\n }\n\n async synthesize(input: VoiceSynthesisInput): Promise<VoiceSynthesisResult> {\n const voiceId = input.voiceId ?? this.defaultVoiceId;\n if (!voiceId) {\n throw new Error('Voice ID is required for ElevenLabs synthesis.');\n }\n\n const formatKey = input.format ?? 'mp3';\n const outputFormat = FORMAT_MAP[formatKey] ?? FORMAT_MAP.mp3;\n const sampleRate =\n input.sampleRateHz ??\n SAMPLE_RATE[outputFormat] ??\n SAMPLE_RATE.mp3_44100_128 ??\n 44100;\n\n const voiceSettings =\n input.stability != null ||\n input.similarityBoost != null ||\n input.style != null\n ? {\n ...(input.stability != null ? { stability: input.stability } : {}),\n ...(input.similarityBoost != null\n ? { similarityBoost: input.similarityBoost }\n : {}),\n ...(input.style != null ? { style: input.style } : {}),\n }\n : undefined;\n\n const stream = await this.client.textToSpeech.convert(voiceId, {\n text: input.text,\n modelId: this.modelId,\n outputFormat,\n voiceSettings,\n });\n\n const audio = await readWebStream(stream);\n\n return {\n audio,\n format: formatKey,\n sampleRateHz: sampleRate,\n durationSeconds: undefined,\n url: undefined,\n };\n }\n}\n\nasync function readWebStream(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) {\n chunks.push(value);\n }\n }\n\n const length = chunks.reduce((total, chunk) => total + chunk.length, 0);\n const result = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n"],"mappings":";;;AAiBA,MAAMA,aAGF;CACF,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;AAED,MAAMC,cAEF;CACF,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,eAAe;CACf,eAAe;CACf,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACZ;AAED,IAAa,0BAAb,MAA8D;CAC5D,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAAyC;AACnD,OAAK,SACH,QAAQ,UACR,IAAI,iBAAiB,EACnB,QAAQ,QAAQ,QACjB,CAAC;AACJ,OAAK,iBAAiB,QAAQ;AAC9B,OAAK,UAAU,QAAQ;;CAGzB,MAAM,aAA+B;AAEnC,WADiB,MAAM,KAAK,OAAO,OAAO,QAAQ,EACjC,UAAU,EAAE,EAAE,KAAK,WAAW;GAC7C,IAAI,MAAM,WAAW;GACrB,MAAM,MAAM,QAAQ;GACpB,aAAa,MAAM,eAAe;GAClC,UAAU,MAAM,QAAQ,YAAY;GACpC,UAAU;IACR,UAAU,MAAM,YAAY;IAC5B,YAAY,MAAM,cAAc;IAChC,UAAU;KACR,MAAM,EAAE,UAAU,GAAG,SAAS,MAAM,UAAU,EAAE;AAChD,YAAO;QACL;IACL;GACF,EAAE;;CAGL,MAAM,WAAW,OAA2D;EAC1E,MAAM,UAAU,MAAM,WAAW,KAAK;AACtC,MAAI,CAAC,QACH,OAAM,IAAI,MAAM,iDAAiD;EAGnE,MAAM,YAAY,MAAM,UAAU;EAClC,MAAM,eAAe,WAAW,cAAc,WAAW;EACzD,MAAM,aACJ,MAAM,gBACN,YAAY,iBACZ,YAAY,iBACZ;EAEF,MAAM,gBACJ,MAAM,aAAa,QACnB,MAAM,mBAAmB,QACzB,MAAM,SAAS,OACX;GACE,GAAI,MAAM,aAAa,OAAO,EAAE,WAAW,MAAM,WAAW,GAAG,EAAE;GACjE,GAAI,MAAM,mBAAmB,OACzB,EAAE,iBAAiB,MAAM,iBAAiB,GAC1C,EAAE;GACN,GAAI,MAAM,SAAS,OAAO,EAAE,OAAO,MAAM,OAAO,GAAG,EAAE;GACtD,GACD;AAWN,SAAO;GACL,OAHY,MAAM,cAPL,MAAM,KAAK,OAAO,aAAa,QAAQ,SAAS;IAC7D,MAAM,MAAM;IACZ,SAAS,KAAK;IACd;IACA;IACD,CAAC,CAEuC;GAIvC,QAAQ;GACR,cAAc;GACd,iBAAiB;GACjB,KAAK;GACN;;;AAIL,eAAe,cACb,QACqB;CACrB,MAAM,SAAS,OAAO,WAAW;CACjC,MAAMC,SAAuB,EAAE;AAE/B,QAAO,MAAM;EACX,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;AAC3C,MAAI,KAAM;AACV,MAAI,MACF,QAAO,KAAK,MAAM;;CAItB,MAAM,SAAS,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,QAAQ,EAAE;CACvE,MAAM,SAAS,IAAI,WAAW,OAAO;CACrC,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,QAAQ;AAC1B,SAAO,IAAI,OAAO,OAAO;AACzB,YAAU,MAAM;;AAElB,QAAO"}
1
+ {"version":3,"file":"elevenlabs-voice.js","names":["FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n>","SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n>","chunks: Uint8Array[]"],"sources":["../../src/impls/elevenlabs-voice.ts"],"sourcesContent":["import type { ElevenLabs } from '@elevenlabs/elevenlabs-js';\nimport { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';\n\nimport type {\n Voice,\n VoiceProvider,\n VoiceSynthesisInput,\n VoiceSynthesisResult,\n} from '../voice';\n\nexport interface ElevenLabsVoiceProviderOptions {\n apiKey: string;\n defaultVoiceId?: string;\n modelId?: string;\n client?: ElevenLabsClient;\n}\n\nconst FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n> = {\n mp3: 'mp3_44100_128',\n wav: 'pcm_44100',\n ogg: 'mp3_44100_128',\n pcm: 'pcm_16000',\n};\n\nconst SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n> = {\n mp3_22050_32: 22050,\n mp3_44100_32: 44100,\n mp3_44100_64: 44100,\n mp3_44100_96: 44100,\n mp3_44100_128: 44100,\n mp3_44100_192: 44100,\n pcm_16000: 16000,\n pcm_22050: 22050,\n pcm_24000: 24000,\n pcm_44100: 44100,\n ulaw_8000: 8000,\n};\n\nexport class ElevenLabsVoiceProvider implements VoiceProvider {\n private readonly client: ElevenLabsClient;\n private readonly defaultVoiceId?: string;\n private readonly modelId?: string;\n\n constructor(options: ElevenLabsVoiceProviderOptions) {\n this.client =\n options.client ??\n new ElevenLabsClient({\n apiKey: options.apiKey,\n });\n this.defaultVoiceId = options.defaultVoiceId;\n this.modelId = options.modelId;\n }\n\n async listVoices(): Promise<Voice[]> {\n const response = await this.client.voices.getAll();\n return (response.voices ?? []).map((voice) => ({\n id: voice.voiceId ?? '',\n name: voice.name ?? '',\n description: voice.description ?? undefined,\n language: voice.labels?.language ?? undefined,\n metadata: {\n category: voice.category ?? '',\n ...(voice.previewUrl ? { previewUrl: voice.previewUrl } : {}),\n ...(() => {\n const { language, ...rest } = voice.labels ?? {};\n return rest;\n })(),\n },\n }));\n }\n\n async synthesize(input: VoiceSynthesisInput): Promise<VoiceSynthesisResult> {\n const voiceId = input.voiceId ?? this.defaultVoiceId;\n if (!voiceId) {\n throw new Error('Voice ID is required for ElevenLabs synthesis.');\n }\n\n const formatKey = input.format ?? 'mp3';\n const outputFormat = FORMAT_MAP[formatKey] ?? FORMAT_MAP.mp3;\n const sampleRate =\n input.sampleRateHz ??\n SAMPLE_RATE[outputFormat] ??\n SAMPLE_RATE.mp3_44100_128 ??\n 44100;\n\n const voiceSettings =\n input.stability != null ||\n input.similarityBoost != null ||\n input.style != null\n ? {\n ...(input.stability != null ? { stability: input.stability } : {}),\n ...(input.similarityBoost != null\n ? { similarityBoost: input.similarityBoost }\n : {}),\n ...(input.style != null ? { style: input.style } : {}),\n }\n : undefined;\n\n const stream = await this.client.textToSpeech.convert(voiceId, {\n text: input.text,\n modelId: this.modelId,\n outputFormat,\n voiceSettings,\n });\n\n const audio = await readWebStream(stream);\n\n return {\n audio,\n format: formatKey,\n sampleRateHz: sampleRate,\n durationSeconds: undefined,\n url: undefined,\n };\n }\n}\n\nasync function readWebStream(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) {\n chunks.push(value);\n }\n }\n\n const length = chunks.reduce((total, chunk) => total + chunk.length, 0);\n const result = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n"],"mappings":";;;AAiBA,MAAMA,aAGF;CACF,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;AAED,MAAMC,cAEF;CACF,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,eAAe;CACf,eAAe;CACf,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACZ;AAED,IAAa,0BAAb,MAA8D;CAC5D,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAA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BAAiB;GACjB,KAAK;GACN;;;AAIL,eAAe,cACb,QACqB;CACrB,MAAM,SAAS,OAAO,WAAW;CACjC,MAAMC,SAAuB,EAAE;AAE/B,QAAO,MAAM;EACX,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;AAC3C,MAAI,KAAM;AACV,MAAI,MACF,QAAO,KAAK,MAAM;;CAItB,MAAM,SAAS,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,QAAQ,EAAE;CACvE,MAAM,SAAS,IAAI,WAAW,OAAO;CACrC,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,QAAQ;AAC1B,SAAO,IAAI,OAAO,OAAO;AACzB,YAAU,MAAM;;AAElB,QAAO"}
@@ -52,7 +52,7 @@ var QdrantVectorProvider = class {
52
52
  async delete(request) {
53
53
  await this.client.delete(request.collection, {
54
54
  wait: true,
55
- points: { ids: request.ids }
55
+ points: request.ids
56
56
  });
57
57
  }
58
58
  async ensureCollection(collectionName, vectorSize) {
@@ -1 +1 @@
1
- {"version":3,"file":"qdrant-vector.js","names":[],"sources":["../../src/impls/qdrant-vector.ts"],"sourcesContent":["import { QdrantClient, type QdrantClientParams } from '@qdrant/js-client-rest';\n\nimport type {\n VectorDeleteRequest,\n VectorSearchQuery,\n VectorSearchResult,\n VectorStoreProvider,\n VectorUpsertRequest,\n} from '../vector-store';\n\nexport interface QdrantVectorProviderOptions {\n url: string;\n apiKey?: string;\n client?: QdrantClient;\n createCollectionIfMissing?: boolean;\n distance?: 'Cosine' | 'Euclid' | 'Dot' | 'Manhattan';\n clientParams?: Omit<QdrantClientParams, 'url' | 'apiKey'>;\n}\n\nexport class QdrantVectorProvider implements VectorStoreProvider {\n private readonly client: QdrantClient;\n private readonly createCollectionIfMissing: boolean;\n private readonly distance: 'Cosine' | 'Euclid' | 'Dot' | 'Manhattan';\n\n constructor(options: QdrantVectorProviderOptions) {\n this.client =\n options.client ??\n new QdrantClient({\n url: options.url,\n apiKey: options.apiKey,\n ...options.clientParams,\n });\n this.createCollectionIfMissing = options.createCollectionIfMissing ?? true;\n this.distance = options.distance ?? 'Cosine';\n }\n\n async upsert(request: VectorUpsertRequest): Promise<void> {\n if (request.documents.length === 0) return;\n const firstDocument = request.documents[0];\n if (!firstDocument) return;\n const vectorSize = firstDocument.vector.length;\n\n if (this.createCollectionIfMissing) {\n await this.ensureCollection(request.collection, vectorSize);\n }\n\n const points = request.documents.map((document) => ({\n id: document.id,\n vector: document.vector,\n payload: {\n ...document.payload,\n ...(document.namespace ? { namespace: document.namespace } : {}),\n ...(document.expiresAt\n ? { expiresAt: document.expiresAt.toISOString() }\n : {}),\n },\n }));\n\n await this.client.upsert(request.collection, {\n wait: true,\n points,\n });\n }\n\n async search(query: VectorSearchQuery): Promise<VectorSearchResult[]> {\n const results = await this.client.search(query.collection, {\n vector: query.vector,\n limit: query.topK,\n filter: query.filter as Record<string, unknown>,\n score_threshold: query.scoreThreshold,\n with_payload: true,\n with_vector: false,\n });\n\n return results.map((item) => ({\n id: String(item.id),\n score: item.score,\n payload: item.payload ?? undefined,\n namespace:\n typeof item.payload === 'object' && item.payload !== null\n ? (item.payload.namespace as string | undefined)\n : undefined,\n }));\n }\n\n async delete(request: VectorDeleteRequest): Promise<void> {\n await this.client.delete(request.collection, {\n wait: true,\n points: { ids: request.ids } as any,\n });\n }\n\n private async ensureCollection(\n collectionName: string,\n vectorSize: number\n ): Promise<void> {\n try {\n await this.client.getCollection(collectionName);\n } catch (_error) {\n await this.client.createCollection(collectionName, {\n vectors: {\n size: vectorSize,\n distance: this.distance,\n },\n });\n }\n }\n}\n"],"mappings":";;;AAmBA,IAAa,uBAAb,MAAiE;CAC/D,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAAsC;AAChD,OAAK,SACH,QAAQ,UACR,IAAI,aAAa;GACf,KAAK,QAAQ;GACb,QAAQ,QAAQ;GAChB,GAAG,QAAQ;GACZ,CAAC;AACJ,OAAK,4BAA4B,QAAQ,6BAA6B;AACt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AAK;IAChB,EACF,CAAC"}
1
+ {"version":3,"file":"qdrant-vector.js","names":[],"sources":["../../src/impls/qdrant-vector.ts"],"sourcesContent":["import { QdrantClient, type QdrantClientParams } from '@qdrant/js-client-rest';\n\nimport type {\n VectorDeleteRequest,\n VectorSearchQuery,\n VectorSearchResult,\n VectorStoreProvider,\n VectorUpsertRequest,\n} from '../vector-store';\n\nexport interface QdrantVectorProviderOptions {\n url: string;\n apiKey?: string;\n client?: QdrantClient;\n createCollectionIfMissing?: boolean;\n distance?: 'Cosine' | 'Euclid' | 'Dot' | 'Manhattan';\n clientParams?: Omit<QdrantClientParams, 'url' | 'apiKey'>;\n}\n\nexport class QdrantVectorProvider implements VectorStoreProvider {\n private readonly client: QdrantClient;\n private readonly createCollectionIfMissing: boolean;\n private readonly distance: 'Cosine' | 'Euclid' | 'Dot' | 'Manhattan';\n\n constructor(options: QdrantVectorProviderOptions) {\n this.client =\n options.client ??\n new QdrantClient({\n url: options.url,\n apiKey: options.apiKey,\n ...options.clientParams,\n });\n this.createCollectionIfMissing = options.createCollectionIfMissing ?? true;\n this.distance = options.distance ?? 'Cosine';\n }\n\n async upsert(request: VectorUpsertRequest): Promise<void> {\n if (request.documents.length === 0) return;\n const firstDocument = request.documents[0];\n if (!firstDocument) return;\n const vectorSize = firstDocument.vector.length;\n\n if (this.createCollectionIfMissing) {\n await this.ensureCollection(request.collection, vectorSize);\n }\n\n const points = request.documents.map((document) => ({\n id: document.id,\n vector: document.vector,\n payload: {\n ...document.payload,\n ...(document.namespace ? { namespace: document.namespace } : {}),\n ...(document.expiresAt\n ? { expiresAt: document.expiresAt.toISOString() }\n : {}),\n },\n }));\n\n await this.client.upsert(request.collection, {\n wait: true,\n points,\n });\n }\n\n async search(query: VectorSearchQuery): Promise<VectorSearchResult[]> {\n const results = await this.client.search(query.collection, {\n vector: query.vector,\n limit: query.topK,\n filter: query.filter as Record<string, unknown>,\n score_threshold: query.scoreThreshold,\n with_payload: true,\n with_vector: false,\n });\n\n return results.map((item) => ({\n id: String(item.id),\n score: item.score,\n payload: item.payload ?? undefined,\n namespace:\n typeof item.payload === 'object' && item.payload !== null\n ? (item.payload.namespace as string | undefined)\n : undefined,\n }));\n }\n\n async delete(request: VectorDeleteRequest): Promise<void> {\n await this.client.delete(request.collection, {\n wait: true,\n points: request.ids,\n });\n }\n\n private async ensureCollection(\n collectionName: string,\n vectorSize: number\n ): Promise<void> {\n try {\n await this.client.getCollection(collectionName);\n } catch (_error) {\n await this.client.createCollection(collectionName, {\n vectors: {\n size: vectorSize,\n distance: this.distance,\n },\n });\n }\n }\n}\n"],"mappings":";;;AAmBA,IAAa,uBAAb,MAAiE;CAC/D,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAAsC;AAChD,OAAK,SACH,QAAQ,UACR,IAAI,aAAa;GACf,KAAK,QAAQ;GACb,QAAQ,QAAQ;GAChB,GAAG,QAAQ;GACZ,CAAC;AACJ,OAAK,4BAA4B,QAAQ,6BAA6B;AACtE,OAAK,WAAW,QAAQ,YAAY;;CAGtC,MAAM,OAAO,SAA6C;AACxD,MAAI,QAAQ,UAAU,WAAW,EAAG;EACpC,MAAM,gBAAgB,QAAQ,UAAU;AACxC,MAAI,CAAC,cAAe;EACpB,MAAM,aAAa,cAAc,OAAO;AAExC,MAAI,KAAK,0BACP,OAAM,KAAK,iBAAiB,QAAQ,YAAY,WAAW;EAG7D,MAAM,SAAS,QAAQ,UAAU,KAAK,cAAc;GAClD,IAAI,SAAS;GACb,QAAQ,SAAS;GACjB,SAAS;IACP,GAAG,SAAS;IACZ,GAAI,SAAS,YAAY,EAAE,WAAW,SAAS,WAAW,GAAG,EAAE;IAC/D,GAAI,SAAS,YACT,EAAE,WAAW,SAAS,UAAU,aAAa,EAAE,GAC/C,EAAE;IACP;GACF,EAAE;AAEH,QAAM,KAAK,OAAO,OAAO,QAAQ,YAAY;GAC3C,MAAM;GACN;GACD,CAAC;;CAGJ,MAAM,OAAO,OAAyD;AAUpE,UATgB,MAAM,KAAK,OAAO,OAAO,MAAM,YAAY;GACzD,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,iBAAiB,MAAM;GACvB,cAAc;GACd,aAAa;GACd,CAAC,EAEa,KAAK,UAAU;GAC5B,IAAI,OAAO,KAAK,GAAG;GACnB,OAAO,KAAK;GACZ,SAAS,KAAK,WAAW;GACzB,WACE,OAAO,KAAK,YAAY,YAAY,KAAK,YAAY,OAChD,KAAK,QAAQ,YACd;GACP,EAAE;;CAGL,MAAM,OAAO,SAA6C;AACxD,QAAM,KAAK,OAAO,OAAO,QAAQ,YAAY;GAC3C,MAAM;GACN,QAAQ,QAAQ;GACjB,CAAC;;CAGJ,MAAc,iBACZ,gBACA,YACe;AACf,MAAI;AACF,SAAM,KAAK,OAAO,cAAc,eAAe;WACxC,QAAQ;AACf,SAAM,KAAK,OAAO,iBAAiB,gBAAgB,EACjD,SAAS;IACP,MAAM;IACN,UAAU,KAAK;IAChB,EACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/integration.providers-impls",
3
- "version": "0.0.0-canary-20251220002821",
3
+ "version": "0.0.0-canary-20251220021406",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -23,8 +23,8 @@
23
23
  "test": "bun test"
24
24
  },
25
25
  "dependencies": {
26
- "@lssm/lib.contracts": "0.0.0-canary-20251220002821",
27
- "@lssm/integration.runtime": "0.0.0-canary-20251220002821",
26
+ "@lssm/lib.contracts": "0.0.0-canary-20251220021406",
27
+ "@lssm/integration.runtime": "0.0.0-canary-20251220021406",
28
28
  "@elevenlabs/elevenlabs-js": "^2.27.0",
29
29
  "@google-cloud/storage": "^7.18.0",
30
30
  "@mistralai/mistralai": "^1.11.0",
@@ -36,8 +36,8 @@
36
36
  "zod": "^4.1.13"
37
37
  },
38
38
  "devDependencies": {
39
- "@lssm/tool.tsdown": "0.0.0-canary-20251220002821",
40
- "@lssm/tool.typescript": "0.0.0-canary-20251220002821",
39
+ "@lssm/tool.tsdown": "0.0.0-canary-20251220021406",
40
+ "@lssm/tool.typescript": "0.0.0-canary-20251220021406",
41
41
  "tsdown": "^0.18.1",
42
42
  "typescript": "^5.9.3"
43
43
  },