diff --git a/internal/intentgate/gate.go b/internal/intentgate/gate.go index de95c66..f9bd0e1 100644 --- a/internal/intentgate/gate.go +++ b/internal/intentgate/gate.go @@ -55,11 +55,14 @@ type MatchResult struct { // Complete 报告槽位是否齐全且全部通过权威校验:false 时业务动作不得派发。 func (m MatchResult) Complete() bool { return len(m.Missing) == 0 && len(m.Invalid) == 0 } -// 命令类型经闸门投影(别名):生态库按边界规则只许本包导入, -// Router/runmgr 等消费方只依赖本包表面。 +// 命令与目录类型经闸门投影(别名):生态库按边界规则只许本包导入, +// Router/runmgr 等消费方只依赖本包表面。CatalogSpec/CatalogSlot 随生成器端口 +// (SetGenerator 的入参)投影,实现生成器不必越过本包直接引用生态库。 type ( - Command = agentintent.Command - ActionRef = agentintent.ActionRef + Command = agentintent.Command + ActionRef = agentintent.ActionRef + CatalogSpec = agentintent.CatalogSpec + CatalogSlot = agentintent.CatalogSlot ) const ( diff --git a/internal/server/e2e_test.go b/internal/server/e2e_test.go index e1b1e0a..6ee4b6f 100644 --- a/internal/server/e2e_test.go +++ b/internal/server/e2e_test.go @@ -946,7 +946,7 @@ func TestStaticServed(t *testing.T) { _ = io.Discard } -// TestHITLIntentPivot:装载插件意图后,自由输入命中其他意图 → 转轨(agent-intent 闸门)。 +// TestHITLIntentPivot:装载插件意图后,自由输入命中其他意图 → 转轨(intentgate 闸门)。 func TestHITLIntentPivot(t *testing.T) { srv, _ := newTestServer(t) h := srv.Handler() diff --git a/internal/server/intent_admission_test.go b/internal/server/intent_admission_test.go index 981737b..d2d6bba 100644 --- a/internal/server/intent_admission_test.go +++ b/internal/server/intent_admission_test.go @@ -7,7 +7,6 @@ import ( "testing" agentcommand "agent-command" - agentintent "agent-intent/intent" "agent-system-backend/internal/cmdbus" "agent-system-backend/internal/intentgate" ) @@ -303,8 +302,10 @@ func TestHighRiskCommandStillRequiresConfirmation(t *testing.T) { // 显式取消命令宿主未实现:如实回落普通回合,不派发同一句里的 Start。 type cancelGenerator struct{} -func (cancelGenerator) Generate(context.Context, string, []agentintent.CatalogSpec) ([]agentintent.Command, error) { - return []agentintent.Command{ +// 生成器只经 intentgate 表面接线:目录与命令类型都由闸门投影, +// 宿主实现不必(也不应)直接导入生态库。 +func (cancelGenerator) Generate(context.Context, string, []intentgate.CatalogSpec) ([]intentgate.Command, error) { + return []intentgate.Command{ {Kind: intentgate.CommandStart, Action: intentgate.ActionRef{Kind: intentgate.ActionCommand, ID: "demo.report"}}, {Kind: intentgate.CommandCancel, Target: "demo.report"}, }, nil