feat(integration): prepaid billing, engine UI, credits console, direct tasks, v2 final
- Prepaid credit system: org wallet, debit on usage, chat gate, admin credit console - Engine UI: /manager, /tasks, /tasks/[id], /workforce, /dashboard, /traces pages - Direct task creation (HTTP POST /tasks, MCP tasks_create) at pending_manager_review - Pause/resume/cancel/answer actions in engine API and UI - Employee cap (7 per org default), review pipeline guard (active reviewer required) - Scheduler: wide window prevents org starvation; archived employees excluded from cap - Tenant isolation: project-id cross-org 404, engine never uses another tenant's sandbox - Order route fix: manager built with pipeline states + employee profiles - Contract extension: ModelGrantPort.get_org_policy with DefaultOrgPolicy - Engine event types in @agy/contracts (task.step, task.gate, run.log, run.tool, team.changed) - api-engine.ts typed client; api-credit.ts client - Alembic migration c4d5e6f7a8b9: prepaid credit + engine UI tables - 859 tests passed, 1 skipped; ruff/mypy/tsc/eslint/vitest all green Refs: PLAN-v2.md §9 (T1–T43), todo-v2-final.md
This commit is contained in:
@@ -44,6 +44,8 @@ provider. اینها فقط در **Admin Console** و فقط برای مال
|
||||
جابهجایی صندلی مالکیت فقط با `POST /admin/transfer-ownership` انجام میشود که در
|
||||
یک تراکنش، مالک فعلی را به مدیر تنزل میدهد و جانشین را مالک میکند.
|
||||
|
||||
**اعتبار پیشپرداخت.** سازمانها با اعتبار پیشپرداخت کار میکنند. مالک سامانه در `/admin/credits` به هر سازمان اعتبار میدهد و هر رکورد مصرف (مدل، sandbox و بازتاب حافظه) بهمحض ثبت، از کیف پول همان سازمان کم میشود. وقتی موجودی به صفر یا کمتر برسد، کارهای آن سازمان متوقف میشوند و گفتگوی مدیر هم مدل را صدا نمیزند. کارهای متوقفشده پس از شارژ خودکار ادامه نمییابند؛ با دکمهٔ «ادامه» دستی و از همان مرحله ادامه داده میشوند.
|
||||
|
||||
---
|
||||
|
||||
## ۲. پیشنیازها
|
||||
@@ -245,6 +247,7 @@ web/
|
||||
| استقرار روی شبکهٔ خصوصی | `DEPLOY_ALLOW_PRIVATE_HOSTS` | `false` (پیشفرض)؛ `true` فقط برای مقصدی در شبکهٔ خصوصی که قابل اعتماد است |
|
||||
| MCP gateway | `MCP_GATEWAY_ENABLED` | `true` (پیشفرض) \| `false` |
|
||||
| پرداخت | `PAYMENT_PROVIDER` | `mock` \| `stripe` |
|
||||
| اعتبار اولیهٔ سازمانهای جدید | `BILLING_STARTING_CREDIT` | عدد؛ پیشفرض `0` (یعنی به سازمان جدید اعتباری داده نمیشود) |
|
||||
|
||||
اگر credential واقعی نداریم، **قابلیت حذف نمیشود**: مدل دیتابیس، interface، UI و
|
||||
adapter mock کامل ساخته میشود و adapter واقعی پشت همین flag آماده میماند.
|
||||
@@ -300,6 +303,8 @@ refresh tokenها فقط encrypted at rest ذخیره میشوند و هیچ
|
||||
| `sandbox-gateway` | متوقفکردن sessionهای بیاستفاده، حذف containerهای یتیم با label `smart-org.*`، و ثبت audit | `pnpm worker:sandbox-gateway` |
|
||||
| `delivery` | اجرای pipeline runهای در صف (از checkout تا route) و بررسی ریموتها برای pushهای بیرونی هر `DELIVERY_POLL_SECONDS` | `pnpm worker:delivery` |
|
||||
|
||||
**پیشپرداخت:** پاس `ai-runtime` تسکهای سازمانی را که کیف پول آنها صفر، منفی یا نامشخص است، پیش از خرج کردن هر turn متوقف میکند. این تسکها پس از شارژ دستی ادامه داده میشوند.
|
||||
|
||||
**MCP gateway** یک سرویس مداوم است که با `pnpm mcp:dev` اجرا میشود. عاملهای بیرونی AI با توکنهای محدود به یک سازمان به آن وصل میشوند. جزئیات در `services/mcp-gateway/README.md`.
|
||||
|
||||
هر دستور worker **یک پاس** اجرا میکند و خارج میشود (شکل مناسب cron). برای اجرای مستمر `--loop` بدهید:
|
||||
|
||||
Reference in New Issue
Block a user