Keep the agent-intent import inside the intent adapter
Why: the command has to load guard overlays without naming agent-intent types. Only adapters/intent may import that library. Evidence: GOWORK=off go test -count=1 in adapters/intent and cmd/agent-squad passed. Impact: CLI calls NewFromOverlay. Guard domains stay guard. Refs: D1 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,6 +31,19 @@ type Options struct {
|
||||
Roots []string
|
||||
}
|
||||
|
||||
// NewFromOverlay 从 JSON overlay 构造闸门,并把 guard 域标成受保护域。
|
||||
// 命令行用它,这样命令本身不必 import agent-intent。
|
||||
func NewFromOverlay(ctx context.Context, fsys fs.FS, roots ...string) (*Gate, error) {
|
||||
return New(ctx, Options{
|
||||
IntentOptions: intent.Options{
|
||||
GuardDomains: []string{"guard"},
|
||||
ProtectedDomains: []string{"guard"},
|
||||
},
|
||||
FS: fsys,
|
||||
Roots: roots,
|
||||
})
|
||||
}
|
||||
|
||||
// New 构造闸门。没有任何意图来源时返回 (nil, nil)——引擎拿到 nil IntentGate,
|
||||
// 行为与原实现一致(T0 行为解耦)。
|
||||
func New(ctx context.Context, o Options) (*Gate, error) {
|
||||
|
||||
Reference in New Issue
Block a user