Documentation
¶
Index ¶
- func BuildRuntimeCatalog(options RuntimeCatalogOptions) []protocol.RuntimeCapability
- func DeleteSessionTranscript(sessionID, cwd string) error
- func EvaluateSessionConfig(ctx SessionConfigContext, cfg protocol.SessionConfigPayload) sessionConfigDecision
- func ListDirectoryEntries(path, query string, limit int, recursive bool) (string, []protocol.DirEntry, error)
- func ListSlashCommandsForRuntime(runtimeID, currentDir, query string) ([]protocol.SlashCommandEntry, error)
- func ResolveDirectoryWithinUserHome(rawPath, relativeBase string, emptyUsesHome bool) (string, error)
- func Run(cfg *Config) error
- type AttachedCodexBootstrap
- type AttachedCodexController
- func (c *AttachedCodexController) ApplyConfig(cfg protocol.SessionConfigPayload) error
- func (c *AttachedCodexController) Close() error
- func (c *AttachedCodexController) CurrentDir() string
- func (c *AttachedCodexController) CurrentModel() string
- func (c *AttachedCodexController) CurrentPermissionMode() string
- func (c *AttachedCodexController) CurrentSandboxMode() string
- func (c *AttachedCodexController) Done() <-chan struct{}
- func (c *AttachedCodexController) Err() error
- func (c *AttachedCodexController) ForwardProxyClientMessage(messageType int, data []byte, reply func([]byte) error) error
- func (c *AttachedCodexController) Interrupt() error
- func (c *AttachedCodexController) RecordForwardedInput(content string)
- func (c *AttachedCodexController) ResolvePermissionResponse(resp protocol.PermissionResponsePayload) bool
- func (c *AttachedCodexController) RuntimeSessionID() string
- func (c *AttachedCodexController) SendInput(content string) error
- func (c *AttachedCodexController) SetProxyForwarder(forward func([]byte) error)
- func (c *AttachedCodexController) Start() (AttachedCodexBootstrap, error)
- func (c *AttachedCodexController) StartPassive() error
- func (c *AttachedCodexController) SyncInitialSnapshot()
- type AttachedCodexControllerConfig
- type AttachedCodexRolloutMirror
- type AttachedCodexRolloutMirrorHandlers
- type AttachedHandlers
- type AttachedSessionStateUpdate
- type AttachedTranscriptMirror
- type AttachedTranscriptMirrorHandlers
- type AttachedTranscriptToolUse
- type ClaudeSessionResolution
- type CodexLocalSession
- type CodexSessionResolution
- type Config
- type DisplayParser
- type RuntimeCatalogOptions
- type Service
- func (s *Service) AddMessageObserver(observer func(protocol.Message) error) func()
- func (s *Service) ApplySessionConfig(cfg protocol.SessionConfigPayload) error
- func (s *Service) AutoReconnectEnabled() bool
- func (s *Service) CancelReconnects()
- func (s *Service) ClearAttachedPermissionRequest(requestID string)
- func (s *Service) CodexAppServerURL() string
- func (s *Service) CommandPath() string
- func (s *Service) CurrentDir() string
- func (s *Service) CurrentModel() string
- func (s *Service) CurrentPermissionMode() string
- func (s *Service) CurrentSandboxMode() string
- func (s *Service) DeleteSession(sessionID string) error
- func (s *Service) EmitAttachedPermissionRequest(requestID, tool string, input map[string]any) error
- func (s *Service) EmitStructuredTextLine(line string) error
- func (s *Service) EmitTerminalText(content string) error
- func (s *Service) FinishAttachedTurn(status string) error
- func (s *Service) FinishAttachedTurnFromResult(event map[string]any) error
- func (s *Service) ForgetSession(sessionID string) bool
- func (s *Service) HasActiveTurn() bool
- func (s *Service) HasAttachedPermissionRequest() bool
- func (s *Service) Interrupt() error
- func (s *Service) IsManagementRunning() bool
- func (s *Service) IsRunning() bool
- func (s *Service) LocalMode() bool
- func (s *Service) LocalSessionIDs() []string
- func (s *Service) MarkAttachedInterruptRequested()
- func (s *Service) PauseSession(sessionID string) error
- func (s *Service) ResetAttachedSessionState()
- func (s *Service) RespondPermission(resp protocol.PermissionResponsePayload) error
- func (s *Service) RuntimeID() string
- func (s *Service) RuntimeSessionID() string
- func (s *Service) SendCurrentKeepalive() error
- func (s *Service) SendInput(content string) error
- func (s *Service) SessionID() string
- func (s *Service) SetAttachedPermissionResponseHandler(handler func(protocol.PermissionResponsePayload) bool)
- func (s *Service) SetAutoReconnectEnabled(enabled bool)
- func (s *Service) SetChildStartedHook(hook func(*Service, Config))
- func (s *Service) ShouldAutoApproveTool(toolName string, input map[string]any) bool
- func (s *Service) Start(cfg *Config) (string, error)
- func (s *Service) StartAttached(cfg *Config, handlers AttachedHandlers) (string, error)
- func (s *Service) StartAttachedTurn() error
- func (s *Service) StartLocal(cfg *Config, sink func(protocol.Message) error) (string, error)
- func (s *Service) StartManagement(cfg *Config) (string, error)
- func (s *Service) StartProxy(cfg *Config) (string, error)
- func (s *Service) Stop() error
- func (s *Service) StopWithReason(reason string) error
- func (s *Service) UpdateAttachedSessionState(update AttachedSessionStateUpdate)
- func (s *Service) UpdateRuntimeSelection(claudeEnabled, codexEnabled bool, claudeCommand, codexCommand string, ...)
- type SessionConfigContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRuntimeCatalog ¶
func BuildRuntimeCatalog(options RuntimeCatalogOptions) []protocol.RuntimeCapability
func DeleteSessionTranscript ¶
DeleteSessionTranscript 删除本地 Claude transcript 文件。
func EvaluateSessionConfig ¶
func EvaluateSessionConfig(ctx SessionConfigContext, cfg protocol.SessionConfigPayload) sessionConfigDecision
func ListDirectoryEntries ¶
func ListSlashCommandsForRuntime ¶
func ListSlashCommandsForRuntime(runtimeID, currentDir, query string) ([]protocol.SlashCommandEntry, error)
Types ¶
type AttachedCodexBootstrap ¶
type AttachedCodexController ¶
type AttachedCodexController struct {
// contains filtered or unexported fields
}
func NewAttachedCodexController ¶
func NewAttachedCodexController(service *Service, wsURL string, cfg AttachedCodexControllerConfig) *AttachedCodexController
func (*AttachedCodexController) ApplyConfig ¶
func (c *AttachedCodexController) ApplyConfig(cfg protocol.SessionConfigPayload) error
func (*AttachedCodexController) Close ¶
func (c *AttachedCodexController) Close() error
func (*AttachedCodexController) CurrentDir ¶
func (c *AttachedCodexController) CurrentDir() string
func (*AttachedCodexController) CurrentModel ¶
func (c *AttachedCodexController) CurrentModel() string
func (*AttachedCodexController) CurrentPermissionMode ¶
func (c *AttachedCodexController) CurrentPermissionMode() string
func (*AttachedCodexController) CurrentSandboxMode ¶
func (c *AttachedCodexController) CurrentSandboxMode() string
func (*AttachedCodexController) Done ¶
func (c *AttachedCodexController) Done() <-chan struct{}
func (*AttachedCodexController) Err ¶
func (c *AttachedCodexController) Err() error
func (*AttachedCodexController) ForwardProxyClientMessage ¶
func (*AttachedCodexController) Interrupt ¶
func (c *AttachedCodexController) Interrupt() error
func (*AttachedCodexController) RecordForwardedInput ¶
func (c *AttachedCodexController) RecordForwardedInput(content string)
func (*AttachedCodexController) ResolvePermissionResponse ¶
func (c *AttachedCodexController) ResolvePermissionResponse(resp protocol.PermissionResponsePayload) bool
func (*AttachedCodexController) RuntimeSessionID ¶
func (c *AttachedCodexController) RuntimeSessionID() string
func (*AttachedCodexController) SendInput ¶
func (c *AttachedCodexController) SendInput(content string) error
func (*AttachedCodexController) SetProxyForwarder ¶
func (c *AttachedCodexController) SetProxyForwarder(forward func([]byte) error)
func (*AttachedCodexController) Start ¶
func (c *AttachedCodexController) Start() (AttachedCodexBootstrap, error)
func (*AttachedCodexController) StartPassive ¶
func (c *AttachedCodexController) StartPassive() error
func (*AttachedCodexController) SyncInitialSnapshot ¶
func (c *AttachedCodexController) SyncInitialSnapshot()
type AttachedCodexRolloutMirror ¶
type AttachedCodexRolloutMirror struct {
// contains filtered or unexported fields
}
func NewAttachedCodexRolloutMirror ¶
func NewAttachedCodexRolloutMirror(cwd string) *AttachedCodexRolloutMirror
func (*AttachedCodexRolloutMirror) BeginTurn ¶
func (m *AttachedCodexRolloutMirror) BeginTurn() error
func (*AttachedCodexRolloutMirror) Poll ¶
func (m *AttachedCodexRolloutMirror) Poll(handlers AttachedCodexRolloutMirrorHandlers) error
type AttachedHandlers ¶
type AttachedTranscriptMirror ¶
type AttachedTranscriptMirror struct {
// contains filtered or unexported fields
}
func NewAttachedTranscriptMirror ¶
func NewAttachedTranscriptMirror(sessionID, cwd string) *AttachedTranscriptMirror
func (*AttachedTranscriptMirror) Poll ¶
func (m *AttachedTranscriptMirror) Poll(handlers AttachedTranscriptMirrorHandlers) error
type ClaudeSessionResolution ¶
type ClaudeSessionResolution struct {
SessionID string
Resume bool
TranscriptPath string
AdoptedRecentSession bool
ReplacedRequestedSession bool
}
func ResolveClaudeSessionStart ¶
func ResolveClaudeSessionStart(requestedSessionID, cwd string, resume bool) (ClaudeSessionResolution, error)
type CodexLocalSession ¶
type CodexLocalSession struct {
RuntimeSessionID string
Cwd string
Path string
ModelProvider string
CLIVersion string
Source string
Originator string
SessionTime time.Time
ModTime time.Time
LineCount int
}
func ListCodexLocalSessions ¶
func ListCodexLocalSessions(cwd string, includeAll bool) ([]CodexLocalSession, error)
type CodexSessionResolution ¶
type CodexSessionResolution struct {
RuntimeSessionID string
Resume bool
RolloutPath string
AdoptedRecentSession bool
ReplacedRequestedSession bool
}
func ResolveCodexSessionStart ¶
func ResolveCodexSessionStart(requestedRuntimeSessionID, cwd string, resume bool) (CodexSessionResolution, error)
type Config ¶
type Config struct {
ServerURL string // WS 服务器地址,如 wss://example.com
Token string // JWT token
Command string // 要启动的命令,默认 "claude"
ClaudeCommand string
CodexCommand string
Args []string
WorkingDir string
Model string
PermissionMode string
SandboxMode string
HostID string
SessionID string
RuntimeSessionID string
Resume bool
Management bool
ClaudeEnabled bool
CodexEnabled bool
RuntimeCatalog []protocol.RuntimeCapability
}
Config remote 模式配置
type DisplayParser ¶
type DisplayParser struct {
// contains filtered or unexported fields
}
DisplayParser 将 runtime 流式输出转换为适合 GUI 展示的消息。 Codex 的实时通知已经在 bridge 中被转换为 Claude 风格事件,因此统一复用 Claude 解析器。
func NewDisplayParser ¶
func NewDisplayParser() *DisplayParser
func (*DisplayParser) ParseTextPayload ¶
func (p *DisplayParser) ParseTextPayload(payload protocol.TextPayload) []protocol.SessionHistoryMessage
type RuntimeCatalogOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 管理 remote 代理的生命周期
func (*Service) AddMessageObserver ¶
func (*Service) ApplySessionConfig ¶
func (s *Service) ApplySessionConfig(cfg protocol.SessionConfigPayload) error
func (*Service) AutoReconnectEnabled ¶
func (*Service) CancelReconnects ¶
func (s *Service) CancelReconnects()
func (*Service) ClearAttachedPermissionRequest ¶
func (*Service) CodexAppServerURL ¶
func (*Service) CommandPath ¶
func (*Service) CurrentModel ¶
func (*Service) CurrentPermissionMode ¶
func (*Service) CurrentSandboxMode ¶
func (*Service) DeleteSession ¶
DeleteSession 删除当前管理端名下的子会话,并清理本地 transcript。
func (*Service) EmitAttachedPermissionRequest ¶
func (*Service) EmitStructuredTextLine ¶
func (*Service) EmitTerminalText ¶
func (*Service) FinishAttachedTurn ¶
func (*Service) FinishAttachedTurnFromResult ¶
func (*Service) ForgetSession ¶
func (*Service) HasActiveTurn ¶
func (*Service) HasAttachedPermissionRequest ¶
func (*Service) IsManagementRunning ¶
IsManagementRunning 返回远程管理会话是否在线
func (*Service) LocalSessionIDs ¶
LocalSessionIDs 返回当前进程启动的所有代理会话 ID
func (*Service) MarkAttachedInterruptRequested ¶
func (s *Service) MarkAttachedInterruptRequested()
func (*Service) PauseSession ¶
PauseSession 暂停当前管理端名下的子会话。
func (*Service) ResetAttachedSessionState ¶
func (s *Service) ResetAttachedSessionState()
func (*Service) RespondPermission ¶
func (s *Service) RespondPermission(resp protocol.PermissionResponsePayload) error
func (*Service) RuntimeSessionID ¶
func (*Service) SendCurrentKeepalive ¶
func (*Service) SetAttachedPermissionResponseHandler ¶
func (s *Service) SetAttachedPermissionResponseHandler(handler func(protocol.PermissionResponsePayload) bool)
func (*Service) SetAutoReconnectEnabled ¶
func (*Service) SetChildStartedHook ¶
func (*Service) ShouldAutoApproveTool ¶
func (*Service) StartAttached ¶
func (s *Service) StartAttached(cfg *Config, handlers AttachedHandlers) (string, error)
func (*Service) StartAttachedTurn ¶
func (*Service) StartLocal ¶
StartLocal 启动仅本地使用的 CLI 代理会话,不连接远程 websocket。
func (*Service) StartManagement ¶
StartManagement 启动远程管理会话
func (*Service) StartProxy ¶
StartProxy 启动代理会话;若当前服务已作为管理会话在线,则拉起子代理
func (*Service) StopWithReason ¶
StopWithReason 优雅关闭,并记录触发原因
func (*Service) UpdateAttachedSessionState ¶
func (s *Service) UpdateAttachedSessionState(update AttachedSessionStateUpdate)
func (*Service) UpdateRuntimeSelection ¶
func (s *Service) UpdateRuntimeSelection(claudeEnabled, codexEnabled bool, claudeCommand, codexCommand string, runtimeCatalog []protocol.RuntimeCapability)
Source Files
¶
- attached_events.go
- attached_mode.go
- attached_transcript_mirror.go
- auto_reconnect.go
- bridge.go
- child_sessions.go
- codex_attached_controller.go
- codex_history_sync.go
- codex_native_commands.go
- codex_rollout_mirror.go
- codex_runtime.go
- codex_session_resolution.go
- codex_ws_transport.go
- completions.go
- custom_commands.go
- display_parser.go
- e2ee.go
- exec_other.go
- git_resources.go
- local_commands.go
- local_mode.go
- observers.go
- path_sandbox.go
- permission.go
- process.go
- remote.go
- resources.go
- runner.go
- runtime.go
- runtime_capabilities.go
- session_actions.go
- session_config.go
- session_state.go
- stream_history_sync.go
- transcript_normalizer.go
- transcript_sync.go
- transport.go
Click to show internal directories.
Click to hide internal directories.