Documentation
¶
Index ¶
- type ArtifactSummary
- type AssistantProvider
- type AssistantRequest
- type AssistantResponse
- type CheckpointID
- type DebugStep
- type DebugTrace
- type ErrorKind
- type EventKind
- type ExecutionEvent
- type ExecutionID
- type ExecutionMetrics
- type ExecutionRequest
- type ExecutionResult
- type RuntimeInspector
- type Session
- func (s *Session) Ask(kind, prompt string) (AssistantResponse, error)
- func (s *Session) Cancel() error
- func (s *Session) Checkpoint(name string) (SessionSnapshot, error)
- func (s *Session) Close()
- func (s *Session) Debug(src string, path string) DebugTrace
- func (s *Session) Environment() *object.Environment
- func (s *Session) Events() []ExecutionEvent
- func (s *Session) Execute(req ExecutionRequest) ExecutionResult
- func (s *Session) ID() SessionID
- func (s *Session) Inspect() SessionInspect
- func (s *Session) Replay() ([]ExecutionResult, error)
- func (s *Session) Restore(name string) error
- func (s *Session) SetOutput(output io.Writer)
- type SessionID
- type SessionInspect
- type SessionOptions
- type SessionSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactSummary ¶
type ArtifactSummary struct {
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
MIME string `json:"mime,omitempty"`
Source string `json:"source,omitempty"`
SourceTyp string `json:"source_type,omitempty"`
Width int64 `json:"width,omitempty"`
Height int64 `json:"height,omitempty"`
}
type AssistantProvider ¶
type AssistantProvider interface {
Assist(AssistantRequest) (AssistantResponse, error)
}
type AssistantRequest ¶
type AssistantRequest struct {
Kind string
Prompt string
Context SessionInspect
}
type AssistantResponse ¶
type AssistantResponse struct {
Text string
}
type CheckpointID ¶
type CheckpointID string
type DebugTrace ¶
type DebugTrace struct {
SessionID SessionID `json:"session_id"`
ExecutionID ExecutionID `json:"execution_id"`
OK bool `json:"ok"`
Steps []DebugStep `json:"steps"`
Error string `json:"error,omitempty"`
}
type ErrorKind ¶
type ErrorKind string
ErrorKind classifies execution errors reported via ExecutionMetrics. Its values intentionally match the string values of the root package's ExecErrorKind (interpreter.go) so hosts comparing across both APIs see consistent classifications; pkg/session cannot import the root package (which imports pkg/session), so the values are duplicated here rather than shared via a type alias.
type EventKind ¶
type EventKind string
const ( EventExecutionStart EventKind = "execution.start" EventExecutionFinish EventKind = "execution.finish" EventOutput EventKind = "output" EventDiagnostic EventKind = "diagnostic" EventMetric EventKind = "metric" EventTrace EventKind = "trace" EventRenderArtifact EventKind = "render_artifact" EventError EventKind = "error" EventDebug EventKind = "debug" EventCheckpoint EventKind = "checkpoint" EventRestore EventKind = "restore" EventReplay EventKind = "replay" )
type ExecutionEvent ¶
type ExecutionID ¶
type ExecutionID string
type ExecutionMetrics ¶
type ExecutionRequest ¶
type ExecutionResult ¶
type ExecutionResult struct {
ID ExecutionID `json:"id"`
SessionID SessionID `json:"session_id"`
Source string `json:"source,omitempty"`
Path string `json:"path,omitempty"`
OK bool `json:"ok"`
Result object.Object `json:"-"`
ResultText string `json:"result,omitempty"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
Artifacts []ArtifactSummary `json:"artifacts,omitempty"`
Metrics ExecutionMetrics `json:"metrics"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
}
type RuntimeInspector ¶
type RuntimeInspector interface {
Inspect() SessionInspect
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts SessionOptions) (*Session, error)
func NewWithEnvironment ¶
func NewWithEnvironment(env *object.Environment, opts SessionOptions) (*Session, error)
func (*Session) Cancel ¶
Cancel cancels the currently-running (or next-to-start) Execute call on this session by invoking the cancel function of the context it derives its deadline/cancellation from. If no execution is currently in flight, Cancel is a safe no-op. Cancel does not stop any execution already completed, and it only affects a single in-flight (or immediately upcoming, in a narrow race window) Execute call — it is not a queue/registry of executions.
func (*Session) Checkpoint ¶
func (s *Session) Checkpoint(name string) (SessionSnapshot, error)
func (*Session) Environment ¶
func (s *Session) Environment() *object.Environment
func (*Session) Events ¶
func (s *Session) Events() []ExecutionEvent
func (*Session) Execute ¶
func (s *Session) Execute(req ExecutionRequest) ExecutionResult
func (*Session) Inspect ¶
func (s *Session) Inspect() SessionInspect
func (*Session) Replay ¶
func (s *Session) Replay() ([]ExecutionResult, error)
type SessionInspect ¶
type SessionInspect struct {
ID SessionID `json:"id"`
Profile string `json:"profile"`
ModuleDir string `json:"module_dir,omitempty"`
SourcePath string `json:"source_path,omitempty"`
Variables map[string]string `json:"variables"`
History []ExecutionResult `json:"history"`
Checkpoints []SessionSnapshot `json:"checkpoints"`
Events []ExecutionEvent `json:"events"`
RuntimeLimits map[string]any `json:"runtime_limits,omitempty"`
RenderArtifact int `json:"render_artifacts,omitempty"`
}
type SessionOptions ¶
type SessionOptions struct {
ID SessionID
Profile string
Args []string
ModuleDir string
SourcePath string
Output io.Writer
Security *object.SecurityPolicy
Sandbox *sandbox.SandboxConfig
MaxDepth int
MaxSteps int64
MaxHeapMB int64
MaxOutputBytes int64
Timeout time.Duration
Persist bool
PersistenceDir string
Assistant AssistantProvider
EventLimit int
}