Documentation
¶
Overview ¶
Package recall defines input and paging contracts and an activity-side evidence handler. Workflows own allowance charging and dispatch.
Index ¶
- Constants
- func EncodeCursor(cursor Cursor) (string, error)
- func NewCitationResolver(ctx context.Context, source index.Source, entries []index.MessageEntry, ...) checkpoint.CitationResolver
- func Spec() tools.ToolSpec
- func ValidateToolName(identifier tools.Ident, providerName string) error
- type Access
- type AttachmentInfo
- type Code
- type Cursor
- type Error
- type FindAnchor
- type FindInput
- type Handler
- type Input
- type Kind
- type Line
- type ListInput
- type Match
- type Part
- type Range
- type ReadInput
- type Request
- type Response
- type RunChain
Constants ¶
const ( // Read consumes the read allowance. Read Kind = "read" // List consumes the discovery allowance. List Kind = "list" // Find consumes the discovery allowance. Find Kind = "find" // Result selects eligible result, message or summary text. Result Part = "result" // Arguments selects a tool call's original arguments. Arguments Part = "arguments" // Attachment selects one non-text user-message part. Attachment Part = "attachment" )
const ( // Description contains all model-facing discovery and paging guidance. Description = `` /* 1606-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func EncodeCursor ¶
EncodeCursor returns deterministic, unpadded base32. It signs no authority.
func NewCitationResolver ¶
func NewCitationResolver(ctx context.Context, source index.Source, entries []index.MessageEntry, through index.MessageID) checkpoint.CitationResolver
NewCitationResolver binds current-run citations to authorized canonical entries. Like K13's default nil RunChain, it resolves no rN labels before K18. Source must already be authorized for the activity's root run scope.
func ValidateToolName ¶
ValidateToolName rejects identifiers and provider names that expose the reserved lookup name in rendered receipts. Registration invokes this for application tools when compaction is enabled; the runtime-owned spec is exempt.
Types ¶
type Access ¶
type Access struct{ SessionID, RunID, TargetRunID, Scope string }
Access identifies a run reached through verified transcript evidence.
type AttachmentInfo ¶
type AttachmentInfo struct {
Message string `json:"message,omitzero"`
Run string `json:"run,omitzero"`
Part int `json:"part"`
Kind string `json:"kind"`
Format string `json:"format"`
Bytes int `json:"bytes"`
Tokens int `json:"tokens"`
}
AttachmentInfo identifies an original message part without exposing its bytes.
type Code ¶
type Code string
Code is a stable model-facing recall outcome.
const ( // CodeBudgetExhausted reports an exhausted read or discovery allowance. CodeBudgetExhausted Code = "recall_budget_exhausted" // CodeNotFound reports an ID or selector absent from the reachable chain. CodeNotFound Code = "recall_not_found" CodeUnauthorized Code = "recall_unauthorized" CodeUnavailable Code = "recall_unavailable" // CodeInvalidInput reports malformed arguments or cursor encoding. CodeInvalidInput Code = "recall_invalid_input" // CodeUnsupportedPart reports a non-text part pending multimodal recall. CodeUnsupportedPart Code = "recall_unsupported_part" )
type Cursor ¶
type Cursor struct {
Kind Kind `json:"kind"`
Handle string `json:"handle,omitempty"`
Range *Range `json:"range,omitempty"`
Scan string `json:"scan,omitempty"`
Position int `json:"position"`
Anchor *FindAnchor `json:"anchor,omitempty"`
}
Cursor is an untrusted continuation selector, never a capability. A handler must re-resolve its selector through the current checkpoint chain on every call and bind it to the requested operation before using Position.
func DecodeCursor ¶
DecodeCursor checks only encoding and shape. Even a successfully decoded selector and position must pass chain resolution and authorization later.
type Error ¶
type Error struct {
Code Code `json:"code"`
}
Error carries a structured code without exposing parser or store details.
type FindAnchor ¶
type FindAnchor struct {
Run string `json:"run"`
Entry index.MessageID `json:"entry"`
Chunk int `json:"chunk"`
}
FindAnchor identifies an immutable entry and its text/call chunk in scan order. Position in the enclosing cursor is a byte offset within this chunk.
type Handler ¶
type Handler struct {
Store runstore.Store
Sessions session.Store
Chain RunChain
Authorize func(context.Context, Access) error
}
Handler reads only model-eligible evidence reachable from the activity envelope.
type Input ¶
type Input struct {
Kind Kind `json:"-"`
Read *ReadInput `json:"read,omitempty"`
List *ListInput `json:"list,omitempty"`
Find *FindInput `json:"find,omitempty"`
}
Input contains exactly one operation. ParseInput preserves a recognized Kind on validation failure; callers charge discovery when Kind is empty.
func ParseInput ¶
ParseInput validates the exactly-one operation envelope without resolving IDs or cursors. A malformed recognized operation keeps its Kind for charging.
type Kind ¶
type Kind string
Kind selects the allowance and operation even for malformed known inputs.
type Line ¶
type Line struct {
ID string `json:"id"`
Run string `json:"run,omitzero"`
Kind string `json:"kind"`
Text string `json:"text,omitzero"`
Bytes int `json:"bytes,omitzero"`
Error bool `json:"error,omitzero"`
}
Line is a bounded model-visible receipt or message descriptor.
type ListInput ¶
type ListInput struct {
Handle string `json:"handle,omitempty"`
From index.MessageID `json:"from,omitempty"`
Through index.MessageID `json:"through,omitempty"`
Run string `json:"run,omitempty"`
Cursor string `json:"cursor,omitempty"`
}
ListInput selects either a collapsed handle or an inclusive message range.
type Match ¶
type Match struct {
ID string `json:"id"`
Part Part `json:"part"`
Run string `json:"run,omitzero"`
Offset int `json:"offset"`
SnippetOffset int `json:"snippet_offset"`
Snippet string `json:"snippet"`
}
Match locates literal eligible text and its bounded surrounding excerpt.
type Range ¶
type Range struct {
From index.MessageID `json:"from"`
Through index.MessageID `json:"through"`
Run string `json:"run,omitempty"`
}
Range is the inclusive message range and optional run label of a listing.
type ReadInput ¶
type ReadInput struct {
ID string `json:"id"`
Run string `json:"run,omitempty"`
Part Part `json:"part"`
Offset int `json:"offset"`
Index int `json:"index,omitzero"`
}
ReadInput addresses eligible content. Offset is a nonnegative byte offset.
type Request ¶
type Request struct {
Parts model.ToolResultPartSupport
PartTokens int
RunID, Scope string
View index.ViewRef
Head runstore.Hash
PageBytes, ScanBytes int
}
Request is the trusted activity envelope, never caller-supplied tool arguments.
type Response ¶
type Response struct {
Parts []model.ToolResultContentPart `json:"-"`
Attachments []AttachmentInfo `json:"attachments,omitzero"`
Attachment *AttachmentInfo `json:"attachment,omitzero"`
Reason string `json:"reason,omitzero"`
LimitUnit string `json:"limit_unit,omitzero"`
Limit int `json:"limit,omitzero"`
Code Code `json:"code,omitzero"`
Text string `json:"text,omitzero"`
NextOffset *int `json:"next_offset,omitzero"`
Entries []Line `json:"entries,omitzero"`
Matches []Match `json:"matches,omitzero"`
ReadHint string `json:"read_hint,omitzero"`
Cursor string `json:"cursor,omitzero"`
Format string `json:"format,omitzero"`
Bytes int `json:"bytes,omitzero"`
}
Response is the model-facing result. Cursor and NextOffset continue bounded pages.
type RunChain ¶
type RunChain interface {
Resolve(context.Context, string, string) (index.RunCheckpoint, error)
Head(context.Context, string, string) (runstore.Hash, error)
}
RunChain resolves displayed labels and index heads. K13's default (nil) resolves no rN labels; K18 supplies the production continuation chain.