Documentation
¶
Overview ¶
Package origin defines the "dev.acp-kit.origin/v1" _meta entry: who sent a message, and from where, on a chat platform a relay bridges to an ACP agent.
Relays attach it to session/new, session/load, session/resume, session/fork and every session/prompt. It is the ONLY place identity travels: relays must not put identity text into prompt content. Agents read it to pick a per-user cwd, credentials or policy.
On session/new, session/fork and session/prompt the entry describes the triggering message. On session/resume and session/load it may describe the message that created the session instead (acp-kit re-sends that one when it recovers a session after an agent respawn), so agents should key per-message behaviour on prompts only.
The cwd a relay sends alongside it is opaque (it may be a placeholder); the agent chooses the real working directory.
Index ¶
Constants ¶
const Key = "dev.acp-kit.origin/v1"
Key is the _meta key the origin entry is stored under.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Origin ¶
type Origin struct {
Platform string `json:"platform,omitempty"` // e.g. "slack", "zulip", "poe"
TeamID string `json:"team_id,omitempty"` // workspace / realm / site
UserID string `json:"user_id,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
ThreadID string `json:"thread_id,omitempty"` // thread / topic / conversation
MessageID string `json:"message_id,omitempty"`
IsDM bool `json:"is_dm"`
IsMention bool `json:"is_mention"`
}
Origin identifies the chat message that triggered an ACP call. Every field is optional; IDs are the platform's own, as opaque strings. It must stay comparable (no maps or slices): IsZero relies on ==.
func Decode ¶
Decode parses one encoded origin entry (the value under Key). A null or empty entry reads as absent.
func FromMeta ¶
FromMeta reads the origin entry from a decoded _meta map. It accepts the entry either as an Origin value (in-process) or as the generic map/JSON-decoded form. ok is false when the key is absent or malformed.
func FromRawMeta ¶
func FromRawMeta(raw json.RawMessage) (Origin, bool)
FromRawMeta reads the origin entry from an undecoded _meta object.