itemorigin

package
v0.293.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package itemorigin carries, on a context, WHERE a needs-you row is being made: the officer instance whose tool call is running, its chat session and the moment in it (migration 0185's origin_* columns on attention_asks and plugin_reply_drafts).

🔴 ONLY THE OFFICER TOOL DISPATCHER INSTALLS ONE (internal/api officerToolCall), FROM ITS BOUND CALLER — the agent whose token made the call — and never from anything in the call's arguments. The stores that write the columns (attention.PGStore.Create, plugins.PGStore's outbound draft) read it from the context and nowhere else, so a value a caller supplies cannot reach them: there is no field to put one in.

It is a RESOLVER, run once at the insert, so a tool call that makes no such row costs no read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Args

func Args(o Origin, ok bool) [3]any

Args is o as the three column values an INSERT binds (origin_agent_id, origin_session_id, origin_message_id): NULLs for none.

func With

func With(ctx context.Context, r Resolver) context.Context

With is ctx carrying r: the origin of every row made under it.

Types

type Origin

type Origin struct {
	// AgentID is the officer instance (agents.id).
	AgentID int64
	// SessionID is its chat session (chat_sessions.id) the call was made in;
	// 0 when it has none.
	SessionID int64
	// MessageID is the chat_messages row of the TURN the call was made in —
	// its own prompt row (the per-turn record, internal/api turnInputOf): the
	// moment; 0 when the turn is not known.
	MessageID int64
}

Origin is where a row was made.

func Resolve

func Resolve(ctx context.Context) (Origin, bool)

Resolve is ctx's origin, resolved at most once per With; ok false when ctx carries none, or its resolver found none (no agent).

type Resolver

type Resolver func(ctx context.Context) (Origin, bool)

Resolver answers the origin, ok false for none.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL