refine the prompt/log UX: show commands, de-emphasize injects

Two spot-check fixes (T-178, T-179), both grounded in a boundary test of
the stream-json wire (findings folded into the spike doc):

- Harness-injected user messages (skill loads, slash-command expansions,
  system reminders) carry isSynthetic on the wire (isMeta in the
  transcript). They were rendering as blue "you" cards though the user
  never typed them; now UserMessage.injected flags them and the view
  shows a muted, collapsed "context" card instead.
- Permission prompts now show the command/input being permitted (a
  capped, scrollable code block) so you can see what you approve. Instead
  of fully hiding a prompted tool-use, once resolved it collapses to a
  one-line summary with a green (approved) or red (denied) border; the
  session tracks per-tool_use_id outcome and the view colours it. The
  result is kept.

Corrects an earlier wrong assumption: the Skill tool is auto-allowed
(no permission prompt); the inject only appears once the Skill tool is
actually invoked, which is why deny-captures missed it.

T-178, T-179, D-78.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-25 10:26:33 +02:00
co-authored by Claude Opus 4.7
parent c30a707b41
commit 2243237b13
12 changed files with 189 additions and 32 deletions
@@ -2233,3 +2233,7 @@ INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by,
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-175', 'status', 'in_progress', 'done', NULL, '2026-05-25 07:25:02', '2026-05-25 07:25:02', '2026-05-25 07:25:02', NULL, '3e63273af832240b9f782fc41ca0047d', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-177', 'status', 'in_progress', 'done', NULL, '2026-05-25 07:25:02', '2026-05-25 07:25:02', '2026-05-25 07:25:02', NULL, '73982bc82e335f2d0fd80633aef0c082', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-176', 'status', 'in_progress', 'done', NULL, '2026-05-25 07:27:57', '2026-05-25 07:27:57', '2026-05-25 07:27:57', NULL, '926d5d2694207c65d0f620b2834962aa', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-179', 'status', 'backlog', 'in_progress', NULL, '2026-05-25 08:10:25', '2026-05-25 08:10:25', '2026-05-25 08:10:25', NULL, '059ff72ce3229f45259b097721bfb08f', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-178', 'status', 'backlog', 'in_progress', NULL, '2026-05-25 08:10:25', '2026-05-25 08:10:25', '2026-05-25 08:10:25', NULL, '389b95ddaaef1a5ce318bda840b1cde5', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-178', 'status', 'in_progress', 'done', NULL, '2026-05-25 08:21:46', '2026-05-25 08:21:46', '2026-05-25 08:21:46', NULL, 'ddaad91987208966c2720dee370738ed', 1) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-179', 'status', 'in_progress', 'done', NULL, '2026-05-25 08:26:21', '2026-05-25 08:26:21', '2026-05-25 08:26:21', NULL, '58dc0afa577b9aee651d683aa1b9bc69', 1) ON CONFLICT(hash) DO NOTHING;
+2
View File
@@ -2749,3 +2749,5 @@ INSERT INTO tickets (id, type, parent_id, title, description, status, priority,
INSERT INTO tickets (id, type, parent_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-175', 'task', 'T-164', 'Permission prompt: Allow / Allow-and-remember / Deny+note', 'Bottom-zone permission card (prompt_card.dart): replace binary Allow/Deny with three options. (1) Allow -> allow{updatedInput}. (2) Allow and do not ask again -> shown only when the can_use_tool request carries a permission_suggestions entry (session/localSettings destination); returns allow{updatedInput, updatedPermissions:[suggestion]}. AllowTool gains an optional updatedPermissions field; ToolPrompt + StreamJsonSession carry the request permission_suggestions through. (3) Deny -> reveals an optional note field -> deny{message}. Plus allow-with-note: clide sends the typed note as a follow-up user message right after allowing (protocol has no allow-with-message per D-78; closest faithful approximation). Acceptance: three options render (option 2 only when a suggestion exists); allow / deny / updatedPermissions / deny-note all flow over the control channel; allow+note sends a follow-up; widget + transport tests. Wireframe: docs/design/wireframes/claude-prompts/04-permission.png', 'done', 'high', NULL, NULL, 'D-78', '2026-05-25 07:11:09', '2026-05-25 07:25:02', NULL, 'ae547748304f0b6b388338ed501dfb60', 1) ON CONFLICT(id) DO UPDATE SET type=excluded.type, parent_id=excluded.parent_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (id, type, parent_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-177', 'task', 'T-164', 'Conversation cards: collapse tool_use/tool_result only when multi-line', 'tool_use and tool_result conversation cards start collapsed ONLY when their body is multi-line; single-line bodies render inline (collapse bulk, not chrome - if it fits on one line, just show it). Collapsed header shows a one-line summary (tool_use: tool + key arg, e.g. Write /tmp/x; tool_result: first line or byte size). thinking already collapses; user/assistant text stay expanded. Acceptance: a one-line result renders inline with no caret; a multi-line result starts collapsed with a summary header; widget tests. Relates to T-173 (ConversationCard primitive).', 'done', 'medium', NULL, NULL, 'D-78', '2026-05-25 07:11:22', '2026-05-25 07:25:02', NULL, 'f4a0e3207adf3134901fbee447e2824b', 1) ON CONFLICT(id) DO UPDATE SET type=excluded.type, parent_id=excluded.parent_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (id, type, parent_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-176', 'task', 'T-164', 'AskUserQuestion native picker: stepper + review, Other, per-choice note', 'Overhaul the AskUserQuestion bottom-zone card (prompt_card.dart). Single question -> no stepper, bare question + options. Multiple (2-4) -> stepper: top nav showing "N - Header" per step (check on answered, box on current) + prev/next arrows, one question at a time with Back/Next, then a Review screen (question -> answer, Back / Submit answers). Each question: numbered option buttons (1-4) + an Other choice that reveals a free-text field (typed text becomes the answer value, not the word Other) + a +note affordance on a picked option (answer becomes Label - note). multiSelect toggles and comma-joins labels. A chat-instead escape denies the prompt (message: user chose to chat instead) and refocuses the composer. On submit -> allow{updatedInput:{questions, answers}} -> card closes -> clide appends a compact answered echo item to the conversation log. Acceptance: single vs multi layouts; Other + note produce correct answer strings; review step; chat-instead denies + refocuses; widget tests. Wireframes: docs/design/wireframes/claude-prompts/ (01 single, 02 stepper, 03 review).', 'done', 'high', NULL, NULL, 'D-78', '2026-05-25 07:11:16', '2026-05-25 07:27:57', NULL, 'c63148c0b3d03a97b5ccc7e75133916d', 1) ON CONFLICT(id) DO UPDATE SET type=excluded.type, parent_id=excluded.parent_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (id, type, parent_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-178', 'task', 'T-164', 'De-emphasize harness-injected user messages (skill/command injects)', 'When a skill or slash-command is invoked, Claude injects its content as a user-role message (e.g. skill text begins "Base directory for this skill:", commands wrap content in <command-name>/<command-message>/<command-args>, system reminders in <system-reminder>). These are NOT typed by the user but render as a normal blue "you" card. Detect injected user messages (content markers; also isMeta when present) and render them de-emphasized: a collapsed, muted "context" card (bare variant), NOT the blue "you" accent. UserMessage gains an injected flag set in parseTranscriptChunk; conversation_view renders injected user messages collapsed/muted. Acceptance: a skill-inject user message renders collapsed + muted + not labelled "you"; a normal typed message still renders as "you"; widget + parser tests.', 'done', 'medium', NULL, NULL, 'D-78', '2026-05-25 08:10:10', '2026-05-25 08:21:46', NULL, '0fdbcde0168c2563152bbd862fc69d50', 1) ON CONFLICT(id) DO UPDATE SET type=excluded.type, parent_id=excluded.parent_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (id, type, parent_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('T-179', 'task', 'T-164', 'Permission prompt shows the command; resolved tool-use collapses with green/red border', 'Two parts. (1) The permission prompt UI must show what is being permitted: render the tool input (e.g. the Bash command / Write content) in the prompt card as a collapsible, trimmed code block, so the user can see what they approve. (2) Replace the current full-hide of a permission-prompted tool-use card: while the prompt is open, keep the payload in the prompt (hidden from the log); after resolution, show a COLLAPSED one-line summary in the log with a green border when approved and a red border when denied. Requires the session to track per-tool_use_id outcome (pending/allow/deny) and expose it; the conversation view renders prompted tool-use cards collapsed + colour-bordered by outcome (and keeps the result). Acceptance: prompt shows the command (collapsible); after allow the tool-use shows collapsed with a green border, after deny a red border; widget tests.', 'done', 'medium', NULL, NULL, 'D-78', '2026-05-25 08:10:18', '2026-05-25 08:26:21', NULL, 'b0679e5eaf9cc6cff3ccecde0ed31909', 1) ON CONFLICT(id) DO UPDATE SET type=excluded.type, parent_id=excluded.parent_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);