mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
feat(v2/approvals): per-card titles and structured options
Approval cards now carry a required title (Add MCP Request, Install Packages Request, Rebuild Request, Credentials Request) and structured options with distinct pre-click label, post-click selectedLabel (e.g. "✅ Approved" / "❌ Rejected"), and value used for click routing. The title and normalized options are persisted in pending_questions so the post-click card edit can render the correct per-type title and selected label on both chat-sdk channels and Discord interactions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -512,8 +512,9 @@ Send an interactive question and wait for the user's response. This is a **block
|
||||
{
|
||||
name: 'ask_user_question',
|
||||
params: {
|
||||
title: string, // short card title, e.g. "Confirm deletion"
|
||||
question: string,
|
||||
options: string[], // button labels
|
||||
options: (string | { label: string; selectedLabel?: string; value?: string })[],
|
||||
timeout?: number, // seconds (default: 300)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,8 +309,13 @@ function createWhatsAppChannel(): ChannelAdapter {
|
||||
{
|
||||
"operation": "ask_question",
|
||||
"questionId": "q-123",
|
||||
"title": "Failing Test",
|
||||
"question": "How should we handle the failing test?",
|
||||
"options": ["Skip it", "Fix and retry", "Abort deployment"]
|
||||
"options": [
|
||||
"Skip it",
|
||||
{ "label": "Fix and retry", "selectedLabel": "✅ Fixing", "value": "fix" },
|
||||
{ "label": "Abort deployment", "selectedLabel": "❌ Aborted", "value": "abort" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ Agent calls `add_reaction` tool with message ID and emoji. Agent-runner writes m
|
||||
{ "text": "LGTM" }
|
||||
|
||||
// Interactive card
|
||||
{ "operation": "ask_question", "question": "Approve deployment?", "options": ["Yes", "No", "Defer"] }
|
||||
{ "operation": "ask_question", "title": "Deploy", "question": "Approve deployment?", "options": ["Yes", "No", "Defer"] }
|
||||
|
||||
// Edit existing message
|
||||
{ "operation": "edit", "messageId": "3", "text": "Updated: LGTM with minor comments" }
|
||||
|
||||
Reference in New Issue
Block a user