Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.6.1 (2026-05-12)

### Fixed — Dashboard SDK version label now auto-derives from `libraries/typescript/package.json`

`dashboard-app/src/App.tsx` rendered the topbar/footer SDK version from a hardcoded `const SDK_VERSION = '0.6.0'` literal. After the SDK was bumped to `0.6.1`, the dashboard kept advertising `dashboard · v0.6.0` / `SDK · 0.6.0` until someone remembered to edit that literal by hand — silent drift between the published package and the UI users see. Fix: `dashboard-app/vite.config.ts` (and the matching `vitest.config.ts` for tests) read `libraries/typescript/package.json` at build time and inject the version through Vite's `define` as a `__SDK_VERSION__` global, declared in the new `dashboard-app/src/vite-env.d.ts`. The single source of truth is now the TS SDK's `package.json` (bumped in lockstep with the Python `pyproject.toml` and `__init__.py` per the release-via-pr rule). Regenerated bundle synced into `libraries/typescript/src/dashboard/ui.html` and `libraries/python/getpatter/dashboard/ui.html`. Files: `dashboard-app/src/App.tsx`, `dashboard-app/vite.config.ts`, `dashboard-app/vitest.config.ts`, `dashboard-app/src/vite-env.d.ts`, `libraries/typescript/src/dashboard/ui.html`, `libraries/python/getpatter/dashboard/ui.html`.

### Changed — `StreamHandler` adopt-capability check now uses duck typing

The TS realtime adopt branch in `stream-handler.ts` previously relied on `this.adapter instanceof OpenAIRealtimeAdapter` to gate the prewarm-handoff path. Switched to a duck-type check (`typeof adapter.adoptWebSocket === 'function'`) so the generic stream-handler module stays provider-agnostic on this hot path and matches the Python handler's `getattr(self._adapter, "adopt_websocket", None)` shape. Files: `libraries/typescript/src/stream-handler.ts`.
Expand Down
6 changes: 5 additions & 1 deletion dashboard-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import {
type SparklineResult,
} from './lib/mappers';

const SDK_VERSION = '0.6.0';
// Build-time constant injected by Vite `define` from
// libraries/typescript/package.json — see ../vite.config.ts and
// ./vite-env.d.ts. Auto-derived so a published SDK bump (Py + TS
// kept in lockstep) updates the dashboard label without a manual edit.
const SDK_VERSION = __SDK_VERSION__;
const RANGE_LABEL: Record<RangeKey, string> = {
'1h': '1h',
'24h': '24h',
Expand Down
6 changes: 6 additions & 0 deletions dashboard-app/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="vite/client" />

// Injected at build time by Vite `define` (see ../vite.config.ts).
// Holds the SDK version read from libraries/typescript/package.json so
// the dashboard label tracks the published SDK without a manual edit.
declare const __SDK_VERSION__: string;
16 changes: 16 additions & 0 deletions dashboard-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { viteSingleFile } from 'vite-plugin-singlefile';

// Auto-derive the SDK version label rendered in the dashboard from
// `libraries/typescript/package.json` so a bump of the published SDK
// flows into the bundled UI without a second manual edit. The TS and
// Python SDK versions are kept in lockstep (release-via-pr rule), so
// reading either one is sufficient — we pick the TS package because
// it lives in the same JS toolchain as this build.
const here = fileURLToPath(new URL('.', import.meta.url));
const sdkPkgPath = resolve(here, '..', 'libraries', 'typescript', 'package.json');
const sdkPkg = JSON.parse(readFileSync(sdkPkgPath, 'utf8')) as { version: string };

// Vite + React + singlefile plugin: emits a single self-contained dist/index.html
// with all JS, CSS, and assets inlined. Both SDKs (Python + TypeScript) embed
// this file as the dashboard UI served from `GET /`.
export default defineConfig({
plugins: [react(), viteSingleFile()],
define: {
__SDK_VERSION__: JSON.stringify(sdkPkg.version),
},
build: {
target: 'es2020',
cssCodeSplit: false,
Expand Down
13 changes: 13 additions & 0 deletions dashboard-app/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';

// Mirror the build-time SDK version constant from vite.config.ts so any
// test that ends up importing App.tsx (which references __SDK_VERSION__)
// resolves the symbol against the same source of truth.
const here = fileURLToPath(new URL('.', import.meta.url));
const sdkPkgPath = resolve(here, '..', 'libraries', 'typescript', 'package.json');
const sdkPkg = JSON.parse(readFileSync(sdkPkgPath, 'utf8')) as { version: string };

// Vitest config separate from vite.config.ts so the SPA build (singlefile
// inline) is unaffected by the test runner. Only ``test`` files are picked
// up; the bundle still ships from src/ via vite.config.ts.
export default defineConfig({
define: {
__SDK_VERSION__: JSON.stringify(sdkPkg.version),
},
test: {
environment: 'node',
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
Expand Down
2 changes: 1 addition & 1 deletion libraries/python/getpatter/dashboard/ui.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libraries/typescript/src/dashboard/ui.html

Large diffs are not rendered by default.

Loading