scope

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 1 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 scope carries session-, turn-, and tool-scoped metadata through context.Context so that subsystems (journal, metrics, sandbox, and others) can attribute their work without explicit parameter passing.

Scope

A Scope identifies the active execution context:

Context Propagation

With returns a new context with the non-empty fields of the given Scope merged onto any existing scope in the context. From extracts the current scope. Callers nest scopes by calling With at each level (session, turn, tool call), and inner scopes inherit outer fields automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func With

func With(ctx context.Context, s Scope) context.Context

With returns a new context with non-empty fields of s merged onto any existing Scope in ctx.

Types

type Scope

type Scope struct {
	SessionID  string
	TurnID     string // User message ID that initiated the turn
	MessageID  string // Assistant message ID that emitted the tool call
	ToolCallID string // Active ToolCall.ID
	ToolName   string // Active ToolCall.Name

	WorkspaceRoot   string // Canonical workspace root path
	Agent           string // The session's agent
	Purpose         string // LLM call purpose: chat, compaction or title
	ParentSessionID string // Parent session for subagents; empty otherwise
}

Scope carries session-, turn-, and tool-scoped metadata across execution.

func From

func From(ctx context.Context) (Scope, bool)

From extracts the Scope from ctx.

Jump to

Keyboard shortcuts

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