Skip to content

Kumo design system, agents-ui package, Oxlint/Oxfmt migration, and code quality pass#865

Merged
threepointone merged 16 commits into
mainfrom
kumo
Feb 7, 2026
Merged

Kumo design system, agents-ui package, Oxlint/Oxfmt migration, and code quality pass#865
threepointone merged 16 commits into
mainfrom
kumo

Conversation

@threepointone

Copy link
Copy Markdown
Contributor

Summary

This branch modernizes the repo's UI layer, introduces shared UI infrastructure, fully migrates linting/formatting tooling from Biome/Prettier to Oxlint/Oxfmt, and makes a thorough type safety and code quality pass across the codebase.

Kumo design system adoption

  • Refactored the playground to use @cloudflare/kumo components throughout (Button, InputArea, CodeBlock, Tabs, Switch, Badge, Banner, etc.), replacing raw HTML and custom styling.
  • Introduced a LinkProvider / AppLink adapter to bridge Kumo's link component with React Router.
  • Replaced lucide-react icons with @phosphor-icons/react.
  • Added a Workers color theme (bundled in @cloudflare/agents-ui) with CSS custom properties for Cloudflare-branded light/dark variants.
  • Refactored useTheme to manage both mode (light/dark/system) and color theme (workers/kumo), persisted to localStorage.
  • Modernized the tictactoe example with Kumo + Tailwind styling.
  • Added design documentation under design/ (README, visuals.md).

New @cloudflare/agents-ui package

  • Created a shared private package (packages/agents-ui) bundling Workers theme CSS, shared React components (ConnectionIndicator, ModeToggle, CloudflareLogo, PoweredByAgents), and hooks (ThemeProvider, useTheme).
  • ConnectionIndicator includes proper ARIA attributes (role="status", aria-live="polite").
  • Declared @cloudflare/kumo and @phosphor-icons/react as peer dependencies.
  • Migrated the workflows example to use agents-ui components and Kumo UI.
  • Added a new resumable-stream-chat example demonstrating resumable streaming with useAgentChat.

Complete Oxlint/Oxfmt migration (Biome/Prettier fully removed)

  • Removed biome.json, .prettierrc, .prettierignore and their dev dependencies.
  • Added .oxlintrc.json (plugins: react, jsx-a11y, typescript, react-hooks) and .oxfmtrc.json.
  • Updated package.json scripts (lint, format, check, lint-staged).
  • Replaced Prettier in all 4 package build scripts (packages/agents, ai-chat, codemode, hono-agents) with oxfmt --write for .d.ts formatting.
  • Updated .vscode/settings.json to use oxc.oxc-vscode as the default formatter; updated .vscode/extensions.json to recommend oxc.oxc-vscode instead of Prettier/Biome extensions.
  • Converted all biome-ignore inline comments to oxlint-disable / eslint-disable equivalents.
  • Cleaned up unnecessary disable comments; re-enabled jsx-a11y plugin rules fully.
  • Every remaining oxlint-disable has a specific rule name and a reason comment.
  • Final state: 0 lint errors, 11 warnings (all intentional exhaustive-deps).

Type safety improvements

  • .github/resolve-workspace-versions.ts — custom PackageJson interface; try/catch around JSON.parse.
  • examples/a2a/src/app.tsisAsyncIterable type guard for async stream detection.
  • examples/a2a/src/cli.tscatch (error: unknown) with proper narrowing; replaced unsafe error as { code, data } cast with runtime in checks.
  • examples/codemode/src/client.tsxToolPart interface with toolCallId; asToolPart() runtime type guard replacing as unknown as double assertion.
  • examples/mcp-client/src/client.tsxtools: unknown[] instead of any[].
  • openai-sdk/human-in-the-loop/src/client.tsxRunResultState interface; try/catch around JSON.parse for both tool arguments and serialized state; modal state cleanup when interruption resolves.
  • All 35 tsconfig projects pass tsc --noEmit with 0 errors.

Accessibility improvements

  • packages/agents-ui ConnectionIndicatorrole="status", aria-live="polite", aria-hidden on decorative dot.
  • examples/workflows/src/app.tsxaria-label on task name input, reject reason input, and toast dismiss button.
  • examples/playground/src/layout/Sidebar.tsxaria-expanded, aria-controls on collapsible category buttons; role="region" and aria-label on expanded content.
  • site/ai-playgroundhtmlFor/id wiring on labels, improved image alt text.
  • Targeted jsx-a11y disables with reasons for legitimate cases (modal backdrops, game board cells).

Error handling improvements

  • examples/workflows/src/server.ts — try/catch around SQL metadata update operations in updateUIState and clearUIState.
  • examples/resumable-stream-chat/src/client.tsx — try/catch around sendMessage; useCallback for WebSocket event handlers and send.
  • examples/resumable-stream-chat/src/server.ts — try/catch around streamText in the execute callback.
  • examples/tictactoe/src/client.tsx — wrapped handleCellClick and handleNewGame in useCallback; added them to useEffect dependency arrays to fix stale closures.
  • examples/workflows/src/app.tsx — replaced unsafe as WorkflowCardData type assertion with a proper transform that validates the result field shape.

Documentation & configuration

  • Added AGENTS.md at the repo root and under packages/agents/, examples/, guides/, docs/, design/.
  • Root AGENTS.md fully updated to reference Oxlint/Oxfmt (no Biome/Prettier references remain anywhere in the repo).
  • Added examples/TODO.md tracking remaining cleanup items; checked off completed items.
  • Removed obsolete .cursor/rules/cloudflare.mdc.
  • Renamed .dev.vars.example to .env.example across examples.
  • Updated wrangler.jsonc across all examples/guides/openai-sdk for consistent assets config.
  • Added "agents": "*" as a dependency in all examples; added @cloudflare/ai-chat and @cloudflare/codemode where imported.
  • Marked all examples as "private": true.
  • Bumped dependency versions (hono, mcp-remote, vite plugins) and refreshed package-lock.json.

Stats

  • 181+ files changed across 15 commits + uncommitted review fixes
  • ~6,500 insertions, ~8,200 deletions (net reduction)

Notes for reviewers

  1. Prettier is fully removed. No Prettier references remain in source, build scripts, or editor config. All 4 package build scripts now use oxfmt --write to format generated .d.ts files. The VS Code workspace settings recommend oxc.oxc-vscode as the formatter. Run npm run build to verify the full build pipeline works.

  2. Oxlint/Oxfmt are the only lint/format tools. Run npm run lint and npm run format to verify. Config lives in .oxlintrc.json and .oxfmtrc.json at the repo root. Current state: 0 errors, 11 warnings (all react-hooks/exhaustive-deps — the deps are intentionally omitted in those hooks).

  3. jsx-a11y rules are fully enabled. All violations are either fixed or have a targeted oxlint-disable-next-line with a reason. Please fix rather than disable any new a11y warnings in future code.

  4. @cloudflare/agents-ui is a new private package at packages/agents-ui/. It shares theme + component code between examples (workflows, resumable-stream-chat, etc.). It declares @cloudflare/kumo and @phosphor-icons/react as peer dependencies. Review packages/agents-ui/src/ for the full API surface.

  5. Type safety pass was thorough. Every any suppression now has a specific rule name and explanation comment. Some any remains where external SDK generics require it (e.g., Agent<any, any> constraints, proxy/dynamic-method wrapping) — documented inline. All JSON.parse calls in client-facing code now have try/catch. Unsafe type assertions have been replaced with runtime checks or proper transforms.

  6. React patterns were tightened. Stale closure bugs fixed in tictactoe (moved useCallback declarations before useEffect calls, added to dep arrays). WebSocket callbacks in resumable-stream-chat wrapped in useCallback. Workflows WorkflowCard now uses a validated transform instead of a raw type assertion.

  7. The design/ directory is new. Contains README.md and visuals.md describing the Kumo integration approach and Workers theme. Intended as living documentation for contributors.

  8. wrangler.jsonc changes are cosmetic. Most wrangler config changes just normalize the assets field or update compatibility_date. No runtime behavior changes.

  9. .env.example replaces .dev.vars.example. Aligns with newer Wrangler conventions. Existing .dev.vars files (gitignored) still work.

Refactor the playground examples to use the @cloudflare/kumo design system: replace custom cards, buttons, inputs, badges, banners, empty states, text and surface wrappers with kumo components; swap lucide-react icons for phosphor icons; introduce LinkProvider around BrowserRouter for RouterLink integration. Update demo markup and utility classnames to use kumo tokens and component props while preserving behavior. Remove lucide-react from examples/playground package.json and add a minimal examples/loader/package.json.
Add design documentation (design/README.md and visuals.md) and refactor the playground to consistently use Kumo UI components and patterns. Introduce an AppLink adapter in client.tsx to bridge Kumo's LinkProvider with React Router. Replace many raw HTML/unstyled elements with Kumo primitives (Button, InputArea, CodeBlock, Tabs, Switch, etc.), update Badge variants, and improve LogPanel styling and direction colors. These updates fix a Link type mismatch, unify visual/spacing behavior (workaround for Text not accepting className), and improve consistency and accessibility across demos.
Add top-level AGENTS documentation and supporting docs under design/, guides/, packages/, and several examples to describe repo structure, standards, testing, and contribution workflow. Update multiple example and guide wrangler.jsonc and playground files to align configurations and assets; add example TODO and AGENTS.md files where applicable. Remove obsolete .cursor/rules/cloudflare.mdc. These changes consolidate documentation and bring examples/configs up to date for contributors and demos.
Introduce a Cloudflare-branded "Workers" color theme and UI to select color theme and mode.

- Add private workspace package @cloudflare/agents-theme with workers.css providing CSS custom properties for a Workers theme (light/dark variants).
- Import the theme into playground styles and document theme usage in design/visuals.md and examples/AGENTS.md.
- Update examples/playground/index.html to set default data-theme and to prevent flash by applying data-mode and data-theme on load.
- Refactor the playground useTheme hook to manage mode (light/dark/system) and colorTheme (workers/kumo), persist both to localStorage, and update document attributes accordingly.
- Update Sidebar to split theme controls into Mode and ColorTheme toggles (plus UI/icon changes).

These changes enable a Cloudflare-branded theme for examples while preserving the ability to fall back to Kumo's default theme.
Modernize the tictactoe example: switch from .dev.vars to .env.example, mark TODOs as completed, and update README instructions. Replace the old static UI/normalize.css with a Tailwind + Kumo-based design: refactor client.tsx to use @cloudflare/kumo components and Phosphor icons, overhaul styles.css to import Tailwind/Kumo/agents-theme, and remove the bundled normalize.css. Add @cloudflare/agents-theme to package.json and enable the Tailwind Vite plugin in vite.config.ts. Clean up wrangler.jsonc assets (remove redundant "directory"). These changes standardize environment handling and modernize styling and UX for the example.
Add theme support and refactor the AI playground UI to use Kumo styles/components. Introduces a ThemeProvider and useTheme hook (wraps App), prevents FOUC by initializing data-mode in index.html, and updates body/root classes. App refactor: swap many gray utility classes for kumo tokens, replace raw buttons/SVGs with Kumo Button/Link components and WorkersAILogo, add GearIcon, consolidate agent state updates into updateState helper, cap MCP logs, simplify session ID handling, and improve Streamdown usage. Remove unused FinetuneSelector and ModelSelector components and drop tailwind config; add new runtime deps in package.json (agents-theme, streamdown/code).
Introduce a new private workspace package @cloudflare/agents-ui that bundles the Workers color theme CSS, shared React components (ConnectionIndicator, ModeToggle, Cloudflare logo), and hooks (ThemeProvider, useTheme). Replace usages of the old agents-theme with agents-ui/theme/workers.css across examples and update example package dependencies to depend on @cloudflare/agents-ui.

Add a new resumable-stream-chat example (client, styles, README, vite config, wrangler config and package.json) demonstrating resumable streaming with useAgentChat; the client uses Kumo components and agents-ui components/hooks and is wrapped with ThemeProvider. Small UI and accessibility tweaks applied to playground demos (class changes like flex-shrink-0→shrink-0, layout refactors, improved header/input UI). Move the useTheme hook from the site playground into the new agents-ui package and add exports/README/tsconfig for the package. Remove the old packages/agents-theme package.json. Also rename .dev.vars.example files to .env.example and update README references to use .env. Package lock updated to reflect dependency changes.
Migrate the workflows example to use @cloudflare/agents-ui shared components and Kumo UI. Add ThemeProvider, ConnectionIndicator, ModeToggle and PoweredByAgents usage; wrap the app in ThemeProvider and load theme CSS from agents-ui. Replace legacy public/styles.css with a Tailwind + Kumo + agents-ui src/styles.css, add a small theme init script to index.html, and add @cloudflare/agents-ui and Tailwind tooling to package.json/vite config. Refactor app.tsx: unified connection status, toast timer, callAgent wrapper with local-dev error messaging, pagination deduplication, and componentize WorkflowCard/StatusBadge/WorkflowEndActions. Simplify server status mapping to a known map and update wrangler assets config for SPA not-found handling.
Switch linting/formatting tooling from Biome/Prettier to oxfmt/oxlint across the repo. Add .oxfmtrc.json and .oxlintrc.json, remove .prettierrc, .prettierignore and biome.json, and update package.json scripts and devDependencies to use oxfmt/oxlint (also update lint-staged). Replace in-source lint suppressions (biome-ignore / biome-ignore-all) with the corresponding oxlint disable comments in many source files. Apply minor formatting/whitespace fixes and a small wrangler.toml cleanup. package-lock.json was updated to reflect the dependency changes.
Delete file- and inline-level oxlint-disable comments across the repo and tighten the linter configuration. .oxlintrc.json re-enables several rules (no-inferrable-types, prefer-as-const, default-param-last, various jsx-a11y rules) and removes broad ignorePatterns for node_modules, dist, and .wrangler. Multiple source files (examples, guides, openai-sdk, packages/agents react and tests, and site/ai-playground components) had their /* oxlint-disable */ or // oxlint-disable-next-line comments removed to restore linting and accessibility checks and to clean up commented lines in JSX.
Replace generic oxlint-disable comments with specific eslint/tslint rule disables and inline justifications across the codebase, improving clarity for suppressed checks. Also apply small accessibility fixes (add htmlFor/id on labels, adjust image alt text) and add targeted jsx-a11y disables for click-only interactive elements. Other minor changes include underscoring unused parameters, scoping any usage with enable/disable comments, and small test typing adjustments. Files updated include multiple examples, site components, and packages/agents sources to reflect these lint and a11y improvements.
Tighten TypeScript types and add safer runtime checks across multiple files. .github/resolve-workspace-versions.ts: introduce a PackageJson interface, store package file metadata, and simplify dependency field handling. examples/a2a: add isAsyncIterable helper and use it to detect async streams. examples/a2a/cli: normalize caught errors (unknown -> Error), log message/code/data safely. examples/codemode: add a ToolPart interface, replace any casts, and guard clipboard writes. examples/mcp-client: narrow API response type to tools: unknown[] instead of any[]. openai-sdk/human-in-the-loop: introduce RunResultState type, type AgentStateDisplay and App state, and replace unsafe any access with null-safe checks. Overall these changes reduce any usage and improve type safety and runtime robustness.
Update dependency versions across multiple example and package manifests and refresh package-lock.json. Notable changes: bump hono to ^4.11.8 in examples, bump mcp-remote to ^0.1.38, and upgrade dev deps in openai-sdk/chess-app ( @cloudflare/vite-plugin, @vitejs/plugin-react, @types/react ). The package-lock.json was updated to lock the new versions and ensure consistent installs.
Switch linting/formatting from Biome/Prettier to Oxlint/Oxfmt (editor settings, recommended extension, build scripts updated to run `oxfmt --write`). Add/adjust packages and peers for the new agents-ui package. Make a broad code-quality pass: add runtime guards and try/catch around JSON.parse and streaming calls, strengthen error logging, replace unsafe type assertions with runtime checks, and wrap callbacks in useCallback to avoid stale closures. Improve accessibility (aria attributes, role/aria-live, labels, controls) and update docs (AGENTS.md, examples TODO, add pr.md). Miscellaneous example and component fixes across the repo to reflect the tooling and API changes.
@changeset-bot

changeset-bot Bot commented Feb 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9847174

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
hono-agents Patch
@cloudflare/codemode Patch
@cloudflare/ai-chat Patch
agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Feb 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@865

commit: 9847174

@claude

This comment was marked as resolved.

@threepointone
threepointone merged commit c3211d0 into main Feb 7, 2026
5 checks passed
@threepointone
threepointone deleted the kumo branch February 7, 2026 23:30
@github-actions github-actions Bot mentioned this pull request Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant