acpshared

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogFile

func CreateLogFile(path string) (*os.File, error)

func IsActivityTimeout

func IsActivityTimeout(err error) bool

func NewActivityTimeoutError

func NewActivityTimeoutError(timeout time.Duration) error

func NotifyJobStart

func NotifyJobStart(
	emitHuman bool,
	job *job,
	ide string,
	model string,
	addDirs []string,
	reasoningEffort string,
	accessMode string,
)

func RecordFailure

func RecordFailure(mu *sync.Mutex, list *[]FailInfo, f FailInfo)

func ResolveTimeoutError

func ResolveTimeoutError(timeout time.Duration, errs ...error) error

func RetryableSetupFailure

func RetryableSetupFailure(err error) bool

func SessionErrorCode

func SessionErrorCode(err error) int

func StartACPActivityWatchdog

func StartACPActivityWatchdog(
	ctx context.Context,
	monitor *activityMonitor,
	timeout time.Duration,
	cancel context.CancelCauseFunc,
) func()

func StreamSessionUpdates

func StreamSessionUpdates(session agent.Session, handler *SessionUpdateHandler) error

func SwapNewAgentClientForTest

func SwapNewAgentClientForTest(
	fn func(context.Context, agent.ClientConfig) (agent.Client, error),
) func()

Types

type ActivityTimeoutError

type ActivityTimeoutError = activityTimeoutError

type FailInfo

type FailInfo = runshared.FailInfo

func RecordFailureWithContext

func RecordFailureWithContext(
	failuresMu *sync.Mutex,
	j *job,
	failures *[]FailInfo,
	err error,
	exitCode int,
) FailInfo

type JobAttemptResult

type JobAttemptResult = runshared.JobAttemptResult

func BuildFailureResult

func BuildFailureResult(err error, exitCode int, j *job, index int, emitHuman bool) JobAttemptResult

func ExecuteJobWithTimeout

func ExecuteJobWithTimeout(
	ctx context.Context,
	cfg *config,
	j *job,
	cwd string,
	useUI bool,
	index int,
	timeout time.Duration,
	runJournal *journal.Journal,
	aggregateUsage *model.Usage,
	aggregateMu *sync.Mutex,
	trackClient func(agent.Client) func(),
) JobAttemptResult

func ExecuteSessionAndResolve

func ExecuteSessionAndResolve(
	ctx context.Context,
	timeout time.Duration,
	execution *SessionExecution,
	j *job,
	index int,
	emitHuman bool,
) JobAttemptResult

func HandleSessionCancellation

func HandleSessionCancellation(
	cancelErr error,
	j *job,
	index int,
	emitHuman bool,
) JobAttemptResult

func HandleSessionTimeout

func HandleSessionTimeout(
	timeoutErr error,
	j *job,
	index int,
	emitHuman bool,
	timeout time.Duration,
) JobAttemptResult

type SessionExecution

type SessionExecution struct {
	Client        agent.Client
	ReleaseClient func()
	Session       agent.Session
	Handler       *SessionUpdateHandler
	OutFile       *os.File
	ErrFile       *os.File
	Logger        *slog.Logger
}

func SetupSessionExecution

func SetupSessionExecution(req SessionSetupRequest) (*SessionExecution, error)

func (*SessionExecution) Close

func (s *SessionExecution) Close()

type SessionSetupRequest

type SessionSetupRequest struct {
	Context           context.Context
	Config            *config
	Job               *job
	CWD               string
	UseUI             bool
	StreamHumanOutput bool
	Index             int
	RunJournal        runtimeEventSubmitter
	AggregateUsage    *model.Usage
	AggregateMu       *sync.Mutex
	Activity          *activityMonitor
	Logger            *slog.Logger
	TrackClient       func(agent.Client) func()
}

type SessionUpdateHandler

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

func (*SessionUpdateHandler) Done

func (h *SessionUpdateHandler) Done() <-chan struct{}

func (*SessionUpdateHandler) Err

func (h *SessionUpdateHandler) Err() error

func (*SessionUpdateHandler) HandleCompletion

func (h *SessionUpdateHandler) HandleCompletion(err error) error

func (*SessionUpdateHandler) HandleUpdate

func (h *SessionUpdateHandler) HandleUpdate(update model.SessionUpdate) error

func (*SessionUpdateHandler) Snapshot

type SessionUpdateHandlerConfig

type SessionUpdateHandlerConfig struct {
	Context        context.Context
	Index          int
	AgentID        string
	JobID          string
	SessionID      string
	Logger         *slog.Logger
	RunID          string
	OutWriter      io.Writer
	ErrWriter      io.Writer
	RunJournal     runtimeEventSubmitter
	RunManager     model.RuntimeManager
	JobUsage       *model.Usage
	AggregateUsage *model.Usage
	AggregateMu    *sync.Mutex
	Activity       *activityMonitor
	ReusableAgent  *reusableAgentExecution
}

type SessionViewSnapshot

type SessionViewSnapshot = transcript.SessionViewSnapshot

Jump to

Keyboard shortcuts

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