picoclaw/pkg/providers/messageutil
maxiaoyang 7c7d7146ef feat(messageutil): add IsSystemSenderID and ApplyUserNamePrefix helpers
Two more helpers needed for end-to-end multi-user attribution:

- IsSystemSenderID filters synthetic trigger sources (cron, heartbeat,
  async:* tool callbacks, system channel) so internal events do not
  surface as distinct human users in the conversation. Without this,
  cron-triggered messages would carry attribution like cron, producing
  a confusing [cron] [System: cron] ... double prefix on adapters that
  fall back to in-content rendering.

- ApplyUserNamePrefix renders msg.Name as a [name] prefix on user
  content for adapters whose APIs do not support a per-message author
  identity (Anthropic, Bedrock, OpenAI Responses). The persisted
  message is never mutated; only the wire payload carries the prefix.
  Tool result messages and non-user roles pass through unchanged.

These helpers are pure and independently testable; they will be wired
into the agent and provider adapters in subsequent commits.

Refs #2702.
2026-04-29 21:01:03 +08:00
..
messageutil.go feat(messageutil): add IsSystemSenderID and ApplyUserNamePrefix helpers 2026-04-29 21:01:03 +08:00
messageutil_test.go feat(messageutil): add IsSystemSenderID and ApplyUserNamePrefix helpers 2026-04-29 21:01:03 +08:00