Files
buzz/docs
DuncanandWill Pfleger d808c4bdbf feat(acp): publish kind-9/40003 permission sentinel cards into channel thread
Implements Phase-1 of issue #4938: the harness now publishes kind-9
sentinel cards into the channel thread when a session/request_permission
reaches the Ask policy arm, and edits them to resolved state (kind-40003)
when the permission concludes.

Sentinel publish system (buzz-acp):
- Add relay_publisher, agent_relay_keys, agent_owner_pubkey_hex,
  turn_initiator_pubkey, sentinel_channel_id, sentinel_thread_reply_id
  fields to AcpClient; wired per-turn from pool.rs and lib.rs.
- D7-final admission check: Ask only fires for owner-initiated turns
  when relay_publisher is present; non-owner turns silently downgrade
  to reject so no card is posted for unattended sessions.
- kind-9 sentinel published after inserting the pending entry; event ID
  stored in PermissionEntry::sentinel_event_id for the edit.
- kind-40003 resolved edit published in finish_permission Ok path;
  skipped when sentinel_event_id is None (relay-absent sessions).
- Both publishes are fire-and-forget; permission flow never blocks on
  relay acceptance.
- publish_event_acked / PublishEventAcked / AckOutcome scaffolding
  preserved for future acked-publish callers.

Label fix (desktop):
- describePermissionOutcome: accepts optionLabels (display strings) and
  optionKinds (for deny/approve verb only) as separate maps; never
  renders raw ACP kind strings to the user.
- describePermissionTerminalReason: builds optionLabels from label ?? name
  fields; raw kind string falls back to verb-only ("Approved" / "Denied")
  when no display string is available.
- Legacy key path passes empty labels map (verb-only fallback).

Documentation (NIP-AO.md):
- Permission Sentinel Cards section: kind-9/40003 lifecycle, D7-final
  admission check, D5 durable-rule disclosure, sentinel authenticity.

Tests:
- 736 + 9 buzz-acp unit tests pass (sentinel publish skipped via
  relay_publisher: None in test helpers; D7 gate bypassed when
  relay_publisher is None).
- agentSessionTranscriptPermissions.test.mjs: 12 named tests for
  describePermissionOutcome and describePermissionTerminalReason.
- computePermissionRequest.test.mjs: tests for sentinel card parser.
- Updated expectations in agentSessionTranscript.test.mjs and
  ingestArchivedObserverEvents.test.mjs to match verb-only fallback.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-08 13:48:55 -04:00
..
2026-07-21 17:16:23 +00:00