oh-my-muse/muse-cloud/sql/muse/V27__extend_ai_agent_handoff_source.sql
lili 65f949c997 feat(handoff): P2 agent 放宽接纳 market 来源 + verify/consume(后端)
跨空间 handoff(market→agent)兑现侧:放宽 requireVisibleActiveSourceAgent 的 agentType
校验仅接纳 verify 通过的 market token(precheck+bind 两处);precheck 阶段 verify(targetOwner=
agent)+consume(token 用完即弃)、落 source_owner/handoff_hash;bind 凭 precheck.source_owner=
market 识别放宽路径(不重复核验、凭 precheckId 信任)。保护节点/work 属主/agent-version active/
非 handoff 原校验全不放宽。

- ai-server pom +market-api;V27 加 source_owner/handoff_hash + muse_agent.source_market_asset_id(可空)
- AgentSlotPrecheckReqVO +sourceType/handoffToken/sourceId/sourceVersion/authorizationSummaryId
- ErrorCodeConstants +AI_MARKET_HANDOFF_UNAVAILABLE;precheckAgentSlot 签名 +apiVersion(consume 需要)

验证:MuseAgentSlotServiceTest 25/0(含 5 P2 红线单测:正路放宽接纳/verify 拒/无 token 拒/
非 handoff 维持 system-user 校验/bind 凭 source_owner 放宽);Bc+AiGrantRuntime ArchUnit 3/0
(ai 依赖 market-api 合法、consume 在 application 层不破 runtime 隔离)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 12:30:50 -07:00

12 lines
951 B
SQL

-- P2 跨空间 handoff(market→agent):为 agent 槽位预检补 handoff 来源标记,使 bind 阶段凭 source_owner 识别 market 放宽路径;
-- 为 muse_agent 补 market 来源溯源列。均为可空列、向后兼容(旧行 source_owner=null 走同空间原校验路径)。
-- 1) agent 槽位预检:source_owner 标记兑现来源(market=跨空间 handoff;bind 凭此放宽 agentType 校验);
-- handoff_hash 存 token sha256(审计;token 明文不入库,与 knowledge handoff_hash 同口径)。
ALTER TABLE muse_ai_agent_slot_precheck ADD COLUMN source_owner VARCHAR(32);
ALTER TABLE muse_ai_agent_slot_precheck ADD COLUMN handoff_hash CHAR(64);
-- 2) muse_agent:market 上架 agent 物化时的来源资产溯源(独立 market 类型 agent;
-- install 自动物化为独立后续主线,本列先就位、对齐 knowledge muse_knowledge_base.source_market_asset_id)。
ALTER TABLE muse_agent ADD COLUMN source_market_asset_id BIGINT;