Add Chrome Built-in AI (Prompt API / Gemini Nano) as a zero-download local provider in the AI Harness

Abierto
#1,215 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
68/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
playwright, react, typescript
Área
ai, frontend

Línea de trabajo

Start with src/lib/ai/providers.ts, src/lib/ai/types.ts, and src/lib/ai/local-adapter.ts, then inspect the provider settings panels in src/components/studio/views/ai-harness-settings*.tsx. Implement and test capability detection plus provider integration in src/lib/ai/tools.ts and src/lib/ai/provider-errors.ts, using Playwright to mock the Prompt API. Done means an available built-in provider appears only for supported browsers, structured output and errors work through the existing adapter interface, and unit and E2E coverage passes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

ai-agent enhancement feature priority: low

Summary

The AI Harness supports OpenRouter, Ollama, and in-browser models (transformers.js). There is a fourth local-first option that fits the product's "zero backend, minimal download" philosophy: the Chrome Built-in AI Prompt API (Gemini Nano). It ships with the browser — no weights to download, no remote calls, no Ollama install — and supports constrained/structured output, which is ideal for the harness's tool-calling and claim-extraction flows.

Evidence

  • Provider surface: src/lib/ai/providers.ts + src/lib/ai/local-adapter.ts (Ollama + in-browser models) + src/lib/ai/types.ts (provider abstraction to extend).
  • The Settings/AI Harness panels (src/components/studio/views/ai-harness-settings*.tsx) already model per-provider capability gating — the pattern to copy for capability detection.
  • No references to LanguageModel / window.ai / Prompt API exist in src/ today.

Impact

  • New feature with zero infrastructure: instant local AI for Chrome/Edge users without the ~25 MB model download of the semantic path or an Ollama install.
  • Fits privacy posture: on-device inference, opt-in, nothing leaves the device — consistent with ADR 045's threat model.
  • Structured output: responseConstraint gives JSON that always parses — a better primitive for client-side tool calls (src/lib/ai/tools.ts) than prompt-engineering.

Proposed approach

  1. Capability-detect self.LanguageModel.availability() (and LanguageModelParams); expose as a new provider in the harness only when available.
  2. Implement behind the existing provider adapter interface; reuse url-guard.ts-style defensive coding for the (absent) network path.
  3. Keep it clearly labeled "Chrome/Edge only" in the provider picker; follow the repo's capability-ladder UX: Prompt API → WebGPU in-browser model → Ollama → OpenRouter.
  4. E2E: mock the Prompt API in Playwright; unit tests for availability detection and error mapping via provider-errors.ts.

References

Lenguaje dominante
TypeScript
Estrellas
3
Forks
2
Merge medio
11 h 49 min
PR fusionados (30 d)
102

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de d-oit/do-knowledge-studio

Todos los issues de d-oit/do-knowledge-studio

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.