Add Chrome Built-in AI (Prompt API / Gemini Nano) as a zero-download local provider in the AI Harness
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- playwright, react, typescript
调研方向
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 内容生成。
描述
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 insrc/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:
responseConstraintgives JSON that always parses — a better primitive for client-side tool calls (src/lib/ai/tools.ts) than prompt-engineering.
Proposed approach
- Capability-detect
self.LanguageModel.availability()(andLanguageModelParams); expose as a new provider in the harness only when available. - Implement behind the existing provider adapter interface; reuse
url-guard.ts-style defensive coding for the (absent) network path. - 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.
- E2E: mock the Prompt API in Playwright; unit tests for availability detection and error mapping via
provider-errors.ts.
References
- Chrome Built-in AI / Prompt API docs: https://developer.chrome.com/docs/ai/prompt-api
- 2026 browser-AI runtime comparison (Prompt API vs WebGPU vs transformers.js): https://pockit.tools/blog/run-llms-browser-webgpu-transformers-js-chrome-built-in-ai-guide/
- Capability-ladder pattern: https://nirajiitr.com/blog/client-side-webgpu-ai-small-language-models-browser
- 主要语言
- TypeScript
- 星标
- 3
- 派生
- 2
- 平均合并
- 11 小时 49 分钟
- 30 天内合并 PR
- 102
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
d-oit/do-knowledge-studio 的其他 Issue
-
Migrate do-harness.toml to the current [[sensors]] schema (do-harness CLI 0.6.0 cannot parse it)未关闭chore config priority: low
难度 2/5 1-3 小时 新手友好度 90/100
d-oit/do-knowledge-studio#1219 ·
维护者通常 1 天内回复
-
Dependabot only scans the root manifest — add workspace packages/* directories, cooldown, and grouped updates可能已有人在做 @d-oit 今天认领。 未关闭ci config deps priority: medium
难度 2/5 1-3 小时 新手友好度 88/100
d-oit/do-knowledge-studio#1212 ·
维护者通常 1 天内回复
-
documentation priority: low
难度 3/5 1-2 天 新手友好度 68/100
d-oit/do-knowledge-studio#1218 ·
维护者通常 1 天内回复
-
chore priority: low skills
难度 3/5 1-2 天 新手友好度 72/100
d-oit/do-knowledge-studio#1217 ·
维护者通常 1 天内回复
-
discussion enhancement performance priority: low search
难度 4/5 3-5 天 新手友好度 52/100
d-oit/do-knowledge-studio#1216 ·
维护者通常 1 天内回复
查看 d-oit/do-knowledge-studio 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
danielmiessler/LifeOS#3028 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 90/100
Koenkk/zigbee2mqtt#33855 ·
维护者通常 1 天内回复