Proxy: allow denying /ai per project (capability check like /email)

未關閉
#718 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
api, backend

研究方向

Start with platform/packages/proxy/src/index.ts, comparing the /ai usage check near line 288 with the /email capability gate near line 305; the provisioning path is also cited at platform/packages/api/src/provisioning/provision.ts. Choose and implement a way to deny project AI calls before model execution, then verify denied calls cannot reach the model while allowed projects still can.

由索引模型根據 Issue 內容生成。

描述

Request

Let an operator deny the proxy's /ai routes to a project (or at least honour the installation's ai capability there), the same way /email is already gated.

Why

We host agent-built apps in one Void project (lumi-apps) and serve them through our own dispatch Worker. Those apps must not use AI: our platform meters and approves every AI call, and an app calling Workers AI directly bypasses that. Other projects on the same installation do need AI, so turning it off installation-wide isn't an option.

Today every deployed Worker gets the __VOID_PROXY service binding plus __PROJECT_ID and __VOID_PROXY_TOKEN (platform/packages/api/src/provisioning/provision.ts:170-178 at v1.5.0), so app code can call /ai/* whether or not its manifest declares AI. The proxy checks PLATFORM_CAPABILITIES only for email (platform/packages/proxy/src/index.ts:305); /ai has only the monthly-usage block (index.ts:288), which is written asynchronously after usage is counted, so a plan quota limits spend but doesn't deny calls.

What would solve it

Any of these, in order of preference:

  1. A per-project capability setting (for example void project capabilities set ai=false) that the proxy enforces on /ai before running the model.
  2. The proxy honouring the installation-level ai capability on /ai, matching /email.
  3. Not injecting __VOID_PROXY into Workers whose manifest uses none of the proxy-backed features.

Happy to test a pre-release. Related context: #692.

主要語言
TypeScript
星號
627
分支
66
平均合併
14 小時 17 分鐘
30 天內合併 PR
200

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

voidzero-dev/void 的其他 Issue

查看 voidzero-dev/void 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。