Documentation
¶
Overview ¶
Package cli handles command-line argument parsing and event streaming.
Index ¶
- Constants
- func DerivePermBase(sentinelPath string) string
- func GenerateRunID() string
- func NewEventWriter(path string) (*eventWriter, error)
- func OverrideStopReason(stopReason string, cancelled bool, timedOut bool) string
- func ParsePermissionHandler(value string) (*permission.FileHandler, error)
- func Run(args []string) int
- func StartSession(ctx context.Context, provider runtime.Provider, opts runtime.StartOptions, ...) (runtime.Session, error)
- func WaitForSession(ctx context.Context, provider runtime.Provider, cfg SessionWaitConfig, ...) sessionResult
- func WriteSentinel(path string, exitCode int, sessionID, stopReason, runID string, ...)
- func WriteSentinelWithReason(path string, exitCode int, sessionID, stopReason, runID, reason string, ...)
- type EventMetadata
- type EventSink
- type ServerDiscovery
- type SessionWaitConfig
- type SessionWaitDeps
Constants ¶
const (
DefaultBackend = "opencode-acp"
)
const DefaultPermissionClaimTimeout = 0
DefaultPermissionClaimTimeout is the zero value, meaning "no timeout": the resolver waits indefinitely for a connected socket client to answer, falling through to the file-handler (or no-resolver) only when the client disconnects. A non-zero --permission-claim-timeout arms an explicit timer for unattended automation scenarios.
Variables ¶
This section is empty.
Functions ¶
func DerivePermBase ¶ added in v0.8.0
derivePermBase derives the permission handler base path from a sentinel path. Rule: if the path ends in ".done", strip it and append ".perm". Otherwise append ".perm" directly. This mirrors the derive_permission_base function in dispatch-avenor.sh.
func GenerateRunID ¶ added in v0.8.0
func GenerateRunID() string
generateRunID returns a random 16-character hex string (8 bytes of entropy). If crypto/rand is unavailable (e.g. fd exhaustion), it falls back to a time+pid-derived ID prefixed with "auto-" so consumers can distinguish it from the normal random form. The fallback is logged to stderr; the function never panics.
func NewEventWriter ¶ added in v0.8.0
func OverrideStopReason ¶
func ParsePermissionHandler ¶ added in v0.8.0
func ParsePermissionHandler(value string) (*permission.FileHandler, error)
func StartSession ¶ added in v0.8.0
func WaitForSession ¶ added in v0.8.0
func WaitForSession(ctx context.Context, provider runtime.Provider, cfg SessionWaitConfig, deps SessionWaitDeps) sessionResult
func WriteSentinel ¶ added in v0.8.0
func WriteSentinel(path string, exitCode int, sessionID, stopReason, runID string, stderr io.Writer)
WriteSentinel writes the completion sentinel file at path using an atomic tmp+rename strategy. Errors are logged to stderr but never affect the caller's exit code.
func WriteSentinelWithReason ¶ added in v0.9.0
func WriteSentinelWithReason(path string, exitCode int, sessionID, stopReason, runID, reason string, stderr io.Writer)
WriteSentinelWithReason writes the completion sentinel file at path using an atomic tmp+rename strategy, with an optional reason line (used for exit code 5 "blocked" sentinels). Errors are logged to stderr but never affect the caller's exit code.
Types ¶
type EventMetadata ¶ added in v0.20.0
type EventMetadata struct {
// contains filtered or unexported fields
}
func NewEventMetadata ¶ added in v0.20.0
func NewEventMetadata(runID, runLabel, runtimeID string) *EventMetadata
type ServerDiscovery ¶
func DiscoverServer ¶
func DiscoverServer(flagURL string, getenv func(string) string) ServerDiscovery
type SessionWaitConfig ¶ added in v0.9.0
type SessionWaitDeps ¶ added in v0.9.0
type SessionWaitDeps struct {
Writer EventSink
FileHandler *permission.FileHandler
ControlServer *control.ControlServer
Stderr io.Writer
}