vibes-diy 14.3.402 → 14.3.403

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.
@@ -27359,6 +27359,21 @@ function callAIOversizeImageChars(prompt) {
27359
27359
  }
27360
27360
  return total > CALLAI_MAX_IMAGE_URL_CHARS ? total : void 0;
27361
27361
  }
27362
+ function callAIAudioTooLargeMessage(chars2) {
27363
+ const mb = /* @__PURE__ */ __name((n3) => (n3 / (1024 * 1024)).toFixed(1), "mb");
27364
+ return `audio too large: ${mb(chars2)} MB of audio and images; callAI accepts up to ${mb(CALLAI_MAX_AUDIO_CHARS)} MB per request. Try a shorter recording.`;
27365
+ }
27366
+ function callAIOversizeAudioChars(prompt) {
27367
+ if (typeof prompt === "string") return void 0;
27368
+ let audio = 0;
27369
+ let images = 0;
27370
+ for (const part of prompt) {
27371
+ if (part.type === "input_audio") audio += part.input_audio.data.length;
27372
+ if (part.type === "image_url") images += part.image_url.url.length;
27373
+ }
27374
+ if (audio === 0) return void 0;
27375
+ return audio + images > CALLAI_MAX_AUDIO_CHARS ? audio + images : void 0;
27376
+ }
27362
27377
  function isResCallAI(x3) {
27363
27378
  return !(ResCallAI(x3) instanceof type.errors);
27364
27379
  }
@@ -27374,6 +27389,9 @@ function isResErrorImgGen(x3) {
27374
27389
  function isResVibeListModels(x3) {
27375
27390
  return !(ResVibeListModels(x3) instanceof type.errors);
27376
27391
  }
27392
+ function isResVibeSpeak(x3) {
27393
+ return !(ResVibeSpeak(x3) instanceof type.errors);
27394
+ }
27377
27395
  function isResVibeSearchPlaces(x3) {
27378
27396
  return !(ResVibeSearchPlaces(x3) instanceof type.errors);
27379
27397
  }
@@ -27507,7 +27525,7 @@ function isEvtVibeColorOverride(x3) {
27507
27525
  function isEvtVibeLookCss(x3) {
27508
27526
  return !(EvtVibeLookCss(x3) instanceof type.errors);
27509
27527
  }
27510
- var Base, EvtRuntimeReady, EvtRuntimeAck, EvtRuntimeDrafting, EvtVibeSetSource, EvtVibeHotSwapError, EvtVibeHotSwapOk, EvtVibeEditMode, EvtVibeEditText, EvtVibeEditRequest, EvtVibeHotSwapPainted, EvtVibeNetworkActive, EvtVibeNetworkIdle, JSONSchema, CallAIContentPart, CallAIPrompt, ReqCallAI, CALLAI_MAX_IMAGE_URL_CHARS, CALLAI_SIGN_IN, ResOkCallAI, ResErrorCallAI, ResCallAI, NativeEngine, NativeInferenceQuota, NativeInferenceAvailability, NativeImageSourceAvailability, NativeImagePlaygroundCreated, NativeImagePlaygroundCancelled, ImgGenTargetShape, ImgGenSourceShape, ReqImgGen, ImgGenFile, ResOkImgGen, ResErrorImgGen, ResImgGen, ModelKind, ModelOption, ReqVibeListModels, ResOkVibeListModels, ResErrorVibeListModels, ResVibeListModels, VibePlacesLatLng, VibePlacesBounds, VibePlacesQuery, VibePlace, VibePlacesResult, ReqVibeSearchPlaces, ResOkVibeSearchPlaces, ResErrorVibeSearchPlaces, ResVibeSearchPlaces, VibePlacesMapModeDecision, ReqVibePlacesMapMode, ResOkVibePlacesMapMode, ResErrorVibePlacesMapMode, ResVibePlacesMapMode, IMG_GEN_CANCELLED, IMG_GEN_NEEDS_TAP, IMG_GEN_UNREACHABLE, IMG_GEN_UNREACHABLE_MESSAGE, CAPTURE_REFUSED_CODE, CAPTURE_REFUSED_MESSAGE, ReqGetDoc, ReqQueryDocs, ReqSubscribeDocs, ReqBroadcastEphemeral, ReqListDbNames, ReqSyncPull, ReqSyncPush, EvtSyncReconnected, MIRROR_PROTO, MIRROR_CAP_PENDING, MIRROR_CAP_RECEIPTS, MirrorOp, MirrorWriteOp, ReqMirrorSubscribe, ReqMirrorWrite, ReqMirrorInterest, DRAFT_READ_ONLY_CODE, DRAFT_READ_ONLY_MESSAGE, EvtMirrorDelta, EvtMirrorReset, EvtMirrorSettled, EvtMirrorRefused, MirrorWriteSettle, EvtMirrorWriteSettled, ResOkVibePutAsset, ResErrorVibePutAsset, ResVibePutAsset, EvtVibePutAssetProgress, EvtVibeImgGenPreview, viewerPayload, viewerCapabilities, ReqVibeWhoAmI, ResVibeWhoAmI, ReqVibeAccessFnSource, ResVibeAccessFnSource, ReqVibeLookupHandles, lookupHandleItem, ResVibeLookupHandles, ReqVibeProfileInfo, ResVibeProfileInfo, ReqVibeUpdateAvatarCid, ResVibeUpdateAvatarCid, ReqVibeLogin, EvtVibeViewerChanged, socialEdgeView, EvtVibeSocialChanged, EvtVibeSocialCleared, ReqVibeSocial, ResVibeSocial, ReqVibeRequestFollowersAccess, ResVibeRequestFollowersAccess, ReqVibeSetVisibility, ResVibeSetVisibility, ReqVibeSetAccountPrivacy, ResVibeSetAccountPrivacy, ReqVibeSocialInvite, ResVibeSocialInvite, ReqVibeInviteByEmail, ResVibeInviteByEmail, ReqVibeResolveInviteSubjects, ResVibeResolveInviteSubjects, ReqVibeLinkAccount, ResVibeLinkAccount, ReqVibeConnectionStatus, ResVibeConnectionStatus, ReqVibeApiFetch, ResVibeApiFetch, EvtVibeAccessFnSource, EvtVibeColorOverride, EvtVibeLookCss, EvtVibeScrollToTop, EvtVibeEnablePullToRefresh, EvtVibeUrlState, EvtVibeContentHeight, EvtVibeContentHeightRequest, ReqOpenDmThread;
27528
+ var Base, EvtRuntimeReady, EvtRuntimeAck, EvtRuntimeDrafting, EvtVibeSetSource, EvtVibeHotSwapError, EvtVibeHotSwapOk, EvtVibeEditMode, EvtVibeEditText, EvtVibeEditRequest, EvtVibeHotSwapPainted, EvtVibeNetworkActive, EvtVibeNetworkIdle, JSONSchema, CallAIContentPart, CallAIPrompt, ReqCallAI, CALLAI_MAX_IMAGE_URL_CHARS, CALLAI_MAX_AUDIO_CHARS, CALLAI_SIGN_IN, ResOkCallAI, ResErrorCallAI, ResCallAI, NativeEngine, NativeInferenceQuota, NativeInferenceAvailability, NativeImageSourceAvailability, NativeImagePlaygroundCreated, NativeImagePlaygroundCancelled, ImgGenTargetShape, ImgGenSourceShape, ReqImgGen, ImgGenFile, ResOkImgGen, ResErrorImgGen, ResImgGen, ModelKind, ModelOption, ReqVibeListModels, ResOkVibeListModels, ResErrorVibeListModels, ResVibeListModels, SPEECH_DEFAULT_MODEL, SPEECH_DEFAULT_VOICE, SPEECH_MAX_INPUT_CHARS, SPEECH_VOICES, ReqVibeSpeak, ResOkVibeSpeak, ResErrorVibeSpeak, ResVibeSpeak, VibePlacesLatLng, VibePlacesBounds, VibePlacesQuery, VibePlace, VibePlacesResult, ReqVibeSearchPlaces, ResOkVibeSearchPlaces, ResErrorVibeSearchPlaces, ResVibeSearchPlaces, VibePlacesMapModeDecision, ReqVibePlacesMapMode, ResOkVibePlacesMapMode, ResErrorVibePlacesMapMode, ResVibePlacesMapMode, IMG_GEN_CANCELLED, IMG_GEN_NEEDS_TAP, IMG_GEN_UNREACHABLE, IMG_GEN_UNREACHABLE_MESSAGE, CAPTURE_REFUSED_CODE, CAPTURE_REFUSED_MESSAGE, ReqGetDoc, ReqQueryDocs, ReqSubscribeDocs, ReqBroadcastEphemeral, ReqListDbNames, ReqSyncPull, ReqSyncPush, EvtSyncReconnected, MIRROR_PROTO, MIRROR_CAP_PENDING, MIRROR_CAP_RECEIPTS, MirrorOp, MirrorWriteOp, ReqMirrorSubscribe, ReqMirrorWrite, ReqMirrorInterest, DRAFT_READ_ONLY_CODE, DRAFT_READ_ONLY_MESSAGE, EvtMirrorDelta, EvtMirrorReset, EvtMirrorSettled, EvtMirrorRefused, MirrorWriteSettle, EvtMirrorWriteSettled, ResOkVibePutAsset, ResErrorVibePutAsset, ResVibePutAsset, EvtVibePutAssetProgress, EvtVibeImgGenPreview, viewerPayload, viewerCapabilities, ReqVibeWhoAmI, ResVibeWhoAmI, ReqVibeAccessFnSource, ResVibeAccessFnSource, ReqVibeLookupHandles, lookupHandleItem, ResVibeLookupHandles, ReqVibeProfileInfo, ResVibeProfileInfo, ReqVibeUpdateAvatarCid, ResVibeUpdateAvatarCid, ReqVibeLogin, EvtVibeViewerChanged, socialEdgeView, EvtVibeSocialChanged, EvtVibeSocialCleared, ReqVibeSocial, ResVibeSocial, ReqVibeRequestFollowersAccess, ResVibeRequestFollowersAccess, ReqVibeSetVisibility, ResVibeSetVisibility, ReqVibeSetAccountPrivacy, ResVibeSetAccountPrivacy, ReqVibeSocialInvite, ResVibeSocialInvite, ReqVibeInviteByEmail, ResVibeInviteByEmail, ReqVibeResolveInviteSubjects, ResVibeResolveInviteSubjects, ReqVibeLinkAccount, ResVibeLinkAccount, ReqVibeConnectionStatus, ResVibeConnectionStatus, ReqVibeApiFetch, ResVibeApiFetch, EvtVibeAccessFnSource, EvtVibeColorOverride, EvtVibeLookCss, EvtVibeScrollToTop, EvtVibeEnablePullToRefresh, EvtVibeUrlState, EvtVibeContentHeight, EvtVibeContentHeightRequest, ReqOpenDmThread;
27511
27529
  var init_types2 = __esm({
27512
27530
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/types/index.ts"() {
27513
27531
  "use strict";
@@ -27728,6 +27746,14 @@ var init_types2 = __esm({
27728
27746
  type: "'image_url'",
27729
27747
  image_url: type({ url: "string" })
27730
27748
  })
27749
+ ).or(
27750
+ // A recording for an audio-capable chat model (speech to text): base64
27751
+ // bytes with no data-URL prefix, and the container format. OpenRouter's
27752
+ // `input_audio` part, passed through to the provider unchanged.
27753
+ type({
27754
+ type: "'input_audio'",
27755
+ input_audio: type({ data: "string", format: "string" })
27756
+ })
27731
27757
  )
27732
27758
  );
27733
27759
  CallAIPrompt = lazyType(() => type("string").or(CallAIContentPart.array()));
@@ -27755,6 +27781,9 @@ var init_types2 = __esm({
27755
27781
  CALLAI_MAX_IMAGE_URL_CHARS = 8 * 1024 * 1024;
27756
27782
  __name(callAIImageTooLargeMessage, "callAIImageTooLargeMessage");
27757
27783
  __name(callAIOversizeImageChars, "callAIOversizeImageChars");
27784
+ CALLAI_MAX_AUDIO_CHARS = 10 * 1024 * 1024;
27785
+ __name(callAIAudioTooLargeMessage, "callAIAudioTooLargeMessage");
27786
+ __name(callAIOversizeAudioChars, "callAIOversizeAudioChars");
27758
27787
  CALLAI_SIGN_IN = "sign-in";
27759
27788
  ResOkCallAI = lazyType(
27760
27789
  () => type({
@@ -27776,7 +27805,8 @@ var init_types2 = __esm({
27776
27805
  // guest — no press, or the guest door named sign-in (#5265, revised
27777
27806
  // 2026-11-11). Sent only to a runtime that carries
27778
27807
  // `userActivation` on its request; an older one gets the message alone.
27779
- "reason?": "'refusal' | 'image-too-large' | 'sign-in'",
27808
+ // "audio-too-large": the same gate for a prompt carrying a recording.
27809
+ "reason?": "'refusal' | 'image-too-large' | 'audio-too-large' | 'sign-in'",
27780
27810
  "explanation?": "string"
27781
27811
  }).and(Base)
27782
27812
  );
@@ -27939,6 +27969,75 @@ var init_types2 = __esm({
27939
27969
  );
27940
27970
  ResVibeListModels = lazyType(() => ResOkVibeListModels.or(ResErrorVibeListModels));
27941
27971
  __name(isResVibeListModels, "isResVibeListModels");
27972
+ SPEECH_DEFAULT_MODEL = "google/gemini-2.5-pro-tts";
27973
+ SPEECH_DEFAULT_VOICE = "Kore";
27974
+ SPEECH_MAX_INPUT_CHARS = 4e3;
27975
+ SPEECH_VOICES = [
27976
+ "Zephyr",
27977
+ "Puck",
27978
+ "Charon",
27979
+ "Kore",
27980
+ "Fenrir",
27981
+ "Leda",
27982
+ "Orus",
27983
+ "Aoede",
27984
+ "Callirrhoe",
27985
+ "Autonoe",
27986
+ "Enceladus",
27987
+ "Iapetus",
27988
+ "Umbriel",
27989
+ "Algieba",
27990
+ "Despina",
27991
+ "Erinome",
27992
+ "Algenib",
27993
+ "Rasalgethi",
27994
+ "Laomedeia",
27995
+ "Achernar",
27996
+ "Alnilam",
27997
+ "Schedar",
27998
+ "Gacrux",
27999
+ "Pulcherrima",
28000
+ "Achird",
28001
+ "Zubenelgenubi",
28002
+ "Vindemiatrix",
28003
+ "Sadachbia",
28004
+ "Sadaltager",
28005
+ "Sulafat"
28006
+ ];
28007
+ ReqVibeSpeak = lazyType(
28008
+ () => type({
28009
+ type: "'vibe.req.speak'",
28010
+ ownerHandle: "string",
28011
+ appSlug: "string",
28012
+ input: "string",
28013
+ "model?": "string",
28014
+ "voice?": "string",
28015
+ "instructions?": "string",
28016
+ // Same meaning as ReqCallAI.userActivation: a press may mint a guest viewer.
28017
+ "userActivation?": "boolean"
28018
+ }).and(Base)
28019
+ );
28020
+ ResOkVibeSpeak = lazyType(
28021
+ () => type({
28022
+ type: "'vibe.res.speak'",
28023
+ status: "'ok'",
28024
+ /** Raw signed 16-bit little-endian PCM, base64. */
28025
+ audioBase64: "string",
28026
+ sampleRate: "number",
28027
+ channels: "number",
28028
+ model: "string"
28029
+ }).and(Base)
28030
+ );
28031
+ ResErrorVibeSpeak = lazyType(
28032
+ () => type({
28033
+ type: "'vibe.res.speak'",
28034
+ status: "'error'",
28035
+ message: "string",
28036
+ "reason?": "'sign-in'"
28037
+ }).and(Base)
28038
+ );
28039
+ ResVibeSpeak = lazyType(() => ResOkVibeSpeak.or(ResErrorVibeSpeak));
28040
+ __name(isResVibeSpeak, "isResVibeSpeak");
27942
28041
  VibePlacesLatLng = lazyType(() => type({ lat: "number", lng: "number" }));
27943
28042
  VibePlacesBounds = lazyType(() => type({ south: "number", west: "number", north: "number", east: "number" }));
27944
28043
  VibePlacesQuery = lazyType(
@@ -170995,6 +171094,8 @@ async function prepareCallAIPrompt(prompt, downscale = (u3) => downscaleImageDat
170995
171094
  );
170996
171095
  const oversize = callAIOversizeImageChars(parts);
170997
171096
  if (oversize !== void 0) throw new CallAIImageTooLargeError(callAIImageTooLargeMessage(oversize));
171097
+ const oversizeAudio = callAIOversizeAudioChars(parts);
171098
+ if (oversizeAudio !== void 0) throw new CallAIAudioTooLargeError(callAIAudioTooLargeMessage(oversizeAudio));
170998
171099
  return parts;
170999
171100
  }
171000
171101
  function registerCallAI(vibeApi2, readUserActivation = readCallAIUserActivation) {
@@ -171013,13 +171114,14 @@ function registerCallAI(vibeApi2, readUserActivation = readCallAIUserActivation)
171013
171114
  throw new CallAIRefusalError(callAIRes.message, callAIRes.explanation);
171014
171115
  }
171015
171116
  if (callAIRes.reason === "image-too-large") throw new CallAIImageTooLargeError(callAIRes.message);
171117
+ if (callAIRes.reason === "audio-too-large") throw new CallAIAudioTooLargeError(callAIRes.message);
171016
171118
  if (callAIRes.reason === CALLAI_SIGN_IN) throw new CallAISignInError(callAIRes.message);
171017
171119
  throw new Error(callAIRes.message);
171018
171120
  }
171019
171121
  return callAIRes.result;
171020
171122
  }, "callAI");
171021
171123
  }
171022
- var CallAIRefusalError, CallAIImageTooLargeError, CallAISignInError, callAI, callAi;
171124
+ var CallAIRefusalError, CallAIImageTooLargeError, CallAIAudioTooLargeError, CallAISignInError, callAI, callAi;
171023
171125
  var init_call_ai = __esm({
171024
171126
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/call-ai.ts"() {
171025
171127
  "use strict";
@@ -171028,6 +171130,7 @@ var init_call_ai = __esm({
171028
171130
  init_performance2();
171029
171131
  init_types2();
171030
171132
  init_resize_image();
171133
+ init_types2();
171031
171134
  CallAIRefusalError = class extends Error {
171032
171135
  static {
171033
171136
  __name(this, "CallAIRefusalError");
@@ -171050,6 +171153,16 @@ var init_call_ai = __esm({
171050
171153
  this.name = "CallAIImageTooLargeError";
171051
171154
  }
171052
171155
  };
171156
+ CallAIAudioTooLargeError = class extends Error {
171157
+ static {
171158
+ __name(this, "CallAIAudioTooLargeError");
171159
+ }
171160
+ reason = "audio-too-large";
171161
+ constructor(message6) {
171162
+ super(message6);
171163
+ this.name = "CallAIAudioTooLargeError";
171164
+ }
171165
+ };
171053
171166
  CallAISignInError = class extends Error {
171054
171167
  static {
171055
171168
  __name(this, "CallAISignInError");
@@ -177068,7 +177181,7 @@ var init_register_dependencies = __esm({
177068
177181
  return Result.Err(captureRefusedError());
177069
177182
  }
177070
177183
  await this.ackReady.asPromise();
177071
- if ("type" in msg && (msg.type === "vibe.req.callAI" || msg.type === "vibe.req.imgGen" || msg.type === "vibe.req.apiFetch" || msg.type === "vibe.req.searchPlaces" || msg.type === "vibe.req.placesMapMode")) {
177184
+ if ("type" in msg && (msg.type === "vibe.req.callAI" || msg.type === "vibe.req.imgGen" || msg.type === "vibe.req.speak" || msg.type === "vibe.req.apiFetch" || msg.type === "vibe.req.searchPlaces" || msg.type === "vibe.req.placesMapMode")) {
177072
177185
  return this.requestIdle(msg, opts, void 0);
177073
177186
  }
177074
177187
  if (opts.idleTimeout !== void 0) {
@@ -177214,6 +177327,22 @@ var init_register_dependencies = __esm({
177214
177327
  { wait: isResVibeListModels, timeout: 3e4 }
177215
177328
  );
177216
177329
  }
177330
+ // Text to speech (callAI skill § Speech). Spends credits like callAI and the
177331
+ // server bounds its own gateway call, so it waits like callAI does.
177332
+ speak(input3, opts, call2 = {}) {
177333
+ return this.request(
177334
+ {
177335
+ type: "vibe.req.speak",
177336
+ ...this.svc.vibeApp,
177337
+ input: input3,
177338
+ ...opts.model !== void 0 && opts.model !== "" ? { model: opts.model } : {},
177339
+ ...opts.voice !== void 0 && opts.voice !== "" ? { voice: opts.voice } : {},
177340
+ ...opts.instructions !== void 0 && opts.instructions !== "" ? { instructions: opts.instructions } : {},
177341
+ ...call2.userActivation !== void 0 ? { userActivation: call2.userActivation } : {}
177342
+ },
177343
+ { wait: isResVibeSpeak, surfaceStatus: true }
177344
+ );
177345
+ }
177217
177346
  imgGen(prompt, opts = {}) {
177218
177347
  const { inputImageBase64, model, target: target2, source, userActivation, onPreview } = opts;
177219
177348
  return this.request(
@@ -200852,7 +200981,16 @@ var VibesFileContent = lazyType2(
200852
200981
  "size?": "number"
200853
200982
  })
200854
200983
  );
200855
- var MessageContent = lazyType2(() => TextContent.or(ImageUrlContent).or(VibesFileContent));
200984
+ var InputAudioContent = lazyType2(
200985
+ () => type({
200986
+ type: "'input_audio'",
200987
+ input_audio: type({
200988
+ data: "string",
200989
+ format: "string"
200990
+ })
200991
+ })
200992
+ );
200993
+ var MessageContent = lazyType2(() => TextContent.or(ImageUrlContent).or(VibesFileContent).or(InputAudioContent));
200856
200994
  var ChatMessage = lazyType2(
200857
200995
  () => type({
200858
200996
  role: "'system' | 'user' | 'assistant'",
@@ -213468,6 +213606,35 @@ var resPlacesMapMode = lazyType(
213468
213606
  })
213469
213607
  );
213470
213608
 
213609
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/app-speech.ts
213610
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
213611
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
213612
+ init_performance2();
213613
+ init_out4();
213614
+ init_common();
213615
+ init_lazy_type();
213616
+ var reqAppSpeech = lazyType(
213617
+ () => type({
213618
+ type: "'vibes.diy.req-app-speech'",
213619
+ "auth?": dashAuthType,
213620
+ ownerHandle: "string",
213621
+ appSlug: "string",
213622
+ input: "string",
213623
+ "model?": "string",
213624
+ "voice?": "string",
213625
+ "instructions?": "string"
213626
+ })
213627
+ );
213628
+ var resAppSpeech = lazyType(
213629
+ () => type({
213630
+ type: "'vibes.diy.res-app-speech'",
213631
+ audioBase64: "string",
213632
+ sampleRate: "number",
213633
+ channels: "number",
213634
+ model: "string"
213635
+ })
213636
+ );
213637
+
213471
213638
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/agent-connector-note.ts
213472
213639
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
213473
213640
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
@@ -255131,6 +255298,35 @@ var micCaptureConfig = {
255131
255298
  menu: false
255132
255299
  };
255133
255300
 
255301
+ // ../../home/runner/work/vibes.diy/vibes.diy/prompts/pkg/llms/speech.ts
255302
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
255303
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
255304
+ init_performance2();
255305
+ var speechConfig = {
255306
+ name: "speech",
255307
+ needs: ["sound-core", "mic-capture"],
255308
+ label: "Speech",
255309
+ description: "Apps that talk and listen: read text aloud in a natural voice (a narrator, a language tutor, a story reader, spoken quiz questions), turn a recording into words (dictation, voice notes to text, an interviewer that asks aloud and hears the answer), and ask the model about a recording. speak() returns a playable WAV with 30 voices and plain-words style; transcribe() takes a MediaRecorder Blob as it is.",
255310
+ cues: [
255311
+ "read aloud",
255312
+ "read it aloud",
255313
+ "text to speech",
255314
+ "speech to text",
255315
+ "speak",
255316
+ "spoken",
255317
+ "narrate",
255318
+ "narrator",
255319
+ "voiceover",
255320
+ "transcribe",
255321
+ "transcript",
255322
+ "dictation",
255323
+ "dictate",
255324
+ "interview me"
255325
+ ],
255326
+ importModule: "call-ai",
255327
+ importName: "speak"
255328
+ };
255329
+
255134
255330
  // ../../home/runner/work/vibes.diy/vibes.diy/prompts/pkg/llms/photo-input.ts
255135
255331
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
255136
255332
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
@@ -256673,6 +256869,8 @@ var allConfigs = [
256673
256869
  webAudioConfig,
256674
256870
  webMusicConfig,
256675
256871
  mediaCaptureConfig,
256872
+ // Speech needs mic-capture (above) for its recorder.
256873
+ speechConfig,
256676
256874
  // The stage surface (menu: false) ahead of the three skills that need it, d3, three-js and p5: a
256677
256875
  // picture set in the page with the kit's components as the chrome around it.
256678
256876
  surfaceStageConfig,
@@ -361957,7 +362155,9 @@ var RUNTIME_HOMES = {
361957
362155
  useWorldControls: "use-vibes",
361958
362156
  callAI: "call-ai",
361959
362157
  callAi: "call-ai",
361960
- listModels: "call-ai"
362158
+ listModels: "call-ai",
362159
+ speak: "call-ai",
362160
+ transcribe: "call-ai"
361961
362161
  };
361962
362162
  var FIREPROOF_MEMBERS = ["useLiveQuery", "useDocument", "useAllDocs", "useChanges"];
361963
362163
  var IMPORT_MAP_SPECIFIERS2 = new Set(
@@ -367160,6 +367360,7 @@ var RUNTIME_EXPORTS = [
367160
367360
  "CALLAI_IMAGE_QUALITY",
367161
367361
  "COLOR_OVERRIDE_STYLE_ID",
367162
367362
  "CREATE_VIBE_SAFE_URL_LENGTH",
367363
+ "CallAIAudioTooLargeError",
367163
367364
  "CallAIImageTooLargeError",
367164
367365
  "CallAIRefusalError",
367165
367366
  "CallAISignInError",
@@ -367178,7 +367379,11 @@ var RUNTIME_EXPORTS = [
367178
367379
  "RUNTIME_BUILD_GLOBAL",
367179
367380
  "SHADCN_THEME_COLOR_NAMES",
367180
367381
  "SHADCN_THEME_INLINE_CSS",
367382
+ "SPEECH_DEFAULT_MODEL",
367383
+ "SPEECH_DEFAULT_VOICE",
367384
+ "SPEECH_VOICES",
367181
367385
  "TAILWIND_REMAP_STYLE_ID",
367386
+ "TRANSCRIBE_DEFAULT_MODEL",
367182
367387
  "VIBES_DIY_BUILDER_URL",
367183
367388
  "VibeContextProvider",
367184
367389
  "VibeSandboxApi",
@@ -367217,6 +367422,8 @@ var RUNTIME_EXPORTS = [
367217
367422
  "applyFontImport",
367218
367423
  "applyLookCssMessage",
367219
367424
  "armGrace",
367425
+ "audioFormatOf",
367426
+ "base64ToBytes",
367220
367427
  "beginHotSwap",
367221
367428
  "beginHotSwapRollback",
367222
367429
  "beginNetworkActivity",
@@ -367225,6 +367432,7 @@ var RUNTIME_EXPORTS = [
367225
367432
  "buildCreateVibeUrl",
367226
367433
  "buildGithubInstallUrl",
367227
367434
  "buildGithubInstallUrlFrom",
367435
+ "bytesToBase64",
367228
367436
  "callAI",
367229
367437
  "callAi",
367230
367438
  "canRead",
@@ -367292,6 +367500,8 @@ var RUNTIME_EXPORTS = [
367292
367500
  "onUncaughtVibeError",
367293
367501
  "orderCompanionGraph",
367294
367502
  "parseRuntimeBuild",
367503
+ "pcmDurationMs",
367504
+ "pcmToWav",
367295
367505
  "platformMapsMode",
367296
367506
  "postBootErrorToParent",
367297
367507
  "postHotSwapErrorToParent",
@@ -367314,6 +367524,7 @@ var RUNTIME_EXPORTS = [
367314
367524
  "registerInterestSink",
367315
367525
  "registerListModels",
367316
367526
  "registerPullToRefreshHandler",
367527
+ "registerSpeak",
367317
367528
  "registerUrlStateBridge",
367318
367529
  "registerVibeLog",
367319
367530
  "registeredPictureStore",
@@ -367337,9 +367548,12 @@ var RUNTIME_EXPORTS = [
367337
367548
  "setHotSwapRestore",
367338
367549
  "setHotSwapRuntimeId",
367339
367550
  "socialEnv",
367551
+ "speak",
367340
367552
  "splitVibeLogArgs",
367341
367553
  "stripHostInjectedParams",
367342
367554
  "subscribeGrace",
367555
+ "transcribe",
367556
+ "transcribePrompt",
367343
367557
  "transformForHotSwap",
367344
367558
  "unmountVibe",
367345
367559
  "unregisterVibeLog",
@@ -400151,6 +400365,10 @@ function measureTurnSize(messages) {
400151
400365
  attachmentCount += 1;
400152
400366
  attachmentBytes += dataUrlBytes(part.image_url.url);
400153
400367
  break;
400368
+ case "input_audio":
400369
+ attachmentCount += 1;
400370
+ attachmentBytes += Math.floor(part.input_audio.data.length * 3 / 4);
400371
+ break;
400154
400372
  }
400155
400373
  }
400156
400374
  return { promptChars, attachmentCount, attachmentBytes };
@@ -409403,6 +409621,244 @@ var searchPlacesEvento = {
409403
409621
  )
409404
409622
  };
409405
409623
 
409624
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/app-speech.ts
409625
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
409626
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
409627
+ init_performance2();
409628
+ init_esm();
409629
+ init_types2();
409630
+ init_out4();
409631
+ var APP_SPEECH_NOT_VISIBLE = "app-speech-not-visible";
409632
+ var APP_SPEECH_INVALID = "app-speech-invalid";
409633
+ var APP_SPEECH_UPSTREAM = "app-speech-upstream";
409634
+ var APP_SPEECH_UPSTREAM_MESSAGE = "The voice did not answer this time. Try again in a moment.";
409635
+ var SPEECH_MODELS = ["google/gemini-2.5-pro-tts", "google/gemini-2.5-flash-tts"];
409636
+ var SPEECH_TIMEOUT_MS = 9e4;
409637
+ var AUDIO_TOKENS_PER_SECOND = 25;
409638
+ var USD_PER_OUTPUT_TOKEN = 2e-5;
409639
+ var USD_PER_INPUT_TOKEN = 1e-6;
409640
+ function speechUrlFor(llmUrl) {
409641
+ if (/\/chat\/completions\/?$/.test(llmUrl)) return llmUrl.replace(/\/chat\/completions\/?$/, "/audio/speech");
409642
+ return BuildURI.from(llmUrl).pathname("/api/v1/audio/speech").cleanParams().toString();
409643
+ }
409644
+ __name(speechUrlFor, "speechUrlFor");
409645
+ function parsePcmContentType(contentType) {
409646
+ const read2 = /* @__PURE__ */ __name((key, fallback) => {
409647
+ const m = new RegExp(`${key}=(\\d+)`).exec(contentType ?? "");
409648
+ const n3 = m === null ? NaN : Number(m[1]);
409649
+ return Number.isFinite(n3) && n3 > 0 ? n3 : fallback;
409650
+ }, "read");
409651
+ return { sampleRate: read2("rate", 24e3), channels: read2("channels", 1) };
409652
+ }
409653
+ __name(parsePcmContentType, "parsePcmContentType");
409654
+ function speechUsage(args3) {
409655
+ const seconds = args3.pcmBytes / (args3.sampleRate * args3.channels * 2);
409656
+ const completion2 = Math.round(seconds * AUDIO_TOKENS_PER_SECOND);
409657
+ const prompt = Math.ceil(args3.inputChars / 4);
409658
+ return {
409659
+ prompt_tokens: prompt,
409660
+ completion_tokens: completion2,
409661
+ total_tokens: prompt + completion2,
409662
+ cost: completion2 * USD_PER_OUTPUT_TOKEN + prompt * USD_PER_INPUT_TOKEN
409663
+ };
409664
+ }
409665
+ __name(speechUsage, "speechUsage");
409666
+ function speechCostCents(args3) {
409667
+ const usage = speechUsage(args3);
409668
+ return costCentsFromUsage({ given: [usage], calculated: { total_tokens: usage.total_tokens } });
409669
+ }
409670
+ __name(speechCostCents, "speechCostCents");
409671
+ function bytesToBase644(bytes) {
409672
+ let binary2 = "";
409673
+ const CHUNK = 32768;
409674
+ for (let i3 = 0; i3 < bytes.length; i3 += CHUNK) {
409675
+ binary2 += String.fromCharCode(...bytes.subarray(i3, i3 + CHUNK));
409676
+ }
409677
+ return btoa(binary2);
409678
+ }
409679
+ __name(bytesToBase644, "bytesToBase64");
409680
+ function speechRequestProblem(args3) {
409681
+ if (args3.input.trim() === "") return "speak needs some text to say";
409682
+ const chars2 = args3.input.length + (args3.instructions?.length ?? 0);
409683
+ if (chars2 > SPEECH_MAX_INPUT_CHARS) {
409684
+ return `speak takes up to ${SPEECH_MAX_INPUT_CHARS} characters per call (got ${chars2}); split longer text into several calls`;
409685
+ }
409686
+ if (args3.model !== void 0 && SPEECH_MODELS.includes(args3.model) === false) {
409687
+ return `speak can use ${SPEECH_MODELS.join(" or ")}; ${args3.model} is not one of them`;
409688
+ }
409689
+ if (args3.voice !== void 0 && SPEECH_VOICES.includes(args3.voice) === false) {
409690
+ return `speak has no voice named ${args3.voice}; try one of ${SPEECH_VOICES.slice(0, 6).join(", ")}, \u2026`;
409691
+ }
409692
+ return void 0;
409693
+ }
409694
+ __name(speechRequestProblem, "speechRequestProblem");
409695
+ function speechInput(args3) {
409696
+ const style = args3.instructions?.trim();
409697
+ return style === void 0 || style === "" ? args3.input : `${style}: ${args3.input}`;
409698
+ }
409699
+ __name(speechInput, "speechInput");
409700
+ async function synthesizeSpeech(deps, args3) {
409701
+ const model = args3.model ?? SPEECH_DEFAULT_MODEL;
409702
+ const rRes = await exception2Result(
409703
+ () => deps.fetch(speechUrlFor(deps.llmUrl), {
409704
+ method: "POST",
409705
+ headers: { Authorization: `Bearer ${deps.apiKey}`, "Content-Type": "application/json" },
409706
+ body: JSON.stringify({
409707
+ model,
409708
+ input: speechInput(args3),
409709
+ voice: args3.voice ?? SPEECH_DEFAULT_VOICE,
409710
+ response_format: "pcm"
409711
+ }),
409712
+ signal: AbortSignal.timeout(SPEECH_TIMEOUT_MS)
409713
+ })
409714
+ );
409715
+ if (rRes.isErr()) return Result.Err(`speech gateway unreachable: ${rRes.Err().message}`);
409716
+ const res = rRes.Ok();
409717
+ if (res.ok === false) {
409718
+ const rDetail = await exception2Result(() => res.text());
409719
+ const detail = rDetail.isOk() ? rDetail.Ok() : "";
409720
+ return Result.Err(`speech gateway error (status ${res.status}) ${detail.slice(0, 300)}`);
409721
+ }
409722
+ const rBody = await exception2Result(() => res.arrayBuffer());
409723
+ if (rBody.isErr()) return Result.Err(`speech gateway body unreadable: ${rBody.Err().message}`);
409724
+ const pcm = new Uint8Array(rBody.Ok());
409725
+ if (pcm.length === 0) return Result.Err("speech gateway returned no audio");
409726
+ const { sampleRate, channels } = parsePcmContentType(res.headers.get("content-type"));
409727
+ return Result.Ok({ pcm, sampleRate, channels, model });
409728
+ }
409729
+ __name(synthesizeSpeech, "synthesizeSpeech");
409730
+ async function meterSpeech(vctx, args3) {
409731
+ const logger = ensureLogger(vctx.sthis, "appSpeech");
409732
+ const usageArgs = {
409733
+ inputChars: args3.inputChars,
409734
+ pcmBytes: args3.speech.pcm.length,
409735
+ sampleRate: args3.speech.sampleRate,
409736
+ channels: args3.speech.channels
409737
+ };
409738
+ const usage = speechUsage(usageArgs);
409739
+ const costCents = speechCostCents(usageArgs);
409740
+ const promptId = `speech-${vctx.sthis.nextId(12).str}`;
409741
+ const rPromptCtx = await exception2Result(
409742
+ () => vctx.sql.db.insert(vctx.sql.tables.promptContexts).values({
409743
+ userId: args3.userId,
409744
+ chatId: `app-speech:${args3.ownerHandle}/${args3.appSlug}`,
409745
+ promptId,
409746
+ nethash: vctx.netHash(),
409747
+ promptTokens: usage.prompt_tokens,
409748
+ completionTokens: usage.completion_tokens,
409749
+ totalTokens: usage.total_tokens,
409750
+ ref: {
409751
+ type: "prompt.usage.sql",
409752
+ usage: {
409753
+ // `cost` (USD) rides undeclared on SseUsage, as in billing.ts and image-gen.ts.
409754
+ given: [usage],
409755
+ calculated: {
409756
+ prompt_tokens: usage.prompt_tokens,
409757
+ completion_tokens: usage.completion_tokens,
409758
+ total_tokens: usage.total_tokens
409759
+ }
409760
+ },
409761
+ model: args3.speech.model,
409762
+ ...clientRefStamp(vctx)
409763
+ },
409764
+ created: (/* @__PURE__ */ new Date()).toISOString()
409765
+ })
409766
+ );
409767
+ if (rPromptCtx.isErr()) {
409768
+ logger.Warn().Err(rPromptCtx).Str("promptId", promptId).Msg("speech-prompt-context-persist-failed");
409769
+ }
409770
+ const rTrack = costCents > 0 ? await vctx.billing.trackUsage({ userId: args3.userId, costCents, promptId, model: args3.speech.model, mode: "speech" }) : Result.Ok(void 0);
409771
+ if (rTrack.isErr()) {
409772
+ logger.Warn().Err(rTrack).Str("promptId", promptId).Msg("speech-billing-track-failed");
409773
+ } else if (costCents > 0 && trackChargeApplied(rTrack.Ok())) {
409774
+ const rMilestones = exception2Result(
409775
+ () => captureCreditUsageMilestones(vctx, {
409776
+ userId: args3.userId,
409777
+ check: args3.creditCheck,
409778
+ chargedCredits: costCents * DISPLAY_CREDITS_PER_CENT,
409779
+ lane: "speech",
409780
+ ownerHandle: args3.ownerHandle,
409781
+ appSlug: args3.appSlug,
409782
+ ledger: creditMilestoneLedger(vctx.sql)
409783
+ })
409784
+ );
409785
+ if (rMilestones.isErr()) logger.Warn().Err(rMilestones).Str("promptId", promptId).Msg("credit-milestones-threw");
409786
+ }
409787
+ return { promptId, costCents };
409788
+ }
409789
+ __name(meterSpeech, "meterSpeech");
409790
+ var appSpeechEvento = {
409791
+ hash: "app-speech",
409792
+ validate: unwrapMsgBase(async (msg) => {
409793
+ const ret = reqAppSpeech(msg.payload);
409794
+ if (ret instanceof type.errors) {
409795
+ return Result.Ok(Option.None());
409796
+ }
409797
+ return Result.Ok(Option.Some({ ...msg, payload: ret }));
409798
+ }),
409799
+ handle: optAuth(
409800
+ async (ctx) => {
409801
+ const req2 = ctx.validated.payload;
409802
+ const vctx = ctx.ctx.getOrThrow("vibesApiCtx");
409803
+ const logger = ensureLogger(vctx.sthis, "appSpeech");
409804
+ const sendError2 = /* @__PURE__ */ __name((message6, code2) => ctx.send.send(ctx, { type: "vibes.diy.res-error", error: { message: message6, code: code2 } }), "sendError");
409805
+ const userId = req2._auth?.verifiedAuth.claims.userId;
409806
+ if (userId === void 0) {
409807
+ await sendError2("Authentication required", "authentication_required");
409808
+ return Result.Ok(EventoResult.Continue);
409809
+ }
409810
+ const problem = speechRequestProblem(req2);
409811
+ if (problem !== void 0) {
409812
+ await sendError2(problem, APP_SPEECH_INVALID);
409813
+ return Result.Ok(EventoResult.Continue);
409814
+ }
409815
+ const visible = await callerCanReadApp(vctx, { ownerHandle: req2.ownerHandle, appSlug: req2.appSlug, callerUserId: userId });
409816
+ if (visible === false) {
409817
+ await sendError2("This app's voice is not available to you.", APP_SPEECH_NOT_VISIBLE);
409818
+ return Result.Ok(EventoResult.Continue);
409819
+ }
409820
+ let creditCheck;
409821
+ if (vctx.billing.enforceEnabled) {
409822
+ const rCheck = await vctx.billing.checkCredits({ userId });
409823
+ if (rCheck.isErr()) {
409824
+ logger.Warn().Err(rCheck).Str("app", `${req2.ownerHandle}/${req2.appSlug}`).Msg("speech-billing-check-failed-open");
409825
+ } else if (rCheck.Ok().allowed === false) {
409826
+ await sendError2("credits-exhausted: you have used your included AI credits \u2014 upgrade to continue", "credits-exhausted");
409827
+ return Result.Ok(EventoResult.Continue);
409828
+ } else {
409829
+ creditCheck = rCheck.Ok();
409830
+ }
409831
+ }
409832
+ const rSpeech = await synthesizeSpeech(
409833
+ { fetch: vctx.inferenceFetch, llmUrl: vctx.params.llm.url, apiKey: vctx.params.llm.apiKey },
409834
+ req2
409835
+ );
409836
+ if (rSpeech.isErr()) {
409837
+ logger.Warn().Err(rSpeech).Str("app", `${req2.ownerHandle}/${req2.appSlug}`).Msg("speech-failed");
409838
+ await sendError2(APP_SPEECH_UPSTREAM_MESSAGE, APP_SPEECH_UPSTREAM);
409839
+ return Result.Ok(EventoResult.Continue);
409840
+ }
409841
+ const speech = rSpeech.Ok();
409842
+ await meterSpeech(vctx, {
409843
+ userId,
409844
+ ownerHandle: req2.ownerHandle,
409845
+ appSlug: req2.appSlug,
409846
+ inputChars: speechInput(req2).length,
409847
+ speech,
409848
+ ...creditCheck === void 0 ? {} : { creditCheck }
409849
+ });
409850
+ await ctx.send.send(ctx, {
409851
+ type: "vibes.diy.res-app-speech",
409852
+ audioBase64: bytesToBase644(speech.pcm),
409853
+ sampleRate: speech.sampleRate,
409854
+ channels: speech.channels,
409855
+ model: speech.model
409856
+ });
409857
+ return Result.Ok(EventoResult.Continue);
409858
+ }
409859
+ )
409860
+ };
409861
+
409406
409862
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/places-map-mode.ts
409407
409863
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
409408
409864
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
@@ -414913,6 +415369,8 @@ var handlerManifest = [
414913
415369
  entry("vibes.diy.req-list-app-models", listAppModelsEvento),
414914
415370
  // A vibe's `Place.searchNearby` / `searchByText` through @vibes.diy/google-maps-shim (#8104).
414915
415371
  entry("vibes.diy.req-search-places", searchPlacesEvento),
415372
+ // A vibe's `speak(text, opts)`: text to speech via the gateway's /audio/speech, billed like callAI.
415373
+ entry("vibes.diy.req-app-speech", appSpeechEvento),
414916
415374
  // The page's map mode, once per page, before the shim's first importLibrary resolves (#8104 step 3).
414917
415375
  entry("vibes.diy.req-places-map-mode", placesMapModeEvento),
414918
415376
  // Engine-split mint (spec 2026-07-11): first-build mint on the warm