@faiber/faiber-chat 0.17.2 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -143,7 +143,18 @@ fall back to `createSpeechRecorder()` and `transcribe()`. Never treat provisiona
143
143
  saved message. Finalization can revise earlier words. Abort and unmount should cancel.
144
144
 
145
145
  `playSpeech()` is browser-only progressive **phrase** synthesis, not provider-level audio
146
- streaming. It preserves text order and prepares one phrase ahead, without retaining audio
147
- across users. Individual phrases use the configured voice and its billing rules. Synthesis,
146
+ streaming. It preserves text order, preloads up to three phrases and schedules ready audio on the
147
+ browser audio clock. Synthesis slower than playback can still cause buffering. Individual phrases use the configured voice and its billing rules. Synthesis,
148
148
  decode, and playback errors reject the promise; cancellation stops playback and in-flight
149
149
  requests. Short utterances still depend on model generation latency.
150
+
151
+ Opt into **client-side** replay with `{ cacheScope: tenantId + ':' + userId + ':' + voiceRevision, persistCache: true }`.
152
+ The latest utterance's compressed MP3 sections are kept in browser IndexedDB (up to 16 MiB);
153
+ replay and page reload reuse available sections without TTS requests. Omit `persistCache`
154
+ for memory-only replay, or omit `cacheScope` to disable caching. This stores private audio
155
+ on the device: only enable persistence when your product permits it. Include the service,
156
+ tenant, authenticated user and voice revision in the scope. Call exported
157
+ `clearSpeechPlaybackCache()` on logout, and abort active playback first. Changing text,
158
+ language or scope replaces the last entry. Cancelled playback retains already generated
159
+ sections; a replay requests only missing sections. Storage denial falls back to memory.
160
+ No server cache is introduced.
package/dist/.tsbuildinfo CHANGED
@@ -1 +1 @@
1
- {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/axios/index.d.ts","../../core/dist/types.d.ts","../../core/dist/env.d.ts","../../core/dist/auth.d.ts","../../core/dist/client.d.ts","../../core/dist/resource.d.ts","../../core/dist/openapi.d.ts","../../core/dist/realtime.d.ts","../../core/dist/index.d.ts","../../task/dist/types.d.ts","../../task/dist/workspace.d.ts","../../task/dist/operations.types.d.ts","../../task/dist/operations.d.ts","../../task/dist/index.d.ts","../src/workspace.ts","../src/types.ts","../src/operations.types.ts","../src/operations.ts","../src/speech-recorder.ts","../src/speech-playback.ts","../src/speech-live.ts","../src/index.ts"],"fileIdsList":[[68,74,75,76,77,78,79,80],[68,74,76],[68,75],[75,78,81],[75,81],[68],[68,73],[61],[60,61],[60,61,62,63,64,65,66,67],[60,61,64],[60],[60,68,69,70,71,72],[60,68,69,70,71],[68,69],[60,68,69]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"2343ec253c90c370449755739733f5f429f58cffdb51a50977bb4a042012fa8f","impliedFormat":99},{"version":"6cc1f17dc5454eb1112cfb4a2e2ddc93de8c3f9016c8db7bdf0328caac374ffa","impliedFormat":99},{"version":"82065c5512d8d6f81b26cf13ea9ecd3e558be9560f7b5c62260858219ecd87f7","impliedFormat":99},{"version":"ed17ed1b2bcf384c88bc6cec6b427989b98db99fc7ad35a50605501a463bbc53","impliedFormat":99},{"version":"82bf4efcca8ab8764a91ac126c0af605ab6717ee94b2316461b5fa388b27e165","impliedFormat":99},{"version":"82ffc9a1d95766c8f6f6bb4316b1d83e9d6a1d4ec41057d1a897cca70176bfc1","impliedFormat":99},{"version":"3f5eeb0a84713ccf640b9a6af4629e006f59d7629abc3fc95af2efb062fd0b83","impliedFormat":99},{"version":"ac62f6b0f2e963ea9a251ee8384e64cebe0fe4acd32ca177d838d7c5a7ad2b43","impliedFormat":99},{"version":"fdd1b5a8a2b98f82c94e4dc4e3b207ca81766b656d23acd3c7458fffd9af21dd","impliedFormat":99},{"version":"7d9f11e32135998fd237bef7e5d27a056202e21c82f322bd9d9a1016cdac01b1","impliedFormat":99},{"version":"957290d195fac41901b74d0336ea5f6d39e6b1f893cc05c8ef38cdfed375fd26","impliedFormat":99},{"version":"6c03f7c38960990bcb88f5896be7df8527e98fa639dd1b08a108c3b07d7eb2d0","impliedFormat":99},{"version":"e6a4d605f200cf1474350431c9d19cfbf4ea432e5f379ef2374045930c4f84f0","impliedFormat":99},{"version":"e06e45393e7abefd1585bd057f80621a3f4b369d47bd1af1128582c99026e1b4","impliedFormat":99},{"version":"57ecdcf2ad8b1e3024cb03a4cd1abcd4a5f49203befbdd2b27b393fdb2bd565f","signature":"dac85f399b63eeb989b4e1e1db8e4a1bd7435dd49c7bdd1ff8c29b33abcc0b1e","impliedFormat":99},{"version":"16c2ef0848f9e21595f3a883183af7d06d3a8173c038b00574ee2710a3b8baa5","signature":"1ddf5cc92fee8b9d607f8c2537b80a03500b10d1c1e2d2dd5faef819bafc3f0f","impliedFormat":99},{"version":"01146f6265e7ff241360a2ec9a3e13d71bcbf288f4ac3294fdcf2e7fe2a874ff","signature":"2ac24648212ca5e81c69328c83b80965e3af075de06f011f75af04f69e297464","impliedFormat":99},{"version":"f529fc85a29bc5513fdf85c0944411b8685bfaac9d68e4bfc6c2e589183b30ae","signature":"33c3497f1dd00c607d278275ac5cac8dc15f01fa173f310812b49c27dddea0d5","impliedFormat":99},{"version":"695af79a049dc07658aeb7e3001b0c8cc09757232f8f5fdde19cd782a0e1efeb","signature":"db7e7630d9d03be96c69405ba7808da66664c70253761bf2514c9b48f730e1ba","impliedFormat":99},{"version":"1ee775df09e140fa90688c819729c69e6ed1b558bb6215edbf92442a5238163e","signature":"c1c5f00430577f3081fa8abdbf2cbd14524539c7ac1ab4a904e3d212a679d92b","impliedFormat":99},{"version":"30fcab33101d3e3a7e5bd9ee1fb4618f910f81c7af39f4a38b38e5ca59782e5e","signature":"97847fd60c6c81e812163ba48ebd12b6274fdba73832ad4c2162a271a365b5bf","impliedFormat":99},{"version":"113e92171e40003e3fd859a62a4ac26ef4a2358affcb49bf701ab67e0453f780","signature":"fd34900a43ba4368b5da1264ffa3a5aefd4273ac909e611c044bd44abfa73b98","impliedFormat":99}],"root":[[74,81]],"options":{"composite":true,"declaration":true,"declarationMap":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[81,1],[77,2],[76,3],[80,4],[79,5],[75,6],[74,7],[63,8],[64,9],[62,8],[68,10],[66,11],[65,11],[61,12],[73,13],[72,14],[71,15],[69,6],[70,16]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/axios/index.d.ts","../../core/dist/types.d.ts","../../core/dist/env.d.ts","../../core/dist/auth.d.ts","../../core/dist/client.d.ts","../../core/dist/resource.d.ts","../../core/dist/openapi.d.ts","../../core/dist/realtime.d.ts","../../core/dist/index.d.ts","../../task/dist/types.d.ts","../../task/dist/workspace.d.ts","../../task/dist/operations.types.d.ts","../../task/dist/operations.d.ts","../../task/dist/index.d.ts","../src/workspace.ts","../src/types.ts","../src/operations.types.ts","../src/operations.ts","../src/speech-recorder.ts","../src/speech-playback.ts","../src/speech-live.ts","../src/index.ts"],"fileIdsList":[[68,74,75,76,77,78,79,80],[68,74,76],[68,75],[75,78,81],[75,81],[68],[68,73],[61],[60,61],[60,61,62,63,64,65,66,67],[60,61,64],[60],[60,68,69,70,71,72],[60,68,69,70,71],[68,69],[60,68,69]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"2343ec253c90c370449755739733f5f429f58cffdb51a50977bb4a042012fa8f","impliedFormat":99},{"version":"6cc1f17dc5454eb1112cfb4a2e2ddc93de8c3f9016c8db7bdf0328caac374ffa","impliedFormat":99},{"version":"82065c5512d8d6f81b26cf13ea9ecd3e558be9560f7b5c62260858219ecd87f7","impliedFormat":99},{"version":"ed17ed1b2bcf384c88bc6cec6b427989b98db99fc7ad35a50605501a463bbc53","impliedFormat":99},{"version":"82bf4efcca8ab8764a91ac126c0af605ab6717ee94b2316461b5fa388b27e165","impliedFormat":99},{"version":"82ffc9a1d95766c8f6f6bb4316b1d83e9d6a1d4ec41057d1a897cca70176bfc1","impliedFormat":99},{"version":"3f5eeb0a84713ccf640b9a6af4629e006f59d7629abc3fc95af2efb062fd0b83","impliedFormat":99},{"version":"ac62f6b0f2e963ea9a251ee8384e64cebe0fe4acd32ca177d838d7c5a7ad2b43","impliedFormat":99},{"version":"fdd1b5a8a2b98f82c94e4dc4e3b207ca81766b656d23acd3c7458fffd9af21dd","impliedFormat":99},{"version":"7d9f11e32135998fd237bef7e5d27a056202e21c82f322bd9d9a1016cdac01b1","impliedFormat":99},{"version":"957290d195fac41901b74d0336ea5f6d39e6b1f893cc05c8ef38cdfed375fd26","impliedFormat":99},{"version":"6c03f7c38960990bcb88f5896be7df8527e98fa639dd1b08a108c3b07d7eb2d0","impliedFormat":99},{"version":"e6a4d605f200cf1474350431c9d19cfbf4ea432e5f379ef2374045930c4f84f0","impliedFormat":99},{"version":"e06e45393e7abefd1585bd057f80621a3f4b369d47bd1af1128582c99026e1b4","impliedFormat":99},{"version":"57ecdcf2ad8b1e3024cb03a4cd1abcd4a5f49203befbdd2b27b393fdb2bd565f","signature":"dac85f399b63eeb989b4e1e1db8e4a1bd7435dd49c7bdd1ff8c29b33abcc0b1e","impliedFormat":99},{"version":"16c2ef0848f9e21595f3a883183af7d06d3a8173c038b00574ee2710a3b8baa5","signature":"1ddf5cc92fee8b9d607f8c2537b80a03500b10d1c1e2d2dd5faef819bafc3f0f","impliedFormat":99},{"version":"01146f6265e7ff241360a2ec9a3e13d71bcbf288f4ac3294fdcf2e7fe2a874ff","signature":"2ac24648212ca5e81c69328c83b80965e3af075de06f011f75af04f69e297464","impliedFormat":99},{"version":"f529fc85a29bc5513fdf85c0944411b8685bfaac9d68e4bfc6c2e589183b30ae","signature":"33c3497f1dd00c607d278275ac5cac8dc15f01fa173f310812b49c27dddea0d5","impliedFormat":99},{"version":"695af79a049dc07658aeb7e3001b0c8cc09757232f8f5fdde19cd782a0e1efeb","signature":"db7e7630d9d03be96c69405ba7808da66664c70253761bf2514c9b48f730e1ba","impliedFormat":99},{"version":"90f32542a3e6cf392782538b66244d87186f023de73092b2b74470c85b92da46","signature":"c55c79450489b147cee9aeeb9023922ded904e33851323f2ad96a46ebd14d2cd","impliedFormat":99},{"version":"30fcab33101d3e3a7e5bd9ee1fb4618f910f81c7af39f4a38b38e5ca59782e5e","signature":"97847fd60c6c81e812163ba48ebd12b6274fdba73832ad4c2162a271a365b5bf","impliedFormat":99},{"version":"113e92171e40003e3fd859a62a4ac26ef4a2358affcb49bf701ab67e0453f780","signature":"fd34900a43ba4368b5da1264ffa3a5aefd4273ac909e611c044bd44abfa73b98","impliedFormat":99}],"root":[[74,81]],"options":{"composite":true,"declaration":true,"declarationMap":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[81,1],[77,2],[76,3],[80,4],[79,5],[75,6],[74,7],[63,8],[64,9],[62,8],[68,10],[66,11],[65,11],[61,12],[73,13],[72,14],[71,15],[69,6],[70,16]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
@@ -2,18 +2,26 @@ import type { ChatApi } from './index.js';
2
2
  import type { SpeechSynthesisInput } from './types.js';
3
3
  export interface SpeechPlaybackOptions {
4
4
  signal?: AbortSignal;
5
- /** Called when the first audio actually starts, and while waiting for later audio. */
5
+ /** Reports actual playback and waits when synthesis cannot keep up. */
6
6
  onPhase?: (phase: 'buffering' | 'playing') => void;
7
+ /** Opt-in local replay. Include service/tenant, authenticated user and voice/settings revision.
8
+ * The latest utterance replaces the previous one. Never use a shared anonymous scope. */
9
+ cacheScope?: string;
10
+ /** Persist the last compressed audio in IndexedDB across reloads. Requires cacheScope.
11
+ * Audio remains on this device until replaced or clearSpeechPlaybackCache() is called. */
12
+ persistCache?: boolean;
7
13
  }
8
- /** Split on natural boundaries, with a short first phrase for lower startup latency.
9
- * All non-whitespace text is retained, including Persian punctuation and long tokens. */
14
+ /** Erase the latest replay audio from memory and IndexedDB, e.g. on logout/account switch.
15
+ * Does not stop an active player; abort its signal first. Storage failures are non-fatal. */
16
+ export declare function clearSpeechPlaybackCache(): Promise<void>;
17
+ /** Split into balanced speech-sized phrases; preserve every non-whitespace token. */
10
18
  export declare function splitSpeechText(text: string): string[];
11
- /** Play compact MP3 in phrase order while preparing the next phrase. Requires chat:ai.
12
- * Uses the configured ChatApi transport/authentication. Browser-only; invoke after a user
13
- * gesture. Resolves when playback ends, rejects on provider/playback errors. Abort stops
14
- * playback and outstanding requests. At most two requests/audio segments are outstanding;
15
- * no audio or text is cached across users. This is progressive phrase synthesis, not a
16
- * provider token/audio stream. Each phrase is independently billed by the configured provider.
19
+ /** Progressive MP3 playback through the configured authenticated ChatApi (chat:ai).
20
+ * Starts the first phrase immediately; serial synthesis runs independently up to three
21
+ * phrases ahead. Ready buffers are scheduled on the audio clock without waiting for ended.
22
+ * Slower-than-realtime generation may still require buffering. Each newly synthesized phrase
23
+ * is billed independently; cached replay makes no synthesis request. Browser-only, invoke
24
+ * after a user gesture. Abort stops all scheduled audio and outstanding network requests.
17
25
  */
18
26
  export declare function playSpeech(api: ChatApi, input: SpeechSynthesisInput, options?: SpeechPlaybackOptions): Promise<void>;
19
27
  //# sourceMappingURL=speech-playback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"speech-playback.d.ts","sourceRoot":"","sources":["../src/speech-playback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;CACpD;AACD;yFACyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CActD;AACD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C9H"}
1
+ {"version":3,"file":"speech-playback.d.ts","sourceRoot":"","sources":["../src/speech-playback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uEAAuE;IACvE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;IACnD;6FACyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;8FAC0F;IAC1F,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAgCD;6FAC6F;AAC7F,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAG9D;AACD,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAStD;AACD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA6E9H"}
@@ -1,12 +1,52 @@
1
- /** Split on natural boundaries, with a short first phrase for lower startup latency.
2
- * All non-whitespace text is retained, including Persian punctuation and long tokens. */
1
+ let latest;
2
+ let generation = 0;
3
+ let storageQueue = Promise.resolve();
4
+ const MAX_CACHE_BYTES = 16 * 1024 * 1024;
5
+ function database() {
6
+ return new Promise((resolve, reject) => {
7
+ const request = indexedDB.open('faiber-last-speech-v1', 1);
8
+ let expired = false;
9
+ const timer = setTimeout(() => { expired = true; reject(new Error('Audio storage unavailable')); }, 1000);
10
+ request.onupgradeneeded = () => request.result.createObjectStore('audio');
11
+ request.onerror = () => { clearTimeout(timer); reject(request.error); };
12
+ request.onsuccess = () => { clearTimeout(timer); if (expired)
13
+ request.result.close();
14
+ else
15
+ resolve(request.result); };
16
+ });
17
+ }
18
+ async function stored(write) {
19
+ const db = await database();
20
+ try {
21
+ return await new Promise((resolve, reject) => {
22
+ const tx = db.transaction('audio', write === undefined ? 'readonly' : 'readwrite');
23
+ const store = tx.objectStore('audio');
24
+ const request = write === undefined ? store.get('latest') : write === null ? store.delete('latest') : store.put(write, 'latest');
25
+ tx.oncomplete = () => resolve(write === undefined ? request.result : undefined);
26
+ tx.onerror = tx.onabort = () => reject(tx.error);
27
+ });
28
+ }
29
+ finally {
30
+ db.close();
31
+ }
32
+ }
33
+ function persist(value) {
34
+ storageQueue = storageQueue.catch(() => { }).then(() => stored(value)).catch(() => { });
35
+ return storageQueue;
36
+ }
37
+ /** Erase the latest replay audio from memory and IndexedDB, e.g. on logout/account switch.
38
+ * Does not stop an active player; abort its signal first. Storage failures are non-fatal. */
39
+ export async function clearSpeechPlaybackCache() {
40
+ generation++;
41
+ latest = undefined;
42
+ await persist(null);
43
+ }
44
+ /** Split into balanced speech-sized phrases; preserve every non-whitespace token. */
3
45
  export function splitSpeechText(text) {
4
- const words = text.trim().split(/\s+/u).filter(Boolean);
5
46
  const parts = [];
6
47
  let part = '';
7
- for (const word of words) {
8
- const limit = 85;
9
- if (part && part.length + word.length + 1 > limit) {
48
+ for (const word of text.trim().split(/\s+/u).filter(Boolean)) {
49
+ if (part && part.length + word.length + 1 > (parts.length ? 38 : 55)) {
10
50
  parts.push(part);
11
51
  part = '';
12
52
  }
@@ -20,12 +60,12 @@ export function splitSpeechText(text) {
20
60
  parts.push(part);
21
61
  return parts;
22
62
  }
23
- /** Play compact MP3 in phrase order while preparing the next phrase. Requires chat:ai.
24
- * Uses the configured ChatApi transport/authentication. Browser-only; invoke after a user
25
- * gesture. Resolves when playback ends, rejects on provider/playback errors. Abort stops
26
- * playback and outstanding requests. At most two requests/audio segments are outstanding;
27
- * no audio or text is cached across users. This is progressive phrase synthesis, not a
28
- * provider token/audio stream. Each phrase is independently billed by the configured provider.
63
+ /** Progressive MP3 playback through the configured authenticated ChatApi (chat:ai).
64
+ * Starts the first phrase immediately; serial synthesis runs independently up to three
65
+ * phrases ahead. Ready buffers are scheduled on the audio clock without waiting for ended.
66
+ * Slower-than-realtime generation may still require buffering. Each newly synthesized phrase
67
+ * is billed independently; cached replay makes no synthesis request. Browser-only, invoke
68
+ * after a user gesture. Abort stops all scheduled audio and outstanding network requests.
29
69
  */
30
70
  export async function playSpeech(api, input, options = {}) {
31
71
  if (!input.text.trim() || [...input.text].length > 5000)
@@ -36,54 +76,112 @@ export async function playSpeech(api, input, options = {}) {
36
76
  if (options.signal?.aborted)
37
77
  abort();
38
78
  const context = new AudioContext();
39
- let source;
79
+ const sources = new Set();
80
+ const phaseTimers = new Set();
40
81
  const check = () => { if (controller.signal.aborted)
41
82
  throw new DOMException('Playback cancelled', 'AbortError'); };
83
+ let wake;
84
+ let rejectCompletion;
85
+ const onAbort = () => { for (const source of sources) {
86
+ try {
87
+ source.stop();
88
+ }
89
+ catch { }
90
+ } wake?.(); rejectCompletion?.(new DOMException('Playback cancelled', 'AbortError')); };
91
+ controller.signal.addEventListener('abort', onAbort);
92
+ let producer;
42
93
  try {
43
94
  check();
44
95
  await context.resume();
45
96
  const parts = splitSpeechText(input.text);
46
- const load = async (text) => {
47
- check();
48
- const response = await api.synthesize({ ...input, text, format: 'mp3' }, { signal: controller.signal });
49
- check();
50
- const buffer = await context.decodeAudioData(await response.data.arrayBuffer());
51
- check();
52
- return buffer;
53
- };
54
- let next = load(parts[0]);
55
- // Attach a rejection handler immediately while current audio is playing.
56
- void next.catch(() => { });
57
- for (let i = 0; i < parts.length; i++) {
58
- if (i > 0)
59
- options.onPhase?.('buffering');
60
- const buffer = await next;
61
- check();
62
- if (i + 1 < parts.length) {
63
- next = load(parts[i + 1]);
64
- void next.catch(() => { });
97
+ const epoch = ++generation;
98
+ let cache;
99
+ if (options.cacheScope) {
100
+ const bytes = new TextEncoder().encode(JSON.stringify([options.cacheScope, input.language, parts]));
101
+ const key = Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes)), n => n.toString(16).padStart(2, '0')).join('');
102
+ if (!latest && options.persistCache) {
103
+ await storageQueue;
104
+ const saved = await stored().catch(() => undefined);
105
+ if (generation === epoch)
106
+ latest = saved;
65
107
  }
66
- await new Promise((resolve, reject) => {
67
- const onAbort = () => { try {
68
- source?.stop();
108
+ check();
109
+ cache = latest?.key === key && latest.clips.length === parts.length && latest.clips.every(clip => clip === null || clip instanceof Blob) ? latest : { key, clips: parts.map(() => null) };
110
+ if (generation === epoch)
111
+ latest = cache;
112
+ }
113
+ let completed = 0, endTime = 0;
114
+ let resolveCompletion;
115
+ const completion = new Promise((resolve, reject) => { resolveCompletion = resolve; rejectCompletion = reject; });
116
+ const changed = () => { wake?.(); wake = undefined; };
117
+ const wait = () => new Promise(resolve => { wake = resolve; });
118
+ producer = (async () => {
119
+ for (let i = 0; i < parts.length; i++) {
120
+ while (i - completed >= 3) {
121
+ await wait();
122
+ check();
123
+ }
124
+ check();
125
+ let blob = cache?.clips[i];
126
+ if (!blob) {
127
+ const response = await api.synthesize({ ...input, text: parts[i], format: 'mp3' }, { signal: controller.signal });
128
+ check();
129
+ blob = response.data;
130
+ if (cache && generation === epoch) {
131
+ cache.clips[i] = blob;
132
+ if (cache.clips.reduce((sum, clip) => sum + (clip?.size ?? 0), 0) <= MAX_CACHE_BYTES) {
133
+ if (options.persistCache)
134
+ void persist({ key: cache.key, clips: [...cache.clips] });
135
+ }
136
+ else {
137
+ cache = undefined;
138
+ latest = undefined;
139
+ if (options.persistCache)
140
+ void persist(null);
141
+ }
142
+ }
69
143
  }
70
- catch { } reject(new DOMException('Playback cancelled', 'AbortError')); };
71
- controller.signal.addEventListener('abort', onAbort, { once: true });
72
- source = context.createBufferSource();
144
+ const buffer = await context.decodeAudioData(await blob.arrayBuffer());
145
+ check();
146
+ const source = context.createBufferSource();
73
147
  source.buffer = buffer;
74
148
  source.connect(context.destination);
75
- source.addEventListener('ended', () => { controller.signal.removeEventListener('abort', onAbort); resolve(); }, { once: true });
76
- source.start();
77
- options.onPhase?.('playing');
78
- });
79
- }
149
+ // A small initial lead lets the next request overlap the first phrase's start.
150
+ const when = Math.max(context.currentTime + (i === 0 && !cache?.clips.every(Boolean) ? 0.5 : 0), endTime);
151
+ endTime = when + buffer.duration;
152
+ sources.add(source);
153
+ source.addEventListener('ended', () => {
154
+ sources.delete(source);
155
+ source.disconnect();
156
+ completed++;
157
+ changed();
158
+ if (completed === parts.length)
159
+ resolveCompletion();
160
+ if (completed < parts.length && sources.size === 0 && !controller.signal.aborted)
161
+ options.onPhase?.('buffering');
162
+ }, { once: true });
163
+ const starting = sources.size === 1;
164
+ source.start(when);
165
+ if (starting) {
166
+ const delay = (when - context.currentTime) * 1000;
167
+ if (delay > 0) {
168
+ const timer = setTimeout(() => { phaseTimers.delete(timer); if (!controller.signal.aborted)
169
+ options.onPhase?.('playing'); }, delay);
170
+ phaseTimers.add(timer);
171
+ }
172
+ else
173
+ options.onPhase?.('playing');
174
+ }
175
+ }
176
+ })().catch(error => { rejectCompletion?.(error); }).finally(changed);
177
+ await completion;
80
178
  }
81
179
  finally {
180
+ for (const timer of phaseTimers)
181
+ clearTimeout(timer);
82
182
  controller.abort();
83
- try {
84
- source?.stop();
85
- }
86
- catch { }
183
+ // A compliant transport observes AbortSignal; do not keep a cancelled player open.
184
+ void producer?.catch(() => { });
87
185
  await context.close().catch(() => { });
88
186
  options.signal?.removeEventListener('abort', abort);
89
187
  }
@@ -1 +1 @@
1
- {"version":3,"file":"speech-playback.js","sourceRoot":"","sources":["../src/speech-playback.ts"],"names":[],"mappings":"AAQA;yFACyF;AACzF,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC;YAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAC,IAAI,GAAG,EAAE,CAAC;QAAC,CAAC;QACnF,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QACjC,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAC,IAAI,GAAG,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AACD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAY,EAAE,KAA2B,EAAE,UAAiC,EAAE;IAC7G,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IA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E,GAAE,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faiber/faiber-chat",
3
- "version": "0.17.2",
3
+ "version": "0.18.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "@faiber/sdk-core": "0.17.2",
20
- "@faiber/faiber-task": "0.17.2"
19
+ "@faiber/sdk-core": "0.18.2",
20
+ "@faiber/faiber-task": "0.18.2"
21
21
  }
22
22
  }