@cartanova/qgrid-cli 2.17.1 → 2.18.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 +5 -2
  2. package/bundle/dist/application/qgrid/qgrid.types.js +2 -1
  3. package/bundle/dist/utils/providers/common/model-cost.js +10 -18
  4. package/bundle/dist/utils/providers/grok/grok-types.js +3 -2
  5. package/bundle/dist/utils/providers/grok/grok-voice-client.js +3 -2
  6. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +3 -2
  7. package/bundle/dist/utils/providers/openai/openai-realtime-protocol.js +4 -8
  8. package/bundle/src/application/qgrid/qgrid.frame.ts +8 -0
  9. package/bundle/src/application/qgrid/qgrid.types.ts +2 -0
  10. package/bundle/src/application/sonamu.generated.http +1 -0
  11. package/bundle/src/utils/providers/common/model-cost.ts +0 -1
  12. package/bundle/src/utils/providers/grok/grok-types.ts +1 -0
  13. package/bundle/src/utils/providers/grok/grok-voice-client.test.ts +3 -1
  14. package/bundle/src/utils/providers/grok/grok-voice-client.ts +1 -0
  15. package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +18 -0
  16. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +6 -1
  17. package/bundle/src/utils/providers/openai/openai-realtime-protocol.ts +3 -7
  18. package/bundle/web-dist/client/assets/{index-D56cIqxW.js → index-CbElySnT.js} +3 -3
  19. package/bundle/web-dist/client/assets/{logs-pMW62Hvw.js → logs-BJZmjJan.js} +1 -1
  20. package/bundle/web-dist/client/assets/{monit-COC4S7gf.js → monit-CO4TQDhe.js} +1 -1
  21. package/bundle/web-dist/client/assets/{routes-C38qmify.js → routes-D_pSsIQS.js} +1 -1
  22. package/bundle/web-dist/client/assets/{settings-BWGSVpiQ.js → settings-LKaZCi07.js} +1 -1
  23. package/bundle/web-dist/client/assets/{show-aQTLNz5k.js → show-BvATehjq.js} +1 -1
  24. package/bundle/web-dist/client/assets/{tokens-Ha8SwMPG.js → tokens-D5KX_VAe.js} +1 -1
  25. package/bundle/web-dist/client/assets/{use-oauth-login-flow-JoEnKQis.js → use-oauth-login-flow-DcqeDFdp.js} +1 -1
  26. package/bundle/web-dist/client/assets/{use-update-token-mutation-cdCVcOY5.js → use-update-token-mutation-IqmKULKf.js} +1 -1
  27. package/bundle/web-dist/client/assets/voice-BvjMZbB5.js +1 -0
  28. package/bundle/web-dist/client/index.html +1 -1
  29. package/bundle/web-dist/server/assets/{voice-CHoPEIfo.js → voice-BhVkiSJl.js} +20 -2
  30. package/bundle/web-dist/server/entry-server.generated.js +2 -2
  31. package/package.json +1 -1
  32. package/skills/qgrid/references/ai-sdk-provider-contract.md +1 -1
  33. package/skills/qgrid/references/grok-runtime.md +2 -0
  34. package/skills/qgrid/references/openai-codex-runtime.md +1 -1
  35. package/skills/qgrid/references/sonamu-api-web-flow.md +1 -1
  36. package/bundle/web-dist/client/assets/voice-COmvUTZO.js +0 -1
@@ -464,7 +464,6 @@ export type VoiceCost = { costUsd: number; costSource: "pricing_table"; ticks?:
464
464
  const OPENAI_SPEECH_PRICES = new Map([
465
465
  ["gpt-realtime-2.1", { textIn: 4, textOut: 24, audioOut: 64 }],
466
466
  ["gpt-realtime-2.1-mini", { textIn: 0.6, textOut: 2.4, audioOut: 20 }],
467
- ["gpt-realtime-1.5", { textIn: 4, textOut: 16, audioOut: 64 }],
468
467
  ]);
469
468
 
470
469
  // Transcription, USD per minute of audio (OpenAI's published per-minute estimates; Grok $0.10/hour).
@@ -300,6 +300,7 @@ export const GrokTtsRequest = z.object({
300
300
  // true switches /tts to a JSON envelope with per-character timing (verified on the subscription
301
301
  // token 2026-11-09).
302
302
  with_timestamps: z.boolean().optional(),
303
+ speed: z.number().optional(),
303
304
  });
304
305
 
305
306
  export type GrokTtsRequest = z.infer<typeof GrokTtsRequest>;
@@ -208,7 +208,7 @@ describe("GrokVoiceClient.speak", () => {
208
208
  });
209
209
  });
210
210
 
211
- it("passes explicit language and format and strips content-type parameters", async () => {
211
+ it("passes explicit language, format and speed and strips content-type parameters", async () => {
212
212
  const fake = fakeFetch(
213
213
  () =>
214
214
  new Response(mp3, { status: 200, headers: { "content-type": "audio/wav; codecs=1" } }),
@@ -219,12 +219,14 @@ describe("GrokVoiceClient.speak", () => {
219
219
  voice: "eve",
220
220
  language: "fr",
221
221
  format: "wav",
222
+ speed: 0.8,
222
223
  });
223
224
  expect(result.mediaType).toBe("audio/wav");
224
225
  const body = fake.calls[0]!.init.body;
225
226
  expect(typeof body === "string" && JSON.parse(body)).toMatchObject({
226
227
  language: "fr",
227
228
  format: "wav",
229
+ speed: 0.8,
228
230
  });
229
231
  });
230
232
 
@@ -255,6 +255,7 @@ export class GrokVoiceClient implements GrokVoicePort {
255
255
  language: request.language ?? GROK_TTS_DEFAULT_LANGUAGE,
256
256
  format: request.format ?? GROK_TTS_DEFAULT_FORMAT,
257
257
  with_timestamps: request.with_timestamps,
258
+ speed: request.speed,
258
259
  });
259
260
 
260
261
  const headers = {
@@ -251,6 +251,24 @@ describe("OpenAIDispatcher direct runtime", () => {
251
251
  expect(fetchMock).toHaveBeenCalledTimes(2);
252
252
  });
253
253
 
254
+ it("re-judges a token updated during its quota lookup instead of reporting it over quota", async () => {
255
+ let finishOld!: (value: Response) => void;
256
+ const quota = (percent: number) => new Response(JSON.stringify({
257
+ rate_limits: { primary_window: { used_percent: percent } },
258
+ }));
259
+ const fetchMock = vi.fn()
260
+ .mockImplementationOnce(() => new Promise((resolve) => { finishOld = resolve; }))
261
+ .mockResolvedValueOnce(quota(65));
262
+ const d = new OpenAIDispatcher(config(), { fetch: fetchMock });
263
+ await d.onTokenAdded(1, "one", credentials, 100);
264
+ const selection = d.selectToken(1, true, new AbortController().signal);
265
+ await vi.waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(1));
266
+ await d.onTokenUpdated(1, "one", { ...credentials, accessToken: "refreshed" }, 100);
267
+ finishOld(quota(65));
268
+ await expect(selection).resolves.toMatchObject({ tokenId: 1 });
269
+ expect(fetchMock).toHaveBeenCalledTimes(2);
270
+ });
271
+
254
272
  it("rejects unsupported image backgrounds", () => {
255
273
  expect(QueryInput.safeParse({
256
274
  prompt: "a circle", imageGeneration: true,
@@ -1075,8 +1075,13 @@ export class OpenAIDispatcher implements ProviderDispatcher {
1075
1075
  if (token.quotaThreshold === null || token.quotaThreshold === undefined) return true;
1076
1076
  const generation = token.generation;
1077
1077
  const result = await readOpenAIQuotaUsage(async () => this.getRateLimitsByTokenId(id, signal));
1078
+ const current = this.tokenMetadata.get(id);
1078
1079
 
1079
- if (this.tokenMetadata.get(id) !== token || token.generation !== generation) return false;
1080
+ // A token update (credential refresh, sync) landed mid-lookup: judge the updated token
1081
+ // instead of reporting it over quota.
1082
+ if (current !== token || token.generation !== generation) {
1083
+ return current?.active ? this.isQuotaEligible(id, current, signal) : false;
1084
+ }
1080
1085
 
1081
1086
  if (result.kind === "lookup_failed") {
1082
1087
  this.quotaBlocked.delete(id);
@@ -76,14 +76,10 @@ export const OPENAI_TRANSCRIPTION_MODELS_WITHOUT_PROMPT: ReadonlySet<string> = n
76
76
 
77
77
  /**
78
78
  * Text-to-speech (realtime conversational) ids. Verbatim fidelity on the 2026-10-17 matrix:
79
- * gpt-realtime-2.1-mini 13/13, gpt-realtime-2.1 12/13 (one paraphrase), gpt-realtime-1.5 6/13
80
- * (often answers the text instead of repeating it). Default stays 2.1-mini.
79
+ * gpt-realtime-2.1-mini 13/13, gpt-realtime-2.1 12/13 (one paraphrase). Default stays 2.1-mini.
80
+ * gpt-realtime-1.5 was removed on 2026-11-09: it answered the text instead of repeating it (6/13).
81
81
  */
82
- export const OPENAI_SPEECH_MODELS = [
83
- "gpt-realtime-2.1-mini",
84
- "gpt-realtime-2.1",
85
- "gpt-realtime-1.5",
86
- ] as const;
82
+ export const OPENAI_SPEECH_MODELS = ["gpt-realtime-2.1-mini", "gpt-realtime-2.1"] as const;
87
83
 
88
84
  /**
89
85
  * A minimal Opus-only SDP offer. Codex sends a real WebRTC offer; qgrid has no RTP peer and only