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

オープン
#1,215 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
playwright, react, typescript
領域
ai, frontend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
3
フォーク
2
平均マージ
11時間 49分
マージ済み PR(30日)
102

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

d-oit/do-knowledge-studio のほかの issue

d-oit/do-knowledge-studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。