Documentation
¶
Overview ¶
Package link is the inter-island exchange broker — Lane 5, Phase 2 of docs/inter-island-exchange-spec.md. Cross-island is deny-all by default (containment); an info channel exists ONLY as an explicit, operator-granted, directional A→B grant on a named topic. The daemon is the only broker: there is no island↔island socket, every message flows through dejimad, and every grant/message/denial is ledgered.
This package owns only the authorization: the persisted Grant store. Delivery is NOT here — a granted cross-island message is delivered into the *recipient agent's ordinary mailbox* (internal/mailbox), stamped with daemon-controlled provenance, so there is a single durable inbox and a single audit surface. The HTTP gate in internal/api enforces "an island may only send AS itself, and only on a granted channel" — agents request, never self-approve. Action delegation (one island causing another to *act*) is the separate, harder-gated Phase 3 and is NOT here: a Phase-2 grant moves info, never actions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionRequest ¶
type ActionRequest struct {
ID string `json:"id"`
From string `json:"from"` // source island
FromAgent string `json:"from_agent"` // source agent (self-reported within A)
To string `json:"to"` // destination island
ToAgent string `json:"to_agent"` // destination agent
Topic string `json:"topic"` // the granted channel
Action string `json:"action"` // named, typed action exposed by B
Params string `json:"params,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
ActionRequest is a requested cross-island action invocation: source island From (agent FromAgent) asking destination island To (agent ToAgent) to run the named, typed Action with Params, over the granted channel Topic. It is the action-tier analog of a link message — but an action is a NAMED operation B exposed, never free text.
type Grant ¶
type Grant struct {
From string `json:"from"`
To string `json:"to"`
Topic string `json:"topic"`
Actions []string `json:"actions,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Grant is an operator-authorized, directional info channel from island From to island To on a named Topic. Actions is reserved for Phase 3 (the per-action allowlist); in Phase 2 a grant is info-only and Actions is empty. The grant is island→island — the target *agent* is a delivery address chosen per message, not part of the grant (the island is the security boundary the operator grants).
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue holds action requests awaiting operator approval. It is IN-MEMORY by design: a daemon restart drops every pending request so nothing ever auto-executes after a restart (fail-closed); a TTL expires stale requests while the daemon runs. Concurrency-safe.
func (*Queue) Add ¶
func (q *Queue) Add(r ActionRequest) ActionRequest
Add enqueues a pending request, assigning an ID + CreatedAt, and returns it.
func (*Queue) List ¶
func (q *Queue) List() []ActionRequest
List returns the non-expired pending requests, oldest first, pruning expired ones as it goes.
type Store ¶
Store is the per-daemon set of link grants. Operator-only and deny-all: a channel that isn't in the store does not exist. Concurrency-safe; persisted atomically (mirrors internal/githubid).
func Update ¶
Update runs fn against the store under a process-wide lock and persists the result atomically. Use it for every read-modify-write.
func (*Store) Allowed ¶
Allowed reports whether a from→to message on topic is authorized, returning the matching grant. Default-deny: no grant ⇒ (Grant{}, false).