@cartanova/qgrid-cli 2.16.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/bundle/dist/application/qgrid/qgrid.frame.js +63 -25
  2. package/bundle/dist/application/qgrid/qgrid.types.js +11 -3
  3. package/bundle/dist/utils/providers/grok/grok-types.js +8 -2
  4. package/bundle/dist/utils/providers/grok/grok-voice-client.js +4 -4
  5. package/bundle/dist/utils/speech-alignment.js +129 -0
  6. package/bundle/src/application/qgrid/qgrid.frame.test.ts +57 -7
  7. package/bundle/src/application/qgrid/qgrid.frame.ts +67 -30
  8. package/bundle/src/application/qgrid/qgrid.types.ts +17 -2
  9. package/bundle/src/utils/providers/grok/grok-types.ts +15 -10
  10. package/bundle/src/utils/providers/grok/grok-voice-client.ts +4 -4
  11. package/bundle/src/utils/speech-alignment.test.ts +72 -0
  12. package/bundle/src/utils/speech-alignment.ts +178 -0
  13. package/bundle/web-dist/client/assets/TimedPlayer-cuEgYA3Q.js +1 -0
  14. package/bundle/web-dist/client/assets/{index-SGfYBzGT.js → index-Cb14ZYfq.js} +3 -3
  15. package/bundle/web-dist/client/assets/index-Co8uAhSV.css +1 -0
  16. package/bundle/web-dist/client/assets/{logs-DrTz38re.js → logs-CSL1j0RN.js} +1 -1
  17. package/bundle/web-dist/client/assets/{monit-klIY-HEI.js → monit-J69xfniH.js} +1 -1
  18. package/bundle/web-dist/client/assets/{routes-bGN3y2NW.js → routes-CdWdhivH.js} +1 -1
  19. package/bundle/web-dist/client/assets/{settings-BHwEvAZL.js → settings-BGa41_nL.js} +1 -1
  20. package/bundle/web-dist/client/assets/show-CSpPVL8-.js +2 -0
  21. package/bundle/web-dist/client/assets/{tokens-DMWMG9O5.js → tokens-B9FeVPJk.js} +1 -1
  22. package/bundle/web-dist/client/assets/{use-oauth-login-flow-D1v4h9zA.js → use-oauth-login-flow-Tmy4lKYv.js} +1 -1
  23. package/bundle/web-dist/client/assets/{use-update-token-mutation-BVBUlqBN.js → use-update-token-mutation-CGwI6TU8.js} +1 -1
  24. package/bundle/web-dist/client/assets/voice-BNcGUdUd.js +1 -0
  25. package/bundle/web-dist/client/index.html +2 -2
  26. package/bundle/web-dist/server/assets/TimedPlayer-DAwjkP4z.js +54 -0
  27. package/bundle/web-dist/server/assets/{show-D8r2sVK0.js → show-hBbPOUZD.js} +41 -6
  28. package/bundle/web-dist/server/assets/{voice-C2HfwkGp.js → voice-CHoPEIfo.js} +76 -68
  29. package/bundle/web-dist/server/entry-server.generated.js +3 -3
  30. package/package.json +1 -1
  31. package/skills/qgrid/references/ai-sdk-provider-contract.md +1 -1
  32. package/skills/qgrid/references/grok-runtime.md +5 -1
  33. package/skills/qgrid/references/sonamu-api-web-flow.md +2 -2
  34. package/bundle/web-dist/client/assets/index-DyrPRt6O.css +0 -1
  35. package/bundle/web-dist/client/assets/show-BiJkyrfB.js +0 -2
  36. package/bundle/web-dist/client/assets/voice-CwD3asSF.js +0 -1
@@ -3,6 +3,7 @@ import { t as Link } from "./link-DrdV092C.js";
3
3
  import { a as ForwardRef$4, c as remarkGfm, l as Markdown, t as Route } from "../entry-server.generated.js";
4
4
  import { n as formatMicroUsd, t as cacheHitRate } from "./cost-oNK0T4Jo.js";
5
5
  import { n as ForwardRef$5, t as requestModelDisplay } from "./request-model-DRF7hmJC.js";
6
+ import { t as TimedPlayer } from "./TimedPlayer-DAwjkP4z.js";
6
7
  //#region ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/extends.js
7
8
  var require_extends = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8
9
  function _extends() {
@@ -2033,7 +2034,7 @@ function parseImageSegments(text) {
2033
2034
  });
2034
2035
  return segments.filter((segment) => segment.type !== "text" || segment.text.trim().length > 0);
2035
2036
  }
2036
- function ImageAwareContent({ text, markdown }) {
2037
+ function ImageAwareContent({ text, markdown, audioWords }) {
2037
2038
  const [viewerSrc, setViewerSrc] = (0, import_react.useState)(null);
2038
2039
  const segments = parseImageSegments(text);
2039
2040
  if (!segments.some((segment) => segment.type !== "text")) return markdown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -2057,7 +2058,14 @@ function ImageAwareContent({ text, markdown }) {
2057
2058
  }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
2058
2059
  className: "text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed",
2059
2060
  children: segment.text
2060
- }, `text-${index}`) : segment.type === "audio" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", {
2061
+ }, `text-${index}`) : segment.type === "audio" ? audioWords ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2062
+ className: "flex max-w-xl flex-col gap-2",
2063
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimedPlayer, {
2064
+ src: segment.src,
2065
+ words: audioWords,
2066
+ className: "w-full max-w-md"
2067
+ })
2068
+ }, `audio-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", {
2061
2069
  controls: true,
2062
2070
  src: segment.src,
2063
2071
  className: "w-full max-w-md"
@@ -2091,14 +2099,15 @@ function ImageAwareContent({ text, markdown }) {
2091
2099
  })]
2092
2100
  });
2093
2101
  }
2094
- function FormattedContent({ text, markdown }) {
2102
+ function FormattedContent({ text, markdown, audioWords }) {
2095
2103
  const parsed = tryParseJson(text);
2096
2104
  const [mode, setMode] = (0, import_react.useState)("pretty");
2097
2105
  const jsonContainer = parsed.ok && parsed.value instanceof Object ? parsed.value : null;
2098
2106
  if (!parsed.ok || jsonContainer === null) {
2099
2107
  if (markdown) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageAwareContent, {
2100
2108
  text,
2101
- markdown: true
2109
+ markdown: true,
2110
+ audioWords
2102
2111
  });
2103
2112
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageAwareContent, { text: parsed.ok ? JSON.stringify(parsed.value, null, 2) : text });
2104
2113
  }
@@ -2442,6 +2451,25 @@ function ToolInputImages({ images }) {
2442
2451
  })
2443
2452
  })] });
2444
2453
  }
2454
+ var VoiceStepResult = object({ words: array(object({
2455
+ text: string(),
2456
+ start: number(),
2457
+ end: number()
2458
+ })).optional() });
2459
+ /**
2460
+ * Voice rows keep their word timing in the speech/transcription step result (TTS output words, or
2461
+ * the words heard in the STT input). The step is fetched once so the embedded clip can show its
2462
+ * words; rows without timing render as plain content.
2463
+ */
2464
+ function VoiceAwareContent({ text, stepId }) {
2465
+ const { data: detail } = RequestLogStepService.useRequestLogStep("A", stepId ?? 0, { enabled: stepId !== null });
2466
+ const words = detail ? VoiceStepResult.safeParse(safeParseJson(detail.tool_result)).data?.words : void 0;
2467
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
2468
+ text,
2469
+ markdown: true,
2470
+ audioWords: words
2471
+ });
2472
+ }
2445
2473
  function RequestInputImages({ images, stepId }) {
2446
2474
  const { data: detail } = RequestLogStepService.useRequestLogStep("I", stepId ?? 0, { enabled: images === null && stepId !== null });
2447
2475
  const args = detail ? safeParseJson(detail.tool_args) : null;
@@ -2993,6 +3021,7 @@ function RequestDetail({ id }) {
2993
3021
  });
2994
3022
  const toolCalls = stepTree.flatMap((step) => step.toolCalls);
2995
3023
  const firstImageGenerationStepId = toolCalls.find((toolCall) => toolCall.toolName === "image_generation")?.id ?? null;
3024
+ const voiceStepId = toolCalls.find((toolCall) => toolCall.toolName === "speech" || toolCall.toolName === "transcription")?.id ?? null;
2996
3025
  const hasSteps = stepTree.length > 0;
2997
3026
  const tokensPerSecEnabled = isTokensPerSecEnabled(data);
2998
3027
  const history = data.history ?? null;
@@ -3017,7 +3046,10 @@ function RequestDetail({ id }) {
3017
3046
  className: "space-y-3",
3018
3047
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3019
3048
  className: "relative",
3020
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: data.user_prompt ?? "null" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
3049
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: data.user_prompt ?? "null" }), data.media_kind === "stt" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceAwareContent, {
3050
+ text: data.user_prompt ?? "null",
3051
+ stepId: voiceStepId
3052
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
3021
3053
  text: data.user_prompt ?? "null",
3022
3054
  markdown: true
3023
3055
  })]
@@ -3070,7 +3102,10 @@ function RequestDetail({ id }) {
3070
3102
  title: "Response",
3071
3103
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3072
3104
  className: "relative",
3073
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: data.response }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
3105
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, { text: data.response }), data.media_kind === "tts" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceAwareContent, {
3106
+ text: data.response,
3107
+ stepId: voiceStepId
3108
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedContent, {
3074
3109
  text: data.response,
3075
3110
  markdown: true
3076
3111
  })]
@@ -1,6 +1,7 @@
1
1
  import { J as require_react, Q as __toESM, n as QgridService, q as require_jsx_runtime } from "./services.generated-B6QpnL_N.js";
2
2
  import { t as Link } from "./link-DrdV092C.js";
3
3
  import { a as ForwardRef$4, o as ForwardRef$5 } from "../entry-server.generated.js";
4
+ import { t as TimedPlayer } from "./TimedPlayer-DAwjkP4z.js";
4
5
  //#region ~icons/lucide/external-link.jsx
5
6
  var import_react = /* @__PURE__ */ __toESM(require_react());
6
7
  var import_jsx_runtime = require_jsx_runtime();
@@ -158,59 +159,22 @@ var STT_MODELS = [
158
159
  "openai/gpt-4o-mini-transcribe",
159
160
  "grok/grok-voice-transcribe-2.0"
160
161
  ];
161
- var OPENAI_VOICES = [
162
- "marin",
163
- "cedar",
164
- "alloy",
165
- "ash",
166
- "ballad",
167
- "coral",
168
- "echo",
169
- "sage",
170
- "shimmer",
171
- "verse"
172
- ];
162
+ var OPENAI_VOICES = "marin cedar alloy ash ballad coral echo sage shimmer verse".split(" ");
173
163
  var GROK_VOICE_GROUPS = [{
174
164
  label: "Female",
175
- voices: [
176
- "ara",
177
- "aurora",
178
- "carina",
179
- "celeste",
180
- "eve",
181
- "iris",
182
- "liora",
183
- "luna",
184
- "ursa"
185
- ]
165
+ voices: "ara aurora carina celeste eve iris liora luna ursa".split(" ")
186
166
  }, {
187
167
  label: "Male",
188
- voices: [
189
- "altair",
190
- "atlas",
191
- "castor",
192
- "cosmo",
193
- "helios",
194
- "helix",
195
- "kepler",
196
- "leo",
197
- "lumen",
198
- "lux",
199
- "naksh",
200
- "orion",
201
- "perseus",
202
- "rex",
203
- "rigel",
204
- "sal",
205
- "sirius",
206
- "zagan",
207
- "zenith"
208
- ]
168
+ voices: "altair atlas castor cosmo helios helix kepler leo lumen lux naksh orion perseus rex rigel sal sirius zagan zenith".split(" ")
209
169
  }];
210
170
  var OPENAI_VOICE_GROUPS = [{
211
171
  label: "",
212
172
  voices: OPENAI_VOICES
213
173
  }];
174
+ var TIMING_SOURCE = {
175
+ provider: "timing from Grok TTS",
176
+ aligned: "timing aligned via Grok STT"
177
+ };
214
178
  var isOpenAI = (model) => model.startsWith("openai/");
215
179
  var FIELD = "w-full rounded-lg border border-sand-200/80 bg-white px-2.5 py-1.5 text-[12px] text-sand-800 placeholder:text-sand-400 focus:outline-none focus:border-sienna-300 disabled:opacity-50";
216
180
  var CONTROL = `${FIELD} h-8`;
@@ -276,12 +240,38 @@ function History({ empty, children }) {
276
240
  children
277
241
  });
278
242
  }
243
+ /** Words from per-character timing (Grok TTS shape): each run of non-space characters is a word. */
244
+ function wordsFromCharTimes(timestamps) {
245
+ if (!timestamps) return void 0;
246
+ const words = [];
247
+ let current;
248
+ timestamps.graphChars.forEach((char, i) => {
249
+ const [start, end] = timestamps.graphTimes[i];
250
+ if (/\s/.test(char)) {
251
+ current = void 0;
252
+ return;
253
+ }
254
+ if (current) {
255
+ current.text += char;
256
+ current.end = end;
257
+ } else {
258
+ current = {
259
+ text: char,
260
+ start,
261
+ end
262
+ };
263
+ words.push(current);
264
+ }
265
+ });
266
+ return words;
267
+ }
279
268
  function TtsPanel() {
280
269
  const [model, setModel] = (0, import_react.useState)(TTS_MODELS[0]);
281
270
  const [voice, setVoice] = (0, import_react.useState)("ara");
282
271
  const [instructions, setInstructions] = (0, import_react.useState)("");
283
272
  const [text, setText] = (0, import_react.useState)("Hi! What did you do this weekend?");
284
273
  const [history, setHistory] = (0, import_react.useState)([]);
274
+ const [withTimestamps, setWithTimestamps] = (0, import_react.useState)(true);
285
275
  const nextKey = (0, import_react.useRef)(0);
286
276
  const speak = QgridService.useSpeakMutation();
287
277
  const openai = isOpenAI(model);
@@ -299,6 +289,7 @@ function TtsPanel() {
299
289
  projectName: PROJECT_NAME
300
290
  };
301
291
  if (style) params.instructions = style;
292
+ if (withTimestamps) params.withTimestamps = true;
302
293
  speak.mutate({ params }, { onSuccess: (out) => {
303
294
  const item = {
304
295
  key: nextKey.current++,
@@ -308,7 +299,9 @@ function TtsPanel() {
308
299
  instructions: params.instructions,
309
300
  text,
310
301
  elapsedMs: performance.now() - startedAt,
311
- requestLogId: out.requestLogId
302
+ requestLogId: out.requestLogId,
303
+ words: wordsFromCharTimes(out.audioTimestamps),
304
+ timing: out.timestampsError ? `timing failed: ${out.timestampsError}` : out.timestampsSource && TIMING_SOURCE[out.timestampsSource]
312
305
  };
313
306
  setHistory((items) => [item, ...items]);
314
307
  } });
@@ -397,20 +390,32 @@ function TtsPanel() {
397
390
  }),
398
391
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
399
392
  className: "flex items-center gap-3",
400
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
401
- type: "button",
402
- onClick: () => generate(voice),
403
- disabled: speak.isPending || !text.trim(),
404
- className: BUTTON,
405
- children: [
406
- speak.isPending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ForwardRef$2, { className: "size-3.5 animate-spin" }),
407
- "Generate with ",
408
- voice
409
- ]
410
- }), speak.isError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
411
- className: "text-[12px] text-danger-500 break-words",
412
- children: speak.error?.message
413
- })]
393
+ children: [
394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
395
+ type: "button",
396
+ onClick: () => generate(voice),
397
+ disabled: speak.isPending || !text.trim(),
398
+ className: BUTTON,
399
+ children: [
400
+ speak.isPending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ForwardRef$2, { className: "size-3.5 animate-spin" }),
401
+ "Generate with ",
402
+ voice
403
+ ]
404
+ }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
406
+ className: "flex items-center gap-1.5 text-[12px] text-sand-600",
407
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
408
+ type: "checkbox",
409
+ checked: withTimestamps,
410
+ onChange: (e) => setWithTimestamps(e.target.checked),
411
+ className: "accent-sienna-500"
412
+ }), "Word timing"]
413
+ }),
414
+ speak.isError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
415
+ className: "text-[12px] text-danger-500 break-words",
416
+ children: speak.error?.message
417
+ })
418
+ ]
414
419
  })
415
420
  ]
416
421
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -419,21 +424,20 @@ function TtsPanel() {
419
424
  empty: "Generated clips stack here, newest first, so voices can be compared side by side.",
420
425
  children: history.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(HistoryRow, {
421
426
  title: `${item.voice} · ${shortModel(item.model)}`,
422
- meta: `${(item.elapsedMs / 1e3).toFixed(1)}s`,
427
+ meta: [`${(item.elapsedMs / 1e3).toFixed(1)}s`, item.timing].filter(Boolean).join(" · "),
423
428
  requestLogId: item.requestLogId,
424
429
  onRemove: () => setHistory((items) => items.filter((i) => i.key !== item.key)),
425
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
430
+ children: [(!item.words || item.instructions) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
426
431
  className: "truncate text-[12px] text-sand-600",
427
432
  title: item.text,
428
- children: [item.text, item.instructions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
433
+ children: [!item.words && item.text, item.instructions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
429
434
  className: "text-sand-400",
430
435
  children: [" — ", item.instructions]
431
436
  })]
432
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", {
433
- controls: true,
434
- autoPlay: true,
437
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimedPlayer, {
435
438
  src: item.src,
436
- className: "h-8 w-full"
439
+ words: item.words,
440
+ autoPlay: true
437
441
  })]
438
442
  }, item.key))
439
443
  })
@@ -515,7 +519,8 @@ function SttPanel() {
515
519
  text: out.text,
516
520
  elapsedMs: performance.now() - startedAt,
517
521
  durationSec: out.durationSec,
518
- requestLogId: out.requestLogId
522
+ requestLogId: out.requestLogId,
523
+ words: out.words
519
524
  };
520
525
  setHistory((items) => [item, ...items]);
521
526
  } });
@@ -611,7 +616,10 @@ function SttPanel() {
611
616
  ].filter(Boolean).join(" · "),
612
617
  requestLogId: item.requestLogId,
613
618
  onRemove: () => setHistory((items) => items.filter((i) => i.key !== item.key)),
614
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
619
+ children: item.words && item.words.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimedPlayer, {
620
+ src: item.clipUrl,
621
+ words: item.words
622
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
615
623
  className: "rounded-lg bg-sand-50 px-3 py-2 text-[13px] text-sand-800 whitespace-pre-wrap",
616
624
  children: item.text || "(empty transcript)"
617
625
  })
@@ -48203,7 +48203,7 @@ function ChatWidget() {
48203
48203
  }
48204
48204
  //#endregion
48205
48205
  //#region src/components/Sidebar.tsx
48206
- var qgridVersion = "2.16.0";
48206
+ var qgridVersion = "2.17.0";
48207
48207
  function Sidebar({ className }) {
48208
48208
  const pathname = useRouterState({ select: (s) => s.location.pathname });
48209
48209
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", {
@@ -50840,11 +50840,11 @@ var $$splitComponentImporter$2 = () => import("./assets/tokens-TDQguTdh.js");
50840
50840
  var Route$2 = createFileRoute("/tokens")({ component: lazyRouteComponent($$splitComponentImporter$2, "component") });
50841
50841
  //#endregion
50842
50842
  //#region src/routes/voice.tsx
50843
- var $$splitComponentImporter$1 = () => import("./assets/voice-C2HfwkGp.js");
50843
+ var $$splitComponentImporter$1 = () => import("./assets/voice-CHoPEIfo.js");
50844
50844
  var Route$1 = createFileRoute("/voice")({ component: lazyRouteComponent($$splitComponentImporter$1, "component") });
50845
50845
  //#endregion
50846
50846
  //#region src/routes/requests/show.tsx
50847
- var $$splitComponentImporter = () => import("./assets/show-D8r2sVK0.js");
50847
+ var $$splitComponentImporter = () => import("./assets/show-hBbPOUZD.js");
50848
50848
  var showSearchSchema = object({ id: number$1() });
50849
50849
  var Route = createFileRoute("/requests/show")({
50850
50850
  validateSearch: showSearchSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartanova/qgrid-cli",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cartanova-ai/qgrid"
@@ -263,4 +263,4 @@ For external providers, the logger reads AI SDK's provider-neutral `onStart.outp
263
263
 
264
264
  `qgrid.transcription("openai/<id>")` and `qgrid.speech("openai/<id>")` share the Grok voice factories; the `openai/` prefix selects the realtime route and switches the option namespace to `providerOptions.openai`, whose schemas are copied field-for-field from `@ai-sdk/openai` (`openAITranscriptionModelOptions`, `openaiSpeechModelOptionsSchema`, vercel/ai `fce9210`). Honored: transcription `language`, `prompt` (`gpt-realtime-whisper` rejects `prompt` with HTTP 400 from the server; `whisper-1` accepts it but the upstream ignores it); speech `voice` (one of OpenAI realtime's 10 preset voices: `alloy ash ballad coral echo sage shimmer verse marin cedar`, default `marin`; others fail with HTTP 400), `instructions`/`openai.instructions`, `outputFormat` `wav` (default) or `pcm`. Every other set key emits the AI SDK `unsupported` warning; `language` on speech reuses the official provider's warning text and an unknown `outputFormat` falls back to `wav` with a warning (the official provider falls back to `mp3`). `providerOptions.qgrid.tokenName` must carry the `openai/` prefix. Transcription input must be PCM16 WAV or raw PCM; `segments` is empty, `durationInSeconds` is computed server-side from the audio, `language` echoes the request. Speech `providerMetadata.qgrid.mediaType` is `audio/wav` or `audio/pcm;rate=24000`. Keep model unions equal to the server's candidate lists and prune both from the live matrix (`openai-codex-runtime.md`, "Realtime voice").
265
265
 
266
- `qgrid.speech("grok/...")` honors one `providerOptions.xai` key, `withTimestamps` (2.16.0+), mapped to the server's `withTimestamps`; every other `xai` key still warns. The timing comes back in `providerMetadata.qgrid.audioTimestamps` (`graphChars`, `graphTimes` `[start, end]` seconds, index-aligned) plus `providerMetadata.qgrid.duration`, the same field names `@ai-sdk/xai` uses under `providerMetadata.xai`. OpenAI speech has no timing data; the server rejects `withTimestamps` there with HTTP 400.
266
+ Speech timing: `qgrid.speech("grok/...")` honors one `providerOptions.xai` key, `withTimestamps` (2.16.0+); `providerOptions.qgrid.withTimestamps` (2.17.0+) works for both `grok/` and `openai/` speech and is read straight from the namespace because the qgrid option parsers drop unknown keys. Every other `xai` key still warns. Timing comes back in `providerMetadata.qgrid.audioTimestamps` (`graphChars`, `graphTimes` `[start, end]` seconds, index-aligned) plus `duration` and `timestampsSource` (`provider` for Grok, `aligned` for OpenAI); the field names match `@ai-sdk/xai`'s `providerMetadata.xai`. A failed timing step returns the audio with `timestampsError` and an `other` warning. Grok transcription maps the server's `words` to AI SDK `segments` (`startSecond`/`endSecond`, 2.17.0+); OpenAI transcription segments stay empty.
@@ -81,7 +81,11 @@ Provider `cost_in_usd_ticks` is authoritative, including zero; one tick is `1e-1
81
81
 
82
82
  Qgrid exposes image generation/editing, asynchronous video start/status, transcription, and speech through `api.x.ai`. Reference images select `/images/edits`; video uses `/videos/generations` and `/videos/{request_id}`; voice uses multipart `/stt` and JSON `/tts` (`grok-media-client.ts`, `grok-voice-client.ts`, `packages/api/src/application/qgrid/qgrid.frame.ts`).
83
83
 
84
- TTS timestamps (2.16.0+): `withTimestamps: true` on `speak` sends `with_timestamps: true`, and `/tts` then answers with a JSON envelope (`audio` base64, `content_type`, `duration`, `audio_timestamps.graph_chars` / `graph_times`) instead of raw bytes; the client decodes it and `speak` returns `audioTimestamps` (`graphChars`, `graphTimes`, character-level `[start, end]` seconds) and `durationSec`. Verified with the subscription token on 2026-11-09 (42 characters for a 42-character line, 0.87 s to the response). OpenAI realtime speech has no timing data and rejects the flag with 400.
84
+ TTS timestamps (2.16.0+): `withTimestamps: true` on `speak` sends `with_timestamps: true`, and `/tts` then answers with a JSON envelope (`audio` base64, `content_type`, `duration`, `audio_timestamps.graph_chars` / `graph_times`) instead of raw bytes; the client decodes it and `speak` returns `audioTimestamps` (`graphChars`, `graphTimes`, character-level `[start, end]` seconds), `durationSec`, and `timestampsSource: "provider"`. Verified with the subscription token on 2026-11-09 (42 characters for a 42-character line, 0.87 s to the response).
85
+
86
+ STT words (2.17.0+): `/stt` sends word-level `words` (`text`, `start`, `end`; `speaker` with diarize) by default; `transcribe` returns them as `TranscribeOutput.words` (`text`, `start`, `end` only). Against Grok TTS timing of the same clip, 17/17 words matched with a median boundary difference of 46 ms (p90 67 ms, STT consistently about 45 ms later), in 0.5 s.
87
+
88
+ OpenAI speech timing (2.17.0+): OpenAI realtime has no timing data, so `speak` with `withTimestamps` transcribes the generated WAV with Grok STT on an automatically selected Grok token and aligns the heard words to the script (`utils/speech-alignment.ts`: edit-distance pairing, so mis-heard words keep their slot and a spoken preamble is skipped; unpaired script words split the gap between neighbours; each word's span is split over its characters). The result is `timestampsSource: "aligned"`; the step log records the heard text and matched/script word counts. A failed Grok step is fail-soft: the audio returns with `timestampsError`.
85
89
 
86
90
  Image generation and editing default to `grok-imagine-image-2.0`; the public SDK lists it and
87
91
  `grok-imagine-image` (1.0). Quality omission passes through as upstream `auto`, currently low for
@@ -64,9 +64,9 @@ The list header ends its filter row with a reload button (2.10.2+) that calls th
64
64
 
65
65
  Structured output visibility: the list has an `Fmt` column (`voice/stt` or `voice/tts` when `media_kind` is `stt` or `tts`, `video` when it is `video`, otherwise `img` when `is_image_generation` is true, otherwise `json` when `is_structured` is true, otherwise `text`) and a `broken` badge driven by `response_json_ok = false`; there is no broken-JSON list filter. At review time, all 114,647 succeeded structured rows had `response_json_ok = true` and zero false rows existed; the unindexed zero-result lookup scanned 1,286,016 rows and took about 3 seconds. Before reinstating the filter, validate the failure-signal semantics and index the predicate. The detail page shows a dark Response Type panel (zod expression by default, `type` declaration via toggle) rendered server-side from the stored `json_schema`. Plain-text rows render no panel. Rows written by pre-2.7.2 servers show `text`.
66
66
 
67
- Media rows (2.15.5+): `startMediaRun` writes the nullable `media_kind` column (`image`, `video`, `stt`, `tts`) at `createRun`; text runs keep it NULL, and media rows written before the column stay NULL and show their old `Fmt` label (no backfill). Speech rows store browser-playable audio (`audio/wav`, `audio/mpeg`) in `response` as `<audio src="data:...;base64,..."></audio>`, the same inline pattern image rows use, and the detail page renders it as an `<audio controls>` player; OpenAI `pcm` output is wrapped as WAV for the log copy only, while Grok `pcm`/`mulaw`/`alaw` keep the `[audio <mime> <bytes> bytes]` placeholder. The audio is stored once, not repeated in the `speech` step result. Speech `ttft_ms` is time to the first audio byte measured from the same start as `duration_ms`: the first `response.output_audio.delta` for OpenAI realtime, response-header arrival for Grok `/tts` (not streamed, so it is close to the full duration). `finishRun` takes an explicit `ttft_ms` for runs without generate steps and otherwise derives it from the first generate step. STT rows record no TTFT; since 2.16.0 their browser-playable input audio is embedded the same way in `user_prompt` (the detail page renders the USER panel through the same media parser), and other input types keep the placeholder. Inline audio grows the request-log table with every logged voice call; `logger: false` skips it.
67
+ Media rows (2.15.5+): `startMediaRun` writes the nullable `media_kind` column (`image`, `video`, `stt`, `tts`) at `createRun`; text runs keep it NULL, and media rows written before the column stay NULL and show their old `Fmt` label (no backfill). Speech rows store browser-playable audio (`audio/wav`, `audio/mpeg`) in `response` as `<audio src="data:...;base64,..."></audio>`, the same inline pattern image rows use, and the detail page renders it as an `<audio controls>` player; OpenAI `pcm` output is wrapped as WAV for the log copy only, while Grok `pcm`/`mulaw`/`alaw` keep the `[audio <mime> <bytes> bytes]` placeholder. The audio is stored once, not repeated in the `speech` step result. Speech `ttft_ms` is time to the first audio byte measured from the same start as `duration_ms`: the first `response.output_audio.delta` for OpenAI realtime, response-header arrival for Grok `/tts` (not streamed, so it is close to the full duration). `finishRun` takes an explicit `ttft_ms` for runs without generate steps and otherwise derives it from the first generate step. STT rows record no TTFT; since 2.16.0 their browser-playable input audio is embedded the same way in `user_prompt` (the detail page renders the USER panel through the same media parser), and other input types keep the placeholder. Inline audio grows the request-log table with every logged voice call; `logger: false` skips it. Voice step results keep word timing (`words`: TTS output words, or the words Grok heard in the STT input; 2.17.0+); the detail page fetches that one step (subset `A`) for `tts`/`stt` rows and renders the RESPONSE or USER clip with the shared `TimedPlayer` (highlighted, clickable words).
68
68
 
69
- Voice playground (2.15.5+): the sidebar's Playground section links `/voice`, a dashboard-only test page with Text to speech and Speech to text panels that call the generated `QgridService.useSpeakMutation` / `useTranscribeMutation` with project name `qgrid_voice`; no API was added. Voice lists are web constants: OpenAI's 10 realtime presets and the 28 Grok `/tts` voices (9 female, 19 male) listed for the subscription token on 2026-11-06; the server still validates them. Instructions and the STT prompt are shown only for `openai/` models. STT sends no `language`: a 2026-11-09 run (6 OpenAI STT models × auto/en/ko × 6 synthetic learner clips) found `en` no better than auto and `ko` translating English audio into Korean on gpt-4o-transcribe and whisper-1. The STT model list keeps only `openai/gpt-4o-transcribe` (default), `openai/gpt-4o-mini-transcribe`, and the unmeasured `grok/grok-voice-transcribe-2.0`; the server still accepts the other ids. The page is one card with Text to speech / Speech to text tabs; both panels stay mounted (the inactive one is hidden) so form state and history survive tab switches. Each result is prepended to an in-memory history row (removable, lost on reload) with a request-log link that opens in a new tab so the history is kept. TTS voices are chips (Grok split Female/Male) above the text: a name selects the voice, and ▶ plays a bundled sample from `packages/web/public/voice-samples/{openai,grok}/<voice>.mp3` without a request (and selects it; pressing again stops). Each of the 38 samples introduces itself ("I'm <Voice>. Nice to meet you. How's it going?"), regenerated on 2026-11-09 through qgrid (`grok/grok-tts`, `openai/gpt-realtime-2.1-mini`) and checked with STT; re-encoded to 40 kbps mono MP3 (about 640 KB, shipped in the CLI bundle via `web-dist`). Do not trust the OpenAI speech self-transcript as a verbatim check: one ballad take carried an audible "Okay, let's read that line aloud exactly as written." preamble that two STT models heard while `response.output_audio_transcript.done` showed only the script. A voice added upstream needs a sample file or its ▶ fails to load. STT recordings and uploads are numbered clips so one clip run through several models reads as a comparison. Recordings (MediaRecorder webm/opus) and uploads are decoded with `AudioContext` at 24 kHz, mixed to mono, and sent as PCM16 WAV (`voice-audio.ts`), because the OpenAI transcription route accepts only WAV or raw PCM. Results link to their request log.
69
+ Voice playground (2.15.5+): the sidebar's Playground section links `/voice`, a dashboard-only test page with Text to speech and Speech to text panels that call the generated `QgridService.useSpeakMutation` / `useTranscribeMutation` with project name `qgrid_voice`; no API was added. Voice lists are web constants: OpenAI's 10 realtime presets and the 28 Grok `/tts` voices (9 female, 19 male) listed for the subscription token on 2026-11-06; the server still validates them. Instructions and the STT prompt are shown only for `openai/` models. STT sends no `language`: a 2026-11-09 run (6 OpenAI STT models × auto/en/ko × 6 synthetic learner clips) found `en` no better than auto and `ko` translating English audio into Korean on gpt-4o-transcribe and whisper-1. The STT model list keeps only `openai/gpt-4o-transcribe` (default), `openai/gpt-4o-mini-transcribe`, and the unmeasured `grok/grok-voice-transcribe-2.0`; the server still accepts the other ids. The page is one card with Text to speech / Speech to text tabs; both panels stay mounted (the inactive one is hidden) so form state and history survive tab switches. Each result is prepended to an in-memory history row (removable, lost on reload) with a request-log link that opens in a new tab so the history is kept. TTS voices are chips (Grok split Female/Male) above the text: a name selects the voice, and ▶ plays a bundled sample from `packages/web/public/voice-samples/{openai,grok}/<voice>.mp3` without a request (and selects it; pressing again stops). Each of the 38 samples introduces itself ("I'm <Voice>. Nice to meet you. How's it going?"), regenerated on 2026-11-09 through qgrid (`grok/grok-tts`, `openai/gpt-realtime-2.1-mini`) and checked with STT; re-encoded to 40 kbps mono MP3 (about 640 KB, shipped in the CLI bundle via `web-dist`). Do not trust the OpenAI speech self-transcript as a verbatim check: one ballad take carried an audible "Okay, let's read that line aloud exactly as written." preamble that two STT models heard while `response.output_audio_transcript.done` showed only the script. A voice added upstream needs a sample file or its ▶ fails to load. STT recordings and uploads are numbered clips so one clip run through several models reads as a comparison. A "Word timing" checkbox (default on, 2.17.0+) sends `withTimestamps`; TTS rows and Grok STT rows then render the clip with its words under the player (`TimedPlayer`), highlight the word being spoken (animation-frame polling with a `timeupdate` fallback when frames are throttled), and show the timing source (Grok TTS, aligned via Grok STT, or the failure). Clicking a word plays from its start. Recordings (MediaRecorder webm/opus) and uploads are decoded with `AudioContext` at 24 kHz, mixed to mono, and sent as PCM16 WAV (`voice-audio.ts`), because the OpenAI transcription route accepts only WAV or raw PCM. Results link to their request log.
70
70
 
71
71
  Tool contract visibility: the detail page renders a Tools panel between Response Type and Steps for requests whose `tools` is non-empty. It starts collapsed and its header shows the tool count plus a responsive, truncated name list built from the detail subset — collapsed views issue no extra query. Expanding fires `toolsView` once and caches it for that request id, since a stored tool contract never changes. Each card shows the name, the full description, the parameter count, and a compact display-only zod shape; enum values past the sixth collapse to `/* +N */`, with the full shape reachable through hover and keyboard focus. All JSON Schema conversion happens server-side — the web renders completed strings and holds no schema logic.
72
72