Commit Graph
15 Commits
Author SHA1 Message Date
chenchenandClaude Opus 4.7 610fde5d03 feat(mcp-server): Heicode integration + register transaction hardening
== Heicode integration (~41 endpoints across 5 modules) ==
- §2 ResourceBinding (5 endpoints) — resources.py / resource_grants.py
- §4 NewAPI metadata proxy (4 endpoints) — heicode_proxy.py + heicode_client.py
- §5 Agnet platform stub (12 endpoints, in-memory mock) — agnet_stub.py
- §6 Task orchestration (5 endpoints + 3 extension endpoints) — heicode_tasks.py
  6.1-6.5: intent / list / get / answer / messages
  6.6-6.8: execution / delivery / audit?tab=... (Slice 8/9/10)
- §7 SSE single channel + approvals (4 endpoints + 5 event types) —
  heicode_events.py + event_bus.py
- §7.8.1 internal billing-provider PUT endpoint — auth.py (routes)

== Schema changes ==
- migrations/026 heicode_tasks (orchestration state)
- migrations/027 users.billing_provider (litellm | newapi switch)
- migrations/028 heicode_approvals (high-risk approval queue)

== Register transaction hardening (P0 + P1 + P2) ==
routes/auth.py register():
- Pre-existing P0: failed register returned IntegrityError str verbatim
  (leaking SQL params + ~50 plaintext LiteLLM keys per attempt).
  Now logs exc_info, returns {code: REGISTER_FAILED, message: ...}.
- Pre-existing P0: model dedupe — two ModelProvider rows with overlapping
  supported_models (e.g. taiji/gpt-4o-mini in both taiji and azure providers)
  collide on uq_tenant_model. seen_models set deduplicates within the loop.
- New P1: track created_litellm_keys; on any failure call delete_key() for
  each — prevents remote orphan keys when DB rollback fires.
- New P1: replace verify_code with peek_verification_code at the start;
  only call verify_code (which consumes) after commit succeeds. Failed
  registrations no longer burn the user's one-shot code.
- New P2: narrow inner `except (LiteLLMClientError, Exception)` to just
  LiteLLMClientError so SQLAlchemy errors bubble to the outer rollback
  instead of being silently swallowed into a half-allocated 200 response.
- New P2: same narrowing on outer `except (AgentManagerError, Exception)`.

== Auth middleware ==
- app/auth.py: allow /api/auth/internal/billing-provider and
  /api/auth/internal/approvals to bypass user JWT (service-token auth
  via HEICODE_INTERNAL_SERVICE_TOKEN, validated in-route).

== Docs ==
- Heicode-接口契约文档.md v2.2 (41 endpoints + SSE schema + 6.6-6.8)
- Heicode-对接进度与待办.md (through §7.14 SSE + 7.8.2 delivery回执)
- Heicode-完整调用流程图.md (sequence + routing diagrams)
- Agent-Manager-Heicode对接需求文档.md
- HEICODE_API_INTEGRATION.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:43:10 +08:00
chenchen d0b79030f1 更新heicode 2026-05-05 14:13:59 +08:00
unknown e379f9dee6 备份 2026-03-25 20:48:00 +08:00
zhanggangyong 40447f86f6 更新开发者平台 2026-03-16 04:05:44 +00:00
zhanggangyong a3d7ef6a6e 备份 2026-03-15 15:30:24 +00:00
zhanggangyong 6d164c838b 更新大志备注 2026-01-16 10:38:17 +00:00
zhanggangyong cd4dea8a0d 更新agent manager数据接口 2026-01-12 13:52:38 +00:00
zhanggangyong b75f9671ff 更新超级管理员收入 2026-01-12 07:47:50 +00:00
zhanggangyong 726b4dd4c6 feat: 添加用户注册和个人信息管理接口
- 添加用户注册接口 POST /api/auth/register
- 添加获取用户信息接口 GET /api/user/profile
- 添加更新用户信息接口 PUT /api/user/profile
2026-01-11 16:22:40 +00:00
zhanggangyong 4343cf8347 更新渠道端文档 2026-01-06 17:23:36 +00:00
Ubuntu 2aecf0146b 更新管理平台完整接口 2026-01-04 03:31:29 +00:00
Ubuntu 0d4c57c6b0 更新计费与资源管理API 2025-12-26 07:49:38 +00:00
Ubuntu 9a2cdd21b0 更新运营 2025-12-26 04:22:23 +00:00
Ubuntu c735d60140 更新接口 2025-12-25 07:25:32 +00:00
Ubuntu 2e09716dd9 更新计费逻辑 2025-12-25 04:20:42 +00:00