Skip to content

feat: add exec approval V2 prompt adapter interface#447

Open
AlexAlves87 wants to merge 1 commit into
openclaw:masterfrom
AlexAlves87:feat/exec-approvals-prompt-adapter
Open

feat: add exec approval V2 prompt adapter interface#447
AlexAlves87 wants to merge 1 commit into
openclaw:masterfrom
AlexAlves87:feat/exec-approvals-prompt-adapter

Conversation

@AlexAlves87
Copy link
Copy Markdown
Contributor

Summary

This adds the V2 prompt adapter contract needed before the coordinator (PR7) can be wired up. The interface decouples the coordinator from any UI implementation, and the null stub lets PR7 compile and be tested without a WinUI dependency.

What changed

  • ExecApprovalV2PromptRequest — sealed request type with the 8 fields the presenter needs (DisplayCommand, Cwd, Host, Security, Ask, AgentId, ResolvedPath, SessionKey). AllowAlwaysPatterns is intentionally excluded; it lives on ExecApprovalEvaluation and is the coordinator's responsibility to pass through after the decision.
  • IExecApprovalV2PromptHandler — single PromptAsync method returning Task<ExecApprovalDecision>. Non-nullable contract; implementations fail-closed to Deny on any unhandled error.
  • ExecApprovalV2NullPromptHandler — stub that always returns Deny synchronously via Task.FromResult. Never throws. Intended as the default until a real dialog implementation ships.

The V2 infix avoids collision with the existing IExecApprovalPromptHandler / ExecApprovalPromptRequest types on the legacy path.

Testing

dotnet test tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --filter "ExecApprovalV2Prompt"

12 tests, all passing. Coverage includes stub behavior, the AllowAlwaysPatterns exclusion verified via reflection, assembly placement, legacy type separation, and a guard that the null stub is not referenced from production src/.

Notes

No production wiring in this PR. SystemCapability is untouched. The real dialog implementation is a separate slice after the coordinator lands.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Defines the prompt adapter contract needed before the coordinator (PR7)
can be wired up. The interface decouples the coordinator from any UI
implementation; the null stub lets PR7 compile and be tested without a
WinUI dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant