tuxevil-rotator 4.2.2 → 4.3.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 (39) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README.md +9 -4
  3. package/package.json +1 -1
  4. package/plugins/opencode-discovery/capabilities.d.mts +7 -0
  5. package/plugins/opencode-discovery/capabilities.mjs +54 -0
  6. package/plugins/opencode-discovery/index.d.mts +2 -1
  7. package/plugins/opencode-discovery/index.mjs +6 -1
  8. package/plugins/opencode-discovery/package.json +3 -1
  9. package/src/audio-transcription.ts +32 -6
  10. package/src/cli.ts +3 -3
  11. package/src/compat/model-specs.ts +4 -0
  12. package/src/compat.ts +30 -1
  13. package/src/dashboard-app.ts +1 -0
  14. package/src/install-agent.ts +211 -129
  15. package/src/install-opencode.ts +80 -18
  16. package/src/providers/google-antigravity/catalog.ts +14 -6
  17. package/src/providers/google-antigravity/dynamic-catalog.ts +79 -3
  18. package/src/providers/google-antigravity/forward.ts +4 -2
  19. package/src/providers/google-antigravity/quota.ts +4 -0
  20. package/src/providers/ollama/forward.ts +10 -0
  21. package/src/providers/openai-codex/catalog.ts +157 -18
  22. package/src/proxy.ts +35 -2
  23. package/src/rotator.ts +16 -2
  24. package/src/types.ts +78 -29
  25. package/src/web/app.tsx +4 -0
  26. package/src/web/lib/audio-recorder.ts +159 -0
  27. package/src/web/lib/colors.ts +4 -0
  28. package/src/web/lib/playground-storage.ts +261 -0
  29. package/src/web/lib/playground.ts +448 -0
  30. package/src/web/nav.ts +1 -0
  31. package/src/web/pages/Playground.tsx +1111 -0
  32. package/src/web/pages/Transcription.tsx +428 -0
  33. package/src/web/state/api.ts +3 -0
  34. package/src/web/state/playground-client.ts +136 -0
  35. package/src/web/state/playground.ts +69 -0
  36. package/src/web/state/router.ts +2 -2
  37. package/src/web/state/transcription-client.ts +93 -0
  38. package/src/web/styles/app.css +45 -0
  39. package/tools/telemetry-receiver/receiver.js +59 -46
@@ -0,0 +1,93 @@
1
+ import { ApiError, notifyUnauthorized } from "./api.js";
2
+ import {
3
+ apiErrorMessage,
4
+ record,
5
+ type TranscriptionResult,
6
+ } from "../lib/playground.js";
7
+ import { validateAudioFile, audioFileLimit } from "../lib/audio-recorder.js";
8
+
9
+ export interface TranscriptionInput {
10
+ file: File;
11
+ model: string;
12
+ language: string;
13
+ prompt: string;
14
+ maxBodyBytes: number;
15
+ }
16
+ export async function transcribeAudio(
17
+ input: TranscriptionInput,
18
+ signal: AbortSignal,
19
+ fetcher: typeof fetch = fetch,
20
+ ): Promise<Omit<TranscriptionResult, "id" | "createdAt">> {
21
+ validateAudioFile(input.file, audioFileLimit(input.maxBodyBytes));
22
+ if (!input.model) throw new Error("Choose an audio model first.");
23
+ if (input.language && !/^[a-z]{2,3}(?:-[a-zA-Z]{2,4})?$/.test(input.language))
24
+ throw new Error(
25
+ "Use a language code such as es or en, or leave it blank for automatic detection.",
26
+ );
27
+ if (input.prompt.length > 1000)
28
+ throw new Error("Vocabulary context must be 1000 characters or fewer.");
29
+ const form = new FormData();
30
+ form.append("file", input.file);
31
+ form.append("model", input.model);
32
+ form.append("response_format", "json");
33
+ if (input.language) form.append("language", input.language);
34
+ if (input.prompt) form.append("prompt", input.prompt);
35
+ const controller = new AbortController();
36
+ const abort = () => controller.abort();
37
+ signal.addEventListener("abort", abort, { once: true });
38
+ if (signal.aborted) abort();
39
+ const started = performance.now();
40
+ let timedOut = false;
41
+ const timeout = setTimeout(() => {
42
+ timedOut = true;
43
+ controller.abort();
44
+ }, 40_000);
45
+ try {
46
+ const response = await fetcher("/api/playground/audio/transcriptions", {
47
+ method: "POST",
48
+ credentials: "same-origin",
49
+ body: form,
50
+ signal: controller.signal,
51
+ });
52
+ if (response.status === 401) {
53
+ notifyUnauthorized();
54
+ throw new ApiError(401, "Your session ended. Sign in again.");
55
+ }
56
+ let body: unknown;
57
+ try {
58
+ body = await response.json();
59
+ } catch {
60
+ throw new Error(
61
+ `Invalid transcription response (HTTP ${response.status}).`,
62
+ );
63
+ }
64
+ if (!response.ok)
65
+ throw new Error(
66
+ apiErrorMessage(body) ||
67
+ `Transcription failed (HTTP ${response.status}).`,
68
+ );
69
+ if (!record(body) || typeof body.text !== "string")
70
+ throw new Error("Transcription response is missing text.");
71
+ if (controller.signal.aborted) throw new Error("Request cancelled.");
72
+ return {
73
+ filename: input.file.name,
74
+ model: input.model,
75
+ language: input.language,
76
+ prompt: input.prompt,
77
+ text: body.text,
78
+ elapsedMs: performance.now() - started,
79
+ };
80
+ } catch (err) {
81
+ if (timedOut)
82
+ throw new Error(
83
+ "Transcription request timed out. Try a shorter recording.",
84
+ { cause: err },
85
+ );
86
+ if (signal.aborted)
87
+ throw new Error("Transcription cancelled.", { cause: err });
88
+ throw err;
89
+ } finally {
90
+ clearTimeout(timeout);
91
+ signal.removeEventListener("abort", abort);
92
+ }
93
+ }
@@ -5895,3 +5895,48 @@ dialog::backdrop {
5895
5895
  box-shadow: none;
5896
5896
  }
5897
5897
  }
5898
+
5899
+ /* Playground: the same controls and surfaces as the rest of the dashboard. */
5900
+ .playground { display: flex; flex-direction: column; gap: 18px; }
5901
+ .pg-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
5902
+ .pg-toolbar label { display: inline-flex; align-items: center; gap: 6px; }
5903
+ .pg-toolbar .pg-history { display: block; flex: 1; min-width: 0; max-width: 440px; }
5904
+ .pg-history select { text-overflow: ellipsis; min-width: 0; width: 100%; max-width: 100%; }
5905
+ .pg-panels { display: grid; gap: 16px; align-items: start; }
5906
+ .pg-panels-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
5907
+ .pg-panels-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
5908
+ .pg-panels > .panel { min-width: 0; }
5909
+ .pg-parameters { margin: 14px 0; padding: 12px 0; border-block: 1px solid var(--border); }
5910
+ .pg-parameters summary, .pg-inspect summary { color: var(--text-2); cursor: pointer; font-size: 12px; }
5911
+ .pg-parameters fieldset { border: 0; padding: 14px 0 0; margin: 0; min-width: 0; }
5912
+ .pg-turns { max-height: 65vh; overflow: auto; margin-block: 14px; overflow-wrap: anywhere; }
5913
+ .pg-turn { border-top: 1px solid var(--border); padding-block: 14px; }
5914
+ .pg-user { background: var(--surface-2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
5915
+ .pg-user p { white-space: pre-wrap; }
5916
+ .pg-user img, .pg-images img { display: block; max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 8px; margin-block: 8px; }
5917
+ .pg-answer { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; line-height: 1.65; font-size: 13px; margin-block: 10px; }
5918
+ .pg-code { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
5919
+ .pg-metrics { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-3); font-size: 11px; margin-block: 12px; }
5920
+ .pg-composer { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
5921
+ .pg-images { display: flex; flex-wrap: wrap; gap: 14px; }
5922
+ .pg-images > div { max-width: 220px; }
5923
+ .pg-check-models { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; max-height: 240px; overflow: auto; margin-bottom: 18px; }
5924
+ .pg-check-models label { display: flex; align-items: start; gap: 8px; overflow-wrap: anywhere; font-size: 12px; }
5925
+ .pg-check-models + .pg-toolbar { margin-bottom: 18px; }
5926
+ .pg-results { display: grid; gap: 16px; }
5927
+ .playground input[type="checkbox"] { accent-color: var(--accent); }
5928
+ @media (max-width: 1100px) { .pg-panels-3 { grid-template-columns: 1fr; } }
5929
+ @media (max-width: 760px) {
5930
+ .pg-panels-2 { grid-template-columns: 1fr; }
5931
+ .pg-toolbar .pg-history { max-width: 100%; flex: 1 0 100%; }
5932
+ .pg-check-models { grid-template-columns: 1fr; }
5933
+ }
5934
+ .pg-composer textarea.input { min-height: 100px; height: auto; resize: vertical; }
5935
+ .pg-parameters textarea.input { min-height: 90px; height: auto; resize: vertical; }
5936
+
5937
+ /* Audio preview and results share the existing playground surfaces. */
5938
+ .pg-transcription { display: grid; gap: 16px; }
5939
+ .pg-audio-preview { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
5940
+ .pg-audio-preview audio { width: 100%; max-width: 600px; }
5941
+ .pg-audio-context.input { min-height: 72px; height: auto; resize: vertical; }
5942
+ @media (max-width: 760px) { .playground > .pg-toolbar > .segmented { flex-wrap: wrap; } }
@@ -334,61 +334,74 @@ function sanitizeTokensByModel(raw) {
334
334
 
335
335
  // Pricing per 1M tokens (USD) — mirrors MODEL_PRICING in the rotator
336
336
  const MODEL_PRICING = {
337
- "claude-opus-4-6-thinking": { inputPer1M: 5.00, outputPer1M: 25.00 },
338
- "claude-sonnet-4-6": { inputPer1M: 3.00, outputPer1M: 15.00 },
339
- "gemini-3.1-pro": { inputPer1M: 2.00, outputPer1M: 12.00 },
340
- "gemini-3.1-pro-low": { inputPer1M: 2.00, outputPer1M: 12.00 },
341
- "gemini-3.1-pro-high": { inputPer1M: 2.00, outputPer1M: 12.00 },
342
- "gemini-3-flash": { inputPer1M: 0.50, outputPer1M: 3.00 },
343
- "gemini-3.6-flash": { inputPer1M: 1.50, outputPer1M: 7.50 },
344
- "gemini-3.6-flash-high": { inputPer1M: 1.50, outputPer1M: 7.50 },
345
- "gemini-3.6-flash-medium": { inputPer1M: 1.50, outputPer1M: 7.50 },
346
- "gemini-3.6-flash-low": { inputPer1M: 1.50, outputPer1M: 7.50 },
347
- "gemini-3.6-flash-tiered": { inputPer1M: 1.50, outputPer1M: 7.50 },
348
- // Gemini 3.7 Flash tiered — public Gemini API pricing, verified
349
- // 2026-08-13. Introductory rates through 2026-12-31; from 2027-01-01
350
- // these double to input 1.50 / output 7.50 per 1M tokens.
351
- "gemini-3.7-flash-tiered": { inputPer1M: 0.75, outputPer1M: 3.75 },
337
+ "claude-opus-4-6-thinking": { inputPer1M: 5.0, outputPer1M: 25.0 },
338
+ "claude-sonnet-4-6": { inputPer1M: 3.0, outputPer1M: 15.0 },
339
+ "gemini-3.1-pro": { inputPer1M: 2.0, outputPer1M: 12.0 },
340
+ "gemini-3.1-pro-low": { inputPer1M: 2.0, outputPer1M: 12.0 },
341
+ "gemini-3.1-pro-high": { inputPer1M: 2.0, outputPer1M: 12.0 },
342
+ "gemini-3-flash": { inputPer1M: 0.5, outputPer1M: 3.0 },
343
+ "gemini-3.6-flash": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
344
+ "gemini-3.6-flash-high": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
345
+ "gemini-3.6-flash-medium": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
346
+ "gemini-3.6-flash-low": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
347
+ "gemini-3.6-flash-tiered": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
348
+ // Gemini introductory pricing: see docs/model-pricing.md (2026-10-25).
349
+ "gemini-3.7-flash-tiered": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
352
350
  // Gemini 3.8 Flash uses the same introductory window and doubles on 2027-01-01.
353
- "gemini-3.8-flash-low": { inputPer1M: 0.75, outputPer1M: 3.75 },
354
- "gemini-3.8-flash-medium": { inputPer1M: 0.75, outputPer1M: 3.75 },
355
- "gemini-3.8-flash-high": { inputPer1M: 0.75, outputPer1M: 3.75 },
356
- "gpt-oss-120b-medium": { inputPer1M: 2.00, outputPer1M: 10.00 },
357
-
358
- // Ollama Cloud free-tier models — mirrors MODEL_PRICING in src/types.ts
359
- "gpt-oss:20b": { inputPer1M: 0.07, outputPer1M: 0.30 },
360
- "gpt-oss:120b": { inputPer1M: 0.15, outputPer1M: 0.60 },
351
+ "gemini-3.8-flash-low": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
352
+ "gemini-3.8-flash-medium": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
353
+ "gemini-3.8-flash-high": { inputPer1M: 0.75, outputPer1M: 3.75, cachingPer1M: 0.075, cachingStoragePer1MPerHour: 0.5 },
354
+ "gpt-oss-120b-medium": { inputPer1M: 2.0, outputPer1M: 10.0 },
355
+
356
+ // Ollama Cloud standard-price models — mirrors MODEL_PRICING in src/types.ts
357
+ "gpt-oss:20b": { inputPer1M: 0.07, outputPer1M: 0.30, cachingPer1M: 0.035 },
358
+ "gpt-oss:120b": { inputPer1M: 0.15, outputPer1M: 0.60, cachingPer1M: 0.014 },
361
359
  "deepseek-v4-flash:preview": { inputPer1M: 0.14, outputPer1M: 0.28 },
362
- "deepseek-v4-flash:0731": { inputPer1M: 0.14, outputPer1M: 0.28 },
363
- "deepseek-v4-pro": { inputPer1M: 0.435, outputPer1M: 0.87 },
364
- "qwen3.5:397b": { inputPer1M: 0.60, outputPer1M: 3.60 },
365
- "glm-5.1": { inputPer1M: 0.80, outputPer1M: 2.56 },
366
- "glm-5.2": { inputPer1M: 0.80, outputPer1M: 2.56 },
367
- "gemma4:31b": { inputPer1M: 0.14, outputPer1M: 0.40 },
368
- "kimi-k2.6": { inputPer1M: 0.95, outputPer1M: 4.00 },
369
- "kimi-k2.7-code": { inputPer1M: 0.95, outputPer1M: 4.00 },
370
- "kimi-k3": { inputPer1M: 0.95, outputPer1M: 4.00 },
371
- "minimax-m2.7": { inputPer1M: 0.30, outputPer1M: 1.20 },
372
- "minimax-m3": { inputPer1M: 0.30, outputPer1M: 1.20 },
373
- "mistral-large-3:675b": { inputPer1M: 0.50, outputPer1M: 1.50 },
374
- "nemotron-3-nano:30b": { inputPer1M: 0.06, outputPer1M: 0.24 },
375
- "nemotron-3-super": { inputPer1M: 0.015, outputPer1M: 0.60 },
376
- "nemotron-3-ultra": { inputPer1M: 0.10, outputPer1M: 3.00 },
360
+ "deepseek-v4-flash:0731": { inputPer1M: 0.14, outputPer1M: 0.28, cachingPer1M: 0.0028 },
361
+ "deepseek-v4-pro": { inputPer1M: 1.32, outputPer1M: 3.96, cachingPer1M: 0.044 },
362
+ "qwen3.5:397b": { inputPer1M: 0.60, outputPer1M: 3.60 },
363
+ "glm-5.1": { inputPer1M: 0.80, outputPer1M: 2.56 },
364
+ "glm-5.2": { inputPer1M: 1.40, outputPer1M: 4.40, cachingPer1M: 0.26 },
365
+ "gemma4:31b": { inputPer1M: 0.14, outputPer1M: 0.40, cachingPer1M: 0.05 },
366
+ "kimi-k2.6": { inputPer1M: 0.95, outputPer1M: 4.00, cachingPer1M: 0.16 },
367
+ "kimi-k2.7-code": { inputPer1M: 0.95, outputPer1M: 4.00, cachingPer1M: 0.19 },
368
+ "kimi-k3": { inputPer1M: 3.00, outputPer1M: 15.00, cachingPer1M: 0.30 },
369
+ "minimax-m2.7": { inputPer1M: 0.30, outputPer1M: 1.20, cachingPer1M: 0.06 },
370
+ "minimax-m3": { inputPer1M: 0.60, outputPer1M: 2.40, cachingPer1M: 0.12 },
371
+ "mistral-large-3:675b": { inputPer1M: 0.50, outputPer1M: 1.50 },
372
+ "nemotron-3-nano:30b": { inputPer1M: 0.06, outputPer1M: 0.24 },
373
+ "nemotron-3-super": { inputPer1M: 0.015, outputPer1M: 0.60, cachingPer1M: 0.015 },
374
+ "nemotron-3-ultra": { inputPer1M: 0.10, outputPer1M: 3.00, cachingPer1M: 0.10 },
377
375
 
378
376
  // OpenCode Zen free models — mirrors MODEL_PRICING in src/types.ts
379
- "big-pickle": { inputPer1M: 0.00, outputPer1M: 0.00 },
380
- "mimo-v2.5-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
381
- "ling-3.0-flash-fin-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
382
- "nemotron-3-ultra-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
383
- "nemotron-3.5-lightning-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
377
+ "big-pickle": { inputPer1M: 0.00, outputPer1M: 0.00 },
378
+ "mimo-v2.5-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
379
+ "ling-3.0-flash-fin-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
380
+ "nemotron-3-ultra-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
381
+ "nemotron-3.5-lightning-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
384
382
  "muse-spark-1.3-contributor-free": { inputPer1M: 0.00, outputPer1M: 0.00 },
385
383
  "ling-3.0-tiny-free": { inputPer1M: 0.05, outputPer1M: 0.20 },
386
384
  "laguna-s-2.1-free": { inputPer1M: 0.20, outputPer1M: 0.80 },
387
385
 
388
386
  // OpenAI Codex models — mirrors MODEL_PRICING in src/types.ts
389
- "gpt-5.6-sol": { inputPer1M: 5.00, outputPer1M: 30.00 },
390
- "gpt-5.6-terra": { inputPer1M: 2.00, outputPer1M: 12.00 },
391
- "gpt-5.6-luna": { inputPer1M: 0.20, outputPer1M: 1.20 },
387
+ "gpt-5.6-sol": { inputPer1M: 4.0, outputPer1M: 20.0, cachingPer1M: 0.40 },
388
+ "gpt-5.6-terra": { inputPer1M: 2.0, outputPer1M: 12.0, cachingPer1M: 0.20 },
389
+ "gpt-5.6-luna": { inputPer1M: 0.20, outputPer1M: 1.20, cachingPer1M: 0.02 },
390
+ "gemini-4-argon": { inputPer1M: 2.0, outputPer1M: 10.0, cachingPer1M: 0.1 },
391
+ "gemini-4-argon-low": { inputPer1M: 2.0, outputPer1M: 10.0, cachingPer1M: 0.1 },
392
+ "gemini-4-argon-medium": { inputPer1M: 2.0, outputPer1M: 10.0, cachingPer1M: 0.1 },
393
+ "gemini-4-argon-high": { inputPer1M: 2.0, outputPer1M: 10.0, cachingPer1M: 0.1 },
394
+ "gpt-6-astra": { inputPer1M: 10.0, outputPer1M: 50.0, cachingPer1M: 1.0 },
395
+ "gpt-6-sol": { inputPer1M: 2.0, outputPer1M: 10.0, cachingPer1M: 0.2 },
396
+ "gpt-6-luna": { inputPer1M: 0.1, outputPer1M: 0.5, cachingPer1M: 0.01 },
397
+ "deepseek-v4.1-flash": { inputPer1M: 0.30, outputPer1M: 1.20, cachingPer1M: 0.006 },
398
+ "glm-5.3": { inputPer1M: 1.40, outputPer1M: 4.40, cachingPer1M: 0.26 },
399
+ "glm-5.3-flash": { inputPer1M: 0.15, outputPer1M: 0.50, cachingPer1M: 0.03 },
400
+ "gemma4": { inputPer1M: 0.14, outputPer1M: 0.40, cachingPer1M: 0.05 },
401
+ "mistral-large-4": { inputPer1M: 0.68, outputPer1M: 2.09, cachingPer1M: 0.07 },
402
+ "mistral-large-3": { inputPer1M: 0.50, outputPer1M: 1.50 },
403
+ "nemotron-3-nano": { inputPer1M: 0.06, outputPer1M: 0.24 },
404
+ "deepseek-v4-pro:0813": { inputPer1M: 1.74, outputPer1M: 3.48 },
392
405
  };
393
406
 
394
407
  function getModelPricing(model) {