Help us shape the future of Go! Take the 2026 Go Developer Survey

binding

package
v0.0.0-...-c703685 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 30 Imported by: 2

Documentation

Overview

Source: apps/mekugi/internal/router/app_server_approvals.go:265:500@[42afca9c] Codex approval protocol and stock choice semantics.

Source: apps/mekugi/internal/router/{app_server_clipboard,app_server_text_spans}.go@[e9da429a] submitted input encoding.

Source: apps/mekugi/internal/router/app_server_questions.go:25:42,593:655@[42afca9c] Codex question protocol.

Package binding exposes the Codex mechanisms implemented during extraction.

Source: internal/router/request_user_text.go:1:160@[e2ee92a9] submitted input identity.

Index

Constants

View Source
const QuestionReplyEnd = "</send_user_message_question_reply>"
View Source
const QuestionReplyStart = "<send_user_message_question_reply>"

Variables

View Source
var ErrUnsupportedExecutionInterface = errors.New("This model does not expose the required exec interface. Select a model that supports exec.")

Functions

func AsyncQuestionIdentity

func AsyncQuestionIdentity(item string, index int) string

func AttachmentInput

func AttachmentInput(text string) map[string]any

func CodeModeExecutionHeader

func CodeModeExecutionHeader(text string) (status, cell string, body string)

Source: internal/router/execution_continuation.go:200:309@b9a7b3fe. Match only the host's leading metadata, never strings printed by the program below Output:. Native session metadata inside exec needs a verified router carrier or transparent native-result projection as well.

func CodeModeFailureText

func CodeModeFailureText(texts []string) (string, bool)

Source: apps/mekugi/internal/router/code_mode_failure.go@[c6bad96c]. CodeModeFailureText reads the host's failure header and, when the host appended one as the final part, its complete script error. Presentation bounds the inline preview separately; the host result is never modified.

func CodeModeOnlyModelCatalog

func CodeModeOnlyModelCatalog(body []byte) ([]byte, error)

CodeModeOnlyModelCatalog enforces the execution interface in model metadata, which Codex selects before consulting its execution feature flags.

func ConfirmHistoryInjection

func ConfirmHistoryInjection(ctx context.Context, thread, path string, expected jsontext.Value) error

func ConfirmRetainedOutput

func ConfirmRetainedOutput(ctx context.Context, thread, path, namespace, name, output string) error

func ConfirmTerminalTurn

func ConfirmTerminalTurn(ctx context.Context, thread, path, turn string) error

func ConfirmUserInput

func ConfirmUserInput(ctx context.Context, thread, path, id string) error

func EditReceiptSource

func EditReceiptSource(tool, source string) string

EditReceiptSource projects a host tool/source identity into a receipt label. Source: apps/mekugi/internal/router/native_edit_receipt.go:143:149@[bab31cbe] receiptEvidence.

func EncodeQuestionReplies

func EncodeQuestionReplies(replies []QuestionReply) string

func EncodeQuestionResponse

func EncodeQuestionResponse(completed []QuestionAnswer) map[string]any

func ExecutionAnnotationMatches

func ExecutionAnnotationMatches(part jsonv1.RawMessage, handle map[string]any) bool

ExecutionAnnotationMatches accepts only the complete annotation wire shape for the supplied handle. Extra fields and unrelated text remain untouched.

func ExecutionCalls

func ExecutionCalls(source string, requireResultMetadata bool) ([]map[string]jsonv1.RawMessage, bool)

ExecutionCalls preserves literal tool arguments in supported transparent JavaScript. Result metadata is required for continuation correlation, but not for provisional source previews. Recognition never executes the source.

func ExecutionOutputTexts

func ExecutionOutputTexts(raw jsonv1.RawMessage) []string

ExecutionOutputTexts decodes host output while preserving content-part positions.

func ExecutionResumeHandle

func ExecutionResumeHandle(item map[string]jsonv1.RawMessage, execName string) string

ExecutionResumeHandle recognizes only literal host continuation arguments.

func ImageInput

func ImageInput(path string) map[string]any

func LiteralPatchInputs

func LiteralPatchInputs(source string) []string

Inspect the entire exec syntax tree rather than only transparent one-call wrappers. This recognizes literal patch arguments in ordinary JS sequencing and Promise batches, plus immutable top-level literal bindings used by a top-level expression. It never evaluates JavaScript or takes over the host tool. Dynamic arguments have no trustworthy pre-edit baseline. Source: apps/mekugi/internal/router/native_apply_patch.go:33:115@72549ff1.

func MatchInstructionFragment

func MatchInstructionFragment(fragment guidance.Fragment, thread, item string, index int, text string) error

MatchInstructionFragment binds provider content to a previously admitted host fragment even when provider serialization omits the native metadata.

func NativeExecutionHeader

func NativeExecutionHeader(text string) (state, body string)

func NativeExecutionSession

func NativeExecutionSession(text string) int64

func NativeInstructionFragments

func NativeInstructionFragments(thread string, item jsontext.Value) ([]guidance.Fragment, error)

NativeInstructionFragments decodes content-kind provenance from an admitted raw response item. The caller authenticates the containing host thread and retains these facts before a projection can depend on them. Source: codex-rs/protocol/src/models.rs@0df4aa677 ResponseItem metadata; codex-rs/app-server/src/bespoke_event_handling.rs:1167@0df4aa677.

func NativeJSONSession

func NativeJSONSession(text string) int64

func PermissionSummary

func PermissionSummary(value jsontext.Value) string

PermissionSummary condenses a requested permission profile, following the stock overlay's rule text. Source: codex-rs/tui/src/bottom_pane/approval_overlay.rs format_additional_permissions_rule @7135b303d.

func PrepareStockExecution

func PrepareStockExecution(fields map[string]jsonv1.RawMessage, catalog *codexresponses.ToolCatalog, frontendGuidance FrontendGuidance, guidance *Guidance) (string, error)

PrepareStockExecution recognizes the stock Codex exec interface and adds session-helper guidance to the owning execution description. It never removes, replaces, or rewrites apply_patch, exec_command, or the JavaScript execution contract.

func QuestionIdentity

func QuestionIdentity(thread, item string, request jsontext.Value) string

func QuestionReplyIdentity

func QuestionReplyIdentity(reply QuestionReply) (string, int, bool)

func ReadForkPrefix

func ReadForkPrefix(ctx context.Context, source ForkSource, boundary ForkBoundary, resolve ForkResolver) ([]byte, error)

func ReadInstructionFragments

func ReadInstructionFragments(thread, path string) ([]guidance.Fragment, error)

func ReadReferencedInstructionFragments

func ReadReferencedInstructionFragments(ctx context.Context, thread, path string, resolve ForkResolver) ([]guidance.Fragment, error)

func RetainedTranscript

func RetainedTranscript(e observation.Event) observation.TextEvent

RetainedTranscript preserves already decoded rollout values directly; it does not reconstruct a notification or interpret unavailable raw reasoning.

func SingleExecutionCall

func SingleExecutionCall(source string, requireResultMetadata bool) (map[string]jsonv1.RawMessage, bool)

SingleExecutionCall recognizes one transparent Codex JavaScript invocation.

func SubmittedUserText

func SubmittedUserText(raw json.RawMessage, includeAttachedFiles bool) string

func TextInput

func TextInput(text string, elements []InputTextElement) map[string]any

func ValidateIndependentThreadCatalog

func ValidateIndependentThreadCatalog(request *responses.Request) error

ValidateIndependentThreadCatalog rejects live native registrations without removing similarly named MCP tools or rewriting historical native calls into callable aliases.

Types

type AdmissionSettings

type AdmissionSettings = rollout.Admission

func ReadAdmissionSettings

func ReadAdmissionSettings(thread, path string) (AdmissionSettings, error)

type ApprovalDecision

type ApprovalDecision struct {
	Label                  string
	Response               map[string]any
	Approve, Session, Deny bool
	Outcome                string
}

func CommandApprovalChoice

func CommandApprovalChoice(decision jsontext.Value, network, permissions bool) (ApprovalDecision, bool)

CommandApprovalChoice keeps the host's approval scopes. Command rejection uses native decline instead of aborting before denial feedback reaches the provider.

type ApprovalRequest

type ApprovalRequest struct {
	Kind           string `json:"kind"`
	ThreadID       string `json:"threadId"`
	TurnID         string `json:"turnId"`
	ItemID         string `json:"itemId"`
	Reason         string `json:"reason"`
	Command        string `json:"command"`
	Cwd            string `json:"cwd"`
	GrantRoot      string `json:"grantRoot"`
	NetworkContext *struct {
		Host string `json:"host"`
	} `json:"networkApprovalContext"`
	Additional         jsontext.Value   `json:"additionalPermissions"`
	Amendment          []string         `json:"proposedExecpolicyAmendment"`
	Permissions        jsontext.Value   `json:"permissions"`
	AvailableDecisions []jsontext.Value `json:"availableDecisions"`
}

func DecodeApprovalRequest

func DecodeApprovalRequest(params jsontext.Value) (ApprovalRequest, error)

type ApprovalReview

type ApprovalReview struct {
	Thread, Turn, Item, Status string
}

func DecodeApprovalReview

func DecodeApprovalReview(params jsontext.Value) (ApprovalReview, error)

DecodeApprovalReview names the exact reviewed item, never the review item.

type Binder

type Binder interface {
	Registrar
	Capability(capability.Mechanism) capability.Result
}

type Bindings

type Bindings[S any] struct {
	Requires        []capability.Requirement
	Observation     func(S) Observation
	Frontends       bool // Exposes the descriptor's command contributions.
	Rollout         func(S, RolloutSource) error
	InputProjection func(S) InputProjection
	Guidance        func(S) Guidance
	SessionNaming   func(S) SessionNaming
	ShellApproval   func(S) ShellApproval
	MCP             func(S) MCPServer
}

Bindings declares existing Codex connections. Factories receive the constructed service during registration; reference collection never invokes them.

func (Bindings[S]) Reference

func (b Bindings[S]) Reference() module.BindingReference

func (Bindings[S]) Register

func (b Bindings[S]) Register(r Registrar, service S, commands []command.Definition[S]) error

type CommandAction

type CommandAction struct {
	Type    string `json:"type"`
	Command string `json:"command"`
	Path    string `json:"path"`
	Query   string `json:"query"`
}

Source: apps/mekugi/internal/router/app_server_events.go:84:89@[eaad597b] appServerCommandAction.

type CommandGrants

type CommandGrants interface {
	Allows(approval.Command) bool
	Allow(approval.Command)
}

CommandGrants belongs to one module in one serialized UI scope.

type CommandObservation

type CommandObservation struct {
	Key            [3]string // Thread, turn, item.
	Command, Delta string
	Output         *string
	Exit           *int
}

CommandObservation preserves command identity and supplied output/outcome. Decoding confers neither execution nor report-correlation authority.

func DecodeCommandObservation

func DecodeCommandObservation(method string, raw jsontext.Value) (CommandObservation, bool)

type ContextUsage

type ContextUsage struct {
	Session, Thread             string
	Tokens, Window, Compactions uint64
	FreshInput                  func() json.RawMessage
	Notify                      func(string)
}

ContextUsage carries observed native context facts for an admitted request.

type DispatchError

type DispatchError struct {
	Outcome DispatchOutcome
	Method  string
	Cause   error
}

DispatchError distinguishes an explicit host rejection from a lost acknowledgement. Uncertain effects must be reconciled before another dispatch.

func (*DispatchError) Error

func (e *DispatchError) Error() string

func (*DispatchError) Unwrap

func (e *DispatchError) Unwrap() error

type DispatchOutcome

type DispatchOutcome string
const (
	NotDispatched DispatchOutcome = "not_dispatched"
	HostRejected  DispatchOutcome = "rejected"
	Uncertain     DispatchOutcome = "uncertain"
)

type EnvironmentContext

type EnvironmentContext struct {
	Session, Thread, Workspace string
	Revision                   uint64
}

EnvironmentContext carries admitted runtime identity and its authoritative refresh revision. It conveys facts acquisition scope, never authorization.

type ExecutionCall

type ExecutionCall struct {
	CodeMode      bool
	Native        bool
	NativePayload bool
	CellID        string
	ResumeHandle  string
}

ExecutionCall describes recognized protocol evidence, not execution or success.

func ClassifyExecutionCall

func ClassifyExecutionCall(item map[string]jsonv1.RawMessage, retained *RetainedExecution, execName string) ExecutionCall

ClassifyExecutionCall interprets original input and optional retained carrier facts. Callers validate retained identity before supplying those facts.

type ExecutionContinuation

type ExecutionContinuation struct {
	Handle   map[string]any     `json:"handle"`
	NextCall *ExecutionNextCall `json:"next_call"`
	Reason   string             `json:"reason,omitempty"`
}

ExecutionContinuation retains the historical wire shape for offline inspection. New requests preserve stock Codex continuation guidance.

type ExecutionNextCall

type ExecutionNextCall struct {
	Tool  string `json:"tool"`
	Input any    `json:"input"`
}

ExecutionNextCall is advice encoded in a historical continuation annotation, not a request to execute a tool.

type ExecutionResult

type ExecutionResult struct {
	Terminal     bool
	Succeeded    bool
	ExitCode     *int
	Text         string
	ResumeHandle string
}

ExecutionResult describes the host envelope, not the success of any nested tool. Consumers join native trace evidence before assigning nested outcomes.

func DecodeExecutionResult

func DecodeExecutionResult(toolName string, raw jsonv1.RawMessage) ExecutionResult

DecodeExecutionResult reads retained stock tool output without interpreting program output as a continuation or replacing the original host result.

type FileChange

type FileChange struct {
	Path string `json:"path"`
	Diff string `json:"diff"`
	Kind struct {
		Type      string `json:"type"`
		MovePath  string `json:"move_path"`
		MovePath2 string `json:"movePath"`
	} `json:"kind"`
}

Source: apps/mekugi/internal/router/app_server_events.go:74:82@[eaad597b] appServerFileChange.

func (FileChange) Observation

func (c FileChange) Observation() observation.FileChange

type ForkBoundary

type ForkBoundary = rollout.PrefixBoundary

type ForkResolver

type ForkResolver = rollout.PrefixResolver

type ForkSource

type ForkSource = rollout.PrefixSource

type FrontendGuidance

type FrontendGuidance struct {
	Descriptions string `json:"descriptions"`
	Workflow     string `json:"workflow"`
	Shell        string `json:"shell,omitempty"` // Native-shell descriptions and shared workflow, without Codex execution framing.
}

FrontendGuidance separates executable capabilities from task workflow policy. All projections belong to the same authenticated invocation catalog.

type Guidance

type Guidance struct {
	ContextUsage      func(InstructionInput, ContextUsage) (InstructionUpdate, error)
	Environment       func(context.Context, InstructionInput, EnvironmentContext) (InstructionUpdate, error)
	Threads           func(InstructionInput, []guidance.Replacement) (InstructionUpdate, error)
	BeforePreparation func(InstructionInput) (InstructionUpdate, error)
	ForExecution      func(InstructionInput) (InstructionUpdate, error)
	AfterAttachments  func(InstructionInput, bool) (InstructionUpdate, error)
	Frontends         func([]command.Spec) (FrontendGuidance, error)
	ToolDescription   func(description, guide string, remove bool) (string, error)
	BaseInstructions  func(instructions json.RawMessage, workflow string, remove bool) (json.RawMessage, error)
}

Guidance registers the distinct existing request phases. Callbacks are invocation-immutable; the application owns request copies and catalog indexing.

type HistoryTurn

type HistoryTurn struct {
	ID          string       `json:"id"`
	Status      string       `json:"status"`
	Items       []ThreadItem `json:"items"`
	StartedAt   int64        `json:"startedAt"`
	CompletedAt int64        `json:"completedAt"`
	Error       *struct {
		Message string `json:"message"`
	} `json:"error"`
}

Source: apps/mekugi/internal/router/app_server_resume.go:203:213@[eaad597b] appServerHistoryTurn.

type InputByteRange

type InputByteRange struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

TextElement uses part-relative byte ranges in the app-server input protocol.

type InputProjection

type InputProjection struct {
	Name    string
	Prepare func([]byte) PreparedInputProjection
}

InputProjection prepares once against original input before application additions. Its returned function applies once, after all evidence consumers. Only the returned function may hold request-local state.

type InputTextElement

type InputTextElement struct {
	ByteRange   InputByteRange `json:"byteRange"`
	Placeholder string         `json:"placeholder"`
}

type InstructionInput

type InstructionInput struct {
	Instructions json.RawMessage
	Input        json.RawMessage
}

type InstructionUpdate

type InstructionUpdate struct {
	InstructionInput
	InstructionsChanged bool
	InputChanged        bool
}

type MCPIdentity

type MCPIdentity struct {
	Thread  string
	Session string
	Turn    string
	Call    string
	Item    string
	Window  string
	Version string
	Model   string
	Effort  string
}

MCPIdentity contains host-supplied identity for a stock nested MCP call. Call identifies the nested invocation; Item identifies its enclosing execution.

func DecodeMCPIdentity

func DecodeMCPIdentity(raw jsontext.Value) (MCPIdentity, error)

DecodeMCPIdentity authenticates consistency, not tree membership. The owner must additionally admit this identity against its live invocation records. Source: codex-rs/core/src/mcp_tool_call.rs:1307,1407@0df4aa677.

type MCPServer

type MCPServer struct {
	Name   string
	Server *mcp.Server
	Tools  []string
}

MCPServer borrows a feature-owned SDK server and its invocation tool names.

type Notification

type Notification struct {
	Command *CommandObservation `json:"-"`
	Status  struct {
		Type string `json:"type"`
	} `json:"status"`
	ThreadID   string             `json:"threadId"`
	TurnID     string             `json:"turnId"`
	ItemID     string             `json:"itemId"`
	Delta      string             `json:"delta"`
	ProcessID  string             `json:"processId"`
	Stdin      string             `json:"stdin"`
	Item       ThreadItem         `json:"item"`
	Run        *appserver.HookRun `json:"run,omitempty"`
	Thread     ThreadInfo         `json:"thread"`
	TokenUsage struct {
		Total              TokenUsage  `json:"total"`
		Last               *TokenUsage `json:"last"`
		ModelContextWindow uint64      `json:"modelContextWindow"`
	} `json:"tokenUsage"`
	Turn Turn `json:"turn"`
}

func DecodeNotification

func DecodeNotification(method string, raw jsontext.Value) (Notification, error)

DecodeNotification preserves native payloads while sharing command normalization with pre-queue evidence consumers. It never dispatches or changes the input. Source: apps/mekugi/internal/router/app_server_ui.go:856:866@1bcbdd5a.

func (Notification) Observation

func (p Notification) Observation(method string, at time.Time) observation.Event

type Observation

type Observation struct {
	NewTranscript func(*scope.Store) observation.Transcript
}

Observation accesses transcript correlation in application-owned scopes. Its callbacks consume public facts and cannot issue host operations.

type PreparedInputProjection

type PreparedInputProjection func([]byte) ProjectionResult

type ProjectionReceipt

type ProjectionReceipt struct {
	SavedTokens         int64
	TokensMeasured      bool
	OutputRepetitions   uint64
	RepeatedCalls       map[string]string
	RepeatedAttachments map[string]string
}

ProjectionReceipt describes repeated text in this request copy, not host completion or provider billing. Call keys keep the original Codex identity.

type ProjectionResult

type ProjectionResult struct {
	Input   []byte
	Receipt *ProjectionReceipt
}

type Question

type Question struct {
	ID       string         `json:"id"`
	Header   string         `json:"header"`
	Question string         `json:"question"`
	Title    string         `json:"title"`
	IsSecret bool           `json:"isSecret"`
	Options  jsontext.Value `json:"options"`
}

type QuestionAnswer

type QuestionAnswer struct {
	ID      string
	Answers []string
	Other   bool
}

QuestionAnswer contains completed input only. Secret answers may pass through this response encoder but never enter the feature's retained answer records.

type QuestionOption

type QuestionOption struct {
	Label       string `json:"label"`
	Description string `json:"description"`
}

func QuestionOptions

func QuestionOptions(q Question, sync bool) []QuestionOption

type QuestionReply

type QuestionReply struct {
	Answer         string `json:"answer"`
	Question       string `json:"question"`
	QuestionItemID string `json:"questionItemId"`
}

func QuestionReplies

func QuestionReplies(text string) []QuestionReply

Match the whole stock payload, never an envelope quoted inside a prompt.

type QuestionRequest

type QuestionRequest struct {
	ThreadID  string     `json:"threadId"`
	TurnID    string     `json:"turnId"`
	ItemID    string     `json:"itemId"`
	Questions []Question `json:"questions"`
}

func DecodeQuestionRequest

func DecodeQuestionRequest(params jsontext.Value) (QuestionRequest, error)

type Registrar

type Registrar interface {
	MCP(MCPServer) error
	Observation(Observation) error
	Rollout(func(RolloutSource) error) error
	Frontend(command.Spec) error
	InputProjection(InputProjection) error
	Guidance(Guidance) error
	SessionNaming(SessionNaming) error
	ShellApproval(ShellApproval) error
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry validates and retains composition-ordered Codex connections.

func (*Registry) Capability

func (r *Registry) Capability(mechanism capability.Mechanism) capability.Result

func (*Registry) Commands

func (r *Registry) Commands() []command.Spec

func (*Registry) Frontend

func (r *Registry) Frontend(spec command.Spec) error

func (*Registry) Guidance

func (r *Registry) Guidance(guidance Guidance) error

func (*Registry) InputProjection

func (r *Registry) InputProjection(projection InputProjection) error

func (*Registry) InputProjections

func (r *Registry) InputProjections() []InputProjection

func (*Registry) MCP

func (r *Registry) MCP(server MCPServer) error

func (*Registry) Observation

func (r *Registry) Observation(observation Observation) error

func (*Registry) RegisteredGuards

func (r *Registry) RegisteredGuards() []ShellApproval

func (*Registry) RegisteredGuidance

func (r *Registry) RegisteredGuidance() *Guidance

func (*Registry) RegisteredMCP

func (r *Registry) RegisteredMCP() []MCPServer

func (*Registry) RegisteredNaming

func (r *Registry) RegisteredNaming() *SessionNaming

func (*Registry) RegisteredObservation

func (r *Registry) RegisteredObservation() *Observation

func (*Registry) Rollout

func (*Registry) Rollout(attach func(RolloutSource) error) error

Rollout attaches an offline decoder without starting a backend process.

func (*Registry) SessionNaming

func (r *Registry) SessionNaming(naming SessionNaming) error

func (*Registry) ShellApproval

func (r *Registry) ShellApproval(guard ShellApproval) error

type ResolvedRequest

type ResolvedRequest struct {
	ThreadID  string         `json:"threadId"`
	RequestID jsontext.Value `json:"requestId"`
}

func DecodeResolvedRequest

func DecodeResolvedRequest(params jsontext.Value) (ResolvedRequest, error)

type RetainedExecution

type RetainedExecution struct {
	CarrierKind string
	ToolName    string
	Script      string
}

RetainedExecution supplies validated carrier facts with a normalized kind. A nil value leaves classification to the original host input.

type Rollout

type Rollout = rollout.Inspection

type RolloutCall

type RolloutCall = rollout.Call

type RolloutEvent

type RolloutEvent = rollout.InspectionEvent

type RolloutItem

type RolloutItem = rollout.ToolItem

type RolloutReader

type RolloutReader func(context.Context, string, func(RolloutEvent) error) (Rollout, error)

type RolloutSource

type RolloutSource struct {
	Inspect  RolloutReader
	Replay   func(context.Context, string, map[string]bool) (observation.Source, error)
	Identity func(string) (string, error)
}

RolloutSource exposes distinct decoded consumers of the same offline mechanism.

type RuntimeContext

type RuntimeContext = rollout.Runtime

func ReadRuntimeContext

func ReadRuntimeContext(thread, path, turn string) (RuntimeContext, error)

ReadRuntimeContext consumes only a host-selected path and exact turn identity. The caller retains responsibility for admitting the thread into its invocation.

type SessionNaming

type SessionNaming struct {
	NewThread func(name string, hasTurns bool) ThreadNaming
}

type ShellApproval

type ShellApproval struct {
	Kind       ShellGuardKind
	NewSession func() CommandGrants
}

type ShellGuardKind

type ShellGuardKind string
const (
	RemoteWrite ShellGuardKind = ""
	Sudo        ShellGuardKind = "sudo"
)

func GuardForRequest

func GuardForRequest(kind string) (ShellGuardKind, bool)

GuardForRequest maps private wire kinds to the registered policy owner.

type ThreadAdmissionPolicy

type ThreadAdmissionPolicy struct{}

ThreadAdmissionPolicy is the invocation's final owned configuration overlay. It applies at the sole request owner, after caller/role/restored settings.

func (ThreadAdmissionPolicy) Apply

func (p ThreadAdmissionPolicy) Apply(params any) (jsontext.Value, error)

type ThreadInfo

type ThreadInfo struct {
	SessionID      string        `json:"sessionId"`
	ThreadSource   string        `json:"threadSource"`
	Name           string        `json:"name"`
	ID             string        `json:"id"`
	ParentThreadID string        `json:"parentThreadId"`
	AgentNickname  string        `json:"agentNickname"`
	AgentRole      string        `json:"agentRole"`
	Cwd            string        `json:"cwd"`
	Path           string        `json:"path"`
	CreatedAt      int64         `json:"createdAt"`
	UpdatedAt      int64         `json:"updatedAt"`
	Turns          []HistoryTurn `json:"turns"`
}

Source: apps/mekugi/internal/router/app_server_events.go:91:104@[eaad597b] appServerThreadInfo.

func DecodeHistoryThread

func DecodeHistoryThread(raw []byte, requested string) (ThreadInfo, error)

DecodeHistoryThread admits a thread/read or thread/resume response only for the requested thread identity. Decoding does not restore live operations. Source: apps/mekugi/internal/router/app_server_resume.go:49:58@[eaad597b] resumeSettingsResponse.

func (ThreadInfo) Observation

func (t ThreadInfo) Observation() observation.Thread

Observation admits supplied lineage labels without opening a rollout. Source: apps/mekugi/internal/router/app_server_events.go:125:152@[439670ce].

type ThreadItem

type ThreadItem struct {
	DurationMS       *int64           `json:"durationMs"`
	Delivery         string           `json:"delivery"`
	Questions        []Question       `json:"questions"`
	ID               string           `json:"id"`
	ClientID         string           `json:"clientId"` // userMessage: the submission's clientUserMessageId.
	Type             string           `json:"type"`
	Text             string           `json:"text"`
	Summary          []string         `json:"summary"`
	Command          string           `json:"command"`
	Cwd              string           `json:"cwd"` // commandExecution: the directory the host ran it in.
	Source           string           `json:"source"`
	ProcessID        string           `json:"processId"`
	Path             string           `json:"path"`
	SavedPath        string           `json:"savedPath"`
	Status           string           `json:"status"`
	AggregatedOutput *string          `json:"aggregatedOutput"`
	Query            string           `json:"query"`
	Action           *WebSearchAction `json:"action"`
	Results          []jsontext.Value `json:"results"`
	// Content is variant-specific: user input blocks or raw reasoning strings.
	// Decode only userMessage content; reasoning presentation uses Summary.
	Content        jsontext.Value  `json:"content"`
	Phase          string          `json:"phase"`
	ExitCode       *int            `json:"exitCode"`
	CommandActions []CommandAction `json:"commandActions"`
	Changes        []FileChange    `json:"changes"`
	Tool           string          `json:"tool"`
	Server         string          `json:"server"`
	Arguments      jsontext.Value  `json:"arguments"`
	Result         jsontext.Value  `json:"result"`
	Error          jsontext.Value  `json:"error"`
}

ThreadItem retains native item payloads without presentation state. Source: apps/mekugi/internal/router/app_server_ui.go:70:107@[eaad597b] appServerItem.

func (ThreadItem) Observation

func (i ThreadItem) Observation() observation.Item

Observation supplies public item facts without changing the native source. Variant-specific private reasoning remains in the original host payload.

type ThreadNaming

type ThreadNaming interface {
	ObserveMetadata(name string, hasTurns bool)
	NameChanged(string)
	ObserveInput([]byte)
	Admit() func(context.Context, inference.Complete) (string, error)
	AcceptCandidate() bool
}

ThreadNaming is one module-owned typed policy entry held by an application logical thread scope. Its admitted operation carries no thread identity.

type TokenUsage

type TokenUsage struct {
	TotalTokens           uint64 `json:"totalTokens"`
	InputTokens           uint64 `json:"inputTokens"`
	OutputTokens          uint64 `json:"outputTokens"`
	CachedInputTokens     uint64 `json:"cachedInputTokens"`
	ReasoningOutputTokens uint64 `json:"reasoningOutputTokens"`
}

Source: apps/mekugi/internal/router/app_server_events.go:67:122@1bcbdd5a.

type ToolResult

type ToolResult struct {
	CallID   string
	Tool     string
	Status   string
	ExitCode *int `json:",omitempty"`
}

ToolResult is host outcome evidence independent of model-printed text. Its retained field names preserve the historical change-record wire shape.

type TranscriptItem

type TranscriptItem struct {
	ID, Type, Text, Status, Delivery, Phase string
	Summary                                 []string
	Questions                               []Question
}

TranscriptItem is the decoded native item's text subset. Observation excludes raw/private reasoning; user content remains with the Conversation consumer.

func (TranscriptItem) Observation

func (i TranscriptItem) Observation(thread, turn, id string) observation.TextItem

type Turn

type Turn struct {
	ID     string     `json:"id"`
	Status string     `json:"status"`
	Error  *TurnError `json:"error"`
}

type TurnError

type TurnError struct {
	Message        string         `json:"message"`
	CodexErrorInfo jsontext.Value `json:"codexErrorInfo"`
}

func (*TurnError) Recoverable

func (e *TurnError) Recoverable() bool

Recoverable identifies transient host failures without interpreting prose.

type WebSearchAction

type WebSearchAction struct {
	Type    string   `json:"type"`
	Query   string   `json:"query"`
	Queries []string `json:"queries"`
	URL     string   `json:"url"`
	Pattern string   `json:"pattern"`
}

Source: apps/mekugi/internal/router/app_server_search.go:12:18@[eaad597b] appServerWebSearchAction.

Jump to

Keyboard shortcuts

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