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

claudesessions

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 49 Imported by: 0

Documentation

Overview

Package claudesessions adapts native Claude Agent SDK sessions to Orb events. Its host runs the official SDK and an unmodified Claude executable; Orb never reads, copies, refreshes or proxies Claude credentials.

Index

Constants

View Source
const Name = "claude-sessions"
View Source
const SDKVersion = "0.3.280"

Variables

View Source
var ErrNoClaudeCodeSession = errors.New("no Claude Code session")

ErrNoClaudeCodeSession reports an ID that names no Claude Code session.

Functions

func AmbientAccount added in v0.12.0

func AmbientAccount(ctx context.Context, settings *config.SettingsManager, env []string) (string, bool)

AmbientAccount is the user's own Claude Code login as an account row, or false when it is signed out.

func Configure

func Configure(cfg *agent.SessionRuntimeConfig, agentDir string, env []string) (bind func(*agent.SessionRuntime), err error)

Configure lets Claude run the turns of Claude models in the runtime every other model shares: its loop takes those turns, Orb's own loop the rest, and one conversation moves between them. bind must run before the runtime is exposed.

func Factory

Factory rebuilds the plugin attachment for every SDK session replacement. The caller supplies storage in AgentSessionOptions and owns runtime disposal.

func ForgetAccount added in v0.12.0

func ForgetAccount(settings *config.SettingsManager, agentDir string, env []string, credential *aiauth.Credential)

ForgetAccount signs a removed or replaced Claude account out and deletes its directory.

func ImportClaudeCode added in v0.12.0

func ImportClaudeCode(id string, env []string, create func(cwd string) (*session.SessionManager, error)) (*session.SessionManager, error)

ImportClaudeCode opens a Claude Code session in a new Orb conversation: its messages to read and continue with any model, and its records for Claude to resume from. create makes the conversation in the session's directory, under the session's own ID so opening it again finds the Orb conversation.

func Limits added in v0.19.1

Limits is the latest native subscription reading as plan windows, those already reset left out; nil before the first reading.

func LimitsStatus added in v0.10.0

func LimitsStatus(manager extensions.ReadonlySessionManager, now time.Time) string

LimitsStatus formats the latest native subscription reading for local or remote UI.

func Management

func Management(settings *config.SettingsManager, agentDir string, env []string) extensions.Factory

Management exposes the dormant capability through a native command and palette entry. Installing dependencies and starting sessions are explicit user actions.

func Model

func Model(provider, model *string, settings *config.SettingsManager) *ai.Model

Model selects this capability only for an explicit or restored Claude session.

func Usage added in v0.12.0

func Usage(ctx context.Context, settings *config.SettingsManager, agentDir string, env []string, credential *aiauth.Credential) (usage.Snapshot, error)

Usage reads an account's plan limits as Claude's /usage shows them; a nil credential reads the user's own Claude Code login.

Types

type Driver

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

func New

func New(options Options) (*Driver, error)

func (*Driver) Close added in v0.10.0

func (d *Driver) Close()

Close ends the live native session, if any.

func (*Driver) Loop

func (d *Driver) Loop(ctx context.Context, prompts engine.AgentMessages, agentContext engine.AgentContext, config engine.AgentLoopConfig, emit engine.EventSink) error

Loop owns the complete native turn. Orb queues are drained only between native turns, so no tool is executed twice by an outer Orb agent loop.

type Options

type Options struct {
	Sandbox sandbox.Mode
	// RenderText optionally supplies text components for SDK-hosted tool calls.
	RenderText        func(string) extensions.Component
	Node, SDK, Claude string
	Env               []string
	Manager           *session.SessionManager
	// Headless approves native asks that no UI can answer, as Orb runs its own tools.
	Headless bool
	// Unasked: Orb's permissions plugin is off, so Orb runs its tools without asking, and Claude's
	// run the same way instead of falling back to Claude Code's own prompts.
	Unasked bool
	// Context is Orb's instructions that Claude does not load itself.
	Context string
	Ask     func(context.Context, string, []string) (string, error)
	// Account resolves the selected Claude account's directory through Orb's
	// auth pipeline; empty runs with the user's own Claude Code login.
	Account func(context.Context) string
	// Activity observes native tasks independently of tool-call and turn completion.
	Activity func(work.Record)
}

Jump to

Keyboard shortcuts

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