Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyWorkspaceToolApprovalModes(config settings.ToolApprovalConfig, modes WorkspaceTargetToolApproval) (settings.ToolApprovalConfig, error)
- func BotIDFromContainerID(containerID string) (string, bool)
- func BotIDFromContainerInfo(info ctr.ContainerInfo) (string, bool)
- func BridgeTLSOptionsFromConfig(cfg config.Config) (*bridge.TLSOptions, error)
- func DefaultRemoteToolApprovalConfig() settings.ToolApprovalConfig
- func SkillDiscoveryRootsFromMetadata(metadata map[string]any) []string
- func WithWorkspaceTarget(ctx context.Context, targetID string) context.Context
- func WorkspaceTargetFromContext(ctx context.Context) string
- type BotSnapshotData
- type BridgeTLSRuntimeOptions
- type ContainerMetricsResult
- type ContainerMetricsStatus
- type ContainerSetupEvent
- type ContainerSetupProgress
- type ContainerStatus
- type ContainerStorageMetrics
- type ImagePrepareMode
- type ImagePrepareResult
- type ManagedSnapshotMeta
- type Manager
- func (m *Manager) BotDisplayEnabled(ctx context.Context, botID string) bool
- func (m *Manager) CleanupBotContainer(ctx context.Context, botID string, preserveData bool) error
- func (m *Manager) ClearLegacyIP(botID string)
- func (m *Manager) ClearWorkspaceGPUPreference(ctx context.Context, botID string) error
- func (m *Manager) ClearWorkspaceImagePreference(ctx context.Context, botID string) error
- func (m *Manager) ContainerID(ctx context.Context, botID string) (string, error)
- func (m *Manager) CountData(ctx context.Context, botID string) (int, error)
- func (m *Manager) CreateSnapshot(ctx context.Context, botID, snapshotName, source string) (*SnapshotCreateInfo, error)
- func (m *Manager) CreateVersion(ctx context.Context, botID string) (*VersionInfo, error)
- func (m *Manager) CurrentWorkspaceTargetID(ctx context.Context, botID string) (string, error)
- func (m *Manager) Delete(ctx context.Context, botID string, preserveData bool) error
- func (m *Manager) DisplayDialContext(ctx context.Context, botID, network, address string) (net.Conn, error)
- func (m *Manager) DisplaySocketPath(botID string) string
- func (m *Manager) EnsureBot(ctx context.Context, botID, imageOverride string) error
- func (m *Manager) EnsureNativeRunning(ctx context.Context, botID string) error
- func (m *Manager) EnsureRunning(ctx context.Context, botID string) error
- func (m *Manager) ExportData(ctx context.Context, botID string) (io.ReadCloser, error)
- func (m *Manager) GetContainerInfo(ctx context.Context, botID string) (*ContainerStatus, error)
- func (m *Manager) GetContainerMetrics(ctx context.Context, botID string) (*ContainerMetricsResult, error)
- func (m *Manager) GetResourceLimits(ctx context.Context, botID string) (*ResourceLimitsResult, error)
- func (m *Manager) HasPreservedData(botID string) bool
- func (m *Manager) ImportData(ctx context.Context, botID string, r io.Reader) error
- func (m *Manager) Init(ctx context.Context) error
- func (m *Manager) InitializeNativeWorkspace(ctx context.Context, botID string) error
- func (*Manager) IsLegacyContainer(_ context.Context, containerID string) bool
- func (m *Manager) ListBotSnapshotData(ctx context.Context, botID string) (*BotSnapshotData, error)
- func (m *Manager) ListBots(ctx context.Context) ([]string, error)
- func (m *Manager) ListVersions(ctx context.Context, botID string) ([]VersionInfo, error)
- func (m *Manager) ListWorkspaceTargets(ctx context.Context, botID string) ([]WorkspaceTarget, error)
- func (m *Manager) MCPClient(ctx context.Context, botID string) (*bridge.Client, error)
- func (m *Manager) NativeMCPClient(ctx context.Context, botID string) (*bridge.Client, error)
- func (m *Manager) OnBridgeReset(fn func(botID string))
- func (m *Manager) PrepareImageForCreate(ctx context.Context, image string, opts *ctr.PullImageOptions) (ImagePrepareResult, error)
- func (m *Manager) PreserveData(ctx context.Context, botID string) error
- func (m *Manager) ReconcileContainers(ctx context.Context)
- func (m *Manager) RecordContainerRunning(ctx context.Context, botID, containerID, image string)
- func (m *Manager) RememberWorkspaceGPU(ctx context.Context, botID string, gpu WorkspaceGPUConfig) error
- func (m *Manager) RememberWorkspaceImage(ctx context.Context, botID, image string) error
- func (m *Manager) ResolveWorkspaceGPU(ctx context.Context, botID string) (WorkspaceGPUConfig, error)
- func (m *Manager) ResolveWorkspaceImage(ctx context.Context, botID string) (string, error)
- func (m *Manager) ResolveWorkspaceSkillDiscoveryRoots(ctx context.Context, botID string) ([]string, error)
- func (m *Manager) ResolveWorkspaceTarget(ctx context.Context, botID, targetID string) (ResolvedWorkspaceTarget, error)
- func (m *Manager) RestorePreservedData(ctx context.Context, botID string) error
- func (m *Manager) RollbackVersion(ctx context.Context, botID string, version int) error
- func (m *Manager) SetBridgeTLS(opts *BridgeTLSRuntimeOptions)
- func (m *Manager) SetHookService(h *hooks.Service)
- func (m *Manager) SetLegacyIP(botID, ip string)
- func (m *Manager) SetRemoteWorkspaceService(service *RemoteWorkspaceService)
- func (m *Manager) SetResourceLimits(ctx context.Context, botID string, limits container.ResourceLimits) (*ResourceLimitsResult, error)
- func (m *Manager) SetSetupDiagnostics(diagnostics WorkspaceSetupDiagnostics)
- func (m *Manager) SetupBotContainer(ctx context.Context, botID string) error
- func (m *Manager) SetupBotContainerWithProgress(ctx context.Context, botID string, progress ContainerSetupProgress) error
- func (m *Manager) Start(ctx context.Context, botID string) error
- func (m *Manager) StartWithImage(ctx context.Context, botID, imageOverride string) error
- func (m *Manager) StartWithResolvedConfig(ctx context.Context, botID, image string, gpu WorkspaceGPUConfig) error
- func (m *Manager) StartWithResolvedImage(ctx context.Context, botID, image string) error
- func (m *Manager) Stop(ctx context.Context, botID string, timeout time.Duration) error
- func (m *Manager) StopBot(ctx context.Context, botID string) error
- func (m *Manager) VersionSnapshotName(ctx context.Context, botID string, version int) (string, error)
- func (m *Manager) WaitForWorkspaceReady(ctx context.Context, botID string) error
- func (m *Manager) WorkspaceInfo(ctx context.Context, botID string) (bridge.WorkspaceInfo, error)
- type RemoteWorkspaceService
- func (s *RemoteWorkspaceService) DeleteMount(ctx context.Context, botID, targetID string) error
- func (s *RemoteWorkspaceService) EnsurePrimaryReady(ctx context.Context, botID string) (bool, error)
- func (s *RemoteWorkspaceService) GetMount(ctx context.Context, botID, targetID string) (WorkspaceTarget, error)
- func (s *RemoteWorkspaceService) GetPrimaryMount(ctx context.Context, botID string) (WorkspaceTarget, error)
- func (s *RemoteWorkspaceService) ListAccountGrants(ctx context.Context, ownerUserID string) ([]WorkspaceTargetGrant, error)
- func (s *RemoteWorkspaceService) ListMounts(ctx context.Context, botID string) ([]WorkspaceTarget, error)
- func (s *RemoteWorkspaceService) Mount(ctx context.Context, botID, runtimeID string) (WorkspaceTarget, error)
- func (s *RemoteWorkspaceService) ResolveMount(ctx context.Context, botID, targetID string) (ResolvedWorkspaceTarget, error)
- func (s *RemoteWorkspaceService) ResolvePrimary(ctx context.Context, botID string) (ResolvedWorkspaceTarget, bool, error)
- func (s *RemoteWorkspaceService) SetPrimary(ctx context.Context, botID, targetID string) error
- func (s *RemoteWorkspaceService) UpdateToolApproval(ctx context.Context, botID, targetID string, modes WorkspaceTargetToolApproval) error
- func (s *RemoteWorkspaceService) UpdateToolApprovalConfig(ctx context.Context, botID, targetID string, ...) error
- type ResolvedWorkspaceTarget
- type ResourceLimitCapabilities
- type ResourceLimitCapability
- type ResourceLimitObserved
- type ResourceLimitsResult
- type SetPrimaryWorkspaceTargetRequest
- type SnapshotCreateInfo
- type TemplateBootstrapper
- type UpdateWorkspaceTargetToolApprovalRequest
- type VersionInfo
- type WorkspaceFileInfo
- type WorkspaceFileSystem
- type WorkspaceGPUConfig
- type WorkspaceSetupDiagnostics
- type WorkspaceTarget
- type WorkspaceTargetGrant
- type WorkspaceTargetGrantsResponse
- type WorkspaceTargetToolApproval
- type WorkspaceTargetsResponse
Constants ¶
const ( BotLabelKey = "memoh.bot_id" WorkspaceLabelKey = "memoh.workspace" WorkspaceLabelValue = "v3" WorkspaceCDIDevicesLabelKey = "memoh.workspace.cdi_devices" ContainerPrefix = "workspace-" LegacyContainerPrefix = "mcp-" DisplayRFBSocketName = "display.rfb.sock" ToolsProxyHTTPURL = bridge.ToolsProxyHTTPURL // WorkspaceInitPath and WorkspaceBridgePath are the container start // parameters used by buildWorkspaceContainerSpec: the image's init and the // mount point of the Server-supplied bridge binary. A container missing // either never starts, so WaitForWorkspaceReady surfaces that on its own. WorkspaceInitPath = "/usr/bin/tini" WorkspaceBridgePath = "/opt/memoh/bridge" )
const ( WorkspaceTargetNative = "native" WorkspaceTargetRemote = "remote" WorkspaceTargetStatusOnline = "online" WorkspaceTargetStatusOffline = "offline" WorkspaceTargetStatusRevoked = "revoked" WorkspaceTargetStatusOwnerMismatch = "owner_mismatch" WorkspaceTargetStatusClientUpdateRequired = "client_update_required" )
const ( WorkspaceResourceCPUMillicoresLabelKey = "memoh.workspace.resource.cpu_millicores" WorkspaceResourceMemoryBytesLabelKey = "memoh.workspace.resource.memory_bytes" ResourceLimitStatusApplied = "applied" ResourceLimitStatusNotCreated = "not_created" ResourceLimitStatusPendingRecreate = "pending_recreate" ResourceLimitStatusUnsupported = "unsupported" )
const ( SnapshotSourceManual = "manual" SnapshotSourcePreExec = "pre_exec" SnapshotSourceRollback = "rollback" )
Variables ¶
var ( ErrWorkspaceTargetNotFound = errors.New("workspace target not found") ErrRemoteWorkspaceNotBound = errors.New("remote workspace is not bound") ErrRemoteRuntimeNotUsable = errors.New("remote runtime not found, revoked, or owned by another user") ErrRemoteRuntimeOffline = errors.New("remote runtime is offline") ErrRemoteRuntimeRevoked = errors.New("remote runtime has been revoked") ErrRemoteRuntimeOwnerMismatch = errors.New("remote runtime no longer belongs to the bot owner") ErrRemoteRuntimeClientUpdateNeeded = errors.New("remote runtime client must be updated") ErrInvalidWorkspaceToolApprovalMode = errors.New("invalid workspace tool approval mode") )
var ErrContainerNotFound = errors.New("workspace not found for bot")
ErrContainerNotFound is returned when no container exists for a bot.
var ErrWorkspaceTemplateBootstrapFailed = errors.New("workspace template bootstrap failed")
ErrWorkspaceTemplateBootstrapFailed identifies a workspace that started but could not receive the built-in workspace files. The wrapped cause is private diagnostic data and must be translated at the transport boundary.
Functions ¶
func ApplyWorkspaceToolApprovalModes ¶
func ApplyWorkspaceToolApprovalModes(config settings.ToolApprovalConfig, modes WorkspaceTargetToolApproval) (settings.ToolApprovalConfig, error)
func BotIDFromContainerID ¶
BotIDFromContainerID infers a bot ID from a known container naming scheme. This is only used as a fallback for legacy containers when labels are missing.
func BotIDFromContainerInfo ¶
func BotIDFromContainerInfo(info ctr.ContainerInfo) (string, bool)
BotIDFromContainerInfo resolves the bot ID from container metadata. It prefers the current label and only falls back to name inference.
func BridgeTLSOptionsFromConfig ¶
func BridgeTLSOptionsFromConfig(cfg config.Config) (*bridge.TLSOptions, error)
BridgeTLSOptionsFromConfig 把 server 配置翻译成 bridge dial 的 mTLS options。 disabled → (nil, nil)。strict 但材料/instance-id 不全 → error:strict 不允许 静默回退明文,配置残缺必须在启动期暴露。
func DefaultRemoteToolApprovalConfig ¶
func DefaultRemoteToolApprovalConfig() settings.ToolApprovalConfig
The remote default is allow-everything: mounting a computer is already the explicit trust decision, so per-call asks would just be friction. Bypass and force-review lists stay empty — nothing is inherited from native.
func WithWorkspaceTarget ¶
WithWorkspaceTarget returns a child context whose workspace operations default to targetID. The override is request-scoped; it never mutates the Bot's persisted Primary target or Manager state.
func WorkspaceTargetFromContext ¶
WorkspaceTargetFromContext returns the request-scoped workspace target override, or an empty string when the Bot's persisted Primary should apply.
Types ¶
type BotSnapshotData ¶
type BotSnapshotData struct {
ContainerID string
Info ctr.ContainerInfo
Snapshotter string
RuntimeSnapshots []ctr.SnapshotInfo
ManagedMeta map[string]ManagedSnapshotMeta
}
type BridgeTLSRuntimeOptions ¶
type BridgeTLSRuntimeOptions struct {
Client *bridge.TLSOptions
BridgeMaterialDir string
ExpectedClientURI string
}
func BridgeTLSRuntimeOptionsFromConfig ¶
func BridgeTLSRuntimeOptionsFromConfig(cfg config.Config) (*BridgeTLSRuntimeOptions, error)
type ContainerMetricsResult ¶
type ContainerMetricsResult struct {
Supported bool
UnsupportedReason string
Status ContainerMetricsStatus
SampledAt time.Time
CPU *ctr.CPUMetrics
Memory *ctr.MemoryMetrics
Storage *ContainerStorageMetrics
}
type ContainerMetricsStatus ¶
type ContainerSetupEvent ¶
type ContainerSetupProgress ¶
type ContainerSetupProgress func(ContainerSetupEvent)
type ContainerStatus ¶
type ContainerStatus struct {
ContainerID string `json:"container_id"`
WorkspaceBackend string `json:"workspace_backend"`
RuntimeBackend string `json:"runtime_backend,omitempty"`
Image string `json:"image"`
Status string `json:"status"`
Namespace string `json:"namespace"`
ContainerPath string `json:"container_path"`
CDIDevices []string `json:"cdi_devices,omitempty"`
TaskRunning bool `json:"task_running"`
HasPreservedData bool `json:"has_preserved_data"`
Legacy bool `json:"legacy"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ContainerStatus combines DB records with live containerd state.
type ContainerStorageMetrics ¶
type ImagePrepareMode ¶
type ImagePrepareMode string
const ( ImagePreparePulled ImagePrepareMode = "pulled" ImagePrepareSkipped ImagePrepareMode = "skipped" ImagePrepareDelegated ImagePrepareMode = "delegated" )
type ImagePrepareResult ¶
type ImagePrepareResult struct {
Mode ImagePrepareMode
ImageRef string
Image ctr.ImageInfo
Message string
}
type ManagedSnapshotMeta ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) BotDisplayEnabled ¶
func (*Manager) CleanupBotContainer ¶
CleanupBotContainer removes the container and DB record for a bot. When preserveData is true, /data is exported to a backup archive before deletion.
func (*Manager) ClearLegacyIP ¶
ClearLegacyIP removes a cached legacy IP (e.g. when the container is deleted).
func (*Manager) ClearWorkspaceGPUPreference ¶
func (*Manager) ClearWorkspaceImagePreference ¶
func (*Manager) ContainerID ¶
ContainerID resolves the containerd container ID for a bot. Resolution order: DB lookup → label search → full container scan.
func (*Manager) CountData ¶
CountData returns the number of regular files under the container's /data directory, read live over the gRPC bridge so it never stops the container. It is best-effort context for the export dialog; callers should treat an error (e.g. a stopped or unreachable container) as "unknown".
func (*Manager) CreateSnapshot ¶
func (*Manager) CreateVersion ¶
func (*Manager) CurrentWorkspaceTargetID ¶
CurrentWorkspaceTargetID resolves only the request or persisted target ID. It intentionally avoids connecting to a runtime or loading target settings.
func (*Manager) DisplayDialContext ¶
func (*Manager) DisplaySocketPath ¶
DisplaySocketPath returns the host-side path to the workspace display RFB Unix socket. The directory is mounted into the container at /run/memoh.
func (*Manager) EnsureBot ¶
EnsureBot creates the workspace container for a bot if it does not exist. Bot data lives in the container's writable layer (snapshot), not bind mounts. Only the bridge binary is injected as a read-only file mount; the workspace image owns its toolkit and runtime scripts. If imageOverride is non-empty, it is used instead of the configured default.
func (*Manager) EnsureNativeRunning ¶
EnsureNativeRunning manages only the server-owned container workspace, regardless of which target is currently Primary.
func (*Manager) EnsureRunning ¶
EnsureRunning verifies the container exists and its task is running. If the container is missing, it rebuilds via SetupBotContainer. If the task is stopped, it restarts and sets up networking.
func (*Manager) ExportData ¶
ExportData streams a tar.gz archive of the container's /data directory. The container is stopped during export and restarted afterwards. Caller must consume the returned reader before the context is cancelled.
func (*Manager) GetContainerInfo ¶
GetContainerInfo returns current container status for a bot, combining DB records with live containerd state.
func (*Manager) GetContainerMetrics ¶
func (*Manager) GetResourceLimits ¶
func (*Manager) HasPreservedData ¶
HasPreservedData checks whether a backup tar.gz exists for a bot.
func (*Manager) ImportData ¶
ImportData extracts a tar.gz archive into the container's /data directory. The container is stopped during import and restarted afterwards.
func (*Manager) InitializeNativeWorkspace ¶
InitializeNativeWorkspace applies server-owned bootstrap content after the native workspace bridge is reachable. Remote Runtime targets intentionally do not pass through this method.
func (*Manager) IsLegacyContainer ¶
IsLegacyContainer returns true if the container was created before the bridge process architecture (uses the legacy "mcp-" prefix). Legacy containers are functional but unreachable from the server (they use TCP gRPC instead of UDS). Users should delete and recreate them.
func (*Manager) ListBotSnapshotData ¶
ListBotSnapshotData returns the raw snapshot data for a bot under the per-container lock, so callers never observe transient state during snapshot/version operations.
func (*Manager) ListVersions ¶
func (*Manager) ListWorkspaceTargets ¶
func (*Manager) MCPClient ¶
MCPClient implements bridge.Provider and resolves the request-scoped target override before falling back to the Bot's persisted Primary target.
func (*Manager) NativeMCPClient ¶
func (*Manager) OnBridgeReset ¶ added in v0.20.0
OnBridgeReset registers fn to run each time the bridge connection for a bot is evicted from the pool — after a container restart, rebuild, snapshot replace, or a failed readiness probe. The callback receives the bot ID and runs synchronously on the resetting goroutine, so it must be cheap and must not call back into the Manager's bridge path. Use it to invalidate per-bot state derived from the workspace container process. A nil fn is ignored.
func (*Manager) PrepareImageForCreate ¶
func (m *Manager) PrepareImageForCreate(ctx context.Context, image string, opts *ctr.PullImageOptions) (ImagePrepareResult, error)
func (*Manager) PreserveData ¶
PreserveData exports /data to a backup tar.gz on the host. Used before deleting a container when the user chooses to preserve data. For snapshot-mount backends the caller must stop the task first so the mounted snapshot is consistent; the Apple fallback uses gRPC and does not require a stop.
func (*Manager) ReconcileContainers ¶
ReconcileContainers compares the DB containers table against actual containerd state on startup. For each auto_start container in DB it verifies the container and task exist; if missing they are rebuilt.
func (*Manager) RecordContainerRunning ¶
RecordContainerRunning upserts a DB record marking the resolved container as running. This is exported for the HTTP handler's SSE-based creation flow, where the pull + start happen in the handler but the DB write belongs to Manager.
func (*Manager) RememberWorkspaceGPU ¶
func (*Manager) RememberWorkspaceImage ¶
func (*Manager) ResolveWorkspaceGPU ¶
func (*Manager) ResolveWorkspaceImage ¶
func (*Manager) ResolveWorkspaceSkillDiscoveryRoots ¶
func (*Manager) ResolveWorkspaceTarget ¶
func (*Manager) RestorePreservedData ¶
RestorePreservedData imports preserved data (backup tar.gz) into a running container's /data.
func (*Manager) RollbackVersion ¶
func (*Manager) SetBridgeTLS ¶
func (m *Manager) SetBridgeTLS(opts *BridgeTLSRuntimeOptions)
SetBridgeTLS enables strict mTLS on TCP bridge dials and injects bridge-side TLS material into new workspace containers. UDS bridge targets keep using the local filesystem trust model.
func (*Manager) SetHookService ¶
func (*Manager) SetLegacyIP ¶
SetLegacyIP records the IP address of a legacy (pre-bridge) container so the gRPC pool can reach it via TCP.
func (*Manager) SetRemoteWorkspaceService ¶
func (m *Manager) SetRemoteWorkspaceService(service *RemoteWorkspaceService)
func (*Manager) SetResourceLimits ¶
func (m *Manager) SetResourceLimits(ctx context.Context, botID string, limits container.ResourceLimits) (*ResourceLimitsResult, error)
func (*Manager) SetSetupDiagnostics ¶
func (m *Manager) SetSetupDiagnostics(diagnostics WorkspaceSetupDiagnostics)
func (*Manager) SetupBotContainer ¶
SetupBotContainer creates/starts the container and upserts the DB record.
func (*Manager) SetupBotContainerWithProgress ¶
func (*Manager) StartWithImage ¶
StartWithImage creates and starts the MCP container for a bot. If imageOverride is non-empty, it is used as the base image instead of the configured default. The override only applies when creating a new container.
func (*Manager) StartWithResolvedConfig ¶
func (*Manager) StartWithResolvedImage ¶
StartWithResolvedImage creates and starts the workspace container for a bot using an explicit image reference.
func (*Manager) VersionSnapshotName ¶
func (*Manager) WaitForWorkspaceReady ¶
func (*Manager) WorkspaceInfo ¶
type RemoteWorkspaceService ¶
type RemoteWorkspaceService struct {
// contains filtered or unexported fields
}
RemoteWorkspaceService owns persistent remote mounts. Live runtime connections remain owned by userruntime.Service.
func NewRemoteWorkspaceService ¶
func NewRemoteWorkspaceService(store dbstore.BotRemoteRuntimeBindingStore, runtimes *userruntime.Service) *RemoteWorkspaceService
func (*RemoteWorkspaceService) DeleteMount ¶
func (s *RemoteWorkspaceService) DeleteMount(ctx context.Context, botID, targetID string) error
func (*RemoteWorkspaceService) EnsurePrimaryReady ¶
func (*RemoteWorkspaceService) GetMount ¶
func (s *RemoteWorkspaceService) GetMount(ctx context.Context, botID, targetID string) (WorkspaceTarget, error)
func (*RemoteWorkspaceService) GetPrimaryMount ¶
func (s *RemoteWorkspaceService) GetPrimaryMount(ctx context.Context, botID string) (WorkspaceTarget, error)
func (*RemoteWorkspaceService) ListAccountGrants ¶
func (s *RemoteWorkspaceService) ListAccountGrants(ctx context.Context, ownerUserID string) ([]WorkspaceTargetGrant, error)
ListAccountGrants is the reverse lookup behind the account Computers page: every live mount held by the owner's bots, across all of their runtimes.
func (*RemoteWorkspaceService) ListMounts ¶
func (s *RemoteWorkspaceService) ListMounts(ctx context.Context, botID string) ([]WorkspaceTarget, error)
func (*RemoteWorkspaceService) Mount ¶
func (s *RemoteWorkspaceService) Mount(ctx context.Context, botID, runtimeID string) (WorkspaceTarget, error)
func (*RemoteWorkspaceService) ResolveMount ¶
func (s *RemoteWorkspaceService) ResolveMount(ctx context.Context, botID, targetID string) (ResolvedWorkspaceTarget, error)
func (*RemoteWorkspaceService) ResolvePrimary ¶
func (s *RemoteWorkspaceService) ResolvePrimary(ctx context.Context, botID string) (ResolvedWorkspaceTarget, bool, error)
func (*RemoteWorkspaceService) SetPrimary ¶
func (s *RemoteWorkspaceService) SetPrimary(ctx context.Context, botID, targetID string) error
func (*RemoteWorkspaceService) UpdateToolApproval ¶
func (s *RemoteWorkspaceService) UpdateToolApproval(ctx context.Context, botID, targetID string, modes WorkspaceTargetToolApproval) error
func (*RemoteWorkspaceService) UpdateToolApprovalConfig ¶
func (s *RemoteWorkspaceService) UpdateToolApprovalConfig(ctx context.Context, botID, targetID string, config settings.ToolApprovalConfig) error
type ResolvedWorkspaceTarget ¶
type ResolvedWorkspaceTarget struct {
TargetID string
Kind string
Name string
Primary bool
Client *bridge.Client
Info bridge.WorkspaceInfo
Approval settings.ToolApprovalConfig
}
type ResourceLimitCapabilities ¶
type ResourceLimitCapabilities struct {
CPU ResourceLimitCapability
Memory ResourceLimitCapability
Storage ResourceLimitCapability
}
func ResourceLimitCapabilitiesFor ¶
func ResourceLimitCapabilitiesFor(workspaceBackend, runtimeBackend string) ResourceLimitCapabilities
type ResourceLimitCapability ¶
type ResourceLimitObserved ¶
type ResourceLimitsResult ¶
type ResourceLimitsResult struct {
Desired container.ResourceLimits
Applied container.ResourceLimits
Capabilities ResourceLimitCapabilities
Observed ResourceLimitObserved
Status string
RequiresRecreate bool
WorkspaceBackend string
RuntimeBackend string
}
type SetPrimaryWorkspaceTargetRequest ¶
type SetPrimaryWorkspaceTargetRequest struct {
TargetID string `json:"target_id" validate:"required"`
}
type SnapshotCreateInfo ¶
type TemplateBootstrapper ¶
type TemplateBootstrapper struct {
// contains filtered or unexported fields
}
TemplateBootstrapper copies the canonical embedded template tree into one provider-owned workspace filesystem.
func NewTemplateBootstrapper ¶
func NewTemplateBootstrapper(source fs.FS) *TemplateBootstrapper
func (*TemplateBootstrapper) Bootstrap ¶
func (b *TemplateBootstrapper) Bootstrap(ctx context.Context, target WorkspaceFileSystem, root string) error
Bootstrap applies the built-in workspace template under root. User-owned files are create-only, while files belonging to built-in skills are managed and refreshed on every reconciliation. Extra user skills are never removed.
type UpdateWorkspaceTargetToolApprovalRequest ¶
type UpdateWorkspaceTargetToolApprovalRequest struct {
Enabled *bool `json:"enabled,omitempty"`
Read settings.ToolApprovalMode `json:"read,omitempty"`
Write settings.ToolApprovalMode `json:"write,omitempty"`
Exec settings.ToolApprovalMode `json:"exec,omitempty"`
ToolApprovalConfig *settings.ToolApprovalConfig `json:"tool_approval_config,omitempty"`
}
type VersionInfo ¶
type WorkspaceFileInfo ¶
type WorkspaceFileInfo struct {
IsDir bool
}
WorkspaceFileInfo is the provider-neutral subset of file metadata needed by the workspace bootstrapper.
type WorkspaceFileSystem ¶
type WorkspaceFileSystem interface {
Stat(ctx context.Context, filePath string) (WorkspaceFileInfo, error)
Mkdir(ctx context.Context, dirPath string) error
WriteFile(ctx context.Context, filePath string, content []byte) error
Rename(ctx context.Context, oldPath, newPath string) error
}
WorkspaceFileSystem is the minimal filesystem contract needed to seed a workspace. Container workspaces adapt bridge.Client; future providers such as E2B can implement this contract directly without running the Memoh bridge. Implementations must return an error matching fs.ErrNotExist for a missing path and make Mkdir recursive.
type WorkspaceGPUConfig ¶
type WorkspaceGPUConfig struct {
Devices []string `json:"devices,omitempty"`
}
type WorkspaceSetupDiagnostics ¶
type WorkspaceSetupDiagnostics interface {
RecordContainerSetupFailure(ctx context.Context, botID, phase string, setupErr error) error
ClearContainerSetupFailure(ctx context.Context, botID string) error
}
WorkspaceSetupDiagnostics records sanitized setup failures for Bot health checks without coupling the workspace package to the bots package.
type WorkspaceTarget ¶
type WorkspaceTarget struct {
TargetID string `json:"target_id"`
Kind string `json:"kind"`
RuntimeID string `json:"runtime_id,omitempty"`
Name string `json:"name"`
Primary bool `json:"primary"`
Online bool `json:"online"`
Status string `json:"status"`
ToolApproval WorkspaceTargetToolApproval `json:"tool_approval"`
ToolApprovalConfig settings.ToolApprovalConfig `json:"tool_approval_config"`
}
WorkspaceTarget is the aggregate shape consumed by clients. Callers address mounts by TargetID; RuntimeID identifies the backing remote Runtime and is empty for the Native target.
type WorkspaceTargetGrant ¶
type WorkspaceTargetGrant struct {
TargetID string `json:"target_id"`
BotID string `json:"bot_id"`
RuntimeID string `json:"runtime_id"`
Primary bool `json:"primary"`
}
WorkspaceTargetGrant is one entry of the account-level ACL view: bot BotID may use the owner's runtime RuntimeID, addressable as mount TargetID.
type WorkspaceTargetGrantsResponse ¶
type WorkspaceTargetGrantsResponse struct {
Grants []WorkspaceTargetGrant `json:"grants"`
}
type WorkspaceTargetToolApproval ¶
type WorkspaceTargetToolApproval struct {
Read settings.ToolApprovalMode `json:"read"`
Write settings.ToolApprovalMode `json:"write"`
Exec settings.ToolApprovalMode `json:"exec"`
}
func WorkspaceToolApprovalModes ¶
func WorkspaceToolApprovalModes(config settings.ToolApprovalConfig) WorkspaceTargetToolApproval
type WorkspaceTargetsResponse ¶
type WorkspaceTargetsResponse struct {
Targets []WorkspaceTarget `json:"targets"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bridge provides a gRPC client for the workspace container bridge service.
|
Package bridge provides a gRPC client for the workspace container bridge service. |
|
Package vpath resolves user-supplied paths under a virtual workspace root without consulting the host filesystem.
|
Package vpath resolves user-supplied paths under a virtual workspace root without consulting the host filesystem. |