MCPcopy Create free account
hub / github.com/compozy/agh / handleSandboxInfo

Method handleSandboxInfo

internal/extension/host_api.go:1095–1124  ·  view source on GitHub ↗
(ctx context.Context, raw json.RawMessage)

Source from the content-addressed store, hash-verified

1093}
1094
1095func (h *HostAPIHandler) handleSandboxInfo(ctx context.Context, raw json.RawMessage) (any, error) {
1096 if h.sessions == nil {
1097 return nil, errors.New("extension: session manager is not configured")
1098 }
1099 var params hostAPISandboxInfoParams
1100 if err := decodeHostAPIParams(raw, &params); err != nil {
1101 return nil, err
1102 }
1103 sessionID := strings.TrimSpace(params.SessionID)
1104 if sessionID == "" {
1105 return nil, invalidParamsRPCError(errors.New("session_id is required"))
1106 }
1107 info, err := h.requireHostAPISessionWorkspace(ctx, params.WorkspaceID, sessionID)
1108 if err != nil {
1109 return nil, err
1110 }
1111 if info == nil || info.Sandbox == nil {
1112 return nil, notFoundRPCError("sandbox", sessionID, errors.New("sandbox is not configured"))
1113 }
1114 return hostAPISandboxInfoResult{
1115 SandboxID: strings.TrimSpace(info.Sandbox.SandboxID),
1116 Backend: strings.TrimSpace(info.Sandbox.Backend),
1117 Profile: strings.TrimSpace(info.Sandbox.Profile),
1118 InstanceID: strings.TrimSpace(info.Sandbox.InstanceID),
1119 RuntimeRoot: strings.TrimSpace(info.Sandbox.RuntimeRootDir),
1120 SyncState: hostAPISandboxSyncState(info.Sandbox),
1121 CreatedAt: info.CreatedAt,
1122 LastSyncError: strings.TrimSpace(info.Sandbox.LastSyncError),
1123 }, nil
1124}
1125
1126func (h *HostAPIHandler) handleSandboxExec(ctx context.Context, raw json.RawMessage) (any, error) {
1127 if h.sessions == nil {

Callers

nothing calls this directly

Calls 5

decodeHostAPIParamsFunction · 0.85
invalidParamsRPCErrorFunction · 0.85
notFoundRPCErrorFunction · 0.85
hostAPISandboxSyncStateFunction · 0.85

Tested by

no test coverage detected