Documentation
¶
Overview ¶
Package acpcore holds the behavior every acp-go-* sibling shares: the session store contract and its in-memory implementation at the root, and the sessionlog, observer, storetest, lifecycle, process, wire, and image packages beneath it.
Index ¶
- Constants
- Variables
- type InMemorySessionStore
- func (s *InMemorySessionStore) Append(ctx context.Context, main SessionKey, base int, entries []SessionStoreEntry, ...) error
- func (s *InMemorySessionStore) Delete(ctx context.Context, key SessionKey) error
- func (s *InMemorySessionStore) ListSessions(ctx context.Context) ([]SessionSummary, error)
- func (s *InMemorySessionStore) Load(ctx context.Context, sessionID string) (map[string][]SessionStoreEntry, error)
- func (s *InMemorySessionStore) Replace(ctx context.Context, main SessionKey, replacements []SessionStoreReplacement) error
- type SessionKey
- type SessionStore
- type SessionStoreEntry
- type SessionStoreReplacement
- type SessionSummary
Constants ¶
const SessionStoreMainSubpath = ""
SessionStoreMainSubpath addresses a session's main record.
const SessionStoreTimeout = 10 * time.Second
SessionStoreTimeout bounds one store call a sibling makes on a host's behalf.
Variables ¶
var ErrSessionIDRequired = errors.New("session id is required")
ErrSessionIDRequired reports a write addressed to an empty session id.
Functions ¶
This section is empty.
Types ¶
type InMemorySessionStore ¶
type InMemorySessionStore struct {
// contains filtered or unexported fields
}
InMemorySessionStore is the default store when a host provides none, and the reference implementation the store contract battery is written against. It holds its own copy of every entry, and Load returns another copy.
func NewInMemorySessionStore ¶
func NewInMemorySessionStore() *InMemorySessionStore
NewInMemorySessionStore creates an empty process-local store.
func (*InMemorySessionStore) Append ¶
func (s *InMemorySessionStore) Append(ctx context.Context, main SessionKey, base int, entries []SessionStoreEntry, replacements []SessionStoreReplacement) error
Append extends the main record of the session's committed generation and replaces the listed subpaths.
func (*InMemorySessionStore) Delete ¶
func (s *InMemorySessionStore) Delete(ctx context.Context, key SessionKey) error
Delete removes one subrecord, or the whole session when the main key is named; a deleted session stays deleted. Deleting a key with an empty SessionID is a no-op.
func (*InMemorySessionStore) ListSessions ¶
func (s *InMemorySessionStore) ListSessions(ctx context.Context) ([]SessionSummary, error)
ListSessions lists committed sessions, newest first.
func (*InMemorySessionStore) Load ¶
func (s *InMemorySessionStore) Load(ctx context.Context, sessionID string) (map[string][]SessionStoreEntry, error)
Load returns one complete session generation keyed by subpath. A live empty main record is present under the empty key; a missing session returns nil.
func (*InMemorySessionStore) Replace ¶
func (s *InMemorySessionStore) Replace(ctx context.Context, main SessionKey, replacements []SessionStoreReplacement) error
Replace atomically publishes one session's complete generation.
type SessionKey ¶
type SessionKey struct {
// SessionID is the ACP-visible session ID being stored.
SessionID string
// Subpath is empty for the main record or names a session-owned subrecord.
Subpath string
}
SessionKey addresses one session-store record.
type SessionStore ¶
type SessionStore interface {
Load(ctx context.Context, sessionID string) (map[string][]SessionStoreEntry, error)
Replace(ctx context.Context, main SessionKey, replacements []SessionStoreReplacement) error
Append(ctx context.Context, main SessionKey, base int, entries []SessionStoreEntry, replacements []SessionStoreReplacement) error
Delete(ctx context.Context, key SessionKey) error
ListSessions(ctx context.Context) ([]SessionSummary, error)
}
SessionStore is the durability boundary a host provides. Replace publishes one complete generation and is durable before it returns; it copies the entries it receives, so the caller keeps them. Append extends the committed generation: it atomically appends entries to the main record and replaces each listed subpath, keeping every unlisted subpath. base is the number of main entries the caller expects the generation to hold, compared by count only; when it holds another number, or the session has no committed generation, Append fails without writing. Append to a deleted session writes nothing and succeeds; it is durable before it returns, copies what it receives, and on failure preserves the previous generation. Load atomically reads every live subpath of one session; the returned map, slices, and bytes belong to the caller.
type SessionStoreEntry ¶
type SessionStoreEntry = json.RawMessage
SessionStoreEntry is one JSON object in a session's main record or one of its subrecords. Implementations preserve the raw bytes; the sibling validates entries before publishing them.
type SessionStoreReplacement ¶
type SessionStoreReplacement struct {
Key SessionKey
Entries []SessionStoreEntry
}
SessionStoreReplacement is one record written during an atomic replace.
type SessionSummary ¶
SessionSummary is a lightweight entry returned by session-store listers.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package image holds the family image gates: the decoded-byte limits, the media envelope, prompt image validation in both input forms, and output normalization.
|
Package image holds the family image gates: the decoded-byte limits, the media envelope, prompt image validation in both input forms, and output normalization. |
|
Package lifecycle implements the acp-go.dev/lifecycle extension: the closed event vocabulary, the strict wire decoder, the projection reducer, and the ordered emitter one session incarnation writes through.
|
Package lifecycle implements the acp-go.dev/lifecycle extension: the closed event vocabulary, the strict wire decoder, the projection reducer, and the ordered emitter one session incarnation writes through. |
|
Package observer centralizes the adapter's OpenTelemetry instrumentation: ACP request spans and metrics, prompt-turn GenAI metrics, permission and elicitation dialogs, session store operations, and native process exits.
|
Package observer centralizes the adapter's OpenTelemetry instrumentation: ACP request spans and metrics, prompt-turn GenAI metrics, permission and elicitation dialogs, session store operations, and native process exits. |
|
exporters
Package exporters wires the OTEL_* exporter, propagator, and log-bridge configuration a sibling's command binary hands to its Agent.
|
Package exporters wires the OTEL_* exporter, propagator, and log-bridge configuration a sibling's command binary hands to its Agent. |
|
Package process launches a harness as a plain child: the merged environment, the session cwd, its own process group, and three dedicated pipes.
|
Package process launches a harness as a plain child: the merged environment, the session cwd, its own process group, and three dedicated pipes. |
|
Package sessionlog mirrors native rows and their session configuration as one durable store generation, and reads and writes append-only native JSONL files.
|
Package sessionlog mirrors native rows and their session configuration as one durable store generation, and reads and writes append-only native JSONL files. |
|
Package storetest is the session store contract battery.
|
Package storetest is the session store contract battery. |
|
Package usage supplies shared provider account readers without acquiring credentials.
|
Package usage supplies shared provider account readers without acquiring credentials. |
|
anthropic
Package anthropic reads Claude subscription allowances and usage credits.
|
Package anthropic reads Claude subscription allowances and usage credits. |
|
gateway
Package gateway reads the aggregate usage report a forwarding gateway publishes for the upstream accounts it brokers.
|
Package gateway reads the aggregate usage report a forwarding gateway publishes for the upstream accounts it brokers. |
|
internal/usagehttp
Package usagehttp bounds authenticated provider usage reads.
|
Package usagehttp bounds authenticated provider usage reads. |
|
openaicodex
Package openaicodex reads ChatGPT subscription allowance windows.
|
Package openaicodex reads ChatGPT subscription allowance windows. |
|
opencodego
Package opencodego reads OpenCode Go subscription windows.
|
Package opencodego reads OpenCode Go subscription windows. |
|
openrouter
Package openrouter reads OpenRouter key allowances and account credit balances.
|
Package openrouter reads OpenRouter key allowances and account credit balances. |
|
Package wire holds the uniform error shapes, raw-event framing, and reserved literal rules every sibling answers with.
|
Package wire holds the uniform error shapes, raw-event framing, and reserved literal rules every sibling answers with. |