native

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 20 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 native discovers agent sessions through the agents' own local APIs. It never starts, stops or resumes a worker during discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	Attach      Action = "attach"
	Background  Action = "background"
	Resume      Action = "resume"
	Unavailable Action = "unavailable"
)

type Discoverer

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

func (*Discoverer) Fresh

func (d *Discoverer) Fresh(ctx context.Context) Listing

func (*Discoverer) List

func (d *Discoverer) List(ctx context.Context) Listing

List caches briefly so several overview clients do not spawn CLI probes on every frame. Import uses Fresh and never authorizes from this cache.

func (*Discoverer) Lookup

func (d *Discoverer) Lookup(ctx context.Context, ref Ref) (Session, error)

type Discovery

type Discovery interface{ List(context.Context) Listing }

Discovery is also implemented by deterministic integration fixtures.

type Issue

type Issue struct {
	Provider Provider `json:"provider"`
	Message  string   `json:"message"`
}

type Launch

type Launch struct {
	Command string
	Args    []string
	CWD     string
}

func Plan

func Plan(s Session, allowResume bool) (Launch, error)

Plan is a pure decision. Only fresh native observations can authorize a frontend launch; an HTTP caller cannot supply argv, a directory or a job id.

type Listing

type Listing struct {
	Sessions           []Session      `json:"sessions"`
	Processes          []LocalProcess `json:"processes,omitempty"`
	ProcessIssue       string         `json:"process_issue,omitempty"`
	ProcessesTruncated bool           `json:"processes_truncated,omitempty"`
	Issues             []Issue        `json:"issues"`
	Truncated          bool           `json:"truncated"`
}

type LocalProcess added in v0.8.0

type LocalProcess struct {
	Provider   Provider  `json:"provider"`
	PID        int       `json:"pid"`
	Generation string    `json:"generation"`
	Terminal   string    `json:"terminal"`
	CWD        string    `json:"cwd"`
	StartedAt  time.Time `json:"started_at,omitzero"`
	Group      int       `json:"-"`
	Ancestors  []int     `json:"ancestors,omitempty"`
}

LocalProcess is an observed terminal tab, not a verified conversation. It cannot authorize import, resume or input. Arguments and prompts stay private.

func (LocalProcess) Guidance added in v0.8.0

func (p LocalProcess) Guidance() string

func (LocalProcess) Key added in v0.8.0

func (p LocalProcess) Key() string

func (LocalProcess) Name added in v0.8.0

func (p LocalProcess) Name() string

type Provider

type Provider string
const (
	Codex  Provider = "codex"
	Claude Provider = "claude"
)

type Ref

type Ref struct {
	Provider Provider `json:"provider"`
	ID       string   `json:"id"`
}

func (Ref) Key

func (r Ref) Key() string

func (Ref) Validate

func (r Ref) Validate() error

type Session

type Session struct {
	Ref        Ref       `json:"ref"`
	Name       string    `json:"name"`
	CWD        string    `json:"cwd"`
	Status     string    `json:"status"`
	WaitingFor string    `json:"waiting_for,omitempty"`
	Action     Action    `json:"action"`
	Reason     string    `json:"reason,omitempty"`
	WorkerPID  int       `json:"worker_pid,omitempty"`
	StartedAt  time.Time `json:"started_at"`
	// Handle is a Claude background job id, not a transcript/session-id guess.
	Handle   string `json:"handle,omitempty"`
	Endpoint string `json:"-"`
}

Jump to

Keyboard shortcuts

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